Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .changeset/late-items-fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
"@react-native-webapis/battery-status": patch
"@rnx-kit/esbuild-plugin-import-path-remapper": patch
"@react-native-webapis/web-storage": patch
"@rnx-kit/yarn-plugin-external-workspaces": patch
"@rnx-kit/metro-serializer-esbuild": patch
"@rnx-kit/yarn-plugin-install-to": patch
"@rnx-kit/metro-plugin-typescript": patch
"@rnx-kit/metro-resolver-symlinks": patch
"@rnx-kit/tools-react-native": patch
"@rnx-kit/tools-typescript": patch
"@rnx-kit/react-native-auth": patch
"@rnx-kit/lint-lockfile": patch
"@rnx-kit/tools-language": patch
"@rnx-kit/eslint-plugin": patch
"@rnx-kit/metro-service": patch
"@rnx-kit/tools-android": patch
"@rnx-kit/jest-preset": patch
"@rnx-kit/tools-apple": patch
"@rnx-kit/polyfills": patch
"@rnx-kit/tools-node": patch
"@rnx-kit/cli": patch
---

Fixed import statements so that the TypeScript code can be used directly
4 changes: 0 additions & 4 deletions .github/workflows/align-deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ jobs:
- name: Install package dependencies
run: |
yarn
- name: "Build `@rnx-kit/align-deps`"
run: |
yarn build --dependencies
working-directory: packages/align-deps
- name: Look for new React Native release candidates
id: find-release-candidate
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
yarn
- name: Ensure rnx-kit packages come from our repository
run: |
yarn tsx --conditions typescript incubator/lint-lockfile/src/index.ts
node --no-warnings --conditions=typescript incubator/lint-lockfile/src/index.ts
- name: Check for change files
if: ${{ github.actor != 'microsoft-react-native-sdk[bot]' || github.head_ref != 'changeset-release/main' }}
run: |
Expand Down
4 changes: 2 additions & 2 deletions incubator/@react-native-webapis/battery-status/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { BatteryStatus } from "./NativeBatteryStatus";
import { NativeBatteryStatus } from "./NativeBatteryStatus";
import type { BatteryStatus } from "./NativeBatteryStatus.ts";
import { NativeBatteryStatus } from "./NativeBatteryStatus.ts";

