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
2 changes: 1 addition & 1 deletion docs/animations.md
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ The native driver also works with `Animated.event`. This is especially useful fo
</Animated.ScrollView>
```

You can see the native driver in action by running the [RNTester app](https://github.com/facebook/react-native/blob/main/packages/rn-tester/), then loading the Native Animated Example. You can also take a look at the [source code](https://github.com/facebook/react-native/blob/master/packages/rn-tester/js/examples/NativeAnimation/NativeAnimationsExample.js) to learn how these examples were produced.
You can see the native driver in action by running the [RNTester app](https://github.com/facebook/react-native/blob/main/packages/rn-tester/), then loading the Native Animated Example. You can also take a look at the [source code](https://github.com/facebook/react-native/blob/main/packages/rn-tester/js/examples/NativeAnimation/NativeAnimationsExample.js) to learn how these examples were produced.

#### Caveats

Expand Down
2 changes: 1 addition & 1 deletion docs/build-speed.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Ccache works by wrapping the C++ compilers, storing the compilation results, and
if an intermediate compilation result was originally stored.

Ccache is available in the package manager for most operating systems. On macOS, we can install ccache with `brew install ccache`.
Or you can follow the [official installation instructions](https://github.com/ccache/ccache/blob/master/doc/INSTALL.md) to install from source.
Or you can follow the [official installation instructions](https://github.com/ccache/ccache/blob/master/doc/install.md) to install from source.

You can then do two clean builds (e.g. on Android you can first run `yarn react-native run-android`, delete the `android/app/build` folder and run the first command once more). You will notice that the second build was way faster than the first one (it should take seconds rather than minutes).
While building, you can verify that `ccache` works correctly and check the cache hits/miss rate `ccache -s`
Expand Down
2 changes: 1 addition & 1 deletion docs/debugging-release-builds.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ If a React Native app throws an unhandled exception in a release build, the outp

In the above stack trace, entries like `p@1:132161` are minified function names and bytecode offsets. To debug these calls, we want to translate these into file, line, and function name, e.g. `AwesomeProject/App.js:54:initializeMap`. This is known as **symbolication.**

You can symbolicate minified function names and bytecode like the above by passing the stack trace and a generated source map to [`metro-symbolicate`](http://npmjs.com/package/metro-symbolicate).
You can symbolicate minified function names and bytecode like the above by passing the stack trace and a generated source map to [`metro-symbolicate`](https://www.npmjs.com/package/metro-symbolicate).

### Enabling source maps

Expand Down
8 changes: 4 additions & 4 deletions docs/element-nodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ From [`Element`](https://developer.mozilla.org/en-US/docs/Web/API/Element):
- ℹ️ Returns the value of the `id` or `nativeID` props.
- [`lastElementChild`](https://developer.mozilla.org/en-US/docs/Web/API/Element/lastElementChild)
- [`nextElementSibling`](https://developer.mozilla.org/en-US/docs/Web/API/Element/nextElementSibling)
- [`nodeName`](https://developer.mozilla.org/en-US/docs/Web/API/Element/nodeName)
- [`nodeType`](https://developer.mozilla.org/en-US/docs/Web/API/Element/nodeType)
- [`nodeValue`](https://developer.mozilla.org/en-US/docs/Web/API/Element/nodeValue)
- [`nodeName`](https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeName)
- [`nodeType`](https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType)
- [`nodeValue`](https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeValue)
- [`previousElementSibling`](https://developer.mozilla.org/en-US/docs/Web/API/Element/previousElementSibling)
- [`scrollHeight`](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollHeight)
- [`scrollLeft`](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollLeft)
Expand All @@ -96,7 +96,7 @@ From [`Element`](https://developer.mozilla.org/en-US/docs/Web/API/Element):
- [`scrollWidth`](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollWidth)
- [`tagName`](https://developer.mozilla.org/en-US/docs/Web/API/Element/tagName)
- ℹ️ Returns a normalized native component name prefixed with `RN:`, like `RN:View`.
- [`textContent`](https://developer.mozilla.org/en-US/docs/Web/API/Element/textContent)
- [`textContent`](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent)
- Methods
- [`getBoundingClientRect()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect)
- [`hasPointerCapture()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/hasPointerCapture)
Expand Down
2 changes: 1 addition & 1 deletion docs/images.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Note that image sources required this way include size (width, height) info for

## Static Non-Image Resources

The `require` syntax described above can be used to statically include audio, video or document files in your project as well. Most common file types are supported including `.mp3`, `.wav`, `.mp4`, `.mov`, `.html` and `.pdf`. See [bundler defaults](https://github.com/facebook/metro/blob/master/packages/metro-config/src/defaults/defaults.js#L14-L44) for the full list.
The `require` syntax described above can be used to statically include audio, video or document files in your project as well. Most common file types are supported including `.mp3`, `.wav`, `.mp4`, `.mov`, `.html`, `.pdf` and more. See [bundler defaults](https://github.com/facebook/metro/blob/main/packages/metro-config/src/defaults/defaults.js#L16-L51) for the full list.

You can add support for other types by adding an [`assetExts` resolver option](https://metrobundler.dev/docs/configuration#resolver-options) in your [Metro configuration](https://metrobundler.dev/docs/configuration).

Expand Down
2 changes: 1 addition & 1 deletion docs/testing-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ Snapshots have several weak points:

Snapshots themselves do not ensure that your component render logic is correct, they are merely good at guarding against unexpected changes and for checking that the components in the React tree under test receive the expected props (styles and etc.).

We recommend that you only use small snapshots (see [`no-large-snapshots` rule](https://github.com/jest-community/eslint-plugin-jest/blob/master/docs/rules/no-large-snapshots.md)). If you want to test a _change_ between two React component states, use [`snapshot-diff`](https://github.com/jest-community/snapshot-diff). When in doubt, prefer explicit expectations as described in the previous paragraph.
We recommend that you only use small snapshots (see [`no-large-snapshots` rule](https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-large-snapshots.md)). If you want to test a _change_ between two React component states, use [`snapshot-diff`](https://github.com/jest-community/snapshot-diff). When in doubt, prefer explicit expectations as described in the previous paragraph.

<img src="/docs/assets/p_tests-snapshot.svg" alt=" " />

Expand Down
3 changes: 2 additions & 1 deletion plugins/remark-lint-no-dead-urls/src/__tests__/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import {remark} from 'remark';
import dedent from 'dedent';
import {jest, describe, beforeEach, test, expect} from '@jest/globals';
import {Options} from '../index.ts';

const mockFetch = jest.fn() as jest.MockedFunction<
(url: string, method: unknown, options?: object) => Promise<number>
Expand All @@ -19,7 +20,7 @@ jest.unstable_mockModule('../lib.ts', () => ({

const plugin = (await import('../index.ts')).default;

function processMarkdown(md: string, opts = {}) {
function processMarkdown(md: string, opts: Options = {}) {
return remark().use(plugin, opts).process(md);
}

Expand Down
40 changes: 16 additions & 24 deletions plugins/remark-lint-no-dead-urls/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,20 @@

// Forked from: https://github.com/davidtheclark/remark-lint-no-dead-urls

import {Method, RequestError} from 'got';
import {Root} from 'mdast';
import {type Method, RequestError} from 'got';
import {URL} from 'node:url';
import {lintRule} from 'unified-lint-rule';
import {visit} from 'unist-util-visit';
import type {VFile} from 'vfile';
import {type VFile} from 'vfile';

import {fetch} from './lib.ts';
import type {MDASTNode} from './types.d.ts';

export type Options = {
baseUrl?: string;
skipUrlPatterns?: RegExp[];
headers?: Record<string, string>;
};

const linkCache = new Map();

Expand All @@ -32,11 +38,7 @@ const uri = {
isPath: (url: string) => /^\/.*/.test(url),
};

async function cacheFetch(
urlOrPath: string,
method: Method,
options: {baseUrl?: string} & Record<string, unknown>
) {
async function cacheFetch(urlOrPath: string, method: Method, options: Options) {
if (linkCache.has(urlOrPath)) {
return [urlOrPath, linkCache.get(urlOrPath)];
}
Expand All @@ -50,10 +52,7 @@ async function cacheFetch(
return [urlOrPath, code];
}

async function naiveLinkCheck(
urls: string[],
options: {baseUrl?: string} & Record<string, unknown>
) {
async function naiveLinkCheck(urls: string[], options: Options) {
return Promise.allSettled(
urls.map(async url => {
try {
Expand All @@ -62,11 +61,11 @@ async function naiveLinkCheck(
try {
// Fallback, some endpoints don't support HEAD requests
return await cacheFetch(url, 'GET', options);
} catch (e) {
if (!(e instanceof RequestError)) {
throw e;
} catch (err) {
if (!(err instanceof RequestError)) {
throw err;
}
const code = e.response?.statusCode ?? e.code;
const code = err.response?.statusCode ?? err.code;
linkCache.set(url, code);
return [url, code];
}
Expand All @@ -75,14 +74,7 @@ async function naiveLinkCheck(
);
}

async function noDeadUrls(
ast: Root,
file: VFile,
options: {
skipUrlPatterns?: string[];
baseUrl?: string;
} & Record<string, unknown> = {}
) {
async function noDeadUrls(ast: MDASTNode, file: VFile, options: Options) {
const urlToNodes = new Map();

const {skipUrlPatterns, ...clientOptions} = options;
Expand Down
2 changes: 1 addition & 1 deletion plugins/remark-lint-no-dead-urls/src/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import got, {Method} from 'got';
import got, {type Method} from 'got';

export async function fetch(url: string, method: Method, options = {}) {
const {statusCode} = await got(url, {
Expand Down
1 change: 1 addition & 0 deletions plugins/remark-lint-no-dead-urls/src/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {type Node as MDASTNode} from 'mdast';
2 changes: 1 addition & 1 deletion website/versioned_docs/version-0.83/animations.md
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ The native driver also works with `Animated.event`. This is especially useful fo
</Animated.ScrollView>
```

You can see the native driver in action by running the [RNTester app](https://github.com/facebook/react-native/blob/main/packages/rn-tester/), then loading the Native Animated Example. You can also take a look at the [source code](https://github.com/facebook/react-native/blob/master/packages/rn-tester/js/examples/NativeAnimation/NativeAnimationsExample.js) to learn how these examples were produced.
You can see the native driver in action by running the [RNTester app](https://github.com/facebook/react-native/blob/main/packages/rn-tester/), then loading the Native Animated Example. You can also take a look at the [source code](https://github.com/facebook/react-native/blob/main/packages/rn-tester/js/examples/NativeAnimation/NativeAnimationsExample.js) to learn how these examples were produced.

#### Caveats

Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-0.83/build-speed.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Ccache works by wrapping the C++ compilers, storing the compilation results, and
if an intermediate compilation result was originally stored.

Ccache is available in the package manager for most operating systems. On macOS, we can install ccache with `brew install ccache`.
Or you can follow the [official installation instructions](https://github.com/ccache/ccache/blob/master/doc/INSTALL.md) to install from source.
Or you can follow the [official installation instructions](https://github.com/ccache/ccache/blob/master/doc/install.md) to install from source.

You can then do two clean builds (e.g. on Android you can first run `yarn react-native run-android`, delete the `android/app/build` folder and run the first command once more). You will notice that the second build was way faster than the first one (it should take seconds rather than minutes).
While building, you can verify that `ccache` works correctly and check the cache hits/miss rate `ccache -s`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ If a React Native app throws an unhandled exception in a release build, the outp

In the above stack trace, entries like `p@1:132161` are minified function names and bytecode offsets. To debug these calls, we want to translate these into file, line, and function name, e.g. `AwesomeProject/App.js:54:initializeMap`. This is known as **symbolication.**

You can symbolicate minified function names and bytecode like the above by passing the stack trace and a generated source map to [`metro-symbolicate`](http://npmjs.com/package/metro-symbolicate).
You can symbolicate minified function names and bytecode like the above by passing the stack trace and a generated source map to [`metro-symbolicate`](https://www.npmjs.com/package/metro-symbolicate).

### Enabling source maps

Expand Down
8 changes: 4 additions & 4 deletions website/versioned_docs/version-0.83/element-nodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ From [`Element`](https://developer.mozilla.org/en-US/docs/Web/API/Element):
- ℹ️ Returns the value of the `id` or `nativeID` props.
- [`lastElementChild`](https://developer.mozilla.org/en-US/docs/Web/API/Element/lastElementChild)
- [`nextElementSibling`](https://developer.mozilla.org/en-US/docs/Web/API/Element/nextElementSibling)
- [`nodeName`](https://developer.mozilla.org/en-US/docs/Web/API/Element/nodeName)
- [`nodeType`](https://developer.mozilla.org/en-US/docs/Web/API/Element/nodeType)
- [`nodeValue`](https://developer.mozilla.org/en-US/docs/Web/API/Element/nodeValue)
- [`nodeName`](https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeName)
- [`nodeType`](https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType)
- [`nodeValue`](https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeValue)
- [`previousElementSibling`](https://developer.mozilla.org/en-US/docs/Web/API/Element/previousElementSibling)
- [`scrollHeight`](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollHeight)
- [`scrollLeft`](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollLeft)
Expand All @@ -96,7 +96,7 @@ From [`Element`](https://developer.mozilla.org/en-US/docs/Web/API/Element):
- [`scrollWidth`](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollWidth)
- [`tagName`](https://developer.mozilla.org/en-US/docs/Web/API/Element/tagName)
- ℹ️ Returns a normalized native component name prefixed with `RN:`, like `RN:View`.
- [`textContent`](https://developer.mozilla.org/en-US/docs/Web/API/Element/textContent)
- [`textContent`](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent)
- Methods
- [`getBoundingClientRect()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect)
- [`hasPointerCapture()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/hasPointerCapture)
Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-0.83/images.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Note that image sources required this way include size (width, height) info for

## Static Non-Image Resources

The `require` syntax described above can be used to statically include audio, video or document files in your project as well. Most common file types are supported including `.mp3`, `.wav`, `.mp4`, `.mov`, `.html` and `.pdf`. See [bundler defaults](https://github.com/facebook/metro/blob/master/packages/metro-config/src/defaults/defaults.js#L14-L44) for the full list.
The `require` syntax described above can be used to statically include audio, video or document files in your project as well. Most common file types are supported including `.mp3`, `.wav`, `.mp4`, `.mov`, `.html`, `.pdf` and more. See [bundler defaults](https://github.com/facebook/metro/blob/main/packages/metro-config/src/defaults/defaults.js#L16-L51) for the full list.

You can add support for other types by adding an [`assetExts` resolver option](https://metrobundler.dev/docs/configuration#resolver-options) in your [Metro configuration](https://metrobundler.dev/docs/configuration).

Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-0.83/testing-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ Snapshots have several weak points:

Snapshots themselves do not ensure that your component render logic is correct, they are merely good at guarding against unexpected changes and for checking that the components in the React tree under test receive the expected props (styles and etc.).

We recommend that you only use small snapshots (see [`no-large-snapshots` rule](https://github.com/jest-community/eslint-plugin-jest/blob/master/docs/rules/no-large-snapshots.md)). If you want to test a _change_ between two React component states, use [`snapshot-diff`](https://github.com/jest-community/snapshot-diff). When in doubt, prefer explicit expectations as described in the previous paragraph.
We recommend that you only use small snapshots (see [`no-large-snapshots` rule](https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-large-snapshots.md)). If you want to test a _change_ between two React component states, use [`snapshot-diff`](https://github.com/jest-community/snapshot-diff). When in doubt, prefer explicit expectations as described in the previous paragraph.

<img src="/docs/assets/p_tests-snapshot.svg" alt=" " />

Expand Down