function getBattery(): Promise<BatteryStatus> {
return new Promise((resolve) => {
Expand Down
4 changes: 2 additions & 2 deletions incubator/@react-native-webapis/web-storage/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { makeLocalStorage } from "./localStorage";
import { makeSessionStorage } from "./sessionStorage";
import { makeLocalStorage } from "./localStorage.ts";
import { makeSessionStorage } from "./sessionStorage.ts";

const window = global.window || {};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { NativeWebStorage } from "./NativeWebStorage";
import type { StoragePolyfill } from "./types";
import { NativeWebStorage } from "./NativeWebStorage.ts";
import type { StoragePolyfill } from "./types.ts";

export function makeLocalStorage() {
const localStorage: StoragePolyfill = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { StoragePolyfill } from "./types";
import type { StoragePolyfill } from "./types.ts";

export function makeSessionStorage() {
const store = new Map<string, string>();
Expand Down
2 changes: 1 addition & 1 deletion incubator/@react-native-webapis/web-storage/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Spec } from "./NativeWebStorage";
import type { Spec } from "./NativeWebStorage.ts";

export type StoragePolyfill = {
_isPolyfilledBy: {
Expand Down
2 changes: 1 addition & 1 deletion incubator/lint-lockfile/src/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as fs from "node:fs";
import * as path from "node:path";
import { noDuplicatesRule } from "./rules/noDuplicates.ts";
import { noWorkspacePackageFromNpmRule } from "./rules/noWorkspacePackageFromNpm.ts";
import type { Lockfile, Rule, Workspace } from "./types";
import type { Lockfile, Rule, Workspace } from "./types.ts";
import { loadLockfile as loadYarnLockfile } from "./yarn/lockfile.ts";

function loadLockfile(lockfilePath: string): Lockfile {
Expand Down
2 changes: 1 addition & 1 deletion incubator/polyfills/test/dependency.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { equal, match, notEqual } from "node:assert/strict";
import * as os from "node:os";
import * as path from "node:path";
import { describe, it } from "node:test";
import { getDependencyPolyfills, resolvePath } from "../src/dependency";
import { getDependencyPolyfills, resolvePath } from "../src/dependency.ts";

describe("getDependencyPolyfills()", () => {
it("collects polyfills from included valid packages", (t) => {
Expand Down
2 changes: 1 addition & 1 deletion incubator/tools-typescript/src/tsconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
} from "@rnx-kit/tools-packages";
import path from "node:path";
import ts from "typescript";
import { getDiagnosticWriter } from "./diagnostics";
import { getDiagnosticWriter } from "./diagnostics.ts";

type ConfigsByPath = Map<string, ts.ParsedCommandLine>;
const DEFAULT_CONFIG_NAME = "tsconfig.json";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
type PackagePaths,
type WorkspaceOutputGeneratedContent,
type WorkspaceOutputJson,
} from "./types";
} from "./types.ts";

const PROVIDER_KEY = "externalWorkspacesProvider";
const OUTPUT_PATH_KEY = "externalWorkspacesOutputPath";
Expand Down
7 changes: 5 additions & 2 deletions incubator/yarn-plugin-external-workspaces/src/fetcher.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { type Fetcher, type FetchOptions, type Locator } from "@yarnpkg/core";
import { CwdFS, PortablePath, ppath } from "@yarnpkg/fslib";
import { getWorkspaceTracker, type ExternalWorkspaceTracker } from "./tracker";
import { LOCAL_PROTOCOL, type ExternalWorkspace } from "./workspace";
import {
getWorkspaceTracker,
type ExternalWorkspaceTracker,
} from "./tracker.ts";
import { LOCAL_PROTOCOL, type ExternalWorkspace } from "./workspace.ts";

/**
* The "fetcher" is where we decide if the local path is present or not.
Expand Down
6 changes: 3 additions & 3 deletions incubator/yarn-plugin-external-workspaces/src/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import {
type Resolver,
} from "@yarnpkg/core";
import { npath } from "@yarnpkg/fslib";
import { getPluginConfiguration } from "./configuration";
import { outputWorkspaces } from "./outputCommand";
import { getWorkspaceTracker } from "./tracker";
import { getPluginConfiguration } from "./configuration.ts";
import { outputWorkspaces } from "./outputCommand.ts";
import { getWorkspaceTracker } from "./tracker.ts";

/**
* Post-install go through and write this project's workspaces to a file, enabled by config
Expand Down
15 changes: 9 additions & 6 deletions incubator/yarn-plugin-external-workspaces/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import { type Plugin } from "@yarnpkg/core";
import { externalWorkspacesConfiguration } from "./configuration";
import { ExternalWorkspaceFetcher } from "./fetcher";
import { afterAllInstalled, reduceDependency } from "./hooks";
import { OutputWorkspaces } from "./outputCommand";
import { ExternalWorkspaceResolver, RemoteFallbackResolver } from "./resolvers";
import { externalWorkspacesConfiguration } from "./configuration.ts";
import { ExternalWorkspaceFetcher } from "./fetcher.ts";
import { afterAllInstalled, reduceDependency } from "./hooks.ts";
import { OutputWorkspaces } from "./outputCommand.ts";
import {
ExternalWorkspaceResolver,
RemoteFallbackResolver,
} from "./resolvers.ts";

export type {
DefinitionFinder,
PackagePaths,
WorkspaceOutputJson,
} from "./types";
} from "./types.ts";

/**
* The plugin definition.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { Configuration, Project, structUtils } from "@yarnpkg/core";
import { npath, type PortablePath, ppath } from "@yarnpkg/fslib";
import { Command, Option, UsageError } from "clipanion";
import fs from "node:fs";
import { getPluginConfiguration } from "./configuration";
import { type WorkspaceOutputGeneratedContent } from "./types";
import { getPluginConfiguration } from "./configuration.ts";
import { type WorkspaceOutputGeneratedContent } from "./types.ts";

const outputVersion = "1.0.0";

Expand Down
7 changes: 5 additions & 2 deletions incubator/yarn-plugin-external-workspaces/src/resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ import {
type ResolveOptions,
type Resolver,
} from "@yarnpkg/core";
import { getWorkspaceTracker, type ExternalWorkspaceTracker } from "./tracker";
import {
getWorkspaceTracker,
type ExternalWorkspaceTracker,
} from "./tracker.ts";
import {
LOCAL_PROTOCOL,
REMOTE_PROTOCOL,
type ResolverType,
} from "./workspace";
} from "./workspace.ts";

//const { stringifyIdent, makeDescriptor } = structUtils;
class ResolverBase implements Resolver {
Expand Down
6 changes: 3 additions & 3 deletions incubator/yarn-plugin-external-workspaces/src/tracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import {
getFinderFromJsConfig,
getFinderFromJsonConfig,
getPluginConfiguration,
} from "./configuration";
import { type PackagePaths } from "./types";
import { ExternalWorkspace } from "./workspace";
} from "./configuration.ts";
import { type PackagePaths } from "./types.ts";
import { ExternalWorkspace } from "./workspace.ts";

const nullFunction = (_val: string) => null;
const pkgJson = npath.toPortablePath("package.json");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
type ResolveOptions,
} from "@yarnpkg/core";
import { type PortablePath } from "@yarnpkg/fslib";
import { coerceDescriptorTo, coerceLocatorTo } from "./utilities";
import { coerceDescriptorTo, coerceLocatorTo } from "./utilities.ts";

export const LOCAL_PROTOCOL = "external:";
export const REMOTE_PROTOCOL = "fallback:";
Expand Down
2 changes: 1 addition & 1 deletion incubator/yarn-plugin-install-to/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type Plugin } from "@yarnpkg/core";
import { InstallTo } from "./installTo";
import { InstallTo } from "./installTo.ts";

/**
* The plugin definition.
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
"prettier": "catalog:",
"prettier-plugin-organize-imports": "^4.0.0",
"suggestion-bot": "^4.0.0",
"tsx": "^4.15.0",
"typescript": "catalog:"
},
"engines": {
Expand Down
46 changes: 26 additions & 20 deletions packages/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,16 @@ yarn rnx-cli build [options]

<!-- @rnx-kit/cli/build start -->

| Option | Description |
| ------------------------------ | ---------------------------------------------------------------------------- |
| -p, --platform &lt;string&gt; | Target platform |
| --workspace &lt;string&gt; | Path, relative to project root, of the Xcode workspace to build (macOS only) |
| --scheme &lt;string&gt; | Name of scheme to build (Apple platforms only) |
| --configuration &lt;string&gt; | Build configuration for building the app; 'Debug' or 'Release' |
| --destination &lt;string&gt; | Destination of the built app; 'device', 'emulator', or 'simulator' |
| Option | Description |
| ------------------------------ | ------------------------------------------------------------------------------------- |
| -p, --platform &lt;string&gt; | Target platform |
| --solution &lt;string&gt; | Path, relative to project root, of the Visual Studio solution to build (Windows only) |
| --workspace &lt;string&gt; | Path, relative to project root, of the Xcode workspace to build (macOS only) |
| --scheme &lt;string&gt; | Name of scheme to build (Apple platforms only) |
| --configuration &lt;string&gt; | Build configuration for building the app; 'Debug' or 'Release' |
| --destination &lt;string&gt; | Destination of the built app; 'device', 'emulator', or 'simulator' |
| --ccache-dir &lt;string&gt; | Path to Ccache config |
| --ccache-home &lt;string&gt; | Path to Ccache installation |

<!-- @rnx-kit/cli/build end -->

Expand All @@ -226,14 +229,17 @@ yarn rnx-cli run [options]

<!-- @rnx-kit/cli/run start -->

| Option | Description |
| ------------------------------ | ---------------------------------------------------------------------------- |
| -p, --platform &lt;string&gt; | Target platform |
| --workspace &lt;string&gt; | Path, relative to project root, of the Xcode workspace to build (macOS only) |
| --scheme &lt;string&gt; | Name of scheme to build (Apple platforms only) |
| --configuration &lt;string&gt; | Build configuration for building the app; 'Debug' or 'Release' |
| --destination &lt;string&gt; | Destination of the built app; 'device', 'emulator', or 'simulator' |
| -d, --device &lt;string&gt; | The name of the device to launch the app in |
| Option | Description |
| ------------------------------ | ------------------------------------------------------------------------------------- |
| -p, --platform &lt;string&gt; | Target platform |
| --solution &lt;string&gt; | Path, relative to project root, of the Visual Studio solution to build (Windows only) |
| --workspace &lt;string&gt; | Path, relative to project root, of the Xcode workspace to build (macOS only) |
| --scheme &lt;string&gt; | Name of scheme to build (Apple platforms only) |
| --configuration &lt;string&gt; | Build configuration for building the app; 'Debug' or 'Release' |
| --destination &lt;string&gt; | Destination of the built app; 'device', 'emulator', or 'simulator' |
| --ccache-dir &lt;string&gt; | Path to Ccache config |
| --ccache-home &lt;string&gt; | Path to Ccache installation |
| -d, --device &lt;string&gt; | The name of the device to launch the app in |

<!-- @rnx-kit/cli/run end -->

Expand Down Expand Up @@ -263,11 +269,11 @@ yarn rnx-cli clean [options]

<!-- @rnx-kit/cli/clean start -->

| Option | Description |
| ----------------------------------------------------------- | -------------------------------------------------------- |
| --include &lt;android,cocoapods,metro,npm,watchman,yarn&gt; | Comma-separated flag of caches to clear e.g., `npm,yarn` |
| --project-root &lt;path&gt; | Root path to your React Native project |
| --verify-cache | Whether to verify the integrity of the cache |
| Option | Description |
| ----------------------------------------------------------------- | -------------------------------------------------------- |
| --include &lt;android,cocoapods,metro,npm,watchman,xcode,yarn&gt; | Comma-separated flag of caches to clear e.g., `npm,yarn` |
| --project-root &lt;path&gt; | Root path to your React Native project |
| --verify-cache | Whether to verify the integrity of the cache |

<!-- @rnx-kit/cli/clean end -->

Expand Down
1 change: 0 additions & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@
"metro-config": "^0.83.1",
"react": "19.1.0",
"react-native": "^0.81.0",
"tsx": "^4.15.0",
"type-fest": "^4.0.0"
},
"engines": {
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/scripts/update-readme.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env -S yarn tsx --conditions typescript
#!/usr/bin/env -S node --no-warnings --conditions=typescript

import { markdownTable } from "markdown-table";
import * as fs from "node:fs";
import { reactNativeConfig } from "../src/index.js";
import { reactNativeConfig } from "../src/index.ts";

const README = "README.md";
const UTF8 = { encoding: "utf-8" as const };
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/bin/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import {
saveConfigToCache,
} from "@rnx-kit/tools-react-native/cache";
import { resolveCommunityCLI } from "@rnx-kit/tools-react-native/context";
import { reactNativeConfig } from "../index";
import { RNX_FAST_PATH, RNX_PREFIX } from "./constants";
import { reactNativeConfig } from "../index.ts";
import { RNX_FAST_PATH, RNX_PREFIX } from "./constants.ts";

type Command = BaseCommand<false> | BaseCommand<true>;
type Commands = Record<string, Command>;
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/bin/externalCommands.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Command, Config } from "@react-native-community/cli-types";
import { resolveCommunityCLI } from "@rnx-kit/tools-react-native/context";
import { RNX_FAST_PATH } from "./constants";
import { RNX_FAST_PATH } from "./constants.ts";

function tryImport(module: string, fromDir: string) {
try {
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/bin/rnx-cli.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Config } from "@react-native-community/cli-types";
import { Command } from "commander";
import * as path from "node:path";
import { loadContextForCommand } from "./context";
import { findExternalCommands } from "./externalCommands";
import { loadContextForCommand } from "./context.ts";
import { findExternalCommands } from "./externalCommands.ts";

type CommandOption = Required<Config["commands"][number]>["options"][number];

Expand Down
14 changes: 7 additions & 7 deletions packages/cli/src/bundle.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import type { Config as CLIConfig } from "@react-native-community/cli-types";
import { loadMetroConfig } from "@rnx-kit/metro-service";
import { commonBundleCommandOptions } from "./bundle/cliOptions";
import { emitBytecode } from "./bundle/hermes";
import { getCliPlatformBundleConfigs } from "./bundle/kit-config";
import { metroBundle } from "./bundle/metro";
import { commonBundleCommandOptions } from "./bundle/cliOptions.ts";
import { emitBytecode } from "./bundle/hermes.ts";
import { getCliPlatformBundleConfigs } from "./bundle/kit-config.ts";
import { metroBundle } from "./bundle/metro.ts";
import {
applyBundleConfigOverrides,
overridableCommonBundleOptions,
} from "./bundle/overrides";
import type { CLICommonBundleOptions } from "./bundle/types";
import { asBoolean } from "./helpers/parsers";
} from "./bundle/overrides.ts";
import type { CLICommonBundleOptions } from "./bundle/types.ts";
import { asBoolean } from "./helpers/parsers.ts";

type CLIBundleOptions = CLICommonBundleOptions & {
treeShake?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/bundle/cliOptions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { parsePlatform } from "@rnx-kit/tools-react-native/platform";
import { asBoolean, asNumber, asTransformProfile } from "../helpers/parsers";
import { asBoolean, asNumber, asTransformProfile } from "../helpers/parsers.ts";

export const commonBundleCommandOptions = [
{
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/bundle/kit-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {
getPlatformBundleConfig,
} from "@rnx-kit/config";
import type { AllPlatforms } from "@rnx-kit/tools-react-native/platform";
import { getDefaultBundlerPlugins } from "./defaultPlugins";
import type { CliPlatformBundleConfig } from "./types";
import { getDefaultBundlerPlugins } from "./defaultPlugins.ts";
import type { CliPlatformBundleConfig } from "./types.ts";

/**
* Get the list of target platforms for bundling.
Expand Down
Loading