diff --git a/.clang-format-ignore b/.clang-format-ignore new file mode 100644 index 000000000000..c955f0ad4d5d --- /dev/null +++ b/.clang-format-ignore @@ -0,0 +1,6 @@ +packages/react-native/React/I18n/FBXXHashUtils.h +packages/react-native/ReactAndroid/src/main/jni/first-party/yogajni/** +packages/react-native/ReactAndroid/src/main/jni/third-party/** +packages/react-native/ReactCommon/**/platform/windows/third-party/** +packages/react-native/ReactCommon/jsi/jsi/** +packages/react-native/ReactCommon/yoga/** diff --git a/.eslintrc.js b/.eslintrc.js index 4ef0585b7674..9db5a0e48996 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -15,21 +15,21 @@ module.exports = { extends: ['@react-native'], - plugins: ['@react-native/monorepo', '@react-native/specs'], + plugins: ['@react-native/monorepo', '@react-native/specs', 'import'], overrides: [ // overriding the JS config from @react-native/eslint-config to ensure - // that we use hermes-eslint for all js files + // that we use flow-eslint for all js files { files: ['*.js', '*.js.flow', '*.jsx'], - parser: 'hermes-eslint', + parser: 'flow-eslint', rules: { '@react-native/monorepo/sort-imports': 'warn', 'eslint-comments/no-unlimited-disable': 'off', 'ft-flow/require-valid-file-annotation': ['error', 'always'], 'no-extra-boolean-cast': 'off', 'no-void': 'off', - // These rules are not required with hermes-eslint + // These rules are not required with flow-eslint 'ft-flow/define-flow-type': 'off', 'ft-flow/use-flow-type': 'off', // Flow handles these checks for us, so they aren't required @@ -44,6 +44,7 @@ module.exports = { files: ['*.js', '*.jsx', '*.ts', '*.tsx'], rules: { '@react-native/no-deep-imports': 'off', + 'import/enforce-node-protocol-usage': ['warn', 'always'], }, }, { @@ -52,7 +53,7 @@ module.exports = { './packages/react-native/src/**/*.{js,flow}', './packages/assets-registry/registry.js', ], - parser: 'hermes-eslint', + parser: 'flow-eslint', rules: { '@react-native/monorepo/no-commonjs-exports': 'warn', }, @@ -61,17 +62,14 @@ module.exports = { files: ['package.json'], parser: 'jsonc-eslint-parser', }, - { - files: ['package.json'], - rules: { - '@react-native/monorepo/react-native-manifest': 'error', - }, - }, { files: ['flow-typed/**/*.js', 'packages/react-native/flow/**/*'], rules: { '@react-native/monorepo/valid-flow-typed-signature': 'error', 'ft-flow/require-valid-file-annotation': 'off', + // These libdefs are kept byte-identical across projects (see + // flow-typed-sync-test), so they must not be migrated independently. + 'import/enforce-node-protocol-usage': 'off', 'no-shadow': 'off', 'no-unused-vars': 'off', quotes: 'off', diff --git a/.flowconfig b/.flowconfig index aa3784a1c9e2..5ed0b3725000 100644 --- a/.flowconfig +++ b/.flowconfig @@ -1,33 +1,33 @@ [ignore] ; Ignore build cache folder -/packages/react-native/sdks/.* +glob:packages/react-native/sdks/** ; Ignore fb_internal modules -/packages/react-native/src/fb_internal/.* +glob:packages/react-native/src/fb_internal/** ; Ignore the codegen e2e tests -/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeEnumTurboModule.js +glob:packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeEnumTurboModule.js ; Ignore "BUCK" generated dirs -/\.buckd/ +glob:.buckd/** ; Ignore other platform suffixes -.*\.macos\.js$ -.*\.windows\.js$ +glob:**/*.macos.js +glob:**/*.windows.js -.*/node_modules/resolve/test/resolver/malformed_package_json/package\.json$ +glob:**/node_modules/resolve/test/resolver/malformed_package_json/package.json ; Checked-in build output -/packages/debugger-frontend/dist/ +glob:packages/debugger-frontend/dist/** ; Generated build output -/packages/.*/dist +glob:packages/*/dist/** ; helloworld -/private/helloworld/ios/Pods/ +glob:private/helloworld/ios/Pods/** ; Ignore rn-tester Pods -/packages/rn-tester/Pods/ +glob:packages/rn-tester/Pods/** [untyped] .*/node_modules/@react-native-community/cli/.*/.* @@ -39,7 +39,6 @@ [libs] flow-typed/ -packages/react-native/interface.js packages/react-native/flow/ [options] @@ -57,6 +56,8 @@ experimental.multi_platform.extensions=.android munge_underscores=true module.name_mapper='^react-native$' -> '/packages/react-native/index.js' +module.name_mapper='^react-native/react-private-interface$' -> '/packages/react-native/src/react-private-interface.js' +module.name_mapper='^react-native/setup-env$' -> '/packages/react-native/src/setup-env.js' module.name_mapper='^react-native/\(.*\)$' -> '/packages/react-native/\1' module.name_mapper='^@react-native/dev-middleware$' -> '/packages/dev-middleware' module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\|xml\|ktx\|heic\|heif\)$' -> '/packages/react-native/Libraries/Image/RelativeImageStub' @@ -65,8 +66,6 @@ module.system.haste.module_ref_prefix=m# react.runtime=automatic -experimental.deprecated_utilities.excludes=/packages/react-native/Libraries/Renderer/shims/ReactNativeTypes.js -experimental.deprecated_utilities.excludes=/packages/react-native/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js ban_spread_key_props=true [lints] @@ -90,4 +89,4 @@ untyped-import untyped-type-import [version] -^0.318.0 +^0.327.0 diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 2049a6d802b8..e275b2752f8a 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -1,10 +1,10 @@ name: ๐Ÿ› React Native - Bug Report description: Report a reproducible bug or regression in React Native. -labels: ["Needs: Triage :mag:"] +labels: ['Needs: Triage :mag:'] body: - type: markdown attributes: - value: "## Reporting a bug to React Native" + value: '## Reporting a bug to React Native' - type: markdown attributes: value: | @@ -46,7 +46,7 @@ body: attributes: label: React Native Version description: The version of react-native that this issue reproduces on. Bear in mind that only issues on [supported versions](https://github.com/reactwg/react-native-releases#which-versions-are-currently-supported) will be looked into. - placeholder: "0.73.0" + placeholder: '0.73.0' validations: required: true - type: dropdown @@ -111,7 +111,7 @@ body: attributes: label: MANDATORY Reproducer description: A link to either a failing RNTesterPlayground.js file, an Expo Snack or a public repository from [this template](https://github.com/react-native-community/reproducer-react-native) that reproduces this bug. Reproducers are **mandatory**, issues without a reproducer will be closed. - placeholder: "https://github.com//" + placeholder: 'https://github.com//' validations: required: true - type: textarea diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 4bc1496d4217..906e5c22ff52 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,26 +1,26 @@ blank_issues_enabled: false contact_links: - - name: โฌ†๏ธ Upgrade - Build Regression - url: https://github.com/reactwg/react-native-releases/issues/new/choose - about: | - If you are upgrading to a new React Native version (stable or pre-release) and encounter a build regression. - - name: ๐Ÿš€ Expo Issue - url: https://github.com/expo/expo/issues/new - about: | - If you're using Expo in your project, please report the issue first in the Expo issue tracker. - - name: ๐Ÿ“ƒ Documentation Issue - url: https://github.com/facebook/react-native-website/issues - about: Please report documentation issues in the React Native website repository. - - name: ๐Ÿ“ฆ Metro Issue - url: https://github.com/facebook/metro/issues/new - about: | - If you've encountered a module resolution problem, e.g. "Error: Unable to resolve module ...", or something else that might be related to Metro, please open an issue in the Metro repo instead. - - name: ๐Ÿค” Questions and Help - url: https://reactnative.dev/help - about: Looking for help with your app? Please refer to the React Native community's support resources. - - name: ๐Ÿ’ซ New Architecture - Questions & Technical Deep dive insights - url: https://github.com/reactwg/react-native-new-architecture - about: Questions and doubts related to technical questions for the New Architecture should be directed to the Working Group. Instructions on how to join are available in the README. - - name: ๐Ÿš€ Discussions and Proposals - url: https://github.com/react-native-community/discussions-and-proposals - about: Discuss the future of React Native in the React Native community's discussions and proposals repository. + - name: โฌ†๏ธ Upgrade - Build Regression + url: https://github.com/reactwg/react-native-releases/issues/new/choose + about: | + If you are upgrading to a new React Native version (stable or pre-release) and encounter a build regression. + - name: ๐Ÿš€ Expo Issue + url: https://github.com/expo/expo/issues/new + about: | + If you're using Expo in your project, please report the issue first in the Expo issue tracker. + - name: ๐Ÿ“ƒ Documentation Issue + url: https://github.com/facebook/react-native-website/issues + about: Please report documentation issues in the React Native website repository. + - name: ๐Ÿ“ฆ Metro Issue + url: https://github.com/facebook/metro/issues/new + about: | + If you've encountered a module resolution problem, e.g. "Error: Unable to resolve module ...", or something else that might be related to Metro, please open an issue in the Metro repo instead. + - name: ๐Ÿค” Questions and Help + url: https://reactnative.dev/help + about: Looking for help with your app? Please refer to the React Native community's support resources. + - name: ๐Ÿ’ซ New Architecture - Questions & Technical Deep dive insights + url: https://github.com/reactwg/react-native-new-architecture + about: Questions and doubts related to technical questions for the New Architecture should be directed to the Working Group. Instructions on how to join are available in the README. + - name: ๐Ÿš€ Discussions and Proposals + url: https://github.com/react-native-community/discussions-and-proposals + about: Discuss the future of React Native in the React Native community's discussions and proposals repository. diff --git a/.github/ISSUE_TEMPLATE/debugger_bug_report.yml b/.github/ISSUE_TEMPLATE/debugger_bug_report.yml index 1d7200d2a61d..531765d65689 100644 --- a/.github/ISSUE_TEMPLATE/debugger_bug_report.yml +++ b/.github/ISSUE_TEMPLATE/debugger_bug_report.yml @@ -1,11 +1,11 @@ name: ๐Ÿ” Debugger - Bug Report description: Report a bug with React Native DevTools and the New Debugger -labels: ["Needs: Triage :mag:", "Debugging"] +labels: ['Needs: Triage :mag:', 'Debugging'] body: - type: markdown attributes: - value: "## Reporting a bug for React Native DevTools" + value: '## Reporting a bug for React Native DevTools' - type: markdown attributes: value: | @@ -42,7 +42,7 @@ body: attributes: label: React Native Version description: The version of react-native that this issue reproduces on. Bear in mind that only issues on [supported versions](https://github.com/reactwg/react-native-releases#which-versions-are-currently-supported) will be looked into. - placeholder: "0.76.0" + placeholder: '0.76.0' validations: required: true - type: textarea diff --git a/.github/ISSUE_TEMPLATE/new_architecture_bug_report.yml b/.github/ISSUE_TEMPLATE/new_architecture_bug_report.yml index 4f4936bb2dcb..b56d5cbc0100 100644 --- a/.github/ISSUE_TEMPLATE/new_architecture_bug_report.yml +++ b/.github/ISSUE_TEMPLATE/new_architecture_bug_report.yml @@ -1,11 +1,11 @@ name: ๐Ÿ’ซ New Architecture - Bug Report description: Report a reproducible bug or a build issue when using the New Architecture (Fabric & TurboModules) in React Native. -labels: ["Needs: Triage :mag:", "Type: New Architecture"] +labels: ['Needs: Triage :mag:', 'Type: New Architecture'] body: - type: markdown attributes: - value: "## New Architecture Related Bugs" + value: '## New Architecture Related Bugs' - type: markdown attributes: value: | @@ -43,7 +43,7 @@ body: attributes: label: React Native Version description: The version of react-native that this issue reproduces on. Bear in mind that only issues on [supported versions](https://github.com/reactwg/react-native-releases#which-versions-are-currently-supported) will be looked into. - placeholder: "0.73.0" + placeholder: '0.73.0' validations: required: true - type: dropdown @@ -123,7 +123,7 @@ body: attributes: label: MANDATORY Reproducer description: A link to either a failing RNTesterPlayground.js file, an Expo Snack or a public repository from [this template](https://github.com/react-native-community/reproducer-react-native) that reproduces this bug. Reproducers are **mandatory**, issues without a reproducer will be closed. - placeholder: "https://github.com//" + placeholder: 'https://github.com//' validations: required: true - type: textarea diff --git a/.github/actions/build-android/action.yml b/.github/actions/build-android/action.yml index 3466b817a382..da5a2a5ec71a 100644 --- a/.github/actions/build-android/action.yml +++ b/.github/actions/build-android/action.yml @@ -5,7 +5,7 @@ inputs: required: true description: The type of release we are building. It could be nightly, release or dry-run gradle-cache-encryption-key: - description: "The encryption key needed to store the Gradle Configuration cache" + description: 'The encryption key needed to store the Gradle Configuration cache' runs: using: composite steps: @@ -34,7 +34,7 @@ runs: - name: Setup gradle uses: ./.github/actions/setup-gradle with: - cache-read-only: "false" + cache-read-only: 'false' cache-encryption-key: ${{ inputs.gradle-cache-encryption-key }} - name: Restore Android ccache uses: actions/cache/restore@v5 @@ -62,9 +62,10 @@ runs: export HERMES_PREBUILT_FLAG="ORG_GRADLE_PROJECT_react.internal.useHermesNightly=true" TASKS="publishAllToMavenTempLocal publishAndroidToSonatype build" else - # release: we want to build all archs (default) + # release: build all archs and close the repository so that Sonatype can validate it. + # Releasing to Maven Central happens only after the Apple builds succeed. export HERMES_PREBUILT_FLAG="ORG_GRADLE_PROJECT_react.internal.useHermesStable=true" - TASKS="publishAllToMavenTempLocal publishAndroidToSonatype build" + TASKS="publishAllToMavenTempLocal publishAndroidToSonatype closeSonatypeStagingRepository build" fi env "$HERMES_PREBUILT_FLAG" ./gradlew $TASKS -PenableWarningsAsErrors=true - name: Save Android ccache diff --git a/.github/actions/build-fantom-runner/action.yml b/.github/actions/build-fantom-runner/action.yml index 00ea1d63d2dd..c4b34c32fbee 100644 --- a/.github/actions/build-fantom-runner/action.yml +++ b/.github/actions/build-fantom-runner/action.yml @@ -4,7 +4,7 @@ inputs: required: true description: The type of release we are building. It could be nightly, release or dry-run gradle-cache-encryption-key: - description: "The encryption key needed to store the Gradle Configuration cache" + description: 'The encryption key needed to store the Gradle Configuration cache' runs: using: composite @@ -24,22 +24,22 @@ runs: - name: Setup gradle uses: ./.github/actions/setup-gradle with: - cache-read-only: "false" + cache-read-only: 'false' cache-encryption-key: ${{ inputs.gradle-cache-encryption-key }} - name: Restore Fantom ccache uses: actions/cache/restore@v5 with: path: /github/home/.cache/ccache key: v2-ccache-fantom-${{ github.job }}-${{ github.ref }}-${{ hashFiles( - 'packages/react-native/ReactAndroid/**/*.cpp', - 'packages/react-native/ReactAndroid/**/*.h', - 'packages/react-native/ReactAndroid/**/CMakeLists.txt', - 'packages/react-native/ReactCommon/**/*.cpp', - 'packages/react-native/ReactCommon/**/*.h', - 'packages/react-native/ReactCommon/**/CMakeLists.txt', - 'private/react-native-fantom/tester/**/*.cpp', - 'private/react-native-fantom/tester/**/*.h', - 'private/react-native-fantom/tester/**/CMakeLists.txt' + 'packages/react-native/ReactAndroid/**/*.cpp', + 'packages/react-native/ReactAndroid/**/*.h', + 'packages/react-native/ReactAndroid/**/CMakeLists.txt', + 'packages/react-native/ReactCommon/**/*.cpp', + 'packages/react-native/ReactCommon/**/*.h', + 'packages/react-native/ReactCommon/**/CMakeLists.txt', + 'private/react-native-fantom/tester/**/*.cpp', + 'private/react-native-fantom/tester/**/*.h', + 'private/react-native-fantom/tester/**/CMakeLists.txt' ) }} restore-keys: | v2-ccache-fantom-${{ github.job }}-${{ github.ref }}- @@ -60,15 +60,15 @@ runs: with: path: /github/home/.cache/ccache key: v2-ccache-fantom-${{ github.job }}-${{ github.ref }}-${{ hashFiles( - 'packages/react-native/ReactAndroid/**/*.cpp', - 'packages/react-native/ReactAndroid/**/*.h', - 'packages/react-native/ReactAndroid/**/CMakeLists.txt', - 'packages/react-native/ReactCommon/**/*.cpp', - 'packages/react-native/ReactCommon/**/*.h', - 'packages/react-native/ReactCommon/**/CMakeLists.txt', - 'private/react-native-fantom/tester/**/*.cpp', - 'private/react-native-fantom/tester/**/*.h', - 'private/react-native-fantom/tester/**/CMakeLists.txt' + 'packages/react-native/ReactAndroid/**/*.cpp', + 'packages/react-native/ReactAndroid/**/*.h', + 'packages/react-native/ReactAndroid/**/CMakeLists.txt', + 'packages/react-native/ReactCommon/**/*.cpp', + 'packages/react-native/ReactCommon/**/*.h', + 'packages/react-native/ReactCommon/**/CMakeLists.txt', + 'private/react-native-fantom/tester/**/*.cpp', + 'private/react-native-fantom/tester/**/*.h', + 'private/react-native-fantom/tester/**/CMakeLists.txt' ) }} - name: Show ccache stats (after) shell: bash diff --git a/.github/actions/build-npm-package/action.yml b/.github/actions/build-npm-package/action.yml index 3947642c23c1..e3771ce3d51a 100644 --- a/.github/actions/build-npm-package/action.yml +++ b/.github/actions/build-npm-package/action.yml @@ -31,6 +31,15 @@ runs: pattern: ReactCore* path: ./packages/react-native/ReactAndroid/external-artifacts/artifacts merge-multiple: true + # ReactNativeDependenciesHeaders* is already covered by the + # ReactNativeDependencies* pattern above; ReactNativeHeaders* needs its own. + - name: Download ReactNativeHeaders artifacts + if: ${{ inputs.skip-apple-prebuilts != 'true' }} + uses: actions/download-artifact@v7 + with: + pattern: ReactNativeHeaders* + path: ./packages/react-native/ReactAndroid/external-artifacts/artifacts + merge-multiple: true - name: Print Artifacts Directory if: ${{ inputs.skip-apple-prebuilts != 'true' }} shell: bash @@ -42,6 +51,7 @@ runs: - name: Setup node.js uses: ./.github/actions/setup-node with: + node-version: '24' registry-url: 'https://registry.npmjs.org' - name: Install dependencies uses: ./.github/actions/yarn-install diff --git a/.github/actions/create-release/action.yml b/.github/actions/create-release/action.yml index 1d26e17e8fcc..f0315eab8af0 100644 --- a/.github/actions/create-release/action.yml +++ b/.github/actions/create-release/action.yml @@ -2,15 +2,15 @@ name: create_release description: Creates a new React Native release inputs: version: - description: "The version of React Native we want to release. For example 0.75.0-rc.0" + description: 'The version of React Native we want to release. For example 0.75.0-rc.0' required: true is-latest-on-npm: - description: "Whether we want to tag this release as latest on NPM" + description: 'Whether we want to tag this release as latest on NPM' required: true - default: "false" + default: 'false' dry-run: - description: "Whether the job should be executed in dry-run mode or not" - default: "true" + description: 'Whether the job should be executed in dry-run mode or not' + default: 'true' runs: using: composite steps: diff --git a/.github/actions/maestro-android/action.yml b/.github/actions/maestro-android/action.yml index cbc5ef1b96bc..8962e2894392 100644 --- a/.github/actions/maestro-android/action.yml +++ b/.github/actions/maestro-android/action.yml @@ -20,19 +20,23 @@ inputs: default: release working-directory: required: false - default: "." + default: '.' description: The directory from which metro should be started emulator-arch: required: false default: x86 description: The architecture of the emulator to run + test-state-path: + required: false + default: /tmp/maestro-android-state/results.json + description: The path used to persist per-flow test results between retries runs: using: composite steps: - name: Installing Maestro shell: bash - run: export MAESTRO_VERSION=1.40.0; curl -Ls "https://get.maestro.mobile.dev" | bash + run: export MAESTRO_VERSION=2.6.1; curl -Ls "https://get.maestro.mobile.dev" | bash - name: Set up JDK 17 if: ${{ inputs.install-java == 'true' }} uses: actions/setup-java@v5 @@ -64,7 +68,7 @@ runs: cores: '4' disable-animations: false avd-name: e2e_emulator - script: node .github/workflow-scripts/maestro-android.js ${{ inputs.app-path }} ${{ inputs.app-id }} ${{ inputs.maestro-flow }} ${{ inputs.flavor }} ${{ inputs.working-directory }} + script: node .github/workflow-scripts/maestro-android.js ${{ inputs.app-path }} ${{ inputs.app-id }} ${{ inputs.maestro-flow }} ${{ inputs.flavor }} ${{ inputs.working-directory }} ${{ inputs.test-state-path }} - name: Normalize APP_ID id: normalize-app-id shell: bash @@ -82,9 +86,10 @@ runs: report.xml screen.mp4 - name: Store Logs - if: steps.run-tests.outcome == 'failure' + if: always() uses: actions/upload-artifact@v6 with: name: maestro-logs-android-${{ steps.normalize-app-id.outputs.app-id }}-${{ inputs.flavor }}-${{ inputs.emulator-arch }}-NewArch overwrite: true + if-no-files-found: ignore path: /tmp/MaestroLogs diff --git a/.github/actions/maestro-ios/action.yml b/.github/actions/maestro-ios/action.yml index 4720d1ad5d8d..6ebc7327fb0b 100644 --- a/.github/actions/maestro-ios/action.yml +++ b/.github/actions/maestro-ios/action.yml @@ -16,7 +16,7 @@ inputs: default: Release working-directory: required: false - default: "." + default: '.' description: The directory from which metro should be started runs: @@ -24,7 +24,7 @@ runs: steps: - name: Installing Maestro shell: bash - run: export MAESTRO_VERSION=1.40.0; curl -Ls "https://get.maestro.mobile.dev" | bash + run: export MAESTRO_VERSION=2.6.1; curl -Ls "https://get.maestro.mobile.dev" | bash - name: Installing Maestro dependencies shell: bash run: | diff --git a/.github/actions/prepare-ios-tests/action.yml b/.github/actions/prepare-ios-tests/action.yml index 6465f0db99bd..d5225308f3e7 100644 --- a/.github/actions/prepare-ios-tests/action.yml +++ b/.github/actions/prepare-ios-tests/action.yml @@ -11,7 +11,7 @@ runs: - name: Boot iPhone Simulator shell: bash run: source scripts/.tests.env && xcrun simctl boot "$IOS_DEVICE" || true - - name: "Brew: Tap wix/brew" + - name: 'Brew: Tap wix/brew' shell: bash run: brew tap wix/brew - name: brew install applesimutils watchman diff --git a/.github/actions/setup-gradle/action.yml b/.github/actions/setup-gradle/action.yml index 6228715b65f8..77a6e24cd65f 100644 --- a/.github/actions/setup-gradle/action.yml +++ b/.github/actions/setup-gradle/action.yml @@ -1,13 +1,13 @@ name: Setup gradle -description: "Set up your GitHub Actions workflow with a specific version of gradle" +description: 'Set up your GitHub Actions workflow with a specific version of gradle' inputs: cache-read-only: description: "Whether the Gradle Cache should be in read-only mode so this job won't be allowed to write to it" - default: "true" + default: 'true' cache-encryption-key: - description: "The encryption key needed to store the Gradle Configuration cache" + description: 'The encryption key needed to store the Gradle Configuration cache' runs: - using: "composite" + using: 'composite' steps: - name: Setup gradle uses: gradle/actions/setup-gradle@v4 diff --git a/.github/actions/setup-node/action.yml b/.github/actions/setup-node/action.yml index 0b4884dea872..49b773d4cef5 100644 --- a/.github/actions/setup-node/action.yml +++ b/.github/actions/setup-node/action.yml @@ -13,7 +13,7 @@ inputs: required: false default: '' runs: - using: "composite" + using: 'composite' steps: - name: Setup node.js uses: actions/setup-node@v6 diff --git a/.github/actions/setup-xcode/action.yml b/.github/actions/setup-xcode/action.yml index 19e3f3e6f06e..85223692bc8f 100644 --- a/.github/actions/setup-xcode/action.yml +++ b/.github/actions/setup-xcode/action.yml @@ -6,7 +6,7 @@ inputs: required: false default: '16.4.0' runs: - using: "composite" + using: 'composite' steps: - name: Setup xcode uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd diff --git a/.github/actions/test-ios-rntester/action.yml b/.github/actions/test-ios-rntester/action.yml index 08e355e76858..2b62f554daa1 100644 --- a/.github/actions/test-ios-rntester/action.yml +++ b/.github/actions/test-ios-rntester/action.yml @@ -15,9 +15,18 @@ inputs: required: false default: false use-frameworks: - description: Whether we have to build with Dynamic Frameworks. If this is set to true, it builds from source + description: Whether we have to build with Dynamic Frameworks. required: false default: false + use-prebuilds: + description: >- + Whether to consume the prebuilt ReactCore/ReactNativeDependencies + artifacts. 'auto' (default) keeps the historical coupling: prebuilds for + static, source for dynamic frameworks. Pass 'true' with + use-frameworks:true for the prebuilt + dynamic-frameworks lane (the + config of the 2026-07-03 SocketRocket dual-copy regression). + required: false + default: auto runs: using: composite @@ -41,24 +50,44 @@ runs: - name: Prepare IOS Tests if: ${{ inputs.run-unit-tests == 'true' }} uses: ./.github/actions/prepare-ios-tests + - name: Resolve prebuilds mode + id: prebuilds + shell: bash + run: | + if [[ "${{ inputs.use-prebuilds }}" == "auto" ]]; then + # Historical coupling: prebuilds for static, source for dynamic frameworks. + if [[ "${{ inputs.use-frameworks }}" == "true" ]]; then + echo "enabled=false" >> "$GITHUB_OUTPUT" + else + echo "enabled=true" >> "$GITHUB_OUTPUT" + fi + elif [[ "${{ inputs.use-prebuilds }}" == "true" ]]; then + echo "enabled=true" >> "$GITHUB_OUTPUT" + elif [[ "${{ inputs.use-prebuilds }}" == "false" ]]; then + echo "enabled=false" >> "$GITHUB_OUTPUT" + else + # Don't silently treat a typo as 'disabled' โ€” surface it. + echo "::warning::Unexpected use-prebuilds value '${{ inputs.use-prebuilds }}' (expected auto/true/false); treating as disabled." + echo "enabled=false" >> "$GITHUB_OUTPUT" + fi - name: Download ReactNativeDependencies - if: ${{ inputs.use-frameworks == 'false' }} + if: ${{ steps.prebuilds.outputs.enabled == 'true' }} uses: actions/download-artifact@v7 with: name: ReactNativeDependencies${{ inputs.flavor }}.xcframework.tar.gz path: /tmp/third-party/ - name: Print third-party folder - if: ${{ inputs.use-frameworks == 'false' }} + if: ${{ steps.prebuilds.outputs.enabled == 'true' }} shell: bash run: ls -lR /tmp/third-party - name: Download React Native Prebuilds - if: ${{ inputs.use-frameworks == 'false' }} + if: ${{ steps.prebuilds.outputs.enabled == 'true' }} uses: actions/download-artifact@v7 with: name: ReactCore${{ inputs.flavor }}.xcframework.tar.gz path: /tmp/ReactCore - name: Print ReactCore folder - if: ${{ inputs.use-frameworks == 'false' }} + if: ${{ steps.prebuilds.outputs.enabled == 'true' }} shell: bash run: ls -lR /tmp/ReactCore - name: Install CocoaPods dependencies @@ -66,8 +95,8 @@ runs: run: | if [[ ${{ inputs.use-frameworks }} == "true" ]]; then export USE_FRAMEWORKS=dynamic - else - # If use-frameworks is false, let's use prebuilds + fi + if [[ "${{ steps.prebuilds.outputs.enabled }}" == "true" ]]; then export RCT_USE_LOCAL_RN_DEP="/tmp/third-party/ReactNativeDependencies${{ inputs.flavor }}.xcframework.tar.gz" export RCT_TESTONLY_RNCORE_TARBALL_PATH="/tmp/ReactCore/ReactCore${{ inputs.flavor }}.xcframework.tar.gz" fi @@ -92,7 +121,7 @@ runs: echo "App found at $APP_PATH" echo "app-path=$APP_PATH" >> $GITHUB_ENV - - name: "Run Tests: iOS Unit and Integration Tests" + - name: 'Run Tests: iOS Unit and Integration Tests' if: ${{ inputs.run-unit-tests == 'true' }} shell: bash run: yarn test-ios diff --git a/.github/actions/test-js/action.yml b/.github/actions/test-js/action.yml index 2b5c97a009a0..653a7ee95928 100644 --- a/.github/actions/test-js/action.yml +++ b/.github/actions/test-js/action.yml @@ -2,9 +2,9 @@ name: test-js description: Runs all the JS tests in the codebase inputs: node-version: - description: "The node.js version to use" + description: 'The node.js version to use' required: false - default: "22" + default: '22' runs: using: composite steps: diff --git a/.github/workflow-scripts/__tests__/maestro-android-test.js b/.github/workflow-scripts/__tests__/maestro-android-test.js new file mode 100644 index 000000000000..77b5711030bc --- /dev/null +++ b/.github/workflow-scripts/__tests__/maestro-android-test.js @@ -0,0 +1,89 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +const fs = require('fs'); +const os = require('os'); +const path = require('path'); + +const { + collectFlows, + executeFlowSuite, + loadState, +} = require('../maestro-android'); + +describe('Maestro Android runner', () => { + let temporaryDirectory; + + beforeEach(() => { + temporaryDirectory = fs.mkdtempSync( + path.join(os.tmpdir(), 'maestro-android-test-'), + ); + jest.spyOn(console, 'error').mockImplementation(() => {}); + }); + + afterEach(() => { + jest.restoreAllMocks(); + fs.rmSync(temporaryDirectory, {recursive: true, force: true}); + }); + + it('collects flows recursively in a stable order', () => { + const nestedDirectory = path.join(temporaryDirectory, 'nested'); + fs.mkdirSync(nestedDirectory); + fs.writeFileSync(path.join(temporaryDirectory, 'second.yaml'), 'appId: x'); + fs.writeFileSync(path.join(temporaryDirectory, 'image.png'), 'not a flow'); + fs.writeFileSync(path.join(nestedDirectory, 'first.yml'), 'appId: x'); + + expect(collectFlows(temporaryDirectory)).toEqual([ + path.join(nestedDirectory, 'first.yml'), + path.join(temporaryDirectory, 'second.yaml'), + ]); + }); + + it('runs every flow and retries only flows that have not passed', () => { + const flows = ['first.yml', 'second.yml', 'third.yml'].map(file => + path.join(temporaryDirectory, file), + ); + const statePath = path.join(temporaryDirectory, 'state', 'results.json'); + const firstAttempt = jest.fn(flow => { + if (flow.endsWith('second.yml')) { + throw new Error('failed assertion'); + } + }); + + expect(() => + executeFlowSuite({ + flows, + appId: 'com.example', + state: loadState(statePath), + statePath, + executeFlow: firstAttempt, + }), + ).toThrow('1 Maestro flow(s) failed'); + expect(firstAttempt).toHaveBeenCalledTimes(3); + + const retry = jest.fn(); + executeFlowSuite({ + flows, + appId: 'com.example', + state: loadState(statePath), + statePath, + executeFlow: retry, + }); + + expect(retry).toHaveBeenCalledTimes(1); + expect(retry.mock.calls[0][0]).toBe(flows[1]); + + const finalState = loadState(statePath); + expect(Object.values(finalState.flows)).toEqual([ + {status: 'passed', attempts: 1}, + {status: 'passed', attempts: 2}, + {status: 'passed', attempts: 1}, + ]); + }); +}); diff --git a/.github/workflow-scripts/__tests__/maestro-ios-test.js b/.github/workflow-scripts/__tests__/maestro-ios-test.js new file mode 100644 index 000000000000..8b604ae1da66 --- /dev/null +++ b/.github/workflow-scripts/__tests__/maestro-ios-test.js @@ -0,0 +1,81 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +jest.mock('child_process', () => ({ + execSync: jest.fn(), + spawn: jest.fn(), +})); +jest.mock('fs', () => ({ + existsSync: jest.fn(), + lstatSync: jest.fn(), + readdirSync: jest.fn(), +})); + +const childProcess = require('child_process'); +const fs = require('fs'); + +const {executeFlows, findAvailableSimulator} = require('../maestro-ios'); + +describe('Maestro iOS runner', () => { + beforeEach(() => { + jest.clearAllMocks(); + childProcess.spawn.mockReturnValue({pid: 1, kill: jest.fn()}); + }); + + it('executes each YAML flow separately and skips other files', () => { + fs.existsSync.mockReturnValue(true); + fs.lstatSync.mockImplementation(path => ({ + isDirectory: () => path === 'flows/', + })); + fs.readdirSync.mockReturnValue(['second.yaml', 'image.png', 'first.yml']); + + executeFlows('com.example', 'device-id', 'flows/', 'Hermes'); + + expect(childProcess.execSync).toHaveBeenCalledTimes(2); + expect(childProcess.execSync.mock.calls[0][0]).toContain( + 'test "flows/first.yml"', + ); + expect(childProcess.execSync.mock.calls[1][0]).toContain( + 'test "flows/second.yaml"', + ); + }); + + it('retries only the failing flow', () => { + fs.existsSync.mockReturnValue(false); + childProcess.execSync.mockImplementationOnce(() => { + throw new Error('Maestro driver failed'); + }); + + executeFlows('com.example', 'device-id', 'flow.yml', 'Hermes'); + + expect(childProcess.execSync).toHaveBeenCalledTimes(2); + for (const call of childProcess.execSync.mock.calls) { + expect(call[0]).toContain('test "flow.yml"'); + } + }); + + it('selects an iPhone Pro simulator from the latest runtime', () => { + childProcess.execSync.mockReturnValue( + JSON.stringify({ + devices: { + 'iOS 18.5': [{name: 'iPhone 16 Pro', udid: 'old-pro'}], + 'iOS 26.5': [ + {name: 'iPhone 17 Pro Max', udid: 'new-pro-max'}, + {name: 'iPhone 17 Pro', udid: 'new-pro'}, + ], + }, + }), + ); + + expect(findAvailableSimulator()).toEqual({ + name: 'iPhone 17 Pro', + udid: 'new-pro', + }); + }); +}); diff --git a/.github/workflow-scripts/__tests__/verifyArtifactsAreOnMaven-test.js b/.github/workflow-scripts/__tests__/verifyArtifactsAreOnMaven-test.js index e77e7c4e2e49..8e9758f28609 100644 --- a/.github/workflow-scripts/__tests__/verifyArtifactsAreOnMaven-test.js +++ b/.github/workflow-scripts/__tests__/verifyArtifactsAreOnMaven-test.js @@ -22,6 +22,28 @@ jest.mock('../utils.js', () => ({ process.exit = mockExit; global.fetch = mockFetch; +const BASE_URL = + 'https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts'; + +// The verifier HEAD-checks the POM plus every classifier tarball attached to +// the react-native-artifacts publication (external-artifacts/build.gradle.kts). +const expectedUrls = version => [ + `${BASE_URL}/${version}/react-native-artifacts-${version}.pom`, + ...[ + 'reactnative-core-debug', + 'reactnative-core-release', + 'reactnative-dependencies-debug', + 'reactnative-dependencies-release', + 'reactnative-headers-debug', + 'reactnative-headers-release', + 'reactnative-dependencies-headers-debug', + 'reactnative-dependencies-headers-release', + ].map( + classifier => + `${BASE_URL}/${version}/react-native-artifacts-${version}-${classifier}.tar.gz`, + ), +]; + describe('#verifyArtifactsAreOnMaven', () => { beforeEach(jest.clearAllMocks); @@ -29,17 +51,18 @@ describe('#verifyArtifactsAreOnMaven', () => { mockSleep.mockReturnValueOnce(Promise.resolve()).mockImplementation(() => { throw new Error('Should not be called again!'); }); + // First attempt: the POM is not there yet. Second attempt: every URL is. mockFetch .mockReturnValueOnce(Promise.resolve({status: 404})) - .mockReturnValueOnce(Promise.resolve({status: 200})); + .mockReturnValue(Promise.resolve({status: 200})); const version = '0.78.1'; await verifyArtifactsAreOnMaven(version); expect(mockSleep).toHaveBeenCalledTimes(1); - expect(mockFetch).toHaveBeenCalledWith( - 'https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.78.1/react-native-artifacts-0.78.1.pom', - ); + for (const url of expectedUrls('0.78.1')) { + expect(mockFetch).toHaveBeenCalledWith(url, {method: 'HEAD'}); + } }); it('waits for the packages to be published on maven, when version starts with v', async () => { @@ -48,27 +71,46 @@ describe('#verifyArtifactsAreOnMaven', () => { }); mockFetch .mockReturnValueOnce(Promise.resolve({status: 404})) - .mockReturnValueOnce(Promise.resolve({status: 200})); + .mockReturnValue(Promise.resolve({status: 200})); const version = 'v0.78.1'; await verifyArtifactsAreOnMaven(version); expect(mockSleep).toHaveBeenCalledTimes(1); - expect(mockFetch).toHaveBeenCalledWith( - 'https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.78.1/react-native-artifacts-0.78.1.pom', - ); + for (const url of expectedUrls('0.78.1')) { + expect(mockFetch).toHaveBeenCalledWith(url, {method: 'HEAD'}); + } }); it('passes immediately if packages are already on Maven', async () => { - mockFetch.mockReturnValueOnce(Promise.resolve({status: 200})); + mockFetch.mockReturnValue(Promise.resolve({status: 200})); const version = '0.78.1'; await verifyArtifactsAreOnMaven(version); expect(mockSleep).toHaveBeenCalledTimes(0); - expect(mockFetch).toHaveBeenCalledWith( - 'https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.78.1/react-native-artifacts-0.78.1.pom', - ); + // All nine URLs (POM + 8 classifier tarballs) are verified in one pass. + expect(mockFetch).toHaveBeenCalledTimes(9); + for (const url of expectedUrls('0.78.1')) { + expect(mockFetch).toHaveBeenCalledWith(url, {method: 'HEAD'}); + } + }); + + it('waits when a classifier artifact is missing even though the POM exists', async () => { + mockSleep.mockReturnValueOnce(Promise.resolve()).mockImplementation(() => { + throw new Error('Should not be called again!'); + }); + // First attempt: POM ok, first classifier missing. Second attempt: all ok. + mockFetch + .mockReturnValueOnce(Promise.resolve({status: 200})) + .mockReturnValueOnce(Promise.resolve({status: 404})) + .mockReturnValue(Promise.resolve({status: 200})); + + const version = '0.78.1'; + await verifyArtifactsAreOnMaven(version); + + expect(mockSleep).toHaveBeenCalledTimes(1); + expect(mockExit).not.toHaveBeenCalled(); }); it('tries 90 times and then exits', async () => { @@ -82,6 +124,7 @@ describe('#verifyArtifactsAreOnMaven', () => { expect(mockExit).toHaveBeenCalledWith(1); expect(mockFetch).toHaveBeenCalledWith( 'https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.78.1/react-native-artifacts-0.78.1.pom', + {method: 'HEAD'}, ); }); }); diff --git a/.github/workflow-scripts/analyze_scripts.sh b/.github/workflow-scripts/analyze_scripts.sh index cdf280636b2b..f9a551d64d65 100755 --- a/.github/workflow-scripts/analyze_scripts.sh +++ b/.github/workflow-scripts/analyze_scripts.sh @@ -21,6 +21,6 @@ if [ -x "$(command -v shellcheck)" ]; then -exec sh -c 'shellcheck "$1"' -- {} \; else - echo 'shellcheck is not installed. See https://github.com/facebook/react-native/wiki/Development-Dependencies#shellcheck for instructions.' + echo 'shellcheck is not installed. Install it via your package manager, e.g. `brew install shellcheck`.' exit 1 fi diff --git a/.github/workflow-scripts/lint_files.sh b/.github/workflow-scripts/lint_files.sh deleted file mode 100755 index 9563d7dafb57..000000000000 --- a/.github/workflow-scripts/lint_files.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -# Copyright (c) Meta Platforms, Inc. and affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -set -e - -if git ls-files | grep -E '\.npmignore$'; then - echo "Error: Found unexpected .npmignore file(s). Please use package.json#files instead." - exit 1 -fi diff --git a/.github/workflow-scripts/maestro-android.js b/.github/workflow-scripts/maestro-android.js index 62ee99a2279d..e871325998ba 100644 --- a/.github/workflow-scripts/maestro-android.js +++ b/.github/workflow-scripts/maestro-android.js @@ -9,85 +9,293 @@ const childProcess = require('child_process'); const fs = require('fs'); +const path = require('path'); const usage = ` === Usage === -node maestro-android.js +node maestro-android.js [test_state_path] @param {string} appPath - Path to the app APK @param {string} appId - App ID that needs to be launched -@param {string} maestroFlow - Path to the maestro flow to be executed +@param {string} maestroFlow - Path to the Maestro flow or folder to execute @param {string} flavor - Flavor of the app to be launched. Can be 'release' or 'debug' @param {string} workingDirectory - Working directory from where to run Metro +@param {string} testStatePath - File used to persist per-flow results between CI retries ============== `; -const args = process.argv.slice(2); +const DEFAULT_STATE_PATH = '/tmp/maestro-android-state/results.json'; +const MAESTRO_LOG_DIRECTORY = '/tmp/MaestroLogs'; +const DIAGNOSTIC_COMMAND_TIMEOUT = 15000; +const STATE_VERSION = 1; -if (args.length !== 5) { - throw new Error(`Invalid number of arguments.\n${usage}`); +function collectFlows(flowPath) { + if (!fs.existsSync(flowPath) || !fs.lstatSync(flowPath).isDirectory()) { + return [flowPath]; + } + + const flows = []; + for (const file of fs.readdirSync(flowPath).sort()) { + const filePath = path.join(flowPath, file); + if (fs.lstatSync(filePath).isDirectory()) { + flows.push(...collectFlows(filePath)); + } else if (file.endsWith('.yml') || file.endsWith('.yaml')) { + flows.push(filePath); + } + // Skip non-flow files (e.g. screenshot baselines under screenshots/). + } + return flows; } -const APP_PATH = args[0]; -const APP_ID = args[1]; -const MAESTRO_FLOW = args[2]; -const IS_DEBUG = args[3] === 'debug'; -const WORKING_DIRECTORY = args[4]; +function getFlowKey(flow) { + return path + .relative(process.cwd(), path.resolve(flow)) + .split(path.sep) + .join('/'); +} -const MAX_ATTEMPTS = 3; +function createEmptyState() { + return {version: STATE_VERSION, flows: {}}; +} -async function executeFlowWithRetries(flow, currentAttempt) { +function loadState(statePath) { + if (!fs.existsSync(statePath)) { + return createEmptyState(); + } + + const state = JSON.parse(fs.readFileSync(statePath, 'utf8')); + if ( + state.version !== STATE_VERSION || + state.flows == null || + typeof state.flows !== 'object' + ) { + throw new Error(`Invalid Maestro test state at ${statePath}`); + } + return state; +} + +function saveState(statePath, state) { + fs.mkdirSync(path.dirname(statePath), {recursive: true}); + const temporaryPath = `${statePath}.tmp`; + fs.writeFileSync(temporaryPath, `${JSON.stringify(state, null, 2)}\n`); + fs.renameSync(temporaryPath, statePath); +} + +function runMaestroFlow(flow, appId) { + console.info(`Executing flow: ${flow}`); + const timeout = 1000 * 60 * 10; // 10 minutes try { - console.info(`Executing flow: ${flow}`); - const timeout = 1000 * 60 * 10; // 10 minutes childProcess.execSync( - `MAESTRO_DRIVER_STARTUP_TIMEOUT=120000 $HOME/.maestro/bin/maestro test ${flow} --format junit -e APP_ID=${APP_ID} --debug-output /tmp/MaestroLogs`, + `MAESTRO_DRIVER_STARTUP_TIMEOUT=120000 $HOME/.maestro/bin/maestro test "${flow}" --format junit -e APP_ID="${appId}" --debug-output ${MAESTRO_LOG_DIRECTORY}`, {stdio: 'inherit', timeout}, ); - } catch (err) { - if (currentAttempt < MAX_ATTEMPTS) { - console.info(`Retrying...`); - await executeFlowWithRetries(flow, currentAttempt + 1); - } else { - throw err; - } + } catch (error) { + captureFailureArtifacts(flow); + throw error; } } -async function executeFlowInFolder(flowFolder) { - const files = fs.readdirSync(flowFolder); - for (const file of files) { - const filePath = `${flowFolder}/${file}`; - if (fs.lstatSync(filePath).isDirectory()) { - await executeFlowInFolder(filePath); - } else { - await executeFlowWithRetries(filePath, 0); +function captureFailureArtifacts(flow) { + fs.mkdirSync(MAESTRO_LOG_DIRECTORY, {recursive: true}); + const artifactName = path.basename(flow, path.extname(flow)); + + try { + const screenshot = childProcess.execFileSync( + 'adb', + ['exec-out', 'screencap', '-p'], + {maxBuffer: 20 * 1024 * 1024, timeout: DIAGNOSTIC_COMMAND_TIMEOUT}, + ); + fs.writeFileSync( + path.join(MAESTRO_LOG_DIRECTORY, `${artifactName}-failure.png`), + screenshot, + ); + } catch (error) { + console.error(`Failed to capture screenshot for ${flow}: ${error}`); + } + + try { + childProcess.execFileSync( + 'adb', + ['shell', 'uiautomator', 'dump', '/sdcard/window.xml'], + {stdio: 'ignore', timeout: DIAGNOSTIC_COMMAND_TIMEOUT}, + ); + const hierarchy = childProcess.execFileSync( + 'adb', + ['exec-out', 'cat', '/sdcard/window.xml'], + {maxBuffer: 20 * 1024 * 1024, timeout: DIAGNOSTIC_COMMAND_TIMEOUT}, + ); + fs.writeFileSync( + path.join(MAESTRO_LOG_DIRECTORY, `${artifactName}-failure.xml`), + hierarchy, + ); + } catch (error) { + console.error(`Failed to capture UI hierarchy for ${flow}: ${error}`); + } + + try { + const logcat = childProcess.execFileSync( + 'adb', + ['logcat', '-d', '-v', 'threadtime'], + {maxBuffer: 50 * 1024 * 1024, timeout: DIAGNOSTIC_COMMAND_TIMEOUT}, + ); + fs.writeFileSync( + path.join(MAESTRO_LOG_DIRECTORY, `${artifactName}-logcat.txt`), + logcat, + ); + } catch (error) { + console.error(`Failed to capture logcat for ${flow}: ${error}`); + } +} + +async function stopScreenRecording(screenrecordProcess) { + try { + childProcess.execFileSync('adb', ['shell', 'pkill', '-2', 'screenrecord'], { + stdio: 'ignore', + }); + } catch { + screenrecordProcess.kill('SIGINT'); + } + + if ( + screenrecordProcess.exitCode == null && + screenrecordProcess.signalCode == null + ) { + await Promise.race([ + new Promise(resolve => screenrecordProcess.once('close', resolve)), + sleep(5000), + ]); + } + + if ( + screenrecordProcess.exitCode == null && + screenrecordProcess.signalCode == null + ) { + screenrecordProcess.kill('SIGKILL'); + } +} + +function formatResults(flowKeys, state) { + const results = flowKeys.map(flow => ({flow, ...state.flows[flow]})); + const counts = results.reduce( + (result, flow) => { + result[flow.status] += 1; + return result; + }, + {passed: 0, failed: 0, pending: 0}, + ); + const rows = results + .map( + result => + `| ${result.status} | \`${result.flow.replaceAll('|', '\\|')}\` | ${result.attempts} |`, + ) + .join('\n'); + + return `### Android Maestro E2E results + +Passed: ${counts.passed} ยท Failed: ${counts.failed} ยท Pending: ${counts.pending} + +| Status | Flow | CI attempts | +| --- | --- | ---: | +${rows} +`; +} + +function writeResultsSummary(flowKeys, state) { + const summary = formatResults(flowKeys, state); + console.info(`\n${summary}`); + if (process.env.GITHUB_STEP_SUMMARY) { + fs.appendFileSync(process.env.GITHUB_STEP_SUMMARY, summary); + } +} + +function executeFlowSuite({ + flows, + appId, + state, + statePath, + executeFlow = runMaestroFlow, +}) { + const flowKeys = flows.map(getFlowKey); + + for (const flow of flowKeys) { + state.flows[flow] ??= {status: 'pending', attempts: 0}; + } + saveState(statePath, state); + + const failedFlows = []; + for (let index = 0; index < flows.length; index++) { + const flow = flows[index]; + const flowKey = flowKeys[index]; + const result = state.flows[flowKey]; + + if (result.status === 'passed') { + console.info(`Skipping previously passed flow: ${flow}`); + continue; + } + + result.attempts += 1; + try { + executeFlow(flow, appId); + result.status = 'passed'; + delete result.error; + } catch (error) { + result.status = 'failed'; + result.error = error instanceof Error ? error.message : String(error); + failedFlows.push(flowKey); + console.error(`Flow failed: ${flow}`); + } finally { + saveState(statePath, state); } } + + writeResultsSummary(flowKeys, state); + + if (failedFlows.length > 0) { + throw new Error( + `${failedFlows.length} Maestro flow(s) failed:\n${failedFlows.join('\n')}`, + ); + } } -async function main() { +async function main(args = process.argv.slice(2)) { + if (args.length < 5 || args.length > 6) { + throw new Error(`Invalid number of arguments.\n${usage}`); + } + + const appPath = args[0]; + const appId = args[1]; + const maestroFlow = args[2]; + const isDebug = args[3] === 'debug'; + const workingDirectory = args[4]; + const statePath = args[5] ?? DEFAULT_STATE_PATH; + console.info('\n=============================='); console.info('Running tests for Android with the following parameters:'); - console.info(`APP_PATH: ${APP_PATH}`); - console.info(`APP_ID: ${APP_ID}`); - console.info(`MAESTRO_FLOW: ${MAESTRO_FLOW}`); - console.info(`IS_DEBUG: ${IS_DEBUG}`); - console.info(`WORKING_DIRECTORY: ${WORKING_DIRECTORY}`); + console.info(`APP_PATH: ${appPath}`); + console.info(`APP_ID: ${appId}`); + console.info(`MAESTRO_FLOW: ${maestroFlow}`); + console.info(`IS_DEBUG: ${isDebug}`); + console.info(`WORKING_DIRECTORY: ${workingDirectory}`); + console.info(`TEST_STATE_PATH: ${statePath}`); console.info('==============================\n'); console.info('Install app'); - childProcess.execSync(`adb install ${APP_PATH}`, {stdio: 'ignore'}); + childProcess.execSync(`adb install ${appPath}`, {stdio: 'ignore'}); let metroProcess = null; - if (IS_DEBUG) { + if (isDebug) { console.info('Start Metro'); - childProcess.execSync(`cd ${WORKING_DIRECTORY}`, {stdio: 'ignore'}); - metroProcess = childProcess.spawn('yarn', ['start', '&'], { - cwd: WORKING_DIRECTORY, - stdio: 'ignore', + fs.mkdirSync(MAESTRO_LOG_DIRECTORY, {recursive: true}); + const metroLog = fs.openSync( + path.join(MAESTRO_LOG_DIRECTORY, 'metro.log'), + 'a', + ); + metroProcess = childProcess.spawn('yarn', ['start'], { + cwd: workingDirectory, + stdio: ['ignore', metroLog, metroLog], detached: true, }); + fs.closeSync(metroLog); metroProcess.unref(); console.info(`- Metro PID: ${metroProcess.pid}`); @@ -96,51 +304,44 @@ async function main() { } console.info('Start the app'); - childProcess.execSync(`adb shell monkey -p ${APP_ID} 1`, {stdio: 'ignore'}); + childProcess.execSync(`adb shell monkey -p ${appId} 1`, {stdio: 'ignore'}); - if (IS_DEBUG) { + if (isDebug) { console.info('Wait For App to warm from Metro'); await sleep(10000); } console.info('Start recording to /sdcard/screen.mp4'); - childProcess - .exec('adb shell screenrecord /sdcard/screen.mp4', { - stdio: 'ignore', - detached: true, - }) - .unref(); + const screenrecordProcess = childProcess.spawn( + 'adb', + ['shell', 'screenrecord', '/sdcard/screen.mp4'], + {stdio: 'ignore'}, + ); - console.info(`Start testing ${MAESTRO_FLOW}`); let error = null; try { - //check if MAESTRO_FLOW is a folder - if ( - fs.existsSync(MAESTRO_FLOW) && - fs.lstatSync(MAESTRO_FLOW).isDirectory() - ) { - await executeFlowInFolder(MAESTRO_FLOW); - } else { - await executeFlowWithRetries(MAESTRO_FLOW, 0); - } - } catch (err) { - error = err; + const flows = collectFlows(maestroFlow); + const state = loadState(statePath); + console.info(`Start testing ${flows.length} flow(s)`); + executeFlowSuite({flows, appId, state, statePath}); + } catch (caughtError) { + error = caughtError; } finally { console.info('Stop recording'); + await stopScreenRecording(screenrecordProcess); childProcess.execSync('adb pull /sdcard/screen.mp4', {stdio: 'ignore'}); - if (IS_DEBUG && metroProcess != null) { + if (isDebug && metroProcess != null) { const pid = metroProcess.pid; console.info(`Kill Metro. PID: ${pid}`); process.kill(pid); - console.info(`Metro Killed`); + console.info('Metro Killed'); } } if (error) { throw error; } - process.exit(); } function sleep(ms) { @@ -149,4 +350,16 @@ function sleep(ms) { }); } -main(); +if (require.main === module) { + main().catch(error => { + console.error(error); + process.exitCode = 1; + }); +} + +module.exports = { + collectFlows, + executeFlowSuite, + formatResults, + loadState, +}; diff --git a/.github/workflow-scripts/maestro-ios.js b/.github/workflow-scripts/maestro-ios.js index bad5f8a35248..6b7a536f72d2 100644 --- a/.github/workflow-scripts/maestro-ios.js +++ b/.github/workflow-scripts/maestro-ios.js @@ -23,25 +23,28 @@ node maestro-android.js /^iPhone .* Pro$/.test(device.name)); -const APP_PATH = args[0]; -const APP_ID = args[1]; -const MAESTRO_FLOW = args[2]; -const JS_ENGINE = args[3]; -const IS_DEBUG = args[4] === 'Debug'; -const WORKING_DIRECTORY = args[5]; + if (simulator == null) { + throw new Error('Unable to find an available iPhone Pro simulator'); + } -const MAX_ATTEMPTS = 5; + return simulator; +} -function launchSimulator(simulatorName) { - console.log(`Launching simulator ${simulatorName}`); +function launchSimulator(simulator) { + console.log(`Launching simulator ${simulator.name} (${simulator.udid})`); try { - childProcess.execSync(`xcrun simctl boot "${simulatorName}"`); + childProcess.execSync(`xcrun simctl boot "${simulator.udid}"`); } catch (error) { if ( !error.message.includes('Unable to boot device in current state: Booted') @@ -56,14 +59,6 @@ function installAppOnSimulator(appPath) { childProcess.execSync(`xcrun simctl install booted "${appPath}"`); } -function extractSimulatorUDID() { - console.log('Retrieving device UDID'); - const command = `xcrun simctl list devices booted -j | jq -r '[.devices[]] | add | first | .udid'`; - const udid = String(childProcess.execSync(command)).trim(); - console.log(`UDID is ${udid}`); - return udid; -} - function bringSimulatorInForeground() { console.log('Bringing simulator in foreground'); childProcess.execSync('open -a simulator'); @@ -91,7 +86,7 @@ function startVideoRecording(jsengine, currentAttempt) { ); const recordingArgs = - `simctl io booted recordVideo video_record_${currentAttempt}.mov`.split( + `simctl io booted recordVideo --force video_record_${currentAttempt}.mov`.split( ' ', ); const recordingProcess = childProcess.spawn('xcrun', recordingArgs, { @@ -113,17 +108,12 @@ function stopVideoRecording(recordingProcess) { recordingProcess.kill('SIGINT'); } -function executeTestsWithRetries( - appId, - udid, - maestroFlow, - jsengine, - currentAttempt, -) { +function executeFlowWithRetries(appId, udid, flow, jsengine, currentAttempt) { const recProcess = startVideoRecording(jsengine, currentAttempt); try { const timeout = 1000 * 60 * 10; // 10 minutes - const command = `$HOME/.maestro/bin/maestro --udid="${udid}" test "${maestroFlow}" --format junit -e APP_ID="${appId}"`; + const command = `$HOME/.maestro/bin/maestro --udid="${udid}" test "${flow}" --format junit -e APP_ID="${appId}"`; + console.info(`Executing flow: ${flow} (attempt ${currentAttempt})`); console.log(command); childProcess.execSync(`MAESTRO_DRIVER_STARTUP_TIMEOUT=1500000 ${command}`, { stdio: 'inherit', @@ -132,45 +122,72 @@ function executeTestsWithRetries( stopVideoRecording(recProcess); } catch (error) { - // Can't put this in the finally block because it will be executed after the - // recursive call of executeTestsWithRetries stopVideoRecording(recProcess); if (currentAttempt < MAX_ATTEMPTS) { - executeTestsWithRetries( - appId, - udid, - maestroFlow, - jsengine, - currentAttempt + 1, - ); + console.info(`Retrying flow: ${flow}`); + executeFlowWithRetries(appId, udid, flow, jsengine, currentAttempt + 1); } else { - console.error(`Failed to execute flow after ${MAX_ATTEMPTS} attempts.`); + console.error( + `Failed to execute flow ${flow} after ${MAX_ATTEMPTS} attempts.`, + ); throw error; } } } -async function main() { +function executeFlows(appId, udid, maestroFlow, jsengine) { + if (!fs.existsSync(maestroFlow) || !fs.lstatSync(maestroFlow).isDirectory()) { + executeFlowWithRetries(appId, udid, maestroFlow, jsengine, 1); + return; + } + + for (const file of fs.readdirSync(maestroFlow).sort()) { + const filePath = `${maestroFlow.replace(/\/$/, '')}/${file}`; + if (fs.lstatSync(filePath).isDirectory()) { + executeFlows(appId, udid, filePath, jsengine); + } else if (file.endsWith('.yml') || file.endsWith('.yaml')) { + executeFlowWithRetries(appId, udid, filePath, jsengine, 1); + } + } +} + +async function main(args = process.argv.slice(2)) { + if (args.length !== 6) { + throw new Error(`Invalid number of arguments.\n${usage}`); + } + + const appPath = args[0]; + const appId = args[1]; + const maestroFlow = args[2]; + const jsengine = args[3]; + const isDebug = args[4] === 'Debug'; + const workingDirectory = args[5]; + console.info('\n=============================='); console.info('Running tests for iOS with the following parameters:'); - console.info(`APP_PATH: ${APP_PATH}`); - console.info(`APP_ID: ${APP_ID}`); - console.info(`MAESTRO_FLOW: ${MAESTRO_FLOW}`); - console.info(`JS_ENGINE: ${JS_ENGINE}`); - console.info(`IS_DEBUG: ${IS_DEBUG}`); - console.info(`WORKING_DIRECTORY: ${WORKING_DIRECTORY}`); + console.info(`APP_PATH: ${appPath}`); + console.info(`APP_ID: ${appId}`); + console.info(`MAESTRO_FLOW: ${maestroFlow}`); + console.info(`JS_ENGINE: ${jsengine}`); + console.info(`IS_DEBUG: ${isDebug}`); + console.info(`WORKING_DIRECTORY: ${workingDirectory}`); console.info('==============================\n'); - const simulatorName = 'iPhone 16 Pro'; - launchSimulator(simulatorName); - installAppOnSimulator(APP_PATH); - const udid = extractSimulatorUDID(); + const simulator = findAvailableSimulator(); + launchSimulator(simulator); + installAppOnSimulator(appPath); bringSimulatorInForeground(); - await launchAppOnSimulator(APP_ID, udid, IS_DEBUG); - executeTestsWithRetries(APP_ID, udid, MAESTRO_FLOW, JS_ENGINE, 1); + await launchAppOnSimulator(appId, simulator.udid, isDebug); + executeFlows(appId, simulator.udid, maestroFlow, jsengine); console.log('Test finished'); - process.exit(0); } -main(); +if (require.main === module) { + main(); +} + +module.exports = { + executeFlows, + findAvailableSimulator, +}; diff --git a/.github/workflow-scripts/verifyArtifactsAreOnMaven.js b/.github/workflow-scripts/verifyArtifactsAreOnMaven.js index 1bb46163e0a2..5feb3777c032 100644 --- a/.github/workflow-scripts/verifyArtifactsAreOnMaven.js +++ b/.github/workflow-scripts/verifyArtifactsAreOnMaven.js @@ -7,6 +7,7 @@ * @format */ +// @flow const {log, sleep} = require('./utils'); const SLEEP_S = 60; // 1 minute @@ -15,23 +16,64 @@ const ARTIFACT_URL = 'https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/'; const ARTIFACT_NAME = 'react-native-artifacts-'; -async function verifyArtifactsAreOnMaven(version, retries = MAX_RETRIES) { +// The primary xcframework classifier tarballs attached to the +// react-native-artifacts publication (external-artifacts/build.gradle.kts). +// The 4 dSYM classifiers (core/deps dSYM debug+release) are intentionally +// excluded โ€” they are debug-symbol sidecars, not consumed at install time. +// The POM check alone would pass even when a classifier artifact never made +// it to Maven. +const ARTIFACT_CLASSIFIERS = [ + 'reactnative-core-debug', + 'reactnative-core-release', + 'reactnative-dependencies-debug', + 'reactnative-dependencies-release', + 'reactnative-headers-debug', + 'reactnative-headers-release', + 'reactnative-dependencies-headers-debug', + 'reactnative-dependencies-headers-release', +]; + +async function verifyArtifactsAreOnMaven( + version /*: string */, + retries /*: number */ = MAX_RETRIES, +) /*: Promise */ { if (version.startsWith('v')) { version = version.substring(1); } - const artifactUrl = `${ARTIFACT_URL}${version}/${ARTIFACT_NAME}${version}.pom`; + const urls = [ + `${ARTIFACT_URL}${version}/${ARTIFACT_NAME}${version}.pom`, + ...ARTIFACT_CLASSIFIERS.map( + classifier => + `${ARTIFACT_URL}${version}/${ARTIFACT_NAME}${version}-${classifier}.tar.gz`, + ), + ]; for (let currentAttempt = 1; currentAttempt <= retries; currentAttempt++) { - const response = await fetch(artifactUrl); - - if (response.status !== 200) { - log( - `${currentAttempt}) Artifact's for version ${version} are not on maven yet.\nURL: ${artifactUrl}\nLet's wait a minute and try again.\n`, - ); - await sleep(SLEEP_S); - } else { + let missingUrl = null; + for (const url of urls) { + try { + const response = await fetch(url, {method: 'HEAD'}); + if (response.status === 200) { + continue; + } + log(`Got status ${response.status} while checking ${url}`); + } catch (error) { + const message = error instanceof Error ? error.message : String(error); + log(`Network error while checking ${url}: ${message}`); + missingUrl = url; + break; + } + missingUrl = url; + break; + } + + if (missingUrl == null) { return; } + log( + `${currentAttempt}) Artifact's for version ${version} are not on maven yet.\nURL: ${missingUrl}\nLet's wait a minute and try again.\n`, + ); + await sleep(SLEEP_S); } log( diff --git a/.github/workflows/bump-podfile-lock.yml b/.github/workflows/bump-podfile-lock.yml index 94895d94e19b..9e5c42764430 100644 --- a/.github/workflows/bump-podfile-lock.yml +++ b/.github/workflows/bump-podfile-lock.yml @@ -5,7 +5,7 @@ on: jobs: bump-podfile-lock: - runs-on: macos-latest + runs-on: macos-15 steps: - name: Checkout uses: actions/checkout@v6 diff --git a/.github/workflows/cache-reaper.yml b/.github/workflows/cache-reaper.yml index 190e4d376459..85ce2a8c88c1 100644 --- a/.github/workflows/cache-reaper.yml +++ b/.github/workflows/cache-reaper.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: schedule: # Run every 2hrs during weekdays - - cron: "0 0/2 * * 1-5" + - cron: '0 0/2 * * 1-5' jobs: cache-cleaner: diff --git a/.github/workflows/close-pr.yml b/.github/workflows/close-pr.yml index 6ffd382347d9..6af1b037fcf3 100644 --- a/.github/workflows/close-pr.yml +++ b/.github/workflows/close-pr.yml @@ -1,6 +1,5 @@ name: Label closed PR as merged and leave a comment -on: - push +on: push permissions: contents: read diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index dfce6b95e154..c4cedf2f00b9 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -4,16 +4,16 @@ on: workflow_dispatch: inputs: version: - description: "The version of React Native we want to release. For example 0.75.0-rc.0" + description: 'The version of React Native we want to release. For example 0.75.0-rc.0' required: true type: string is-latest-on-npm: - description: "Whether we want to tag this release as latest on NPM" + description: 'Whether we want to tag this release as latest on NPM' required: true type: boolean default: false dry-run: - description: "Whether the job should be executed in dry-run mode or not" + description: 'Whether the job should be executed in dry-run mode or not' type: boolean default: true diff --git a/.github/workflows/e2e-android-rntester.yml b/.github/workflows/e2e-android-rntester.yml index b5cccaa9a5ac..b6b08b2f68b4 100644 --- a/.github/workflows/e2e-android-rntester.yml +++ b/.github/workflows/e2e-android-rntester.yml @@ -9,14 +9,17 @@ on: fail-on-error: type: boolean default: false + retry-attempt: + type: number + default: 0 outputs: status: - description: "The result of the E2E tests (success or failure)" + description: 'The result of the E2E tests (success or failure)' value: ${{ jobs.report.outputs.status }} jobs: test: - runs-on: ubuntu-latest + runs-on: 4-core-ubuntu outputs: status: ${{ steps.report-status.outputs.status }} strategy: @@ -37,16 +40,42 @@ jobs: path: ./packages/rn-tester/android/app/build/outputs/apk/${{ matrix.flavor }}/ - name: Print folder structure run: ls -lR ./packages/rn-tester/android/app/build/outputs/apk/${{ matrix.flavor }}/ + - name: Download previous per-flow test state + if: ${{ inputs.retry-attempt > 0 }} + continue-on-error: true + uses: actions/download-artifact@v7 + with: + name: e2e_android_rntester_state_${{ matrix.flavor }}_x86_NewArch + path: /tmp/maestro-android-state + - name: Check for unfinished E2E flows + id: test-state + shell: bash + run: | + SHOULD_RUN=true + if [[ -f /tmp/maestro-android-state/results.json ]] && \ + jq -e '(.flows | length > 0) and all(.flows[]; .status == "passed")' /tmp/maestro-android-state/results.json > /dev/null; then + SHOULD_RUN=false + fi + echo "should-run=$SHOULD_RUN" >> "$GITHUB_OUTPUT" - name: Run E2E Tests id: run-tests + if: steps.test-state.outputs.should-run == 'true' continue-on-error: true uses: ./.github/actions/maestro-android - timeout-minutes: 60 + timeout-minutes: 90 with: app-path: ./packages/rn-tester/android/app/build/outputs/apk/${{ matrix.flavor }}/app-x86-${{ matrix.flavor }}.apk app-id: com.facebook.react.uiapp maestro-flow: ./packages/rn-tester/.maestro flavor: ${{ matrix.flavor }} + - name: Store per-flow test state + if: always() + uses: actions/upload-artifact@v6 + with: + name: e2e_android_rntester_state_${{ matrix.flavor }}_x86_NewArch + overwrite: true + if-no-files-found: warn + path: /tmp/maestro-android-state/results.json - name: Report status id: report-status if: ${{ always() && steps.run-tests.outcome == 'failure' }} diff --git a/.github/workflows/e2e-android-templateapp.yml b/.github/workflows/e2e-android-templateapp.yml index 2e44d858843b..f7b010114bfc 100644 --- a/.github/workflows/e2e-android-templateapp.yml +++ b/.github/workflows/e2e-android-templateapp.yml @@ -9,14 +9,17 @@ on: fail-on-error: type: boolean default: false + retry-attempt: + type: number + default: 0 outputs: status: - description: "The result of the E2E tests (success or failure)" + description: 'The result of the E2E tests (success or failure)' value: ${{ jobs.report.outputs.status }} jobs: test: - runs-on: ubuntu-latest + runs-on: 4-core-ubuntu outputs: status: ${{ steps.report-status.outputs.status }} strategy: @@ -73,11 +76,29 @@ jobs: CAPITALIZED_FLAVOR=$(echo "${{ matrix.flavor }}" | awk '{print toupper(substr($0, 1, 1)) substr($0, 2)}') ./gradlew assemble$CAPITALIZED_FLAVOR --no-daemon -PreactNativeArchitectures=x86 + - name: Download previous per-flow test state + if: ${{ inputs.retry-attempt > 0 }} + continue-on-error: true + uses: actions/download-artifact@v7 + with: + name: e2e_android_templateapp_state_${{ matrix.flavor }}_x86_NewArch + path: /tmp/maestro-android-state + - name: Check for unfinished E2E flows + id: test-state + shell: bash + run: | + SHOULD_RUN=true + if [[ -f /tmp/maestro-android-state/results.json ]] && \ + jq -e '(.flows | length > 0) and all(.flows[]; .status == "passed")' /tmp/maestro-android-state/results.json > /dev/null; then + SHOULD_RUN=false + fi + echo "should-run=$SHOULD_RUN" >> "$GITHUB_OUTPUT" - name: Run E2E Tests id: run-tests + if: steps.test-state.outputs.should-run == 'true' continue-on-error: true uses: ./.github/actions/maestro-android - timeout-minutes: 60 + timeout-minutes: 90 with: app-path: /tmp/RNTestProject/android/app/build/outputs/apk/${{ matrix.flavor }}/app-${{ matrix.flavor }}.apk app-id: com.rntestproject @@ -85,6 +106,14 @@ jobs: install-java: 'false' flavor: ${{ matrix.flavor }} working-directory: /tmp/RNTestProject + - name: Store per-flow test state + if: always() + uses: actions/upload-artifact@v6 + with: + name: e2e_android_templateapp_state_${{ matrix.flavor }}_x86_NewArch + overwrite: true + if-no-files-found: warn + path: /tmp/maestro-android-state/results.json - name: Report status id: report-status if: ${{ always() && steps.run-tests.outcome == 'failure' }} diff --git a/.github/workflows/e2e-ios-rntester.yml b/.github/workflows/e2e-ios-rntester.yml index 941711c111e9..f7ec8894d3d9 100644 --- a/.github/workflows/e2e-ios-rntester.yml +++ b/.github/workflows/e2e-ios-rntester.yml @@ -11,12 +11,12 @@ on: default: false outputs: status: - description: "The result of the E2E tests (success or failure)" + description: 'The result of the E2E tests (success or failure)' value: ${{ jobs.report.outputs.status }} jobs: test: - runs-on: macos-15-large + runs-on: macos-26-large outputs: status: ${{ steps.report-status.outputs.status }} strategy: @@ -35,14 +35,12 @@ jobs: path: /tmp/RNTesterBuild/RNTester.app - name: Check downloaded folder content run: ls -lR /tmp/RNTesterBuild - - name: Setup xcode - uses: ./.github/actions/setup-xcode - name: Run E2E Tests id: run-tests continue-on-error: true uses: ./.github/actions/maestro-ios with: - app-path: "/tmp/RNTesterBuild/RNTester.app" + app-path: '/tmp/RNTesterBuild/RNTester.app' app-id: com.meta.RNTester.localDevelopment maestro-flow: ./packages/rn-tester/.maestro/ flavor: ${{ matrix.flavor }} diff --git a/.github/workflows/e2e-ios-templateapp.yml b/.github/workflows/e2e-ios-templateapp.yml index dd4761471ca7..20e5a9c5dff3 100644 --- a/.github/workflows/e2e-ios-templateapp.yml +++ b/.github/workflows/e2e-ios-templateapp.yml @@ -11,12 +11,12 @@ on: default: false outputs: status: - description: "The result of the E2E tests (success or failure)" + description: 'The result of the E2E tests (success or failure)' value: ${{ jobs.report.outputs.status }} jobs: test: - runs-on: macos-15-large + runs-on: macos-26-large outputs: status: ${{ steps.report-status.outputs.status }} strategy: @@ -26,8 +26,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v6 - - name: Setup xcode - uses: ./.github/actions/setup-xcode - name: Setup node.js uses: ./.github/actions/setup-node - name: Run yarn @@ -62,8 +60,8 @@ jobs: - name: Configure git shell: bash run: | - git config --global user.email "react-native-bot@meta.com" - git config --global user.name "React Native Bot" + git config --global user.email "react-native-bot@meta.com" + git config --global user.name "React Native Bot" - name: Prepare artifacts run: | REACT_NATIVE_PKG=$(find /tmp/react-native-tmp -type f -name "*.tgz") @@ -99,7 +97,7 @@ jobs: continue-on-error: true uses: ./.github/actions/maestro-ios with: - app-path: "/tmp/RNTestProject/Build/Products/${{ matrix.flavor }}-iphonesimulator/RNTestProject.app" + app-path: '/tmp/RNTestProject/Build/Products/${{ matrix.flavor }}-iphonesimulator/RNTestProject.app' app-id: org.reactjs.native.example.RNTestProject maestro-flow: ./scripts/e2e/.maestro/ flavor: ${{ matrix.flavor }} diff --git a/.github/workflows/fantom-tests.yml b/.github/workflows/fantom-tests.yml index e6443b4bf66d..82cdd462e6d3 100644 --- a/.github/workflows/fantom-tests.yml +++ b/.github/workflows/fantom-tests.yml @@ -11,18 +11,18 @@ on: default: false outputs: status: - description: "The result of the Fantom tests (success or failure)" + description: 'The result of the Fantom tests (success or failure)' value: ${{ jobs.report.outputs.status }} jobs: test: - runs-on: ubuntu-latest + runs-on: 8-core-ubuntu outputs: status: ${{ steps.report-status.outputs.status }} container: image: reactnativecommunity/react-native-android:latest env: - TERM: "dumb" + TERM: 'dumb' steps: - name: Checkout uses: actions/checkout@v6 diff --git a/.github/workflows/monitor-new-issues.yml b/.github/workflows/monitor-new-issues.yml index 858a60c2b7ba..476daf11880d 100644 --- a/.github/workflows/monitor-new-issues.yml +++ b/.github/workflows/monitor-new-issues.yml @@ -2,7 +2,7 @@ name: Monitor React Native New Issues on: schedule: - - cron: "0 0,6,12,18 * * *" + - cron: '0 0,6,12,18 * * *' workflow_dispatch: # Reminder for when we have to update the schedule (before Jan 2026): @@ -19,7 +19,7 @@ jobs: - name: Set up Node.js uses: ./.github/actions/setup-node - name: Install dependencies - uses: ./.github/actions/yarn-install + uses: ./.github/actions/yarn-install - name: Extract next oncall run: | ONCALLS=$(node ./.github/workflow-scripts/extractIssueOncalls.js "${{ secrets.ONCALL_SCHEDULE }}") @@ -30,12 +30,12 @@ jobs: - name: Monitor New Issues uses: react-native-community/repo-monitor@v1.0.1 with: - task: "monitor-issues" + task: 'monitor-issues' git_secret: ${{ secrets.GITHUB_TOKEN }} - notifier: "discord" + notifier: 'discord' fetch_data_interval: 6 - repo_owner: "react" - repo_name: "react-native" - discord_webhook_url: "${{ secrets.DISCORD_WEBHOOK_URL }}" - discord_id_type: "user" - discord_ids: "${{ env.oncall1 }},${{ env.oncall2 }}" + repo_owner: 'react' + repo_name: 'react-native' + discord_webhook_url: '${{ secrets.DISCORD_WEBHOOK_URL }}' + discord_id_type: 'user' + discord_ids: '${{ env.oncall1 }},${{ env.oncall2 }}' diff --git a/.github/workflows/needs-attention.yml b/.github/workflows/needs-attention.yml index aede3fa3562a..85ac9761d919 100644 --- a/.github/workflows/needs-attention.yml +++ b/.github/workflows/needs-attention.yml @@ -21,8 +21,8 @@ jobs: uses: react-native-community/needs-attention@v2.0.0 with: repo-token: ${{ secrets.GITHUB_TOKEN }} - response-required-label: "Needs: Author Feedback" - needs-attention-label: "Needs: Attention" + response-required-label: 'Needs: Author Feedback' + needs-attention-label: 'Needs: Attention' id: needs-attention - name: Result run: echo '${{ steps.needs-attention.outputs.result }}' diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml deleted file mode 100644 index 1eda5545a47e..000000000000 --- a/.github/workflows/nightly.yml +++ /dev/null @@ -1,90 +0,0 @@ -name: Nightly - -on: - workflow_dispatch: - # nightly build @ 2:15 AM UTC - schedule: - - cron: "15 2 * * *" - -permissions: - contents: read - -jobs: - set_release_type: - runs-on: ubuntu-latest - if: github.repository == 'react/react-native' - outputs: - RELEASE_TYPE: ${{ steps.set_release_type.outputs.RELEASE_TYPE }} - env: - EVENT_NAME: ${{ github.event_name }} - REF: ${{ github.ref }} - steps: - - id: set_release_type - run: | - echo "Setting release type to nightly" - echo "RELEASE_TYPE=nightly" >> $GITHUB_OUTPUT - - prebuild_apple_dependencies: - if: github.repository == 'react/react-native' - uses: ./.github/workflows/prebuild-ios-dependencies.yml - secrets: inherit - - prebuild_react_native_core: - uses: ./.github/workflows/prebuild-ios-core.yml - with: - use-hermes-prebuilt: true - version-type: nightly - secrets: inherit - needs: [prebuild_apple_dependencies] - - build_android: - runs-on: ubuntu-latest - if: github.repository == 'react/react-native' - needs: [set_release_type] - container: - image: reactnativecommunity/react-native-android:latest - env: - TERM: "dumb" - # Set the encoding to resolve a known character encoding issue with decompressing tar.gz files in containers - # via Gradle: https://github.com/gradle/gradle/issues/23391#issuecomment-1878979127 - LC_ALL: C.UTF8 - GRADLE_OPTS: "-Dorg.gradle.daemon=false" - ORG_GRADLE_PROJECT_SIGNING_PWD: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_PWD }} - ORG_GRADLE_PROJECT_SIGNING_KEY: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_KEY }} - ORG_GRADLE_PROJECT_SONATYPE_USERNAME: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPE_USERNAME }} - ORG_GRADLE_PROJECT_SONATYPE_PASSWORD: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPE_PASSWORD }} - REACT_NATIVE_DOWNLOADS_DIR: /opt/react-native-downloads - steps: - - name: Checkout - uses: actions/checkout@v6 - - name: Build Android - uses: ./.github/actions/build-android - with: - release-type: ${{ needs.set_release_type.outputs.RELEASE_TYPE }} - gradle-cache-encryption-key: ${{ secrets.GRADLE_CACHE_ENCRYPTION_KEY }} - - # Delegate the actual npm publish to the shared reusable workflow so - # every `npm publish` in this repo originates from one workflow file โ€” - # required because npm Trusted Publishing only accepts one - # (org, repo, workflow_filename) per package. - build_npm_package: - needs: - [ - set_release_type, - build_android, - prebuild_apple_dependencies, - prebuild_react_native_core, - ] - # The top-level `permissions: contents: read` is the ceiling for - # GITHUB_TOKEN in every job here, including reusable-workflow calls. - # Re-grant `id-token: write` at the job level so publish-npm.yml's - # `publish-react-native` job can mint the OIDC token that npm - # Trusted Publishing exchanges for a publish token. - permissions: - contents: read - id-token: write - uses: ./.github/workflows/publish-npm.yml - secrets: inherit - with: - mode: react-native - release-type: ${{ needs.set_release_type.outputs.RELEASE_TYPE }} diff --git a/.github/workflows/prebuild-ios-core.yml b/.github/workflows/prebuild-ios-core.yml index 5e218f2a7f9c..9c6bad03a434 100644 --- a/.github/workflows/prebuild-ios-core.yml +++ b/.github/workflows/prebuild-ios-core.yml @@ -21,11 +21,7 @@ jobs: fail-fast: false matrix: flavor: ['Debug', 'Release'] - slice: [ - 'ios', - 'ios-simulator', - 'mac-catalyst', - ] + slice: ['ios', 'ios-simulator', 'mac-catalyst'] steps: - name: Checkout uses: actions/checkout@v6 @@ -103,8 +99,7 @@ jobs: uses: actions/upload-artifact@v6 with: name: prebuild-ios-core-headers-${{ matrix.flavor }}-${{ matrix.slice }} - path: - packages/react-native/.build/headers + path: packages/react-native/.build/headers - name: Upload artifacts uses: actions/upload-artifact@v6 with: @@ -138,7 +133,7 @@ jobs: uses: actions/cache/restore@v5 with: path: packages/react-native/.build/output/xcframeworks - key: v2-ios-core-xcframework-${{ matrix.flavor }}-${{ hashFiles('packages/react-native/Package.swift', 'packages/react-native/scripts/ios-prebuild/*.js', 'packages/react-native/scripts/ios-prebuild.js', 'packages/react-native/React/**/*', 'packages/react-native/ReactCommon/**/*', 'packages/react-native/Libraries/**/*') }} + key: v4-ios-core-xcframework-${{ matrix.flavor }}-${{ hashFiles('packages/react-native/Package.swift', 'packages/react-native/scripts/ios-prebuild/*.js', 'packages/react-native/scripts/ios-prebuild.js', 'packages/react-native/React/**/*', 'packages/react-native/ReactCommon/**/*', 'packages/react-native/Libraries/**/*') }} - name: Setup node.js if: steps.restore-ios-xcframework.outputs.cache-hit != 'true' uses: ./.github/actions/setup-node @@ -162,6 +157,45 @@ jobs: pattern: prebuild-ios-core-headers-${{ matrix.flavor }}-* path: packages/react-native/.build/headers merge-multiple: true + - name: Download ReactNativeDependencies + if: steps.restore-ios-xcframework.outputs.cache-hit != 'true' + uses: actions/download-artifact@v7 + with: + name: ReactNativeDependencies${{ matrix.flavor }}.xcframework.tar.gz + path: /tmp/third-party/ + - name: Extract ReactNativeDependencies + if: steps.restore-ios-xcframework.outputs.cache-hit != 'true' + shell: bash + run: | + # ReactNativeHeaders.xcframework is pure-RN (the deps namespaces ship + # in the ReactNativeDependenciesHeaders sidecar built by the deps + # prebuild), but the headers-verify compile gates still need the deps + # headers on their include path (folly/glog/... reached from RN's + # public headers), so the deps artifact is staged here too. + tar -xzf /tmp/third-party/ReactNativeDependencies${{ matrix.flavor }}.xcframework.tar.gz -C /tmp/third-party/ + mkdir -p packages/react-native/third-party/ + mv /tmp/third-party/packages/react-native/third-party/ReactNativeDependencies.xcframework packages/react-native/third-party/ReactNativeDependencies.xcframework + - name: Set Hermes version + if: steps.restore-ios-xcframework.outputs.cache-hit != 'true' + shell: bash + run: | + # Non-stable RN builds resolve Hermes from npm's latest-v1 dist-tag. + # TODO: rename 'latest-v1' to 'latest' once V1 is the only Hermes on npm. + # Stable builds use the version pinned in version.properties. + if [ "${{ inputs.use-hermes-prebuilt }}" == "true" ]; then + HERMES_VERSION="latest-v1" + else + HERMES_VERSION=$(sed -n 's/^HERMES_VERSION_NAME=//p' packages/react-native/sdks/hermes-engine/version.properties) + fi + echo "Using Hermes version: $HERMES_VERSION" + echo "HERMES_VERSION=$HERMES_VERSION" >> $GITHUB_ENV + - name: Stage Hermes headers + if: steps.restore-ios-xcframework.outputs.cache-hit != 'true' + working-directory: packages/react-native + env: + FLAVOR: ${{ matrix.flavor }} + run: | + node -e "require('./scripts/ios-prebuild/hermes').prepareHermesArtifactsAsync(require('./package.json').version, process.env.FLAVOR).then(()=>process.exit(0)).catch(e=>{console.error(e);process.exit(1)})" - name: Setup Keychain if: ${{ steps.restore-ios-xcframework.outputs.cache-hit != 'true' && env.REACT_ORG_CODE_SIGNING_P12_CERT != '' }} uses: apple-actions/import-codesign-certs@v3 # https://github.com/marketplace/actions/import-code-signing-certificates @@ -172,22 +206,44 @@ jobs: if: ${{ steps.restore-ios-xcframework.outputs.cache-hit != 'true' && env.REACT_ORG_CODE_SIGNING_P12_CERT == '' }} run: | cd packages/react-native - node scripts/ios-prebuild -c -f "${{ matrix.flavor }}" + node scripts/ios-prebuild -c -f "${{ matrix.flavor }}" ${{ inputs.version-type != '' && '--require-hermes' || '' }} - name: Create and Sign XCFramework if: ${{ steps.restore-ios-xcframework.outputs.cache-hit != 'true' && env.REACT_ORG_CODE_SIGNING_P12_CERT != '' }} run: | cd packages/react-native - node scripts/ios-prebuild -c -f "${{ matrix.flavor }}" -i "React Org" + node scripts/ios-prebuild -c -f "${{ matrix.flavor }}" -i "React Org" ${{ inputs.version-type != '' && '--require-hermes' || '' }} + - name: Verify composed headers + if: steps.restore-ios-xcframework.outputs.cache-hit != 'true' + run: | + # Generator-time header gate: include-health ratchet, structural + # byte-compare of module maps/umbrellas against the spec render, and + # compile smokes (React module + every namespace module + the + # privileged-consumer/Expo fixtures). Catches consumer-facing header + # regressions here instead of in downstream builds. + cd packages/react-native + node scripts/ios-prebuild/headers-verify.js --flavor "${{ matrix.flavor }}" ${{ inputs.version-type != '' && '--require-stamped-version' || '' }} - name: Compress and Rename XCFramework if: steps.restore-ios-xcframework.outputs.cache-hit != 'true' run: | cd packages/react-native/.build/output/xcframeworks/${{matrix.flavor}} - tar -cz -f ../ReactCore${{matrix.flavor}}.xcframework.tar.gz React.xcframework + # Ship BOTH xcframeworks: React-Core-prebuilt's prepare_command flattens + # ReactNativeHeaders.xcframework's Headers (incl. module.modulemap) into the + # pod. Omitting it leaves consumers without React-Core-prebuilt/Headers/module.modulemap. + tar -cz -f ../ReactCore${{matrix.flavor}}.xcframework.tar.gz React.xcframework ReactNativeHeaders.xcframework - name: Compress and Rename dSYM if: steps.restore-ios-xcframework.outputs.cache-hit != 'true' run: | cd packages/react-native/.build/output/xcframeworks/${{matrix.flavor}}/Symbols tar -cz -f ../../ReactCore${{ matrix.flavor }}.framework.dSYM.tar.gz . + - name: Rename ReactNativeHeaders XCFramework tarball + if: steps.restore-ios-xcframework.outputs.cache-hit != 'true' + run: | + # The compose step already tars ReactNativeHeaders.xcframework standalone; + # published as its own Maven artifact (classifier reactnative-headers-*) + # so SwiftPM consumers can wire it as a separate binaryTarget. It also + # ships inside the ReactCore tarball for the CocoaPods pod. + cp packages/react-native/.build/output/xcframeworks/${{matrix.flavor}}/ReactNativeHeaders.xcframework.tar.gz \ + packages/react-native/.build/output/xcframeworks/ReactNativeHeaders${{matrix.flavor}}.xcframework.tar.gz - name: Upload XCFramework Artifact uses: actions/upload-artifact@v6 with: @@ -198,6 +254,11 @@ jobs: with: name: ReactCore${{ matrix.flavor }}.framework.dSYM.tar.gz path: packages/react-native/.build/output/xcframeworks/ReactCore${{matrix.flavor}}.framework.dSYM.tar.gz + - name: Upload ReactNativeHeaders XCFramework Artifact + uses: actions/upload-artifact@v6 + with: + name: ReactNativeHeaders${{ matrix.flavor }}.xcframework.tar.gz + path: packages/react-native/.build/output/xcframeworks/ReactNativeHeaders${{matrix.flavor}}.xcframework.tar.gz - name: Save cache if present if: ${{ github.ref == 'refs/heads/main' }} # To avoid that the cache explode uses: actions/cache/save@v5 @@ -205,4 +266,5 @@ jobs: path: | packages/react-native/.build/output/xcframeworks/ReactCore${{matrix.flavor}}.xcframework.tar.gz packages/react-native/.build/output/xcframeworks/ReactCore${{matrix.flavor}}.framework.dSYM.tar.gz - key: v2-ios-core-xcframework-${{ matrix.flavor }}-${{ hashFiles('packages/react-native/Package.swift', 'packages/react-native/scripts/ios-prebuild/*.js', 'packages/react-native/scripts/ios-prebuild.js', 'packages/react-native/React/**/*', 'packages/react-native/ReactCommon/**/*', 'packages/react-native/Libraries/**/*') }} + packages/react-native/.build/output/xcframeworks/ReactNativeHeaders${{matrix.flavor}}.xcframework.tar.gz + key: v4-ios-core-xcframework-${{ matrix.flavor }}-${{ hashFiles('packages/react-native/Package.swift', 'packages/react-native/scripts/ios-prebuild/*.js', 'packages/react-native/scripts/ios-prebuild.js', 'packages/react-native/React/**/*', 'packages/react-native/ReactCommon/**/*', 'packages/react-native/Libraries/**/*') }} diff --git a/.github/workflows/prebuild-ios-dependencies.yml b/.github/workflows/prebuild-ios-dependencies.yml index 73cf9870c66c..b34fcf203eb7 100644 --- a/.github/workflows/prebuild-ios-dependencies.yml +++ b/.github/workflows/prebuild-ios-dependencies.yml @@ -3,7 +3,6 @@ name: Prebuild iOS Dependencies on: workflow_call: # this directive allow us to call this workflow from other workflows - jobs: prepare_workspace: name: Prepare workspace @@ -52,14 +51,17 @@ jobs: fail-fast: false matrix: flavor: ['Debug', 'Release'] - slice: ['ios', - 'ios-simulator', - 'macos', - 'mac-catalyst', - 'tvos', - 'tvos-simulator', - 'xros', - 'xros-simulator'] + slice: + [ + 'ios', + 'ios-simulator', + 'macos', + 'mac-catalyst', + 'tvos', + 'tvos-simulator', + 'xros', + 'xros-simulator', + ] steps: - name: Checkout uses: actions/checkout@v6 @@ -88,7 +90,7 @@ jobs: run: ls -lR packages/react-native/third-party - name: Build slice ${{ matrix.slice }} for ${{ matrix.flavor }} if: steps.restore-slice-folder.outputs.cache-hit != 'true' - run: node scripts/releases/prepare-ios-prebuilds.js -b -p ${{ matrix.slice }} -r ${{ matrix.flavor }} + run: node scripts/releases/prepare-ios-prebuilds.js -b -p ${{ matrix.slice }} -r ${{ matrix.flavor }} - name: Upload Artifacts uses: actions/upload-artifact@v6 with: @@ -128,7 +130,7 @@ jobs: with: path: | packages/react-native/third-party/ - key: v3-ios-dependencies-xcframework-${{ matrix.flavor }}-${{ hashfiles('scripts/releases/ios-prebuild/configuration.js') }} + key: v5-ios-dependencies-xcframework-${{ matrix.flavor }}-${{ hashfiles('scripts/releases/ios-prebuild/configuration.js', 'scripts/releases/ios-prebuild/compose-framework.js', 'packages/react-native/scripts/ios-prebuild/headers-xcframework.js', 'packages/react-native/scripts/ios-prebuild/headers-spec.js') }} # If cache hit, we already have our binary. We don't need to do anything. - name: Yarn Install if: steps.restore-xcframework.outputs.cache-hit != 'true' @@ -162,7 +164,13 @@ jobs: if: steps.restore-xcframework.outputs.cache-hit != 'true' run: | tar -cz -f packages/react-native/third-party/ReactNativeDependencies${{ matrix.flavor }}.xcframework.tar.gz \ - packages/react-native/third-party/ReactNativeDependencies.xcframework + packages/react-native/third-party/ReactNativeDependencies.xcframework \ + packages/react-native/third-party/ReactNativeDependenciesHeaders.xcframework + - name: Compress Headers Sidecar XCFramework + if: steps.restore-xcframework.outputs.cache-hit != 'true' + run: | + tar -cz -f packages/react-native/third-party/ReactNativeDependenciesHeaders${{ matrix.flavor }}.xcframework.tar.gz \ + packages/react-native/third-party/ReactNativeDependenciesHeaders.xcframework - name: Show Symbol folder content if: steps.restore-xcframework.outputs.cache-hit != 'true' run: ls -lR packages/react-native/third-party/Symbols @@ -177,6 +185,11 @@ jobs: with: name: ReactNativeDependencies${{ matrix.flavor }}.xcframework.tar.gz path: packages/react-native/third-party/ReactNativeDependencies${{ matrix.flavor }}.xcframework.tar.gz + - name: Upload Headers Sidecar XCFramework Artifact + uses: actions/upload-artifact@v6 + with: + name: ReactNativeDependenciesHeaders${{ matrix.flavor }}.xcframework.tar.gz + path: packages/react-native/third-party/ReactNativeDependenciesHeaders${{ matrix.flavor }}.xcframework.tar.gz - name: Upload dSYM Artifact uses: actions/upload-artifact@v6 with: @@ -189,5 +202,6 @@ jobs: with: path: | packages/react-native/third-party/ReactNativeDependencies${{ matrix.flavor }}.xcframework.tar.gz + packages/react-native/third-party/ReactNativeDependenciesHeaders${{ matrix.flavor }}.xcframework.tar.gz packages/react-native/third-party/ReactNativeDependencies${{ matrix.flavor }}.framework.dSYM.tar.gz - key: v3-ios-dependencies-xcframework-${{ matrix.flavor }}-${{ hashfiles('scripts/releases/ios-prebuild/configuration.js') }} + key: v5-ios-dependencies-xcframework-${{ matrix.flavor }}-${{ hashfiles('scripts/releases/ios-prebuild/configuration.js', 'scripts/releases/ios-prebuild/compose-framework.js', 'packages/react-native/scripts/ios-prebuild/headers-xcframework.js', 'packages/react-native/scripts/ios-prebuild/headers-spec.js') }} diff --git a/.github/workflows/publish-bumped-packages.yml b/.github/workflows/publish-bumped-packages.yml deleted file mode 100644 index 198f1d77749d..000000000000 --- a/.github/workflows/publish-bumped-packages.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Publish Bumped Packages - -on: - push: - branches: - - "main" - - "*-stable" - -jobs: - # Delegate to the shared reusable workflow so every `npm publish` in - # this repo originates from one workflow file โ€” required because npm - # Trusted Publishing only accepts one (org, repo, workflow_filename) - # per package. - publish_bumped_packages: - if: github.repository == 'react/react-native' - uses: ./.github/workflows/publish-npm.yml - secrets: inherit - with: - mode: monorepo-packages diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml index 62ac1e1db1b1..a3e097774b32 100644 --- a/.github/workflows/publish-npm.yml +++ b/.github/workflows/publish-npm.yml @@ -1,47 +1,146 @@ -# Reusable workflow that performs every `npm publish` in this repo. +# Single top-level workflow for every npm publish in this repo. # -# Why this exists: npmjs.com Trusted Publishing accepts only ONE -# (org, repo, workflow_filename, environment) tuple per package. If -# `react-native` were published from `publish-release.yml` AND -# `nightly.yml` directly, we'd need two Trusted Publisher entries per -# package โ€” npm rejects that. By moving every `npm publish` into this -# single reusable workflow file, the OIDC `job_workflow_ref` claim -# always resolves to `publish-npm.yml` regardless of which top-level -# workflow triggered the run, so each package needs exactly one -# Trusted Publisher entry pointing here. +# Why: npmjs.com Trusted Publishing matches the `workflow_ref` OIDC claim, +# which is always the TOP-LEVEL workflow filename. npm allows only ONE +# trusted publisher per package, so every `npm publish` must originate +# from the same top-level file. By consolidating all publish triggers +# here, the OIDC claim is always `publish-npm.yml`. # -# See https://docs.npmjs.com/trusted-publishers and -# https://docs.github.com/en/actions/sharing-automations/reusing-workflows . -name: Publish to npm (reusable) +# This replaces the previous separate entry points: +# - publish-release.yml (tag push) โ†’ mode=release +# - nightly.yml (cron/dispatch) โ†’ mode=nightly +# - publish-bumped-packages.yml (main/stable branch push) โ†’ mode=bumped-packages +# +# See https://docs.npmjs.com/trusted-publishers +name: Publish to npm on: - workflow_call: - inputs: - mode: - description: | - 'react-native' runs the full Android/iOS-prebuilt + JS build - and publishes via scripts/releases-ci/publish-npm.js (which - publishes `react-native` and, in nightly mode, every - @react-native/* package). 'monorepo-packages' runs only the - JS build and publishes via - scripts/releases-ci/publish-updated-packages.js (delta-based, - gated on a #publish-packages-to-npm commit message). - type: string - required: true - release-type: - description: "For mode=react-native: release | nightly | dry-run." - type: string - required: false - default: "dry-run" - skip-apple-prebuilts: - description: "For mode=react-native: skip downloading prebuilt Apple artifacts." - type: boolean - required: false - default: false + push: + tags: + - 'v0.*.*' # This should match v0.X.Y + - 'v0.*.*-rc.*' # This should match v0.X.Y-RC.0 + branches: + - 'main' + - '*-stable' + workflow_dispatch: + # nightly build @ 2:15 AM UTC + schedule: + - cron: '15 2 * * *' + +permissions: + contents: read + +env: + # Stable across partial reruns so later jobs can find the repository created by build_android. + ORG_GRADLE_PROJECT_SONATYPE_REPOSITORY_DESCRIPTION: 'react-native:${{ github.ref_name }}:github-run-${{ github.run_id }}' jobs: - publish-react-native: - if: inputs.mode == 'react-native' + # โ”€โ”€โ”€ Determine what kind of publish this is โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ + determine_mode: + runs-on: ubuntu-latest + if: github.repository == 'react/react-native' + outputs: + mode: ${{ steps.mode.outputs.mode }} + release-type: ${{ steps.mode.outputs.release-type }} + steps: + - id: mode + run: | + if [[ "${{ github.ref_type }}" == "tag" ]]; then + echo "mode=release" >> $GITHUB_OUTPUT + echo "release-type=release" >> $GITHUB_OUTPUT + elif [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then + echo "mode=nightly" >> $GITHUB_OUTPUT + echo "release-type=nightly" >> $GITHUB_OUTPUT + elif [[ "${{ github.event_name }}" == "push" ]]; then + echo "mode=bumped-packages" >> $GITHUB_OUTPUT + echo "release-type=" >> $GITHUB_OUTPUT + fi + - run: | + echo "Mode: ${{ steps.mode.outputs.mode }}" + echo "Release type: ${{ steps.mode.outputs.release-type }}" + + # โ”€โ”€โ”€ Release-only: extract Hermes version for draft release โ”€โ”€โ”€โ”€โ”€โ”€ + set_hermes_version: + runs-on: ubuntu-latest + if: github.ref_type == 'tag' + outputs: + HERMES_VERSION: ${{ steps.set_hermes_version.outputs.HERMES_VERSION }} + steps: + - name: Checkout + uses: actions/checkout@v6 + - id: set_hermes_version + run: | + hermes_version=$(grep -oE 'HERMES_VERSION_NAME=([0-9]+\.[0-9]+\.[0-9]+)' packages/react-native/sdks/hermes-engine/version.properties | cut -d'=' -f2) + echo "HERMES_VERSION=$hermes_version" >> $GITHUB_OUTPUT + echo "HERMES_VERSION=$hermes_version" + + # โ”€โ”€โ”€ Apple prebuilds (release + nightly) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ + prebuild_apple_dependencies: + needs: [determine_mode] + if: needs.determine_mode.outputs.mode == 'release' || needs.determine_mode.outputs.mode == 'nightly' + uses: ./.github/workflows/prebuild-ios-dependencies.yml + secrets: inherit + + prebuild_react_native_core: + needs: [determine_mode, prebuild_apple_dependencies] + if: needs.determine_mode.outputs.mode == 'release' || needs.determine_mode.outputs.mode == 'nightly' + uses: ./.github/workflows/prebuild-ios-core.yml + secrets: inherit + with: + use-hermes-prebuilt: ${{ needs.determine_mode.outputs.mode == 'nightly' }} + version-type: ${{ needs.determine_mode.outputs.mode == 'nightly' && 'nightly' || '' }} + + # โ”€โ”€โ”€ Android build (release + nightly) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ + build_android: + needs: [determine_mode] + if: needs.determine_mode.outputs.mode == 'release' || needs.determine_mode.outputs.mode == 'nightly' + runs-on: ubuntu-latest + container: + image: reactnativecommunity/react-native-android:latest + env: + TERM: 'dumb' + # Set the encoding to resolve a known character encoding issue with decompressing tar.gz files in containers + # via Gradle: https://github.com/gradle/gradle/issues/23391#issuecomment-1878979127 + LC_ALL: C.UTF8 + GRADLE_OPTS: '-Dorg.gradle.daemon=false' + ORG_GRADLE_PROJECT_SIGNING_PWD: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_PWD }} + ORG_GRADLE_PROJECT_SIGNING_KEY: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_KEY }} + ORG_GRADLE_PROJECT_SONATYPE_USERNAME: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPE_USERNAME }} + ORG_GRADLE_PROJECT_SONATYPE_PASSWORD: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPE_PASSWORD }} + REACT_NATIVE_DOWNLOADS_DIR: /opt/react-native-downloads + steps: + - name: Checkout + uses: actions/checkout@v6 + - name: Setup node.js for staging cleanup + if: needs.determine_mode.outputs.mode == 'release' + uses: ./.github/actions/setup-node + - name: Drop stale Android staging repository + if: needs.determine_mode.outputs.mode == 'release' + run: node ./scripts/releases-ci/cleanup-maven-staging-repositories.js + - name: Build Android + uses: ./.github/actions/build-android + with: + release-type: ${{ needs.determine_mode.outputs.release-type }} + gradle-cache-encryption-key: ${{ secrets.GRADLE_CACHE_ENCRYPTION_KEY }} + + # โ”€โ”€โ”€ Build + Publish: react-native + all @react-native/* packages + # (release and nightly modes) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ + publish_react_native: + needs: + [ + determine_mode, + build_android, + prebuild_apple_dependencies, + prebuild_react_native_core, + ] + # Use always() so the explicit status checks below control the gating. + if: | + always() && + (needs.determine_mode.outputs.mode == 'release' || needs.determine_mode.outputs.mode == 'nightly') && + needs.determine_mode.result == 'success' && + needs.build_android.result == 'success' && + needs.prebuild_apple_dependencies.result == 'success' && + needs.prebuild_react_native_core.result == 'success' runs-on: ubuntu-latest environment: npm-publish # `id-token: write` is required so the npm CLI can mint the OIDC @@ -52,13 +151,13 @@ jobs: container: image: reactnativecommunity/react-native-android:latest env: - TERM: "dumb" + TERM: 'dumb' # Set the encoding to resolve a known character encoding issue with decompressing tar.gz files in containers # via Gradle: https://github.com/gradle/gradle/issues/23391#issuecomment-1878979127 LC_ALL: C.UTF8 - GRADLE_OPTS: "-Dorg.gradle.daemon=false" + GRADLE_OPTS: '-Dorg.gradle.daemon=false' # By default we only build ARM64 to save time/resources. For release/nightlies, we override this value to build all archs. - ORG_GRADLE_PROJECT_reactNativeArchitectures: "arm64-v8a" + ORG_GRADLE_PROJECT_reactNativeArchitectures: 'arm64-v8a' REACT_NATIVE_DOWNLOADS_DIR: /opt/react-native-downloads env: ORG_GRADLE_PROJECT_SIGNING_PWD: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_PWD }} @@ -71,34 +170,42 @@ jobs: with: fetch-depth: 0 fetch-tags: true - # TEMPORARY DEBUG: print the OIDC token claims npm Trusted Publishing - # matches against. A 404 from the OIDC exchange means these claims don't - # match the Trusted Publisher entry configured on npmjs.com (org/repo/ - # workflow filename / environment). Prints only the decoded claims, never - # the raw token. Remove once the 404 is resolved. - - name: Debug OIDC token claims - shell: bash - run: | - # ACTIONS_ID_TOKEN_REQUEST_TOKEN/_URL are auto-injected when the job - # has `id-token: write` - they are NOT secrets, don't map them in env. - OIDC_TOKEN=$(curl -sS -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \ - "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=npm:registry.npmjs.org" | jq -r '.value') - # Decode the JWT payload (middle segment); convert base64url -> base64 - # and pad so `base64 -d` accepts it. Prints claims only, not the token. - payload=$(echo "$OIDC_TOKEN" | cut -d'.' -f2 | tr '_-' '/+') - case $(( ${#payload} % 4 )) in 2) payload+='==';; 3) payload+='=';; esac - echo "$payload" | base64 -d 2>/dev/null | jq . - name: Build and Publish NPM Package uses: ./.github/actions/build-npm-package with: - release-type: ${{ inputs.release-type }} + release-type: ${{ needs.determine_mode.outputs.release-type }} gradle-cache-encryption-key: ${{ secrets.GRADLE_CACHE_ENCRYPTION_KEY }} - skip-apple-prebuilts: ${{ inputs.skip-apple-prebuilts && 'true' || 'false' }} - publish-monorepo-packages: - if: inputs.mode == 'monorepo-packages' + # โ”€โ”€โ”€ Release-only: remove an unclosed Android staging repository + # whenever the gated publish job does not complete successfully โ”€ + cleanup_android_staging_repository: + needs: [determine_mode, build_android, publish_react_native] + if: | + always() && + needs.determine_mode.result == 'success' && + needs.determine_mode.outputs.mode == 'release' && + needs.build_android.result != 'skipped' && + needs.publish_react_native.result != 'success' + runs-on: ubuntu-latest + env: + ORG_GRADLE_PROJECT_SONATYPE_USERNAME: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPE_USERNAME }} + ORG_GRADLE_PROJECT_SONATYPE_PASSWORD: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPE_PASSWORD }} + steps: + - name: Checkout + uses: actions/checkout@v6 + - name: Setup node.js + uses: ./.github/actions/setup-node + - name: Drop Android staging repository + run: node ./scripts/releases-ci/cleanup-maven-staging-repositories.js + + # โ”€โ”€โ”€ Publish bumped monorepo packages (main/stable push) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ + publish_bumped_packages: + needs: [determine_mode] + if: needs.determine_mode.outputs.mode == 'bumped-packages' runs-on: ubuntu-latest environment: npm-publish + # `id-token: write` is required so the npm CLI can mint the OIDC + # token that npm Trusted Publishing exchanges for a publish token. permissions: contents: read id-token: write @@ -108,24 +215,8 @@ jobs: - name: Setup node.js uses: ./.github/actions/setup-node with: - registry-url: "https://registry.npmjs.org" - # TEMPORARY DEBUG: print the OIDC token claims npm Trusted Publishing - # matches against. A 404 from the OIDC exchange means these claims don't - # match the Trusted Publisher entry configured on npmjs.com (org/repo/ - # workflow filename / environment). Prints only the decoded claims, never - # the raw token. Remove once the 404 is resolved. - - name: Debug OIDC token claims - shell: bash - run: | - # ACTIONS_ID_TOKEN_REQUEST_TOKEN/_URL are auto-injected when the job - # has `id-token: write` - they are NOT secrets, don't map them in env. - OIDC_TOKEN=$(curl -sS -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \ - "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=npm:registry.npmjs.org" | jq -r '.value') - # Decode the JWT payload (middle segment); convert base64url -> base64 - # and pad so `base64 -d` accepts it. Prints claims only, not the token. - payload=$(echo "$OIDC_TOKEN" | cut -d'.' -f2 | tr '_-' '/+') - case $(( ${#payload} % 4 )) in 2) payload+='==';; 3) payload+='=';; esac - echo "$payload" | base64 -d 2>/dev/null | jq . + node-version: '24' + registry-url: 'https://registry.npmjs.org' - name: Run Yarn Install uses: ./.github/actions/yarn-install - name: Build packages @@ -134,3 +225,107 @@ jobs: run: yarn build-types --skip-snapshot - name: Find and publish all bumped packages run: node ./scripts/releases-ci/publish-updated-packages.js + + # โ”€โ”€โ”€ Release-only: post-publish steps โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ + post_publish: + runs-on: ubuntu-latest + needs: [determine_mode, publish_react_native] + # Use always() so this job still runs in release mode even though some + # upstream jobs (e.g. build_android) are skipped and would otherwise + # poison the implicit success() gate. The explicit result checks below + # handle the real gating: only run for a successful release publish. + if: | + always() && + needs.determine_mode.result == 'success' && + needs.publish_react_native.result == 'success' && + needs.determine_mode.outputs.mode == 'release' + env: + REACT_NATIVE_BOT_GITHUB_TOKEN: ${{ secrets.REACT_NATIVE_BOT_GITHUB_TOKEN }} + steps: + - name: Checkout + uses: actions/checkout@v6 + with: + fetch-depth: 0 + fetch-tags: true + - name: Publish @react-native-community/template + id: publish-template-to-npm + uses: actions/github-script@v8 + with: + github-token: ${{ secrets.REACT_NATIVE_BOT_GITHUB_TOKEN }} + script: | + const {publishTemplate} = require('./.github/workflow-scripts/publishTemplate.js') + const version = "${{ github.ref_name }}" + const isDryRun = false + await publishTemplate(github, version, isDryRun); + - name: Wait for template to be published + timeout-minutes: 3 + uses: actions/github-script@v8 + with: + github-token: ${{ secrets.REACT_NATIVE_BOT_GITHUB_TOKEN }} + script: | + const {verifyPublishedTemplate, isLatest} = require('./.github/workflow-scripts/publishTemplate.js') + const version = "${{ github.ref_name }}" + await verifyPublishedTemplate(version, isLatest()); + - name: Update rn-diff-purge to generate upgrade-support diff + run: | + curl -X POST https://api.github.com/repos/react-native-community/rn-diff-purge/dispatches \ + -H "Accept: application/vnd.github.v3+json" \ + -H "Authorization: Bearer $REACT_NATIVE_BOT_GITHUB_TOKEN" \ + -d "{\"event_type\": \"publish\", \"client_payload\": { \"version\": \"${{ github.ref_name }}\" }}" + - name: Verify Release is on NPM + timeout-minutes: 3 + uses: actions/github-script@v8 + with: + github-token: ${{ secrets.REACT_NATIVE_BOT_GITHUB_TOKEN }} + script: | + const {verifyReleaseOnNpm} = require('./.github/workflow-scripts/verifyReleaseOnNpm.js'); + const {isLatest} = require('./.github/workflow-scripts/publishTemplate.js'); + const version = "${{ github.ref_name }}"; + await verifyReleaseOnNpm(version, isLatest()); + - name: Verify that artifacts are on Maven + uses: actions/github-script@v8 + with: + script: | + const {verifyArtifactsAreOnMaven} = require('./.github/workflow-scripts/verifyArtifactsAreOnMaven.js'); + const version = "${{ github.ref_name }}"; + await verifyArtifactsAreOnMaven(version); + + # โ”€โ”€โ”€ Release-only: changelog, podfile bump, draft release โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ + generate_changelog: + needs: [determine_mode, publish_react_native] + # always() + explicit result checks: run for a successful release publish + # even when skipped upstream jobs would trip the implicit success() gate. + if: | + always() && + needs.determine_mode.result == 'success' && + needs.publish_react_native.result == 'success' && + needs.determine_mode.outputs.mode == 'release' + uses: ./.github/workflows/generate-changelog.yml + secrets: inherit + + bump_podfile_lock: + needs: [determine_mode, publish_react_native] + # always() + explicit result checks: run for a successful release publish + # even when skipped upstream jobs would trip the implicit success() gate. + if: | + always() && + needs.determine_mode.result == 'success' && + needs.publish_react_native.result == 'success' && + needs.determine_mode.outputs.mode == 'release' + uses: ./.github/workflows/bump-podfile-lock.yml + secrets: inherit + + create_draft_release: + needs: [determine_mode, generate_changelog, set_hermes_version] + # always() + explicit result checks: run for a successful release even when + # skipped upstream jobs would trip the implicit success() gate. + if: | + always() && + needs.determine_mode.result == 'success' && + needs.generate_changelog.result == 'success' && + needs.set_hermes_version.result == 'success' && + needs.determine_mode.outputs.mode == 'release' + uses: ./.github/workflows/create-draft-release.yml + secrets: inherit + with: + hermesVersion: ${{ needs.set_hermes_version.outputs.HERMES_VERSION }} diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml deleted file mode 100644 index b896b89cfd7f..000000000000 --- a/.github/workflows/publish-release.yml +++ /dev/null @@ -1,132 +0,0 @@ -name: Publish Release -on: - push: - tags: - - "v0.*.*" # This should match v0.X.Y - - "v0.*.*-rc.*" # This should match v0.X.Y-RC.0 -jobs: - set_release_type: - runs-on: ubuntu-latest - if: github.repository == 'react/react-native' - outputs: - RELEASE_TYPE: ${{ steps.set_release_type.outputs.RELEASE_TYPE }} - env: - EVENT_NAME: ${{ github.event_name }} - REF: ${{ github.ref }} - steps: - - id: set_release_type - run: | - echo "Setting release type to release" - echo "RELEASE_TYPE=release" >> $GITHUB_OUTPUT - - set_hermes_version: - runs-on: ubuntu-latest - if: github.repository == 'react/react-native' - outputs: - HERMES_VERSION: ${{ steps.set_hermes_version.outputs.HERMES_VERSION }} - steps: - - name: Checkout - uses: actions/checkout@v6 - - id: set_hermes_version - run: | - hermes_version=$(grep -oE 'HERMES_VERSION_NAME=([0-9]+\.[0-9]+\.[0-9]+)' packages/react-native/sdks/hermes-engine/version.properties | cut -d'=' -f2) - echo "HERMES_VERSION=$hermes_version" >> $GITHUB_OUTPUT - echo "HERMES_VERSION=$hermes_version" - - prebuild_apple_dependencies: - if: github.repository == 'react/react-native' - uses: ./.github/workflows/prebuild-ios-dependencies.yml - secrets: inherit - - prebuild_react_native_core: - uses: ./.github/workflows/prebuild-ios-core.yml - secrets: inherit - needs: [prebuild_apple_dependencies] - - # Delegate the actual npm publish to the shared reusable workflow so - # every `npm publish` in this repo originates from one workflow file โ€” - # required because npm Trusted Publishing only accepts one - # (org, repo, workflow_filename) per package. - build_npm_package: - needs: - [ - set_release_type, - prebuild_apple_dependencies, - prebuild_react_native_core, - ] - uses: ./.github/workflows/publish-npm.yml - secrets: inherit - with: - mode: react-native - release-type: ${{ needs.set_release_type.outputs.RELEASE_TYPE }} - - post_publish: - runs-on: ubuntu-latest - needs: [build_npm_package] - env: - REACT_NATIVE_BOT_GITHUB_TOKEN: ${{ secrets.REACT_NATIVE_BOT_GITHUB_TOKEN }} - steps: - - name: Checkout - uses: actions/checkout@v6 - with: - fetch-depth: 0 - fetch-tags: true - - name: Publish @react-native-community/template - id: publish-template-to-npm - uses: actions/github-script@v8 - with: - github-token: ${{ secrets.REACT_NATIVE_BOT_GITHUB_TOKEN }} - script: | - const {publishTemplate} = require('./.github/workflow-scripts/publishTemplate.js') - const version = "${{ github.ref_name }}" - const isDryRun = false - await publishTemplate(github, version, isDryRun); - - name: Wait for template to be published - timeout-minutes: 3 - uses: actions/github-script@v8 - with: - github-token: ${{ secrets.REACT_NATIVE_BOT_GITHUB_TOKEN }} - script: | - const {verifyPublishedTemplate, isLatest} = require('./.github/workflow-scripts/publishTemplate.js') - const version = "${{ github.ref_name }}" - await verifyPublishedTemplate(version, isLatest()); - - name: Update rn-diff-purge to generate upgrade-support diff - run: | - curl -X POST https://api.github.com/repos/react-native-community/rn-diff-purge/dispatches \ - -H "Accept: application/vnd.github.v3+json" \ - -H "Authorization: Bearer $REACT_NATIVE_BOT_GITHUB_TOKEN" \ - -d "{\"event_type\": \"publish\", \"client_payload\": { \"version\": \"${{ github.ref_name }}\" }}" - - name: Verify Release is on NPM - timeout-minutes: 3 - uses: actions/github-script@v8 - with: - github-token: ${{ secrets.REACT_NATIVE_BOT_GITHUB_TOKEN }} - script: | - const {verifyReleaseOnNpm} = require('./.github/workflow-scripts/verifyReleaseOnNpm.js'); - const {isLatest} = require('./.github/workflow-scripts/publishTemplate.js'); - const version = "${{ github.ref_name }}"; - await verifyReleaseOnNpm(version, isLatest()); - - name: Verify that artifacts are on Maven - uses: actions/github-script@v8 - with: - script: | - const {verifyArtifactsAreOnMaven} = require('./.github/workflow-scripts/verifyArtifactsAreOnMaven.js'); - const version = "${{ github.ref_name }}"; - await verifyArtifactsAreOnMaven(version); - - generate_changelog: - needs: build_npm_package - uses: ./.github/workflows/generate-changelog.yml - secrets: inherit - - bump_podfile_lock: - needs: build_npm_package - uses: ./.github/workflows/bump-podfile-lock.yml - secrets: inherit - - create_draft_release: - needs: [generate_changelog, set_hermes_version] - uses: ./.github/workflows/create-draft-release.yml - secrets: inherit - with: - hermesVersion: ${{ needs.set_hermes_version.outputs.HERMES_VERSION }} diff --git a/.github/workflows/retry-workflow.yml b/.github/workflows/retry-workflow.yml index d3da630924d7..ea6c17329a05 100644 --- a/.github/workflows/retry-workflow.yml +++ b/.github/workflows/retry-workflow.yml @@ -2,19 +2,19 @@ name: Retry workflow # Based on https://stackoverflow.com/a/78314483 on: - workflow_dispatch: - inputs: - run_id: - required: true + workflow_dispatch: + inputs: + run_id: + required: true jobs: - rerun: - runs-on: ubuntu-latest - if: github.repository == 'react/react-native' - steps: - - name: rerun ${{ inputs.run_id }} - env: - GH_REPO: ${{ github.repository }} - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh run watch ${{ inputs.run_id }} > /dev/null 2>&1 - gh run rerun ${{ inputs.run_id }} --failed + rerun: + runs-on: ubuntu-latest + if: github.repository == 'react/react-native' + steps: + - name: rerun ${{ inputs.run_id }} + env: + GH_REPO: ${{ github.repository }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh run watch ${{ inputs.run_id }} > /dev/null 2>&1 + gh run rerun ${{ inputs.run_id }} --failed diff --git a/.github/workflows/stale-bot.yml b/.github/workflows/stale-bot.yml index de04b05601f1..ab7ada8c9c51 100644 --- a/.github/workflows/stale-bot.yml +++ b/.github/workflows/stale-bot.yml @@ -1,7 +1,7 @@ name: Stale bot on: schedule: - - cron: "*/10 5 * * *" + - cron: '*/10 5 * * *' jobs: stale: runs-on: ubuntu-latest @@ -54,8 +54,8 @@ jobs: stale-pr-message: "This PR is waiting for author's feedback since 24 days. Please provide the requested feedback or this will be closed in 7 days" close-issue-message: "This issue was closed because the author hasn't provided the requested feedback after 7 days." close-pr-message: "This PR was closed because the author hasn't provided the requested feedback after 7 days." - exempt-issue-labels: "Help Wanted :octocat:, Good first issue, Never gets stale, Issue: Author Provided Repro" - exempt-pr-labels: "Help Wanted :octocat:, Never gets stale" + exempt-issue-labels: 'Help Wanted :octocat:, Good first issue, Never gets stale, Issue: Author Provided Repro' + exempt-pr-labels: 'Help Wanted :octocat:, Never gets stale' stale-needs-author-feedback-asc: runs-on: ubuntu-latest if: github.repository == 'react/react-native' @@ -73,5 +73,5 @@ jobs: stale-pr-message: "This PR is waiting for author's feedback since 24 days. Please provide the requested feedback or this will be closed in 7 days" close-issue-message: "This issue was closed because the author hasn't provided the requested feedback after 7 days." close-pr-message: "This PR was closed because the author hasn't provided the requested feedback after 7 days." - exempt-issue-labels: "Help Wanted :octocat:, Good first issue, Never gets stale, Issue: Author Provided Repro" - exempt-pr-labels: "Help Wanted :octocat:, Never gets stale" + exempt-issue-labels: 'Help Wanted :octocat:, Good first issue, Never gets stale, Issue: Author Provided Repro' + exempt-pr-labels: 'Help Wanted :octocat:, Never gets stale' diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index 2815287602c6..d2c63d843967 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -6,7 +6,7 @@ on: push: branches: - main - - "*-stable" + - '*-stable' permissions: contents: read @@ -107,8 +107,7 @@ jobs: test_ios_rntester_ruby_3_2_0: runs-on: macos-15 - needs: - [prebuild_apple_dependencies, prebuild_react_native_core] + needs: [prebuild_apple_dependencies, prebuild_react_native_core] if: ${{ needs.prebuild_react_native_core.result == 'success' }} steps: - name: Checkout @@ -116,7 +115,7 @@ jobs: - name: Run it uses: ./.github/actions/test-ios-rntester with: - ruby-version: "3.2.0" + ruby-version: '3.2.0' flavor: Debug test_ios_rntester_dynamic_frameworks: @@ -141,8 +140,7 @@ jobs: test_ios_rntester: runs-on: macos-15-large - needs: - [prebuild_apple_dependencies, prebuild_react_native_core] + needs: [prebuild_apple_dependencies, prebuild_react_native_core] if: ${{ needs.prebuild_react_native_core.result == 'success' }} continue-on-error: true strategy: @@ -157,6 +155,12 @@ jobs: uses: ./.github/actions/test-ios-rntester with: use-frameworks: ${{ matrix.frameworks }} + # Consume the prebuilt artifacts in the dynamic-frameworks cells too: + # prebuilt + use_frameworks is the config of the 2026-07-03 + # SocketRocket dual-copy regression, previously covered by no lane + # (source-built dynamic frameworks stay covered by + # test_ios_rntester_dynamic_frameworks). + use-prebuilds: true flavor: ${{ matrix.flavor }} test_e2e_ios_rntester: @@ -199,6 +203,40 @@ jobs: fail-on-error: true secrets: inherit + test_ios_spm_rntester: + needs: + [ + prebuild_apple_dependencies, + prebuild_react_native_core, + check_code_changes, + ] + if: ${{ needs.prebuild_react_native_core.result == 'success' && needs.check_code_changes.outputs.should_test_ios == 'true' }} + uses: ./.github/workflows/test-ios-spm-rntester.yml + secrets: inherit + + test_ios_spm_helloworld: + needs: + [ + prebuild_apple_dependencies, + prebuild_react_native_core, + check_code_changes, + ] + if: ${{ needs.prebuild_react_native_core.result == 'success' && needs.check_code_changes.outputs.should_test_ios == 'true' }} + uses: ./.github/workflows/test-ios-spm-helloworld.yml + secrets: inherit + + test_ios_spm_newapp: + needs: + [ + build_npm_package, + prebuild_apple_dependencies, + prebuild_react_native_core, + check_code_changes, + ] + if: ${{ needs.prebuild_react_native_core.result == 'success' && needs.build_npm_package.result == 'success' && needs.check_code_changes.outputs.should_test_ios == 'true' }} + uses: ./.github/workflows/test-ios-spm-newapp.yml + secrets: inherit + test_e2e_android_templateapp: needs: [build_npm_package, build_android] if: ${{ always() && needs.build_android.result == 'success' && needs.build_npm_package.result == 'success' }} @@ -209,6 +247,8 @@ jobs: needs: test_e2e_android_templateapp if: ${{ always() && needs.test_e2e_android_templateapp.outputs.status == 'failure' }} uses: ./.github/workflows/e2e-android-templateapp.yml + with: + retry-attempt: 1 secrets: inherit test_e2e_android_templateapp_retry_2: @@ -217,10 +257,11 @@ jobs: uses: ./.github/workflows/e2e-android-templateapp.yml with: fail-on-error: true + retry-attempt: 2 secrets: inherit build_fantom_runner: - runs-on: ubuntu-latest + runs-on: 8-core-ubuntu needs: [set_release_type, check_code_changes, lint] if: needs.check_code_changes.outputs.any_code_change == 'true' container: @@ -229,8 +270,8 @@ jobs: # Set the encoding to resolve a known character encoding issue with decompressing tar.gz files in containers # via Gradle: https://github.com/gradle/gradle/issues/23391#issuecomment-1878979127 LC_ALL: C.UTF8 - TERM: "dumb" - GRADLE_OPTS: "-Dorg.gradle.daemon=false" + TERM: 'dumb' + GRADLE_OPTS: '-Dorg.gradle.daemon=false' ORG_GRADLE_PROJECT_SIGNING_PWD: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_PWD }} ORG_GRADLE_PROJECT_SIGNING_KEY: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_KEY }} REACT_NATIVE_DOWNLOADS_DIR: /opt/react-native-downloads @@ -263,7 +304,7 @@ jobs: secrets: inherit build_android: - runs-on: ubuntu-latest + runs-on: 8-core-ubuntu needs: [set_release_type, check_code_changes] if: | needs.check_code_changes.outputs.any_code_change == 'true' && @@ -274,8 +315,8 @@ jobs: # Set the encoding to resolve a known character encoding issue with decompressing tar.gz files in containers # via Gradle: https://github.com/gradle/gradle/issues/23391#issuecomment-1878979127 LC_ALL: C.UTF8 - TERM: "dumb" - GRADLE_OPTS: "-Dorg.gradle.daemon=false" + TERM: 'dumb' + GRADLE_OPTS: '-Dorg.gradle.daemon=false' ORG_GRADLE_PROJECT_SIGNING_PWD: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_PWD }} ORG_GRADLE_PROJECT_SIGNING_KEY: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_KEY }} REACT_NATIVE_DOWNLOADS_DIR: /opt/react-native-downloads @@ -298,6 +339,8 @@ jobs: needs: test_e2e_android_rntester if: ${{ always() && needs.test_e2e_android_rntester.outputs.status == 'failure' }} uses: ./.github/workflows/e2e-android-rntester.yml + with: + retry-attempt: 1 secrets: inherit test_e2e_android_rntester_retry_2: @@ -306,10 +349,11 @@ jobs: uses: ./.github/workflows/e2e-android-rntester.yml with: fail-on-error: true + retry-attempt: 2 secrets: inherit build_npm_package: - runs-on: ubuntu-latest + runs-on: 8-core-ubuntu needs: [ set_release_type, @@ -321,15 +365,18 @@ jobs: if: | always() && !contains(needs.*.result, 'failure') && - !contains(needs.*.result, 'cancelled') + !contains(needs.*.result, 'cancelled') && + (needs.build_android.result == 'success' || + needs.prebuild_apple_dependencies.result == 'success' || + needs.prebuild_react_native_core.result == 'success') container: image: reactnativecommunity/react-native-android:latest env: - TERM: "dumb" + TERM: 'dumb' # Set the encoding to resolve a known character encoding issue with decompressing tar.gz files in containers # via Gradle: https://github.com/gradle/gradle/issues/23391#issuecomment-1878979127 LC_ALL: C.UTF8 - GRADLE_OPTS: "-Dorg.gradle.daemon=false" + GRADLE_OPTS: '-Dorg.gradle.daemon=false' REACT_NATIVE_DOWNLOADS_DIR: /opt/react-native-downloads steps: - name: Checkout @@ -342,7 +389,7 @@ jobs: skip-apple-prebuilts: ${{ needs.check_code_changes.outputs.should_test_ios == 'false' }} test_android_helloworld: - runs-on: ubuntu-latest + runs-on: 4-core-ubuntu needs: [build_npm_package, build_android] if: ${{ always() && needs.build_android.result == 'success' && needs.build_npm_package.result == 'success' }} container: @@ -352,9 +399,9 @@ jobs: # via Gradle: https://github.com/gradle/gradle/issues/23391#issuecomment-1878979127 LC_ALL: C.UTF8 YARN_ENABLE_IMMUTABLE_INSTALLS: false - TERM: "dumb" - GRADLE_OPTS: "-Dorg.gradle.daemon=false" - TARGET_ARCHITECTURE: "arm64-v8a" + TERM: 'dumb' + GRADLE_OPTS: '-Dorg.gradle.daemon=false' + TARGET_ARCHITECTURE: 'arm64-v8a' REACT_NATIVE_DOWNLOADS_DIR: /opt/react-native-downloads continue-on-error: true strategy: @@ -455,9 +502,6 @@ jobs: uses: ./.github/actions/setup-node - name: Install dependencies uses: ./.github/actions/yarn-install - - name: Lint file structure - shell: bash - run: ./.github/workflow-scripts/lint_files.sh - name: Run shellcheck shell: bash run: ./.github/workflow-scripts/analyze_scripts.sh @@ -473,9 +517,9 @@ jobs: - name: Flow shell: bash run: yarn flow-check - - name: TypeScript + - name: TypeScript (legacy deep imports / manual types) shell: bash - run: yarn test-typescript + run: yarn test-typescript-legacy test_js: runs-on: ubuntu-latest @@ -484,7 +528,7 @@ jobs: strategy: fail-fast: false matrix: - node-version: ["24", "22.13.0"] + node-version: ['24', '22.13.0'] steps: - name: Checkout uses: actions/checkout@v6 @@ -512,7 +556,7 @@ jobs: run: yarn test-generated-typescript build_debugger_shell: - runs-on: ubuntu-latest + runs-on: macos-26 needs: check_code_changes if: needs.check_code_changes.outputs.debugger_shell == 'true' steps: diff --git a/.github/workflows/test-ios-spm-helloworld.yml b/.github/workflows/test-ios-spm-helloworld.yml new file mode 100644 index 000000000000..cf2f3cbc1e3f --- /dev/null +++ b/.github/workflows/test-ios-spm-helloworld.yml @@ -0,0 +1,137 @@ +name: Test iOS SwiftPM - Hello World + +permissions: + contents: read + +on: + workflow_call: + +jobs: + test: + runs-on: macos-15-large + strategy: + fail-fast: false + matrix: + flavor: [Debug, Release] + env: + APP_IOS_DIR: private/helloworld/ios + XCODE_PROJECT: HelloWorld.xcodeproj + XCODE_SCHEME: HelloWorld + steps: + - name: Checkout + uses: actions/checkout@v6 + - name: Setup xcode + uses: ./.github/actions/setup-xcode + - name: Setup node.js + uses: ./.github/actions/setup-node + - name: Run yarn install + uses: ./.github/actions/yarn-install + - name: Set Hermes prebuilt version + shell: bash + run: node ./scripts/releases/use-hermes-prebuilt.js + - name: Run yarn install again, with the correct hermes version + uses: ./.github/actions/yarn-install + - name: Ensure CocoaPods (`spm add --deintegrate` shells out to `pod`) + shell: bash + run: pod --version || sudo gem install cocoapods --no-document + # Both flavors are needed by every matrix cell, not just the one it builds: + # `spm add` stages both flavor framework trees and lets a per-configuration + # build setting pick one at build time, so it validates the debug/ and + # release/ artifact slots together (and `--download skip` refuses an + # incomplete slot). Please don't "optimise" this down to one flavor. + - name: Download ReactCore (Debug) + uses: actions/download-artifact@v7 + with: + name: ReactCoreDebug.xcframework.tar.gz + path: /tmp/rc-debug + - name: Download ReactCore (Release) + uses: actions/download-artifact@v7 + with: + name: ReactCoreRelease.xcframework.tar.gz + path: /tmp/rc-release + - name: Download ReactNativeDependencies (Debug) + uses: actions/download-artifact@v7 + with: + name: ReactNativeDependenciesDebug.xcframework.tar.gz + path: /tmp/deps-debug + - name: Download ReactNativeDependencies (Release) + uses: actions/download-artifact@v7 + with: + name: ReactNativeDependenciesRelease.xcframework.tar.gz + path: /tmp/deps-release + # The ordinary `spm download`, pointed at the XCFrameworks this run just + # built rather than at the published nightly (RN_CORE_TARBALL_PATH / + # RN_DEPS_TARBALL_PATH are overrides download-spm-artifacts.js already + # supports). It fills both flavor slots per call and skips any slot that + # already validates, so it runs twice: the first pass fills both slots + # from the Release tarballs, then debug/ is dropped and refilled from the + # Debug tarballs while release/ is left alone. hermes-engine is fetched + # from Maven by the command itself. + - name: Download XCFrameworks built in this run (Debug + Release) + shell: bash + working-directory: ${{ env.APP_IOS_DIR }} + run: | + RN_CORE_TARBALL_PATH=/tmp/rc-release/ReactCoreRelease.xcframework.tar.gz \ + RN_DEPS_TARBALL_PATH=/tmp/deps-release/ReactNativeDependenciesRelease.xcframework.tar.gz \ + npx react-native spm download --artifacts /tmp/spm-artifacts + rm -rf /tmp/spm-artifacts/debug + RN_CORE_TARBALL_PATH=/tmp/rc-debug/ReactCoreDebug.xcframework.tar.gz \ + RN_DEPS_TARBALL_PATH=/tmp/deps-debug/ReactNativeDependenciesDebug.xcframework.tar.gz \ + npx react-native spm download --artifacts /tmp/spm-artifacts + - name: Scaffold Package.swift manifests for community dependencies + shell: bash + working-directory: ${{ env.APP_IOS_DIR }} + run: npx react-native spm scaffold || true + - name: Convert the app to SwiftPM + shell: bash + working-directory: ${{ env.APP_IOS_DIR }} + run: npx react-native spm add --deintegrate --artifacts /tmp/spm-artifacts --download skip + - name: Assert the app is on SwiftPM + shell: bash + working-directory: ${{ env.APP_IOS_DIR }} + run: | + if [[ ! -f "$XCODE_PROJECT/.spm-injected.json" ]]; then + echo "::error::spm add did not inject SwiftPM: $XCODE_PROJECT/.spm-injected.json is missing" + exit 1 + fi + if [[ -f Podfile ]] && grep -q 'use_react_native!' Podfile; then + echo "::error::spm add --deintegrate left use_react_native! in the Podfile" + exit 1 + fi + echo "SwiftPM injected in place; Podfile de-integrated." + - name: Build ${{ env.XCODE_SCHEME }} (${{ matrix.flavor }}) + shell: bash + working-directory: ${{ env.APP_IOS_DIR }} + run: | + xcodebuild \ + -project "$XCODE_PROJECT" \ + -scheme "$XCODE_SCHEME" \ + -configuration "${{ matrix.flavor }}" \ + -sdk iphonesimulator \ + -destination 'generic/platform=iOS Simulator' \ + -derivedDataPath build/spm-e2e-dd \ + build + - name: Check the embedded React.framework flavor + shell: bash + working-directory: ${{ env.APP_IOS_DIR }} + run: | + PRODUCTS="build/spm-e2e-dd/Build/Products/${{ matrix.flavor }}-iphonesimulator" + if [[ ! -d "$PRODUCTS" ]]; then + echo "Skipping flavor check: no build products directory." + exit 0 + fi + BINARY=$(find "$PRODUCTS" -maxdepth 4 -path '*.app/Frameworks/React.framework/React' -type f 2>/dev/null | head -1 || true) + if [[ -z "$BINARY" ]] || ! command -v nm >/dev/null; then + echo "Skipping flavor check: no embedded React.framework binary or no nm." + exit 0 + fi + COUNT=$(nm "$BINARY" | grep -c getDebugProps || true) + echo "getDebugProps symbols in $BINARY: $COUNT" + if [[ "${{ matrix.flavor }}" == 'Debug' && "$COUNT" -eq 0 ]]; then + echo "::error::Debug build embeds a Release React.framework (expected getDebugProps symbols, found none)" + exit 1 + fi + if [[ "${{ matrix.flavor }}" == 'Release' && "$COUNT" -ne 0 ]]; then + echo "::error::Release build embeds a Debug React.framework ($COUNT getDebugProps symbols, expected none)" + exit 1 + fi diff --git a/.github/workflows/test-ios-spm-newapp.yml b/.github/workflows/test-ios-spm-newapp.yml new file mode 100644 index 000000000000..3fcceeb4c117 --- /dev/null +++ b/.github/workflows/test-ios-spm-newapp.yml @@ -0,0 +1,148 @@ +name: Test iOS SwiftPM - New App + +permissions: + contents: read + +on: + workflow_call: + +jobs: + test: + runs-on: macos-15-large + strategy: + fail-fast: false + matrix: + flavor: [Debug, Release] + env: + APP_IOS_DIR: private/helloworld/ios + XCODE_PROJECT: HelloWorld.xcodeproj + XCODE_SCHEME: HelloWorld + steps: + - name: Checkout + uses: actions/checkout@v6 + - name: Setup xcode + uses: ./.github/actions/setup-xcode + - name: Setup node.js + uses: ./.github/actions/setup-node + - name: Run yarn install + uses: ./.github/actions/yarn-install + - name: Set Hermes prebuilt version + shell: bash + run: node ./scripts/releases/use-hermes-prebuilt.js + - name: Run yarn install again, with the correct hermes version + uses: ./.github/actions/yarn-install + - name: Ensure CocoaPods (`spm add --deintegrate` shells out to `pod`) + shell: bash + run: pod --version || sudo gem install cocoapods --no-document + # Both flavors are needed by every matrix cell, not just the one it builds: + # `spm add` stages both flavor framework trees and lets a per-configuration + # build setting pick one at build time, so it validates the debug/ and + # release/ artifact slots together (and `--download skip` refuses an + # incomplete slot). Please don't "optimise" this down to one flavor. + - name: Download ReactCore (Debug) + uses: actions/download-artifact@v7 + with: + name: ReactCoreDebug.xcframework.tar.gz + path: /tmp/rc-debug + - name: Download ReactCore (Release) + uses: actions/download-artifact@v7 + with: + name: ReactCoreRelease.xcframework.tar.gz + path: /tmp/rc-release + - name: Download ReactNativeDependencies (Debug) + uses: actions/download-artifact@v7 + with: + name: ReactNativeDependenciesDebug.xcframework.tar.gz + path: /tmp/deps-debug + - name: Download ReactNativeDependencies (Release) + uses: actions/download-artifact@v7 + with: + name: ReactNativeDependenciesRelease.xcframework.tar.gz + path: /tmp/deps-release + - name: Download React Native package + uses: actions/download-artifact@v7 + with: + name: react-native-package + path: /tmp/react-native-tmp + # Reinstalls private/helloworld in place against the packaged react-native + # (published through the local proxy), so the app under test is what a user + # would get from npm rather than the workspace source. + - name: Prepare the HelloWorld application + shell: bash + run: node ./scripts/e2e/init-project-e2e.js --useHelloWorld --pathToLocalReactNative "/tmp/react-native-tmp/$(cat /tmp/react-native-tmp/react-native-package-version)" + # The ordinary `spm download`, pointed at the XCFrameworks this run just + # built rather than at the published nightly (RN_CORE_TARBALL_PATH / + # RN_DEPS_TARBALL_PATH are overrides download-spm-artifacts.js already + # supports). It fills both flavor slots per call and skips any slot that + # already validates, so it runs twice: the first pass fills both slots + # from the Release tarballs, then debug/ is dropped and refilled from the + # Debug tarballs while release/ is left alone. hermes-engine is fetched + # from Maven by the command itself. + - name: Download XCFrameworks built in this run (Debug + Release) + shell: bash + working-directory: ${{ env.APP_IOS_DIR }} + run: | + RN_CORE_TARBALL_PATH=/tmp/rc-release/ReactCoreRelease.xcframework.tar.gz \ + RN_DEPS_TARBALL_PATH=/tmp/deps-release/ReactNativeDependenciesRelease.xcframework.tar.gz \ + npx react-native spm download --artifacts /tmp/spm-artifacts + rm -rf /tmp/spm-artifacts/debug + RN_CORE_TARBALL_PATH=/tmp/rc-debug/ReactCoreDebug.xcframework.tar.gz \ + RN_DEPS_TARBALL_PATH=/tmp/deps-debug/ReactNativeDependenciesDebug.xcframework.tar.gz \ + npx react-native spm download --artifacts /tmp/spm-artifacts + - name: Scaffold Package.swift manifests for community dependencies + shell: bash + working-directory: ${{ env.APP_IOS_DIR }} + run: npx react-native spm scaffold || true + - name: Convert the app to SwiftPM + shell: bash + working-directory: ${{ env.APP_IOS_DIR }} + run: npx react-native spm add --deintegrate --artifacts /tmp/spm-artifacts --download skip + - name: Assert the app is on SwiftPM + shell: bash + working-directory: ${{ env.APP_IOS_DIR }} + run: | + if [[ ! -f "$XCODE_PROJECT/.spm-injected.json" ]]; then + echo "::error::spm add did not inject SwiftPM: $XCODE_PROJECT/.spm-injected.json is missing" + exit 1 + fi + if [[ -f Podfile ]] && grep -q 'use_react_native!' Podfile; then + echo "::error::spm add --deintegrate left use_react_native! in the Podfile" + exit 1 + fi + echo "SwiftPM injected in place; Podfile de-integrated." + - name: Build ${{ env.XCODE_SCHEME }} (${{ matrix.flavor }}) + shell: bash + working-directory: ${{ env.APP_IOS_DIR }} + run: | + xcodebuild \ + -project "$XCODE_PROJECT" \ + -scheme "$XCODE_SCHEME" \ + -configuration "${{ matrix.flavor }}" \ + -sdk iphonesimulator \ + -destination 'generic/platform=iOS Simulator' \ + -derivedDataPath build/spm-e2e-dd \ + build + - name: Check the embedded React.framework flavor + shell: bash + working-directory: ${{ env.APP_IOS_DIR }} + run: | + PRODUCTS="build/spm-e2e-dd/Build/Products/${{ matrix.flavor }}-iphonesimulator" + if [[ ! -d "$PRODUCTS" ]]; then + echo "Skipping flavor check: no build products directory." + exit 0 + fi + BINARY=$(find "$PRODUCTS" -maxdepth 4 -path '*.app/Frameworks/React.framework/React' -type f 2>/dev/null | head -1 || true) + if [[ -z "$BINARY" ]] || ! command -v nm >/dev/null; then + echo "Skipping flavor check: no embedded React.framework binary or no nm." + exit 0 + fi + COUNT=$(nm "$BINARY" | grep -c getDebugProps || true) + echo "getDebugProps symbols in $BINARY: $COUNT" + if [[ "${{ matrix.flavor }}" == 'Debug' && "$COUNT" -eq 0 ]]; then + echo "::error::Debug build embeds a Release React.framework (expected getDebugProps symbols, found none)" + exit 1 + fi + if [[ "${{ matrix.flavor }}" == 'Release' && "$COUNT" -ne 0 ]]; then + echo "::error::Release build embeds a Debug React.framework ($COUNT getDebugProps symbols, expected none)" + exit 1 + fi diff --git a/.github/workflows/test-ios-spm-rntester.yml b/.github/workflows/test-ios-spm-rntester.yml new file mode 100644 index 000000000000..50e771ff25fe --- /dev/null +++ b/.github/workflows/test-ios-spm-rntester.yml @@ -0,0 +1,137 @@ +name: Test iOS SwiftPM - RN Tester + +permissions: + contents: read + +on: + workflow_call: + +jobs: + test: + runs-on: macos-15-large + strategy: + fail-fast: false + matrix: + flavor: [Debug, Release] + env: + APP_IOS_DIR: packages/rn-tester + XCODE_PROJECT: RNTesterPods.xcodeproj + XCODE_SCHEME: RNTester + steps: + - name: Checkout + uses: actions/checkout@v6 + - name: Setup xcode + uses: ./.github/actions/setup-xcode + - name: Setup node.js + uses: ./.github/actions/setup-node + - name: Run yarn install + uses: ./.github/actions/yarn-install + - name: Set Hermes prebuilt version + shell: bash + run: node ./scripts/releases/use-hermes-prebuilt.js + - name: Run yarn install again, with the correct hermes version + uses: ./.github/actions/yarn-install + - name: Ensure CocoaPods (`spm add --deintegrate` shells out to `pod`) + shell: bash + run: pod --version || sudo gem install cocoapods --no-document + # Both flavors are needed by every matrix cell, not just the one it builds: + # `spm add` stages both flavor framework trees and lets a per-configuration + # build setting pick one at build time, so it validates the debug/ and + # release/ artifact slots together (and `--download skip` refuses an + # incomplete slot). Please don't "optimise" this down to one flavor. + - name: Download ReactCore (Debug) + uses: actions/download-artifact@v7 + with: + name: ReactCoreDebug.xcframework.tar.gz + path: /tmp/rc-debug + - name: Download ReactCore (Release) + uses: actions/download-artifact@v7 + with: + name: ReactCoreRelease.xcframework.tar.gz + path: /tmp/rc-release + - name: Download ReactNativeDependencies (Debug) + uses: actions/download-artifact@v7 + with: + name: ReactNativeDependenciesDebug.xcframework.tar.gz + path: /tmp/deps-debug + - name: Download ReactNativeDependencies (Release) + uses: actions/download-artifact@v7 + with: + name: ReactNativeDependenciesRelease.xcframework.tar.gz + path: /tmp/deps-release + # The ordinary `spm download`, pointed at the XCFrameworks this run just + # built rather than at the published nightly (RN_CORE_TARBALL_PATH / + # RN_DEPS_TARBALL_PATH are overrides download-spm-artifacts.js already + # supports). It fills both flavor slots per call and skips any slot that + # already validates, so it runs twice: the first pass fills both slots + # from the Release tarballs, then debug/ is dropped and refilled from the + # Debug tarballs while release/ is left alone. hermes-engine is fetched + # from Maven by the command itself. + - name: Download XCFrameworks built in this run (Debug + Release) + shell: bash + working-directory: ${{ env.APP_IOS_DIR }} + run: | + RN_CORE_TARBALL_PATH=/tmp/rc-release/ReactCoreRelease.xcframework.tar.gz \ + RN_DEPS_TARBALL_PATH=/tmp/deps-release/ReactNativeDependenciesRelease.xcframework.tar.gz \ + npx react-native spm download --artifacts /tmp/spm-artifacts + rm -rf /tmp/spm-artifacts/debug + RN_CORE_TARBALL_PATH=/tmp/rc-debug/ReactCoreDebug.xcframework.tar.gz \ + RN_DEPS_TARBALL_PATH=/tmp/deps-debug/ReactNativeDependenciesDebug.xcframework.tar.gz \ + npx react-native spm download --artifacts /tmp/spm-artifacts + - name: Scaffold Package.swift manifests for community dependencies + shell: bash + working-directory: ${{ env.APP_IOS_DIR }} + run: npx react-native spm scaffold || true + - name: Convert the app to SwiftPM + shell: bash + working-directory: ${{ env.APP_IOS_DIR }} + run: npx react-native spm add --deintegrate --artifacts /tmp/spm-artifacts --download skip + - name: Assert the app is on SwiftPM + shell: bash + working-directory: ${{ env.APP_IOS_DIR }} + run: | + if [[ ! -f "$XCODE_PROJECT/.spm-injected.json" ]]; then + echo "::error::spm add did not inject SwiftPM: $XCODE_PROJECT/.spm-injected.json is missing" + exit 1 + fi + if [[ -f Podfile ]] && grep -q 'use_react_native!' Podfile; then + echo "::error::spm add --deintegrate left use_react_native! in the Podfile" + exit 1 + fi + echo "SwiftPM injected in place; Podfile de-integrated." + - name: Build ${{ env.XCODE_SCHEME }} (${{ matrix.flavor }}) + shell: bash + working-directory: ${{ env.APP_IOS_DIR }} + run: | + xcodebuild \ + -project "$XCODE_PROJECT" \ + -scheme "$XCODE_SCHEME" \ + -configuration "${{ matrix.flavor }}" \ + -sdk iphonesimulator \ + -destination 'generic/platform=iOS Simulator' \ + -derivedDataPath build/spm-e2e-dd \ + build + - name: Check the embedded React.framework flavor + shell: bash + working-directory: ${{ env.APP_IOS_DIR }} + run: | + PRODUCTS="build/spm-e2e-dd/Build/Products/${{ matrix.flavor }}-iphonesimulator" + if [[ ! -d "$PRODUCTS" ]]; then + echo "Skipping flavor check: no build products directory." + exit 0 + fi + BINARY=$(find "$PRODUCTS" -maxdepth 4 -path '*.app/Frameworks/React.framework/React' -type f 2>/dev/null | head -1 || true) + if [[ -z "$BINARY" ]] || ! command -v nm >/dev/null; then + echo "Skipping flavor check: no embedded React.framework binary or no nm." + exit 0 + fi + COUNT=$(nm "$BINARY" | grep -c getDebugProps || true) + echo "getDebugProps symbols in $BINARY: $COUNT" + if [[ "${{ matrix.flavor }}" == 'Debug' && "$COUNT" -eq 0 ]]; then + echo "::error::Debug build embeds a Release React.framework (expected getDebugProps symbols, found none)" + exit 1 + fi + if [[ "${{ matrix.flavor }}" == 'Release' && "$COUNT" -ne 0 ]]; then + echo "::error::Release build embeds a Debug React.framework ($COUNT getDebugProps symbols, expected none)" + exit 1 + fi diff --git a/.github/workflows/validate-cxx-api-snapshots.yml b/.github/workflows/validate-cxx-api-snapshots.yml index b7117920a23f..e0c7caa2f5d8 100644 --- a/.github/workflows/validate-cxx-api-snapshots.yml +++ b/.github/workflows/validate-cxx-api-snapshots.yml @@ -4,26 +4,26 @@ on: workflow_dispatch: pull_request: paths: - - "packages/react-native/ReactCommon/**" - - "packages/react-native/ReactAndroid/**" - - "packages/react-native/React/**" - - "packages/react-native/ReactApple/**" - - "packages/react-native/Libraries/**" - - "scripts/cxx-api/**" + - 'packages/react-native/ReactCommon/**' + - 'packages/react-native/ReactAndroid/**' + - 'packages/react-native/React/**' + - 'packages/react-native/ReactApple/**' + - 'packages/react-native/Libraries/**' + - 'scripts/cxx-api/**' push: branches: - main - - "*-stable" + - '*-stable' paths: - - "packages/react-native/ReactCommon/**" - - "packages/react-native/ReactAndroid/**" - - "packages/react-native/React/**" - - "packages/react-native/ReactApple/**" - - "packages/react-native/Libraries/**" - - "scripts/cxx-api/**" + - 'packages/react-native/ReactCommon/**' + - 'packages/react-native/ReactAndroid/**' + - 'packages/react-native/React/**' + - 'packages/react-native/ReactApple/**' + - 'packages/react-native/Libraries/**' + - 'scripts/cxx-api/**' env: - DOXYGEN_VERSION: "1.16.1" + DOXYGEN_VERSION: '1.16.1' permissions: contents: read @@ -70,7 +70,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: "3.12" + python-version: '3.12' - name: Install Python dependencies shell: bash run: pip install doxmlparser natsort pyyaml diff --git a/.github/workflows/validate-dotslash-artifacts.yml b/.github/workflows/validate-dotslash-artifacts.yml index 0323b89af657..2970d4329056 100644 --- a/.github/workflows/validate-dotslash-artifacts.yml +++ b/.github/workflows/validate-dotslash-artifacts.yml @@ -9,7 +9,7 @@ on: - main paths: - packages/debugger-shell/bin/react-native-devtools - - "scripts/releases/**" + - 'scripts/releases/**' - package.json - yarn.lock pull_request: @@ -17,12 +17,12 @@ on: - main paths: - packages/debugger-shell/bin/react-native-devtools - - "scripts/releases/**" + - 'scripts/releases/**' - package.json - yarn.lock # Same time as the nightly build: 2:15 AM UTC schedule: - - cron: "15 2 * * *" + - cron: '15 2 * * *' jobs: validate-dotslash-artifacts: diff --git a/.prettierrc.js b/.prettierrc.js index e01002625232..70a05cba5f46 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -7,11 +7,6 @@ * @format */ -let plugins = ['prettier-plugin-hermes-parser']; -try { - plugins = require('./.prettier-plugins.fb.js'); -} catch {} - module.exports = { arrowParens: 'avoid', bracketSameLine: true, @@ -20,7 +15,6 @@ module.exports = { singleQuote: true, trailingComma: 'all', endOfLine: 'lf', - plugins, overrides: [ { files: ['*.code-workspace'], @@ -31,7 +25,7 @@ module.exports = { { files: ['*.js', '*.js.flow'], options: { - parser: 'hermes', + parser: 'flow', }, }, { @@ -42,5 +36,11 @@ module.exports = { requirePragma: false, }, }, + { + files: ['*.yml', '*.yaml'], + options: { + requirePragma: false, + }, + }, ], }; diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 000000000000..d6d28d6f5014 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,53 @@ +# React Native + +A framework for building native applications using React. + +This file provides guidance for coding agents working in this repository. + +## Repo structure + +React Native is a monorepo: the `react-native` package, the packages published alongside it, and the apps and tooling used to develop them. + +| Path | Contents | +| --- | --- | +| `packages/react-native/Libraries` | JavaScript source (Flow) โ€” the legacy location, with code gradually moving to `src/private` | +| `packages/react-native/src/private` | JavaScript source (Flow) | +| `packages/react-native/ReactCommon` | Shared C++ โ€” Fabric renderer, TurboModules, JSI, Yoga, `jsinspector-modern` | +| `packages/react-native/ReactAndroid` | Android runtime (Kotlin, Java, JNI) | +| `packages/react-native/{React,ReactApple}` | Apple runtime (Objective-C++, Swift) | +| `packages/rn-tester` | RNTester โ€” test app showcasing each core component and API, plus a `Playground` scratch surface | +| `packages/*` | Other published packages โ€” Metro config, Codegen, ESLint config, dev-middleware, React Native DevTools frontend | +| `private/*` | Unpublished โ€” the `helloworld` sample app, the `react-native-fantom` test runner | +| `scripts/*` | Repository tooling โ€” build, test, release, and CI scripts | + +Architecture notes live in `__docs__` directories beside the code they describe, indexed by [`__docs__/README.md`](__docs__/README.md). Treat them as reference for the subsystem you are working in, not as required reading. + +## Common commands + +Run these from the repository root: + +| Command | Purpose | +| --- | --- | +| `yarn test ` | Jest unit tests, found in `__tests__` directories | +| `yarn fantom ` | [Fantom](private/react-native-fantom/__docs__/README.md) integration tests, named `*-itest.js` | +| `yarn lint` | ESLint | +| `yarn format` | Prettier and clang-format | +| `yarn flow-check` | Flow | +| `yarn start`, `yarn android` | Metro, and RNTester on Android. See [RNTester](packages/rn-tester/README.md) for iOS | + +Native builds use Gradle on Android, and CocoaPods or Swift Package Manager on iOS. See [Building from source](https://reactnative.dev/contributing/how-to-build-from-source). + +## Gotchas + +- JavaScript sources are typed with Flow, and the public API is exported from `packages/react-native/index.js`. TypeScript types are generated from those sources, and `packages/react-native/ReactNativeApi.d.ts` is a committed snapshot of that API โ€” run `yarn build-types` to regenerate both whenever the public API changes. +- The public native API is snapshotted as well: C++ under `scripts/cxx-api` (`yarn cxx-api-build`), and Android in `packages/react-native/ReactAndroid/api/ReactAndroid.api`. CI validates both. +- Native modules and components are declared by JavaScript specs (`Native*.js`, `*NativeComponent.js`), from which their native counterparts are generated. Do not hand-edit generated code. +- `CHANGELOG.md` is compiled at release time. Changelog entries belong in the pull request description. + +## Contributing guidelines + +- Keep each change focused โ€” no unrelated refactors, formatting, or dependency updates. +- Complete the pull request template โ€” the motivation and the user-visible effect, and a [changelog entry](https://reactnative.dev/contributing/changelogs-in-pull-requests) with its category and type tags. +- In the test plan, give the exact commands you ran and their results, plus screenshots or a video for user-interface changes. + +See [CONTRIBUTING.md](CONTRIBUTING.md) for the full process, including how to report bugs. diff --git a/CHANGELOG.md b/CHANGELOG.md index 54300d67fa39..03f4f58212d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,341 @@ # Changelog +## v0.87.0 + +### Breaking + +- **Appearance**: Fix return type of `useColorScheme()` hook (now `ColorSchemeName | null`) ([ef6463c25d](https://github.com/react/react-native/commit/ef6463c25d78990386a15bb26319d1d4d224df14) by [@huntie](https://github.com/huntie)) +- **Appearance**: `useColorScheme()` no longer returns `'unspecified'` (this was always the case, but is a breaking type change) ([8ac88f481a](https://github.com/react/react-native/commit/8ac88f481a51cec28adfe985382ac7b3648921e5) by [@huntie](https://github.com/huntie)) +- **CLI**: The `react-native/core-cli-utils` package is no longer published. It remains available in the React Native repo as a reference implementation. ([9c3fddf9cd](https://github.com/react/react-native/commit/9c3fddf9cd03788a57ffca0f195bb92b84fab281) by [@huntie](https://github.com/huntie)) +- **Hermes**: Remove Legacy Hermes from C++ code ([f9476256bd](https://github.com/react/react-native/commit/f9476256bd1b5d56f46f79bb31a32e77e8e23fe6) by [@cipolleschi](https://github.com/cipolleschi)) +- **JavaScript API**: Deep imports to `'react-native/src/private/...'` have been restricted, and are no longer visible to TypeScript. These subpaths still exist, but do not have type coverage. ([142b6172a9](https://github.com/react/react-native/commit/142b6172a94ea178ed8d0fd9ffb03a64c4dd9676) by [@huntie](https://github.com/huntie)) +- **JavaScript API**: The `NativeDialogManagerAndroid` export is removed. ([a793d21a7e](https://github.com/react/react-native/commit/a793d21a7ebdea0e5a065190497a67619bdefa89) by [@huntie](https://github.com/huntie)) +- **JavaScript API**: The `Touchable` root export (undocumented) is removed. If you are extending `Touchable` as a type, please use `ViewProps` instead. ([6fbf3062f9](https://github.com/react/react-native/commit/6fbf3062f9085c93bcb35c6a61c76029abbc16a5) by [@huntie](https://github.com/huntie)) +- **JavaScript API**: `react-native/rn-get-polyfills` is removed โ€” please use `react-native/js-polyfills` (package) ([b6a535afee](https://github.com/react/react-native/commit/b6a535afee1e099db00e62b904e3611f41227544) by [@huntie](https://github.com/huntie)) +- **Jest**: `react-native/jest-preset` is removed โ€” all projects must now migrate to `react-native/jest-preset` (package) ([9ee21ddd9b](https://github.com/react/react-native/commit/9ee21ddd9b0d6b997709786fda4bd0b67be1ec7d) by [@huntie](https://github.com/huntie)) +- **Legacy Architecture**: Compile out RuntimeScheduler_Legacy under RCT_REMOVE_LEGACY_ARCH ([d205267a5f](https://github.com/react/react-native/commit/d205267a5fa96b343ef9860e9b2d209e5bc8832c) by [@christophpurrer](https://github.com/christophpurrer)) +- **LogBox**: Set max font scaling in `LogBox` to avoid layout breaking ([4aef2b0126](https://github.com/react/react-native/commit/4aef2b0126c22ab386c970a84d61a9ef2c4b3ddd) by [@pchalupa](https://github.com/pchalupa)) +- **Node**: Require Node.js >= 22.13.0 ([a0d39e7a9c](https://github.com/react/react-native/commit/a0d39e7a9c26446b6fe4af4ab7be00aa1c68ddca) by [@huntie](https://github.com/huntie)) +- **React Native DevTools**: Remove support for connecting to the standalone `react-devtools` package via WebSocket. Use React Native DevTools instead. ([f1971caa44](https://github.com/react/react-native/commit/f1971caa447a9d8f2f6185e99ceb45d512940e86) by [@huntie](https://github.com/huntie)) +- **Renderer**: Remove RawPropsKey prefix and suffix ([67381e157f](https://github.com/react/react-native/commit/67381e157faadd9f18db1ff8710d8d46c3c1dae5) by [@javache](https://github.com/javache)) +- **Runtime**: Remove the `SceneTracker` module from `Libraries/Utilities`, stop setting the active scene from `AppRegistry.runApplication`, and pass the app key as an optional second argument to `WrapperComponentProvider` ([bbb5be9b41](https://github.com/react/react-native/commit/bbb5be9b416efc9b1c365b08a0bcf932c14562ca) by [@rubennorte](https://github.com/rubennorte)) +- **ScrollView**: Remove deprecated boolean values support for `ScrollView` `keyboardShouldPersistTaps` ([5bf3e38db2](https://github.com/react/react-native/commit/5bf3e38db24cadfcd994c3da1a051c0bea4e7f02) by [@zoontek](https://github.com/zoontek)) +- **StatusBar**: Remove deprecated `StatusBar` `backgroundColor` / `translucent` / `networkActivityIndicatorVisible` props and `setBackgroundColor` / `setTranslucent` / `setNetworkActivityIndicatorVisible` methods ([6b45e579d6](https://github.com/react/react-native/commit/6b45e579d6c17e2ff43709812810b4a32ec81a40) by [@zoontek](https://github.com/zoontek)) +- **Strict TypeScript API**: Remove legacy `NativeMethods` and `NativeMethodsMixin` types ([b724611aec](https://github.com/react/react-native/commit/b724611aec382742ee52b8b2619eadc47bc14bc4) by [@huntie](https://github.com/huntie)) +- **Strict TypeScript API**: React Native's default JavaScript API is now the [Strict TypeScript API](https://reactnative.dev/docs/strict-typescript-api). Use `customConditions: ["react-native-legacy-deep-imports"]` to opt out. ([c948b61c05](https://github.com/react/react-native/commit/c948b61c051a2d5cfc79925e93eb49904db972c8) by [@huntie](https://github.com/huntie)) + +#### Android specific + +- **AGP**: Adopt AGP v9 ([abb071b135](https://github.com/react/react-native/commit/abb071b135200823b6794210b2696418190b2892) by [@hurali97](https://github.com/hurali97)) + +#### iOS specific + +- **Build**: [0.87] Pick SwiftPM support chain (#57442, #57332, #57564) ([486df8d410](https://github.com/react/react-native/commit/486df8d410d73d7a1be3600c93a6cf7888532843) by [@cipolleschi](https://github.com/cipolleschi)) +- **Build**: Ship a version-stamped ReactNativeVersion.h in the prebuilt iOS core artifacts instead of the 1000.0.0 dev sentinel ([95df50034b](https://github.com/react/react-native/commit/95df50034ba5ce11f4b70bbb6bf692e3691297dc) by [@chrfalch](https://github.com/chrfalch)) +- **Legacy Architecture**: Remove depracted legacy architecture protocol APIs ([ad9936faf6](https://github.com/react/react-native/commit/ad9936faf666264bb03db8c6e7499c529fff3391) by [@christophpurrer](https://github.com/christophpurrer)) +- **Legacy Architecture**: Remove unused legacy architecture RCTAppSetupUtils methods ([40b16dca9f](https://github.com/react/react-native/commit/40b16dca9fa2b553350993f2a687cd6fc7365ec5) by [@christophpurrer](https://github.com/christophpurrer)) +- **Legacy Architecture**: Remove RCTBridge Functions from RCTReactNativeFactory Header ([75eaff4c03](https://github.com/react/react-native/commit/75eaff4c033c93819164808635f2cdca77cf8a3c) by [@christophpurrer](https://github.com/christophpurrer)) +- **Legacy Architecture**: Remove unused bridge-based RCTTurboModuleManager initializer ([cb74b82309](https://github.com/react/react-native/commit/cb74b82309dd9f8e232b8e8f7ef94326e2de8e35) by [@christophpurrer](https://github.com/christophpurrer)) +- **Legacy Architecture**: RNTester / RCTReactNativeFactory remove unused new architecture flags and RCTArchConfiguratorProtocol ([2148f15db5](https://github.com/react/react-native/commit/2148f15db5a64658647748403bca319a599e7a5d) by [@christophpurrer](https://github.com/christophpurrer)) +- **Legacy Architecture**: Remove 6 empty Objective-C stub headers ([23ce90bd3b](https://github.com/react/react-native/commit/23ce90bd3bdfb3b8268466c40bab31bf7a54a8d7) by [@christophpurrer](https://github.com/christophpurrer)) +- **Legacy Architecture**: Remove legacy architecture code guarded by RCT_REMOVE_LEGACY_ARCH from RN iOS ([86350ab988](https://github.com/react/react-native/commit/86350ab988472025d60e192c54e115caf6756295) by [@christophpurrer](https://github.com/christophpurrer)) +- **Legacy Architecture**: Removing further legacy arch symbols such as RCTCxxBridge ([c65281581d](https://github.com/react/react-native/commit/c65281581dd5add76a10cc20945aa4790fb5db8c) by [@javache](https://github.com/javache)) + +### Added + +- **Animated**: Support native driven AnimatedValue interpolation easing ([57ce6bc585](https://github.com/react/react-native/commit/57ce6bc5857d3ad72de755eb612f8cfd197c22ca) by [@zeyap](https://github.com/zeyap)) +- **Animated**: Remove `useNativeDriver` under featureflag animatedForceNativeDriver ([9cf30b6e4b](https://github.com/react/react-native/commit/9cf30b6e4bcab167e7a3de254ba3ada88ed66374) by [@zeyap](https://github.com/zeyap)) +- **Animated**: Remove `useNativeDriver` under featureflag animatedForceNativeDriver ([cffe14ff57](https://github.com/react/react-native/commit/cffe14ff57ce0e76601e9efde833700d6ba609af) by [@zeyap](https://github.com/zeyap)) +- **Animated**: Add `optimizedAnimatedPropUpdates` feature flag ([ed96b22af2](https://github.com/react/react-native/commit/ed96b22af2baea90b8ed418c2f30c1b0990c1845) by Bartlomiej Bloniarz) +- **Assets**: Introduce `react-native/asset-utils` package (relocates Android path utils for libraries/frameworks) ([41d52189e2](https://github.com/react/react-native/commit/41d52189e2167c7edc12a719150c2796b33c0ba0) by [@huntie](https://github.com/huntie)) +- **JavaScript API**: Deprecate `'react-native/Libraries/Core/InitializeCore'`. Use `'react-native/setup-env'` instead. ([bfa679f0ea](https://github.com/react/react-native/commit/bfa679f0ea5431c92894d236b8e414f2feb70280) by [@huntie](https://github.com/huntie)) +- **Legacy Architecture**: Gate shared C++ and Android Java/Kotlin legacy view manager interop behind `RCT_REMOVE_LEGACY_COMPONENT_INTEROP` ([9885fe95ef](https://github.com/react/react-native/commit/9885fe95ef1e7fa08008434620a8c97c3c2b61da) by [@christophpurrer](https://github.com/christophpurrer)) +- **Legacy Architecture**: Gate legacy view manager interop behind `RCT_REMOVE_LEGACY_COMPONENT_INTEROP` ([8b959b46ea](https://github.com/react/react-native/commit/8b959b46ea6195ef2d0a77433d7915fc02797b11) by [@christophpurrer](https://github.com/christophpurrer)) +- **Legacy Architecture**: Gate legacy TurboModule interop behind `RCT_REMOVE_LEGACY_MODULE_INTEROP` ([3278f309e2](https://github.com/react/react-native/commit/3278f309e29fd957dad5f3fa029893013aa4db1c) by [@christophpurrer](https://github.com/christophpurrer)) +- **MapBuffer**: Add `IntBuffer` and `DoubleBuffer` entry types to MapBuffer for compact homogeneous int/double arrays ([e7cadaf9f3](https://github.com/react/react-native/commit/e7cadaf9f315d8984bdea1c7fb6da4e302952819) by [@javache](https://github.com/javache)) +- **Performance**: Add `Systrace.trace` helper that wraps a function with begin/end events using try/finally ([e6c7a269d2](https://github.com/react/react-native/commit/e6c7a269d2b31aea770470078ae5ae1887326c7c) by [@rubennorte](https://github.com/rubennorte)) +- **React Native DevTools**: Implement the `Page.addScriptToEvaluateOnNewDocument` and `Page.removeScriptToEvaluateOnNewDocument` CDP methods in the modern inspector ([bc20ec88eb](https://github.com/react/react-native/commit/bc20ec88ebb901f31d8f554238e97612aa04181b) by [@GijsWeterings](https://github.com/GijsWeterings)) +- **RNTester**: Add All Animated Props example to the rn-tester Animation Backend section ([e2e655385c](https://github.com/react/react-native/commit/e2e655385cfbdb08577e388f47e6f38818dc1f53) by Bartlomiej Bloniarz) +- **RNTester**: Add Performance Test example to the rn-tester Animation Backend section ([09e55cb7c6](https://github.com/react/react-native/commit/09e55cb7c631bfa9a346c6e97047e0b5e8e13bb1) by Bartlomiej Bloniarz) +- **StatusBar**: Support `barStyle="auto"` to follow the current color scheme ([61c8b040bf](https://github.com/react/react-native/commit/61c8b040bf76bd909965dfb98b2c0bd2aa8e7475) by [@zoontek](https://github.com/zoontek)) +- **Strict TypeScript API**: Component and API doc comment coverage has been significantly improved ([701de4ec3d](https://github.com/react/react-native/commit/701de4ec3d2f893c77db67e3df39ea17f6ff1c52) by [@huntie](https://github.com/huntie)) +- **Strict TypeScript API**: Export `Animated.Numeric` ([6206b0b01f](https://github.com/react/react-native/commit/6206b0b01f358eb7fd723e6e99b75c0b1f6d6ea1) by [@huntie](https://github.com/huntie)) +- **Strict TypeScript API**: Add `*Instance` ref types for all built-in components ([a3827f32f4](https://github.com/react/react-native/commit/a3827f32f497057c6d23bd184dd8c8fd5b35a523) by [@huntie](https://github.com/huntie)) +- **Text**: Add support for `textAlign: 'start'` and `textAlign: 'end'`. ([ca29d38537](https://github.com/react/react-native/commit/ca29d385372e4b4832f45d708579029c64d50c62) by [@SJvaca30](https://github.com/SJvaca30)) +- **Text**: Text decorations honor `textDecorationStyle` (`solid`, `double`, `dotted`, `dashed`, `wavy`) ([87184c8fba](https://github.com/react/react-native/commit/87184c8fbac1b869a6dd021f1a9c7cf26dfa462c) by [@quantizor](https://github.com/quantizor)) +- **TurboModules**: Add `ArrayBuffer` support to C++ TurboModules ([226ef2e7c5](https://github.com/react/react-native/commit/226ef2e7c5d1928d5696dc23efc1b8950ba00e37) by [@paradowstack](https://github.com/paradowstack)) +- **TypeScript**: Add `selection` to `TextInputChangeEventData` in TypeScript types ([e745c41a6b](https://github.com/react/react-native/commit/e745c41a6b173f51bb4d2fb6df2c48742a05f310) by [@nsbarsukov](https://github.com/nsbarsukov)) +- **TypeScript**: Export `AccessibilityActionInfo`, `ImageResizeMode`, `EdgeInsetsProp`, and `TextInputBlurEvent` types ([ee36c67a27](https://github.com/react/react-native/commit/ee36c67a277598efa50cf208c04c53bca46c41c1) by [@huntie](https://github.com/huntie)) +- **TypeScript**: Add `Promise.try` + `Promise.withResolvers` typescript types ([b99ddaf606](https://github.com/react/react-native/commit/b99ddaf60661a9b308e9028412fee682e4211d8f) by [@retyui](https://github.com/retyui)) +- **TypeScript**: Add TypeScript support for Error `cause` property ([abcb7821b1](https://github.com/react/react-native/commit/abcb7821b1e43ba5ff0ec92c746e6fbc4b2a10f3) by [@gimi-anders](https://github.com/gimi-anders)) +- **Yoga**: Add CSS Flexbox ยง4.5 automatic minimum sizing. Opt in by clearing the new `YGErrataMinSizeUndefinedInsteadOfAuto` errata bit on `YGConfig`. ([b766986387](https://github.com/react/react-native/commit/b766986387b0b08c8bddd5dbad4a458eb9404c61) by [@adityasharat](https://github.com/adityasharat)) +- **Yoga**: Add CSS Flexbox ยง4.5 automatic minimum sizing. Opt in by clearing the new `YGErrataMinSizeUndefinedInsteadOfAuto` errata bit on `YGConfig`. Adds `YGNodeSetMinContentWidth/Height` for static contributions and `YGMinContentMeasureFunc` for dynamic ones.' ([7f396d1116](https://github.com/react/react-native/commit/7f396d1116b4d372376439317d8f8d01452bc343) by [@adityasharat](https://github.com/adityasharat)) + +#### Android specific + +- **Android SDK**: Update `compileSdk` and `buildTools` to 37 ([3e8dfb1e64](https://github.com/react/react-native/commit/3e8dfb1e64e7c044e3078b6c7ab147a652abe162) by [@alanjhughes](https://github.com/alanjhughes)) +- **MapBuffer**: Add a dedicated `MapBufferList` type to `MapBuffer` for ordered lists of nested `MapBuffer`s ([6a957746f6](https://github.com/react/react-native/commit/6a957746f6a2fc280bd6b30724d4fe10b4841841) by [@javache](https://github.com/javache)) +- **Permissions**: Add `ACCESS_LOCAL_NETWORK` to `PermissionsAndroid` and request it so the dev server stays reachable on Android 17 (SDK 37) ([2bc2c8d7e6](https://github.com/react/react-native/commit/2bc2c8d7e6cf2ebfd338268cd6b999974fb727e4) by [@alanjhughes](https://github.com/alanjhughes)) +- **Runtime**: Add `ReactContext.getRuntimeExecutor()` ([dc9043e940](https://github.com/react/react-native/commit/dc9043e940c0c31a3f906e1d539d02bef54667f7) by [@javache](https://github.com/javache)) +- **ScrollView**: Added an entry point that allows changing whether the scrollable React Native containers should delay pressed state in children views ([91b2537f8a](https://github.com/react/react-native/commit/91b2537f8ac5b29d022743ab7246d860343c3e81) by [@j-piasecki](https://github.com/j-piasecki)) +- **View**: Use software snapshot capture unless featureflag ([ba204faa75](https://github.com/react/react-native/commit/ba204faa75ab89150396f7ad69e755187ec47a58) by [@zeyap](https://github.com/zeyap)) + +#### iOS specific + +- **Build**: Fail closed with an actionable error when the SwiftPM autolinking config command fails, instead of silently emitting an empty Autolinked package ([a7ba4ce522](https://github.com/react/react-native/commit/a7ba4ce5224493067a5e767008c0bc0f309932c6) by [@chrfalch](https://github.com/chrfalch)) +- **i18n**: Added comment to clarify why i18nManager.isRTL may not return the expected value ([e4a5ed3c6d](https://github.com/react/react-native/commit/e4a5ed3c6d6ad4f00652ab8202dda65f6fe40b92) by [@scarlac](https://github.com/scarlac)) +- **Native Modules**: Export `RCTDidInitializeModuleNotificationModuleKey` constant for `RCTDidInitializeModuleNotification` userInfo ([217ee52d4f](https://github.com/react/react-native/commit/217ee52d4f7a13af64a55ab4ff21fc7d70c23dd8) by Eapen George) +- **Text**: Add `enableIOSCompressedTextFrameAdjustment` feature flag for `Text` rendering adjustments. ([b933d45276](https://github.com/react/react-native/commit/b933d45276ed82a8c504b6c856b7dd046f95aeb6) by [@sbuggay](https://github.com/sbuggay)) +- **Text**: `textDecorationStyle: 'dotted'` and `'dashed'` for `` render with custom CoreGraphics paths instead of UIKit pattern bits, matching browser geometry more closely ([9d037509bf](https://github.com/react/react-native/commit/9d037509bf90acf14bcfb6accd35ed184d91ea84) by [@quantizor](https://github.com/quantizor)) +- **TurboModules**: Add ArrayBuffer support to ObjC TurboModules ([54b88d9dea](https://github.com/react/react-native/commit/54b88d9dea5ddc9740327ae426dc3ab8e66f7e75) by [@paradowstack](https://github.com/paradowstack)) + +### Changed + +- **Animated**: Enable Animated flush-queue debouncing (`animatedShouldDebounceQueueFlush`) by default ([5c197fb303](https://github.com/react/react-native/commit/5c197fb303ed0d975482757fefb7ed38349601b6) by [@zeyap](https://github.com/zeyap)) +- **Animated**: Flip cxxNativeAnimatedEnabled featureflag default to true ([fc7dc741d2](https://github.com/react/react-native/commit/fc7dc741d2b9dcdc36660d100a1b4ba420f8b725) by [@zeyap](https://github.com/zeyap)) +- **Animated**: Xplat/js/react-native-github/packages/react-native/ReactCommon/react/renderer/animated/drivers/DecayAnimationDriver.cpp ([69b58f308e](https://github.com/react/react-native/commit/69b58f308e4399c8b56feb9e283be2da8676890a) by generatedunixname1563563004708334) +- **Build**: Fix missing VERSION_NATIVE_FB in commit artifacts ([c6f29a2173](https://github.com/react/react-native/commit/c6f29a21733377799cf8f39ec5351de941a9e58b) by [@javache](https://github.com/javache)) +- **C++**: Xplat/js/react-native-github/packages/react-native/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.cpp ([ce057d6554](https://github.com/react/react-native/commit/ce057d6554b5ed44070336fa2353d7d6624eab92) by generatedunixname1563563004708334) +- **Dependencies**: Replace `abort-controller` with fork version from react-native ([6f3375a140](https://github.com/react/react-native/commit/6f3375a140b10cffe9bed3dd72a017ece97bbbba) by [@retyui](https://github.com/retyui)) +- **Documentation**: Clarify Android AppState background API documentation. ([b09fce6db5](https://github.com/react/react-native/commit/b09fce6db5ce7d025546d84b91ecf201a86a494f) by [@federicobartoli](https://github.com/federicobartoli)) +- **DOM API**: Make `EventTarget` methods enumerable by spec ([25c25b3c7c](https://github.com/react/react-native/commit/25c25b3c7cc81c33c1c36fb371d3f94d00ff412e) by [@retyui](https://github.com/retyui)) +- **Flow**: Turn on `experimental.instance_t_objkit_fix` across fbsource roots ([71fee907fb](https://github.com/react/react-native/commit/71fee907fb9f75ecba210a9041cde7393c98697b) by [@SamChou19815](https://github.com/SamChou19815)) +- **Flow**: Transform readonly in xplatjs ([5fce2de800](https://github.com/react/react-native/commit/5fce2de80028e972951b2544be2082c951febb64) by [@marcoww6](https://github.com/marcoww6)) +- **Flow**: Fix a few readonly 10/n ([09fc0432d1](https://github.com/react/react-native/commit/09fc0432d1eb799c3c1c2ae2ef0dc3acb2944e35) by [@marcoww6](https://github.com/marcoww6)) +- **Flow**: Codemod `in/out` ([9f558a4d6a](https://github.com/react/react-native/commit/9f558a4d6a546f73babacb4de991116e19727a86) by [@marcoww6](https://github.com/marcoww6)) +- **Hermes**: Change default transform profile to 'hermes-stable' ([a2cd37f828](https://github.com/react/react-native/commit/a2cd37f828ad9338eeacd69a64d90c5c512035be) by [@retyui](https://github.com/retyui)) +- **Hermes**: Simplified build JS Hermes infrastructure for the Release ([d49aac6b65](https://github.com/react/react-native/commit/d49aac6b652d5b19bcd044c77905cac0c917fd85) by [@cipolleschi](https://github.com/cipolleschi)) +- **Hermes**: Bump Hermes V1 to 250829098.0.13 ([0175449606](https://github.com/react/react-native/commit/01754496066fb501a450fcb599a9d2929ac37c16) by [@robhogan](https://github.com/robhogan)) +- **IntersectionObserver**: Expose `IntersectionObserverEntry` as a global ([4deb32a507](https://github.com/react/react-native/commit/4deb32a507f15b447f264b27fb1d45dd3d3dfc44) by [@rubennorte](https://github.com/rubennorte)) +- **Metro**: Metro to 0.86.0 ([2b0107e0aa](https://github.com/react/react-native/commit/2b0107e0aaee7d035dbad2cece6134cb2454bb37) by [@robhogan](https://github.com/robhogan)) +- **Metro**: Bump Metro to 0.87.0 ([0565bcdbab](https://github.com/react/react-native/commit/0565bcdbab05e2fb6208aa842721485eb89ffc7c) by [@robhogan](https://github.com/robhogan)) +- **React Native DevTools**: Expose new options in the app menu ([24e370096e](https://github.com/react/react-native/commit/24e370096e4ee402d4b25dd8a7c7a6778bab4a93) by [@huntie](https://github.com/huntie)) +- **React Native DevTools**: Add macOS 26/27 app icon ([fa371d156d](https://github.com/react/react-native/commit/fa371d156db2d796a18c44624d28c397ef5837a7) by [@huntie](https://github.com/huntie)) +- **Runtime**: Make the `window` global non-writable and non-configurable, and the `navigator` global non-writable ([347f8d081e](https://github.com/react/react-native/commit/347f8d081eee8792ae23d87ae04be1cfc7b3fdcb) by [@rubennorte](https://github.com/rubennorte)) +- **Strict TypeScript API**: Additional component props types are now `interface` declarations, enabling module augmentation by libraries like Uniwind (preserve compatibility) ([2574863642](https://github.com/react/react-native/commit/2574863642862d507f74355fad40966a1370bf03) by [@huntie](https://github.com/huntie)) +- **Strict TypeScript API**: Select component props types are now `interface` declarations, enabling module augmentation by libraries like NativeWind and Expo (preserve compatibility) ([db89600b56](https://github.com/react/react-native/commit/db89600b562dda28e9d41028b8b6e63ca94b86a0) by [@huntie](https://github.com/huntie)) +- **StyleSheet**: Make `flattenStyle` avoid extra intermediate objects when flattening nested style arrays. ([d26f7b338d](https://github.com/react/react-native/commit/d26f7b338d340042a15706e5bb4febfe11cdd81f) by [@tarikfp](https://github.com/tarikfp)) +- **StyleSheet**: Remove `experimental_` prefix from `backgroundImage` ([58688bf176](https://github.com/react/react-native/commit/58688bf17623fa54e8c62397ecb0abd285c01a94) by [@intergalacticspacehighway](https://github.com/intergalacticspacehighway)) +- **TurboModules**: The default value of the `useTurboModules` ReactNativeFeatureFlags flag is now `true` ([db4c6ee3b6](https://github.com/react/react-native/commit/db4c6ee3b6898605794aedcd33e6015e2058e997) by [@mdvacca](https://github.com/mdvacca)) +- **VirtualizedList**: Speed up VirtualizedList render-mask creation for large lists by avoiding the old backward sticky-header scan when sticky headers are missing or sparse. ([fe53279889](https://github.com/react/react-native/commit/fe53279889ba1e89c99d5b888d36a4294a8abb8c) by [@tarikfp](https://github.com/tarikfp)) +- **Yoga**: Mark parent dirty when child is freed ([4adca58f4c](https://github.com/react/react-native/commit/4adca58f4c52fabe28b6ee899d34b1aa05bd2ea3) by [@harsha-cpp](https://github.com/harsha-cpp)) + +#### Android specific + +- **Android SDK**: Set minCompileSdk to 34, libraries will have to specify a compileSdk of >= 34 in order to work with React Native ([29e5f954c7](https://github.com/react/react-native/commit/29e5f954c70a57d2d0feaa052b698fb95915a0a0) by [@cortinico](https://github.com/cortinico)) +- **Build**: Add license header to ProGuard files ([b3c0f3ce30](https://github.com/react/react-native/commit/b3c0f3ce301369c7e7f9ea8f7442940229946d61) by [@helfper](https://github.com/helfper)) +- **Gradle**: Gradle to 9.4.1 ([c0ee408c16](https://github.com/react/react-native/commit/c0ee408c163cd4e2e27dad7cbcdd59d97cf3d5a5) by [@leotm](https://github.com/leotm)) +- **i18n**: Translation auto-update for batch 3/64 on master ([9299204523](https://github.com/react/react-native/commit/9299204523bc5c4151c2d8972dd4669f81ecc751) by Intl Scheduler) +- **i18n**: Translation auto-update for batch 3/64 on master ([10ec4ad01a](https://github.com/react/react-native/commit/10ec4ad01a10e2e5bd156eee18b5b56082d975de) by Intl Scheduler) +- **i18n**: Translation auto-update for batch 2/64 on master ([a902d7402c](https://github.com/react/react-native/commit/a902d7402c241b0260121c0e8be72c691387cc1c) by Intl Scheduler) +- **Kotlin**: Convert `ReactHorizontalScrollView` from Java to Kotlin ([5c680995bd](https://github.com/react/react-native/commit/5c680995bd416e2bb0f3ef892bd580f5c4527b18) by [@cortinico](https://github.com/cortinico)) +- **Kotlin**: Convert `ReactScrollView` and `ReactNestedScrollView` from Java to Kotlin ([9d65e6c497](https://github.com/react/react-native/commit/9d65e6c497686ab518618dcfb33758110ed41d6e) by [@cortinico](https://github.com/cortinico)) +- **Kotlin**: Migrate `ReactShadowNode` interface from Java to Kotlin ([f07c7cceee](https://github.com/react/react-native/commit/f07c7cceeed4148b9d1cfca6b1fb35d236ac4e87) by [@cortinico](https://github.com/cortinico)) +- **Kotlin**: Migrate `UIManagerModule` from Java to Kotlin ([21dfc2a855](https://github.com/react/react-native/commit/21dfc2a85578e32c08dc9ea4a0cd87e7cfc0835e) by [@cortinico](https://github.com/cortinico)) +- **Kotlin**: Migrate `UIViewOperationQueue` from Java to Kotlin ([7a8344c037](https://github.com/react/react-native/commit/7a8344c037d361aafb3e180086ab96d44ede63c1) by [@cortinico](https://github.com/cortinico)) +- **Kotlin**: Migrate `BridgeReactContext` from Java to Kotlin ([6720760faf](https://github.com/react/react-native/commit/6720760fafc59cfd5d312fd58d2ee2389a168019) by [@cortinico](https://github.com/cortinico)) +- **Kotlin**: Migrate `ReactNativeHost` from Java to Kotlin (no behavioral changes) ([7eb11331b6](https://github.com/react/react-native/commit/7eb11331b670b83fa7b7a7ae194313848d72d0e6) by [@cortinico](https://github.com/cortinico)) +- **Kotlin**: Bumped min Kotlin version to 2.0+ ([ec1e1ae054](https://github.com/react/react-native/commit/ec1e1ae054f598df73b8795040fae920719a4643) by [@cortinico](https://github.com/cortinico)) +- **Kotlin**: Bump Kotlin to 2.2.0 ([cb04956cde](https://github.com/react/react-native/commit/cb04956cdef16792e38cde443e03ba420c8efb5d) by [@cortinico](https://github.com/cortinico)) +- **Kotlin**: Daily `arc lint --take KTFMT` ([f9ba09d60e](https://github.com/react/react-native/commit/f9ba09d60ecb6362b695bb30d387a72a447dc790) by generatedunixname1430061942044674) +- **Kotlin**: Make CustomEventNamesResolver a fun interface for SAM conversion ([df4cadc126](https://github.com/react/react-native/commit/df4cadc126690ff09ea653b2d02874b892e897f2) by [@cortinico](https://github.com/cortinico)) +- **Kotlin**: Migrate YogaWrap enum to Kotlin ([6e262624fc](https://github.com/react/react-native/commit/6e262624fcb3ccea694f47b9b3474aabdeaed29f) by [@cortinico](https://github.com/cortinico)) +- **Kotlin**: Migrate YogaUnit enum to Kotlin ([97cf21dd41](https://github.com/react/react-native/commit/97cf21dd41c7c2c111b9839e71d2cfc54239fd39) by [@cortinico](https://github.com/cortinico)) +- **Kotlin**: Migrate YogaPositionType enum to Kotlin ([d181829b9c](https://github.com/react/react-native/commit/d181829b9ce9fbed9655dbded41e54baae5ef3d7) by [@cortinico](https://github.com/cortinico)) +- **Kotlin**: Migrate YogaOverflow enum to Kotlin ([14c1d164d5](https://github.com/react/react-native/commit/14c1d164d53de189a97868e0fa3ff8e8e9e66f14) by [@cortinico](https://github.com/cortinico)) +- **Kotlin**: Migrate YogaNodeType enum to Kotlin ([bb137aa028](https://github.com/react/react-native/commit/bb137aa028990e7f6f8f4b1f82541ba758df8fac) by [@cortinico](https://github.com/cortinico)) +- **Kotlin**: Migrate YogaMeasureMode enum to Kotlin ([b7801f29c5](https://github.com/react/react-native/commit/b7801f29c50b5c71ab0e516e23d652b30f82c656) by [@cortinico](https://github.com/cortinico)) +- **Kotlin**: Migrate YogaLogLevel enum to Kotlin ([5d5350b1e4](https://github.com/react/react-native/commit/5d5350b1e48336bc669aa972ebf316df7f9809df) by [@cortinico](https://github.com/cortinico)) +- **Kotlin**: Migrate YogaJustify enum to Kotlin ([084a77631f](https://github.com/react/react-native/commit/084a77631f432eab1d007c59b91a07aef1cf75c8) by [@cortinico](https://github.com/cortinico)) +- **Kotlin**: Migrate YogaGutter enum to Kotlin ([26862a0251](https://github.com/react/react-native/commit/26862a0251b2acdfbade84da46753318a62c700d) by [@cortinico](https://github.com/cortinico)) +- **Kotlin**: Migrate YogaGridTrackType enum to Kotlin ([f1b488f5da](https://github.com/react/react-native/commit/f1b488f5dae2727472bedc9b65d901dbf20f20d5) by [@cortinico](https://github.com/cortinico)) +- **Kotlin**: Migrate YogaFlexDirection enum to Kotlin ([984621b212](https://github.com/react/react-native/commit/984621b212f803bc1db8abec877f2be6c1c45f54) by [@cortinico](https://github.com/cortinico)) +- **Kotlin**: Migrate YogaExperimentalFeature enum to Kotlin ([70ebd43a1a](https://github.com/react/react-native/commit/70ebd43a1a6c03e0fdaa7fea4e4d9bd1cc34eb41) by [@cortinico](https://github.com/cortinico)) +- **Kotlin**: Migrate YogaErrata enum to Kotlin ([d695a5cff4](https://github.com/react/react-native/commit/d695a5cff4a76674d60d835ce518c0e31709cdb1) by [@cortinico](https://github.com/cortinico)) +- **Kotlin**: Migrate YogaEdge enum to Kotlin ([2be96e8d92](https://github.com/react/react-native/commit/2be96e8d920ba09570931a09909dd18c6714ea83) by [@cortinico](https://github.com/cortinico)) +- **Kotlin**: Migrate YogaDisplay enum to Kotlin ([9580a54273](https://github.com/react/react-native/commit/9580a54273c8a4f726f88368a7adb34eaf535cae) by [@cortinico](https://github.com/cortinico)) +- **Kotlin**: Migrate YogaDimension enum to Kotlin ([2d2b9924e3](https://github.com/react/react-native/commit/2d2b9924e3a415f5aae311b71db323bf762a2bb3) by [@cortinico](https://github.com/cortinico)) +- **Kotlin**: Migrate YogaBoxSizing enum to Kotlin ([fe154568e5](https://github.com/react/react-native/commit/fe154568e55b21e87f4efe999d57cd403dd1b6b4) by [@cortinico](https://github.com/cortinico)) +- **ViewManagers**: Corrected nullability of `ViewManager#measure` ([63683f091c](https://github.com/react/react-native/commit/63683f091c7a2f01311ce05e73f7d7d9185113ee) by [@javache](https://github.com/javache)) + +#### iOS specific + +- **Build**: Prebuilt-deps mode: serve third-party headers from the ReactNativeDependencies pod itself and resolve community `s.dependency` on RCT-Folly/glog/boost/etc. via dependency-only facade pods ([a8156acf8b](https://github.com/react/react-native/commit/a8156acf8bbc9ee15901cf0d8935d73454768aa7) by [@chrfalch](https://github.com/chrfalch)) +- **Build**: Remove the Clang VFS overlay from prebuilt React Native Core; resolve headers via React.xcframework + a new headers-only ReactNativeHeaders.xcframework ([376bd0e464](https://github.com/react/react-native/commit/376bd0e464b7785b4bcf8673a96746ec8107f1eb) by [@chrfalch](https://github.com/chrfalch)) +- **Native Modules**: Native modules listed in `unstableModulesRequiringMainQueueSetup` are now always initialized eagerly on the main queue during React Native init; the previous `enableEagerMainQueueModulesOnIOS` opt-in flag has been removed. ([36bec56b0b](https://github.com/react/react-native/commit/36bec56b0b6b2c385c1add41abcde347b0b34fb0) by [@javache](https://github.com/javache)) +- **Renderer**: Drain React-revision merges from a `BeforeWaiting` main run loop observer instead of dispatching each merge as a separate main-queue block ([d80377cd60](https://github.com/react/react-native/commit/d80377cd60df90ed8ebabdf15df67edd0dd1fc8f) by [@j-piasecki](https://github.com/j-piasecki)) +- **Runtime**: `RCTUnsafeExecuteOnMainQueueSync` and bridgeless sync runtime-thread calls now always use the coordinator implementation that pumps UI tasks while waiting for JS, eliminating a class of deadlocks. The previous opt-in flag has been removed. ([eaf770433a](https://github.com/react/react-native/commit/eaf770433a5e6d88e150d5da701460551f0f5603) by [@javache](https://github.com/javache)) + +### Deprecated + +- **Appearance**: `Appearance.setColorScheme('unspecified')` is deprecated, use `'auto'` instead. ([91702e50fe](https://github.com/react/react-native/commit/91702e50fe077ae73ab152da18719d6df98cb71f) by [@huntie](https://github.com/huntie)) +- **Assets**: Deprecate `react-native/assets-registry`. Use `AssetRegistry` from `react-native` and `react-native/asset-utils` instead. ([715eeaad69](https://github.com/react/react-native/commit/715eeaad69ad4b69dc5694fb5fba6dbde922ca06) by [@huntie](https://github.com/huntie)) +- **Image**: Deprecate `ImageBackground`, use a `View` with an absolutely positioned `Image` instead ([2361189716](https://github.com/react/react-native/commit/2361189716afbcced6ee2cdb0fd860cf23460850) by [@zoontek](https://github.com/zoontek)) +- **JavaScript API**: Mark undocumented `UTFSequence` module as deprecated ([549e4e2d8d](https://github.com/react/react-native/commit/549e4e2d8d678cde73caa1ee0fb893c168e06294) by [@retyui](https://github.com/retyui)) +- **JavaScript API**: Mark undocumented `UTFSequence` module as deprecated ([fd49bf2e2c](https://github.com/react/react-native/commit/fd49bf2e2cfa555de36edeb7fe34e4fad9eca946) by [@retyui](https://github.com/retyui)) +- **TypeScript**: The `NativeMethods` interface is deprecated. Use `HostInstance` instead. ([19f5691e39](https://github.com/react/react-native/commit/19f5691e39bd6d5a8775e77697db9a88418f6a70) by [@huntie](https://github.com/huntie)) +- **Yoga**: Fix CQS signal modernize-deprecated-headers in xplat/yoga/yoga [B] [A] ([61db78db0b](https://github.com/react/react-native/commit/61db78db0b938052c0c4d15d3e145739258b2282) by generatedunixname1587093422349604) + +#### Android specific + +- **APIs**: Deprecate `DrawerLayoutAndroid`, use `react-native-drawer-layout` instead ([5c5e6cd8ce](https://github.com/react/react-native/commit/5c5e6cd8ce0bfb9c69ac39a1823872fc8eb8c40e) by [@zoontek](https://github.com/zoontek)) +- **New Architecture**: DefaultReactActivityDelegate's constructor taking new arch flags are deprecated ([935f8e5b7d](https://github.com/react/react-native/commit/935f8e5b7db7c197ad31d60dee008db22b43df5a) by [@javache](https://github.com/javache)) +- **UIManager**: Deprecate `UIBlock` interface and `UIManagerModule.addUIBlock`/`prependUIBlock` methods. Use `UIManagerListener` or View Commands instead. ([29a76918a9](https://github.com/react/react-native/commit/29a76918a988d4120dda5597575bf5be477a7635) by [@cortinico](https://github.com/cortinico)) + +### Removed + +- **C++**: Removed RCTDefaultCxxLogFunction ([2b6f605b3c](https://github.com/react/react-native/commit/2b6f605b3c237361d030748b39074bde2beed59a) by [@javache](https://github.com/javache)) +- **Feature Flags**: Remove unused `enableVirtualViewDebugFeatures` feature flag and the associated `FlingItemOverlay` / `FlingDebugItemOverlay` debug surfaces. ([083fd99ba4](https://github.com/react/react-native/commit/083fd99ba4f603b1cb70231136614a96a3f00c59) by [@javache](https://github.com/javache)) +- **Feature Flags**: Remove the experimental native View prop transformation feature flag. ([2c2cd9ef54](https://github.com/react/react-native/commit/2c2cd9ef54e119bf6527c584b47e1b789080851f) by [@sammy-SC](https://github.com/sammy-SC)) +- **Feature Flags**: Removed the unused `disableMaintainVisibleContentPosition` feature flag from ReactNativeFeatureFlags ([661ce06e02](https://github.com/react/react-native/commit/661ce06e02c80f48d3dca9a4992afc9ea9c3e063) by generatedunixname1608173377072046) +- **Feature Flags**: Remove unused `useLISAlgorithmInDifferentiator` feature flag and LIS algorithm code from the Differentiator ([9f4513c751](https://github.com/react/react-native/commit/9f4513c751621b01dbb0a4379ce7c1d2d4884eeb) by [@javache](https://github.com/javache)) +- **InteractionManager**: Remove deprecated `InteractionManager` (use `requestIdleCallback` instead) ([ed893f7d98](https://github.com/react/react-native/commit/ed893f7d98053eb47f6ea757b5a917de6c37a58f) by [@rubennorte](https://github.com/rubennorte)) +- **Modal**: Remove deprecated `Modal` `animated` prop ([fd10410d51](https://github.com/react/react-native/commit/fd10410d512423933ff12f4264e975226aa4b351) by [@zoontek](https://github.com/zoontek)) +- **Strict TypeScript API**: Remove deprecated `PublicScrollViewInstance` and `PublicModalInstance` types. Use `ScrollViewInstance` and `ModalInstance` instead. ([74fdfd1eab](https://github.com/react/react-native/commit/74fdfd1eab0812171fc60800b87ca22b3069e721) by [@huntie](https://github.com/huntie)) +- **TurboModules**: Remove the `useTurboModules` feature flag. TurboModules are now always enabled. ([b4a715ca1f](https://github.com/react/react-native/commit/b4a715ca1fe054c835918c971fd5cc930f7e5846) by [@mdvacca](https://github.com/mdvacca)) + +#### Android specific + +- **Dev Server**: Remove unused `DevServerHelper.websocketProxyURL` property (legacy remote JS debugger) ([9cb2e63c87](https://github.com/react/react-native/commit/9cb2e63c87f06aa88ffc1c8c070361ccea54905f) by [@huntie](https://github.com/huntie)) +- **DeviceInfo**: Remove `DisplayMetricsHolder.getWindowDisplayMetrics`, `setWindowDisplayMetrics`, and `getDisplayMetricsWritableMap` ([82536f230f](https://github.com/react/react-native/commit/82536f230fc14d9433fc006224e3b3da24d5838f) by [@zoontek](https://github.com/zoontek)) +- **Hermes**: Remove hermesV1Enabled and simplify the code ([0a5c8c6b4b](https://github.com/react/react-native/commit/0a5c8c6b4bbf90dc9d727f6fe5d0f3d9dd7668f8) by [@cipolleschi](https://github.com/cipolleschi)) +- **Legacy Architecture**: Remove legacy architecture stub `UIImplementation`. This class was already non-functional (all methods were empty stubs). ([cf28e6b73c](https://github.com/react/react-native/commit/cf28e6b73cb8bd4a5b5d03be85a1f9aa24d2623b) by [@cortinico](https://github.com/cortinico)) +- **Legacy Architecture**: Remove legacy architecture stub `UIImplementation`. This class was already non-functional (all methods were empty stubs). ([0825f21171](https://github.com/react/react-native/commit/0825f2117163364e31c61becb974c7ecb2e789d4) by [@cortinico](https://github.com/cortinico)) +- **Performance**: Deprecate `logMarkerBridgeless` and `logTaggedMarkerBridgeless` in favor of `logMarker` and `logTaggedMarker` ([319610d328](https://github.com/react/react-native/commit/319610d3286f4d003e23e51edf2f109e817f41b9) by [@javache](https://github.com/javache)) + +#### iOS specific + +- **Hermes**: Remove the RCT_HERMES_V1_ENABLED from Cocoapods ([940ee8ae0d](https://github.com/react/react-native/commit/940ee8ae0d2a87b01e8e67b11115a1b314806163) by [@cipolleschi](https://github.com/cipolleschi)) +- **Legacy Architecture**: Legacy arch removal: RCTCxxMethod and DispatchMessageQueueThread ([3b764745c4](https://github.com/react/react-native/commit/3b764745c43024316915d3b19a2be884ad33b026) by [@javache](https://github.com/javache)) +- **Native Modules**: Deprecate `TimingModule`; will be removed in a future React Native release ([b0a6386995](https://github.com/react/react-native/commit/b0a63869955d5949ada7289a20b5b6cd29195721) by [@christophpurrer](https://github.com/christophpurrer)) + +### Fixed + +- **Animated**: Fix a surface-stop race in the C++ Animated shared backend that could permanently leak per-surface animated state ([d9d2502b61](https://github.com/react/react-native/commit/d9d2502b612cba72279b036757bf02e0c7dfa67a) by Bartlomiej Bloniarz) +- **Animated**: Fix a race in the C++ Animated render-callback lifecycle that could leave stale callbacks running on every frame ([e442c496b7](https://github.com/react/react-native/commit/e442c496b7dc6109167c3a365174aa70db4b243e) by Bartlomiej Bloniarz) +- **Animated**: Sync JS-side `Animated.Value` with the post-animation value before invoking `Animated.timing(...).start({finished})` callbacks so reads from inside the callback (or from React re-renders it triggers) observe the post-animation value rather than the pre-animation value. Gated behind a new JS-only feature flag, `animatedShouldSyncValueBeforeStartCallback`, defaulting to `true` (set to `false` to opt out). ([ee6958a9f4](https://github.com/react/react-native/commit/ee6958a9f44234ab08bc06aad599cdc34fa5b368) by [@fabriziocucci](https://github.com/fabriziocucci)) +- **Assets**: `react-native/Libraries/Image/AssetRegistry` is removed. Please use the `AssetRegistry` API (apps/library code) and/or the `react-native/asset-registry` entrypoint (Metro/build configs). ([6cfde8f296](https://github.com/react/react-native/commit/6cfde8f2961389e68e29fd64321a9185cdc93fe6) by [@huntie](https://github.com/huntie)) +- **Blob**: Fix `Blob.slice()` for negative start offsets and inverted ranges ([b29dc966a4](https://github.com/react/react-native/commit/b29dc966a42fe3482afcadd28fa09db3310546d7) by [@durvesh1992](https://github.com/durvesh1992)) +- **Documentation**: Removed wrong changelog entry in 0.83.2 ([ef38ba4050](https://github.com/react/react-native/commit/ef38ba40507aca1c50778a3f94a51c4ee6ea191f) by [@chrfalch](https://github.com/chrfalch)) +- **DOM API**: Make `AbortSignal.any()` process its input signals in multiple passes to match the DOM specification ([1136e41bd8](https://github.com/react/react-native/commit/1136e41bd8911f0018d410f332b1253367290406) by [@rubennorte](https://github.com/rubennorte)) +- **DOM API**: Fix `parentNode`/`parentElement` returning the document instead of the containing element for `` and other nested root host views, which severed capture/bubble event propagation to ancestors rendered above them ([e410ff5471](https://github.com/react/react-native/commit/e410ff547179f5c7ad198744f7be88117ccdef0c) by [@rubennorte](https://github.com/rubennorte)) +- **Events**: Fix use-after-free data race in EventEmitter.cpp ([5dea3b5e6c](https://github.com/react/react-native/commit/5dea3b5e6c01743a331105a031ab33e016e64b3a) by generatedunixname1383054420177565) +- **FileReader**: Set `FileReader` `readyState` to `LOADING` during a read so `abort()` correctly emits `abort`/`loadend` ([c00813c6ee](https://github.com/react/react-native/commit/c00813c6eeee93ee98645747beed2605928f2330) by [@durvesh1992](https://github.com/durvesh1992)) +- **Image**: Parse Image srcSet density descriptors consistently ([e4cf0a1cc3](https://github.com/react/react-native/commit/e4cf0a1cc3d629916ff1331a48fd7eff65474f1b) by [@ya-nsh](https://github.com/ya-nsh)) +- **JavaScript API**: Extensionless `react-native/scripts/*` imports are now **mandated**; explicit `.js` import specifiers are rejected. ([97727ba67f](https://github.com/react/react-native/commit/97727ba67f1a4fbf5105f18bca695e272b48b836) by [@huntie](https://github.com/huntie)) +- **MapBuffer**: Avoid `memcpy(_, nullptr, 0)` UB in `MapBufferBuilder::build` for empty / scalar-only MapBuffers ([34ccf4f331](https://github.com/react/react-native/commit/34ccf4f331343ed21259808cb20c4b210912aff3) by [@javache](https://github.com/javache)) +- **Networking**: Base64-encode binary (arraybuffer/blob) response bodies in the C++ NetworkingModule so they are not corrupted when delivered to JS ([1127e54d53](https://github.com/react/react-native/commit/1127e54d539a0bc998ecc43104c7573190a87de1) by [@sathoshik](https://github.com/sathoshik)) +- **Pressable**: Fix hover out timeout stored in wrong variable in Pressability ([74b1a4d026](https://github.com/react/react-native/commit/74b1a4d026482e09103d44c5da81fb802202f0f9) by [@w3di](https://github.com/w3di)) +- **React Native DevTools**: React Native DevTools will no longer briefly flash in the system dock/taskbar when starting Metro ([6aa7e35ec3](https://github.com/react/react-native/commit/6aa7e35ec35b1b08a5354a89a7e9cee2ee9b6ece) by [@huntie](https://github.com/huntie)) +- **React Native DevTools**: Add null check on JNI return value in `JCxxInspectorPackagerConnectionDelegateImpl::connectWebSocket` to prevent null dereference ([fa05b8c88b](https://github.com/react/react-native/commit/fa05b8c88b86f953d1f9b812699e24ea593d8587) by [@shubhamksavita](https://github.com/shubhamksavita)) +- **ReactHost**: Fixed a regression that causes crashes on reload for `ReactCxxPlatform`'s `ReactHost` ([ac81869f05](https://github.com/react/react-native/commit/ac81869f05d74bccc79d78e738619cfc403db767) by [@etodanik](https://github.com/etodanik)) +- **Renderer**: Fixed potential revision drop during merge ([c65845cde2](https://github.com/react/react-native/commit/c65845cde259807eb4892d0e37b80ca65be8c191) by [@j-piasecki](https://github.com/j-piasecki)) +- **Renderer**: Several view, text, scrollview, and accessibility props that the iterator-setter path silently dropped now propagate correctly through `setProp`: `automaticallyAdjustKeyboardInsets`, `dynamicTypeRamp`, `writingDirection`, `experimental_accessibilityOrder`, `transformOrigin`, and the full `borderCurves` cascaded set. ([15b1f5529a](https://github.com/react/react-native/commit/15b1f5529a45be6a1957de0f85b51c0f43ab91c6) by [@javache](https://github.com/javache)) +- **Runtime**: Fix missing format specifier in renderApplication invariant ([bc1a31fb16](https://github.com/react/react-native/commit/bc1a31fb16f0cf1ca92331499c6f2fa4e347dfbf) by [@w3di](https://github.com/w3di)) +- **Runtime**: Fix apps failing to boot ("... not registered as callable") caused by core init not running. ([08c323346b](https://github.com/react/react-native/commit/08c323346be6c0fbbd70900d48435f977a78a1bb) by [@zeyap](https://github.com/zeyap)) +- **Runtime**: Fix app failing to initialize (`HMRClient.setup()` redbox) because the environment setup module was dropped from the bundle ([eb987ef550](https://github.com/react/react-native/commit/eb987ef5504d85ff862b5a679056157888c56960) by [@cipolleschi](https://github.com/cipolleschi)) +- **Strict TypeScript API**: Add missing `textAlignVertical` prop on `` ([e04ff69ab3](https://github.com/react/react-native/commit/e04ff69ab37add0661b3e0a66f0c05917e0f2b8b) by [@huntie](https://github.com/huntie)) +- **Strict TypeScript API**: Add missing `pointerEvents` prop to `Text` component ([a2e042f76a](https://github.com/react/react-native/commit/a2e042f76a9aac30359deb0b06ae7f7db9f2be47) by [@huntie](https://github.com/huntie)) +- **Strict TypeScript API**: Update `getNativeScrollRef` return type across ScrollView, FlatList, and SectionList ([535b844680](https://github.com/react/react-native/commit/535b844680fdd05add3262f73c40c5f50f7bf329) by [@huntie](https://github.com/huntie)) +- **Strict TypeScript API**: Optional property types are now widened to explicitly include `| undefined` for `exactOptionalPropertyTypes` compatibility ([0fc76bb527](https://github.com/react/react-native/commit/0fc76bb5278098649672e0407a3de580b8706fa4) by [@zeyap](https://github.com/zeyap)) +- **Testing**: Fix asyncArrayBufferBorrowNativeBackedTest unconditional skip on Hermes ([9d54391814](https://github.com/react/react-native/commit/9d54391814a27032f4bc1a5e90bee147514be846) by [@christophpurrer](https://github.com/christophpurrer)) +- **Testing**: Re-enabled VirtualizedList "retains batch render region when an item is appended" tes ([c0bf1549c2](https://github.com/react/react-native/commit/c0bf1549c2bb5dc3a90ee7da293c7cf964ced119) by [@chicio](https://github.com/chicio)) +- **Text**: Fix text measurements being incorrectly reused across pixel density changes ([d53c7b52a6](https://github.com/react/react-native/commit/d53c7b52a6d21d78b822af91e817cd8b7d6ee3c8) by [@jehartzog](https://github.com/jehartzog)) +- **Touch Handling**: Suppress `React.Fragment` style warning when used as a child of `TouchableHighlight` ([d7b5314bd8](https://github.com/react/react-native/commit/d7b5314bd853679f753379d2233035922bbc8977) by [@qflen](https://github.com/qflen)) +- **TypeScript**: Preserve doc comments on root API symbols in the generated TypeScript types ([642273788b](https://github.com/react/react-native/commit/642273788b9f6493666240768a582e0ca88c340f) by [@huntie](https://github.com/huntie)) +- **TypeScript**: Add eventCount to TextInputKeyPressEventData type ([886faee2d1](https://github.com/react/react-native/commit/886faee2d140338dba1c3788ec3ac5b4f231157b) by [@pchalupa](https://github.com/pchalupa)) +- **TypeScript**: Add missing pointer event handler types (`onPointerOver`, `onPointerOut`, `onGotPointerCapture`, `onLostPointerCapture`, and their `*Capture` variants) to the TypeScript types ([20931fe975](https://github.com/react/react-native/commit/20931fe9755b62f6487d18325e78468e234ea80f) by [@ahmdshrif](https://github.com/ahmdshrif)) +- **TypeScript**: Update ImageSource.d.ts see reference URL to reflect current repository structure ([6eb07a813d](https://github.com/react/react-native/commit/6eb07a813d2e37daf690dbef1fa0f0a3ae3b884a) by [@ergenekonyigit](https://github.com/ergenekonyigit)) +- **TypeScript**: Expose Modal native ref prop in TypeScript declarations ([7cc8c76e83](https://github.com/react/react-native/commit/7cc8c76e838ca3fb9a036ca5af873c48b0762f99) by [@ya-nsh](https://github.com/ya-nsh)) +- **TypeScript**: Align TypeScript accessibility role definitions with supported React Native accessibility roles ([75e1f06b66](https://github.com/react/react-native/commit/75e1f06b66d3fb5addaaff1be8c7fba0a6552a8b) by [@ya-nsh](https://github.com/ya-nsh)) +- **TypeScript**: Change `FlatList.getNativeScrollRef` return type definition to allow accessing the underlying `HostInstance`. ([5162816e03](https://github.com/react/react-native/commit/5162816e035f29ee1743cd00a3f93522b5c1abfe) by [@janpe](https://github.com/janpe)) +- **TypeScript**: Fix missing and incorrect types in `AccessibilityInfo` TypeScript definitions ([4255f9bd89](https://github.com/react/react-native/commit/4255f9bd899a4730298d7ec808def1e062bd81f2) by [@huntie](https://github.com/huntie)) +- **Yoga**: Include a node's padding and border in its automatic minimum size when it has a measure function ([91886f7c88](https://github.com/react/react-native/commit/91886f7c8847dd91fe5fd1390bdfa462f0e465c7) by [@adityasharat](https://github.com/adityasharat)) +- **Yoga**: Crash: YogaLayoutableShadowNode.cpp: function layout: assertion failed (YGNodeGetOwner(childYogaNode) == &yogaNode_) https://github.com/react/react-native/issues/52349 ([6fa330693f](https://github.com/react/react-native/commit/6fa330693fba313a2fe1121545c1efd558b60983) by [@5ZYSZ3K](https://github.com/5ZYSZ3K)) + +#### Android specific + +- **Accessibility**: Issue when clearing accessibilityLabelledBy ([63dec777d9](https://github.com/react/react-native/commit/63dec777d9cf0f2a32acbadf4c6ed5aca0b736a4) by [@rozele](https://github.com/rozele)) +- **Accessibility**: Screen reader behavior for accessibilityState expanded ([fafcfcd5f6](https://github.com/react/react-native/commit/fafcfcd5f6eedf96c7fedc9ba6f04f680f2ae01d) by [@rozele](https://github.com/rozele)) +- **Animated**: Prevent "Mapped property node does not exist" crash in `PropsAnimatedNode.updateView` when a mapped node is removed during an in-flight native animation ([53369ed321](https://github.com/react/react-native/commit/53369ed3216d973b52fd825001a53434137da4a6) by [@shashank-bhatotia](https://github.com/shashank-bhatotia)) +- **Animated**: Fix deadlock between the UI and JS threads when native animations start while a synchronous VirtualView mode-change event is dispatched ([b96b626297](https://github.com/react/react-native/commit/b96b626297f951187ab2146ee0ef80292b6ba5c3) by [@coado](https://github.com/coado)) +- **Build**: Guard missing autolinked JNI directories in generated CMake during native clean/model configuration. ([948835d944](https://github.com/react/react-native/commit/948835d9448ce7e06ef8d3cfbfaf177b396e1ab3) by [@Phecda](https://github.com/Phecda)) +- **Dev Menu**: Fix Dev Menu Settings crash in debugOptimized builds ([2fb4f13fbf](https://github.com/react/react-native/commit/2fb4f13fbff992c5bd53ad4571be046d2f30f10e) by [@Phecda](https://github.com/Phecda)) +- **Dev Server**: Reduced memory usage during JS bundle downloads by eliminating intermediate buffer copies ([57eb56fbf5](https://github.com/react/react-native/commit/57eb56fbf5658170026b82bba04358e58237eb70) by [@DorianMazur](https://github.com/DorianMazur)) +- **Gradients**: Fix incorrect color stop positions in gradients when a positioned stop is immediately followed by an unpositioned stop ([cb63782554](https://github.com/react/react-native/commit/cb637825540a14f2bdde13fa753f4935105f4713) by [@nduaarte](https://github.com/nduaarte)) +- **Image**: Fix `Image.getSize()` failing for local drawable resource URIs including VectorDrawables ([aea8785d66](https://github.com/react/react-native/commit/aea8785d661b6269aedb75f472319dc48519563d) by [@Abbondanzo](https://github.com/Abbondanzo)) +- **Image**: Source props in image headers in Android ([eeb17badf6](https://github.com/react/react-native/commit/eeb17badf6d87166000d50de76dea5b19ea73968) by [@humaidk2](https://github.com/humaidk2)) +- **PointerEvents**: Register pointer capture event handlers in the Android base view config ([74382cacd8](https://github.com/react/react-native/commit/74382cacd870115fd7549dff1cf0ef2e54075769) by [@yaminyassin](https://github.com/yaminyassin)) +- **React Native DevTools**: Show request body preview for FormData and file uploads in DevTools Network tab ([48fe6df3d2](https://github.com/react/react-native/commit/48fe6df3d2b2d72138bda212354443c22c60302f) by [@HarshitMadhav](https://github.com/HarshitMadhav)) +- **Renderer**: Avoid crash in SurfaceMountingManager when sendAccessibilityEvent or setJSResponder is called for a missing or deleted view state. ([8eb4240d36](https://github.com/react/react-native/commit/8eb4240d3661e00920af513ff0e864593c1978a0) by [@ManasGuptaSprinklr](https://github.com/ManasGuptaSprinklr)) +- **Renderer**: Fix crash in Scheduler::animationTick when uiManager_ is null. ([e73592ba51](https://github.com/react/react-native/commit/e73592ba51e00b5789dfb3d445c8d19834f9f66e) by [@shubhamksavita](https://github.com/shubhamksavita)) +- **Renderer**: Fix commit branching dropping updates when `enableAccumulatedUpdatesInRawPropsAndroid` is not enabled. ([bcadedaba4](https://github.com/react/react-native/commit/bcadedaba45ad71405d7dfd6696534dc62655c3e) by [@j-piasecki](https://github.com/j-piasecki)) +- **Runtime**: Use explicit `ReactInstanceManager.mHasStartedDestroyingLock` instead of using `ReactInstanceManager.mHasStartedDestroying` ([f500f4239c](https://github.com/react/react-native/commit/f500f4239c8d029242223f73179f46e2d3c81abd) by [@Yqwed](https://github.com/Yqwed)) +- **Runtime**: JSModule method without args are correctly dispatched ([949b8049df](https://github.com/react/react-native/commit/949b8049dfeb4f5cf449284f9d37093641757a1a) by [@javache](https://github.com/javache)) +- **ScrollView**: Catch IllegalArgumentException in ScrollView.onTouchEvent to prevent crashes from a known Android framework multi-touch bug ([d672c96445](https://github.com/react/react-native/commit/d672c96445eff16da06baa95b63c44fd13be47ab) by [@tomekzaw](https://github.com/tomekzaw)) +- **StatusBar**: Prevent `IllegalArgumentException` crash in `statusBarShow`/`statusBarHide` when the window decorView is detached ([a54b04e94b](https://github.com/react/react-native/commit/a54b04e94b174fd4b91256bddd3944ef8dfdc8c5) by [@alanleedev](https://github.com/alanleedev)) +- **StatusBar**: Prevent `IllegalArgumentException` crash in `StatusBarModule` when activity is destroyed before the UI thread runnable executes ([732b848a8e](https://github.com/react/react-native/commit/732b848a8e94480fb448da0c93b21eb49413e186) by [@alanleedev](https://github.com/alanleedev)) +- **StyleSheet**: Correct logical border radius mapping for `borderEndStartRadius` and `borderStartEndRadius`. ([ad2cf4d1d7](https://github.com/react/react-native/commit/ad2cf4d1d795f0bfeac836156b51828c5c97cb4a) by [@nikhilpakhloo](https://github.com/nikhilpakhloo)) +- **StyleSheet**: Fix crash in SkewMatrixHelper ([9e3a0df61e](https://github.com/react/react-native/commit/9e3a0df61e22a17b09d1e0865436d5f0da569a7e) by [@javache](https://github.com/javache)) +- **StyleSheet**: SkewX / skewY transforms now render correctly on Android Q+. ([62903bc3e2](https://github.com/react/react-native/commit/62903bc3e2da9028105c5f0e6090889a700a4fef) by [@qflen](https://github.com/qflen)) +- **Text**: Prevent descenders from being clipped when Android text lineHeight matches fontSize ([bb3c121073](https://github.com/react/react-native/commit/bb3c121073a84cd14553bbee036f325eeb294478) by [@TorinAsakura](https://github.com/TorinAsakura)) +- **Text**: Account for Android Bold text font weight adjustment when measuring Text. ([d833014948](https://github.com/react/react-native/commit/d8330149481c9227a6acf05ff8c1a1bea3a5af54) by [@TorinAsakura](https://github.com/TorinAsakura)) +- **Text**: Fix text decoration line thickness regression on Android ([9f20cde724](https://github.com/react/react-native/commit/9f20cde7241184447a84c52150dd27a2406b1048) by [@cortinico](https://github.com/cortinico)) +- **Text**: Fix text decoration color not matching foreground color when `textDecorationColor` is not set ([2da0244c16](https://github.com/react/react-native/commit/2da0244c16310aeff253219f7e9d5001e5e5d00b) by [@cortinico](https://github.com/cortinico)) +- **TextInput**: Fix ClassCastException crash on Android 9 and below when an IME submit action races the unmount of a TextInput ([97aa7ad272](https://github.com/react/react-native/commit/97aa7ad2723fb8267f1737d4f7389dbbb9820517) by [@shahidrogers](https://github.com/shahidrogers)) +- **TextInput**: Fix `TextInput` placeholder staying on multiple lines after `multiline` is toggled from `true` back to `false` ([df6de4f758](https://github.com/react/react-native/commit/df6de4f758308e30a0df8e08ad41fec78219ca6d) by [@Abbondanzo](https://github.com/Abbondanzo)) +- **TextInput**: Preserve secure TextInput password character reveal timing when JS state echoes the same text. ([08731165f5](https://github.com/react/react-native/commit/08731165f583e6dae344ea80ae4f9051aac0ff48) by [@sorinc03](https://github.com/sorinc03)) +- **Touch Handling**: Prevent React Native containers from delaying native touches ([d8f71837f8](https://github.com/react/react-native/commit/d8f71837f8db1b9bdd3be7c7df0d5b5c476e4bac) by [@j-piasecki](https://github.com/j-piasecki)) +- **TurboModules**: Fix pure C++ turbo modules not working without `includesGeneratedCode: true` ([c789880517](https://github.com/react/react-native/commit/c7898805178dd7881c745185a5915ce2c4cf3c1d) by [@satya164](https://github.com/satya164)) +- **ViewManagers**: Fix NullPointerException in `ReactProgressBarViewManager.measure()` when invoked with null `localData` or `state` (for example, from the upcoming CSS Flexbox ยง4.5 auto-min-size probe in Yoga). ([ef683f7010](https://github.com/react/react-native/commit/ef683f7010beaad08b5c3130f8ca5ec497072b9c) by [@adityasharat](https://github.com/adityasharat)) + +#### iOS specific + +- **Build**: Fix React-RCTAnimatedModuleProvider build by adding the missing Yoga dependency and a missing space between compiler flags ([08ef7b18d2](https://github.com/react/react-native/commit/08ef7b18d270914c59561873532b5d6d06c4d97b) by [@zoontek](https://github.com/zoontek)) +- **Build**: Fix "redefinition of 'HighResDuration'" / "could not build module 'React'" when building Swift pods with C++ interop against the prebuilt React-Core artifact ([9847238e3f](https://github.com/react/react-native/commit/9847238e3fc2badce8eeea659c4990aba1366d9b) by [@chrfalch](https://github.com/chrfalch)) +- **Build**: Fix "The project 'Pods' is damaged and cannot be opened" when a library uses `spm_dependency` and the generated UUID collides with an existing Pods project object ([1cdf784a06](https://github.com/react/react-native/commit/1cdf784a068e2ed16842b74c0b87b7ff7532fe03) by [@chrfalch](https://github.com/chrfalch)) +- **Build**: Ship React-Core's privacy manifest and localized strings (RCTI18nStrings) inside the prebuilt React.xcframework, so CocoaPods-prebuilt and SwiftPM apps include them ([77b75122ef](https://github.com/react/react-native/commit/77b75122ef9ed172012d7c6acb335f966d4ede79) by [@chrfalch](https://github.com/chrfalch)) +- **Build**: Fix "redefinition of module" build failure on Xcode 26.3 for pods using `spm_dependency` with prebuilt React Native core ([4a6620703c](https://github.com/react/react-native/commit/4a6620703c30b3f53917812720528684838d3bbf) by [@chrfalch](https://github.com/chrfalch)) +- **Build**: Fix Swift C++-interop build failure (implicit copy constructor of TraceRecordingState/HostTracingProfile) for libraries using cxx interop with prebuilt React Native core ([38611186f5](https://github.com/react/react-native/commit/38611186f5867bd578a269872986a5753c8b41fe) by [@chrfalch](https://github.com/chrfalch)) +- **Build**: Keep the prebuilt `Headers/` in place on a Debug/Release configuration switch so the React explicit module still resolves its module map ([df5e6f6a42](https://github.com/react/react-native/commit/df5e6f6a42eeaa431d9130aa185d0f3540aee961) by [@chrfalch](https://github.com/chrfalch)) +- **Build**: Write the prebuilt module-map flag to `OTHER_CPLUSPLUSFLAGS` so C++/ObjC++ sources resolve the relocated namespaces modularly ([14fe96ab51](https://github.com/react/react-native/commit/14fe96ab51554cac899ca49c8d50629aea421d54) by [@chrfalch](https://github.com/chrfalch)) +- **Build**: Prebuilt `ReactNativeHeaders.xcframework` now ships the Hermes public headers so consumers resolve `` out of the box ([43b44ed7c3](https://github.com/react/react-native/commit/43b44ed7c30ebe331ba58ef841a89dcae37301d8) by [@chrfalch](https://github.com/chrfalch)) +- **Codegen**: Fix codegen script phase error logging in `script_phases.sh` ([f14207f9bd](https://github.com/react/react-native/commit/f14207f9bd83c42b0841d6157676a0477bc0b3b3) by [@fallintoplace](https://github.com/fallintoplace)) +- **Dev Menu**: Allow iOS apps with the dev menu enabled (`RCT_DEV_MENU`) to connect to Metro via "Change Bundle Location" ([94380cb4ad](https://github.com/react/react-native/commit/94380cb4ad18eba4164f44bd9a2c9afcef82db43) by [@fmacinator](https://github.com/fmacinator)) +- **Hermes**: Fix debug Hermes being silently embedded in Release builds after the hermes-engine pod is re-installed ([62a2b386c9](https://github.com/react/react-native/commit/62a2b386c91985a46ee048dfa6e2216ba42a7e89) by [@tjzel](https://github.com/tjzel)) +- **Image**: Fix a data race in `RCTImageLoader` loader and decoder lazy initialization that could crash with `EXC_BAD_ACCESS` ([7ed17c9d09](https://github.com/react/react-native/commit/7ed17c9d09e7d45bcaca8c0c7c4a495b58dcc69d) by Miklรณs Fazekas) +- **Legacy Architecture**: Add missing `RCT_REMOVE_LEGACY_COMPONENT_INTEROP` guard to `LegacyViewManagerInteropComponentDescriptor` ([510cc0c5ec](https://github.com/react/react-native/commit/510cc0c5eccc0d921d9fcdeeb4d21ce9d57b6400) by [@christophpurrer](https://github.com/christophpurrer)) +- **LogBox**: Remove unsafe window manipulation in [RCTLogBoxView](vscode-file://vscode-app/c:/Users/agloryvimalabai/AppData/Local/Programs/Microsoft%20VS%20Code/0958016b2a/resources/app/out/vs/code/electron-browser/workbench/workbench.html) dealloc to prevent crash with SceneDelegate ([4f825d3469](https://github.com/react/react-native/commit/4f825d346924f71d80c98f4b7ba260f55ac06f52) by [@aswinandro](https://github.com/aswinandro)) +- **Modal**: Prevent Alert and Modal from rendering in the top-left corner ([859bdb89e5](https://github.com/react/react-native/commit/859bdb89e592f6879c1140eb900ae5baeb352bb9) by [@zoontek](https://github.com/zoontek)) +- **Performance**: Expose the bridgeless performance logger via `RCTBridgeProxy` and post `RCTJavaScriptDidLoadNotification`, so native startup-perf consumers work in bridgeless ([9568de5a2d](https://github.com/react/react-native/commit/9568de5a2dd1277f7cb3051d394475e5cd1130e3) by [@fkgozali](https://github.com/fkgozali)) +- **Renderer**: Add an explicit wake up call to the main loop hen scheduling a React revision merge ([0cdb59f1b4](https://github.com/react/react-native/commit/0cdb59f1b45b6c15ed9e96cc59927a143bcf5d4c) by [@j-piasecki](https://github.com/j-piasecki)) +- **StyleSheet**: Fixed percentage-based border radius ([b4966128af](https://github.com/react/react-native/commit/b4966128af2ecb7370373e7639b36e0b345cbfb1) by [@j-piasecki](https://github.com/j-piasecki)) +- **Touch Handling**: Fix TypeError crash in ResponderTouchHistoryStore when changedTouches is undefined ([2c6cb27f88](https://github.com/react/react-native/commit/2c6cb27f88f418b4fdecaf592484ac14b67dcca2) by generatedunixname1608173377072046) +- **TurboModules**: Always return true in RCTTurboModuleEnabled ([aee4a2586e](https://github.com/react/react-native/commit/aee4a2586ede308a85d2a0c5abe2e941defb86fd) by [@christophpurrer](https://github.com/christophpurrer)) +- **TurboModules**: Deprecate RCTTurboModuleEnabled() and RCTEnableTurboModule() ([feede1422b](https://github.com/react/react-native/commit/feede1422b3acce4c2de095113466e34d84b3486) by [@christophpurrer](https://github.com/christophpurrer)) + +### Security + +- **Dependencies**: Fix security vulnerabilities in `xmldom/xmldom`, `fast-xml-parser`, `yaml`, `fast-uri`, and `addressable` transitive dependencies ([284035b21d](https://github.com/react/react-native/commit/284035b21d94a0b2096b3aa3f39470747d191a57) by [@cortinico](https://github.com/cortinico)) + +## v0.86.2 + +### Fixed + +- **Layout:** Fixed `display: contents` nodes having `hasNewLayout` set incorrectly ([36f69eff0d](https://github.com/react/react-native/commit/36f69eff0d11510f4f16075d9cfbbe474a0683be) by [@j-piasecki](https://github.com/j-piasecki)) + +#### Android + +- **Runtime:** Use explicit `ReactInstanceManager.mHasStartedDestroyingLock` instead of using `ReactInstanceManager.mHasStartedDestroying` ([cdfba520fa](https://github.com/react/react-native/commit/cdfba520fa56a6b3dbb133d9c8060e4e698bc8a0) by [@jingjing2222](https://github.com/jingjing2222)) +- **Runtime:** Do not synchronize on `java.lang.Boolean`. ([@821045a24f](https://github.com/react/react-native/commit/821045a24f07f798351c72d23a01720a2123049d) by [Yqwed](https://github.com/yqwed)) +### Changed + +- **Hermes:** Bump Hermes V1 to 250829098.0.16 ([95538111bf](https://github.com/react/react-native/commit/95538111bf24b5d5269724714e415b38b6395d1a) by [@gabrieldonadel](https://github.com/gabrieldonadel)) + +## v0.86.1 + +- This release got burned because of an issue with Maven + ## v0.86.0 ### Added @@ -595,6 +931,30 @@ - **Touch Handling**: Respect `cancelsTouchesInView` when canceling touches in `RCTSurfaceTouchHandler` ([5634e8a601](https://github.com/facebook/react-native/commit/5634e8a601caf0faa174bac3511929de767609ac) by [@intmain](https://github.com/intmain)) - **View**: Fix duplicate shadow bug during component recycling by cleaning up visual layers in prepareForRecycle ([7dcedf1def](https://github.com/facebook/react-native/commit/7dcedf1def880163ab7ca07b2575a8153029a925) by Atharv Soni) +## v0.83.10 + +### Added + +#### iOS specific + +- **Prebuild**: Cache prebuilt iOS binaries in `~/Library/Caches/ReactNative` so Hermes, ReactNativeDependencies and ReactNativeCore tarballs are reused across clean installs and projects instead of being re-downloaded from Maven ([9a0b05b8d0](https://github.com/react/react-native/commit/9a0b05b8d07f3468a08077119189406d56a230ba) by [@cipolleschi](https://github.com/cipolleschi)) + +### Fixed + +- **React Native DevTools**: Fix a bug where we would incorrectly flag apps using additional Hermes runtimes (e.g. Reanimated) as being multi-host ([c800503214](https://github.com/react/react-native/commit/c8005032140f1aff16027b5ed53caea6c9d299f5) by [@huntie](https://github.com/huntie)) +- **Yoga**: Fixed Yoga node ownership when `display: contents` is used in absolutely positioned subtrees ([f2f92098dd](https://github.com/react/react-native/commit/f2f92098ddf996d3f75cfbaa143d7151c29776f7) by [@j-piasecki](https://github.com/j-piasecki)) +- **Yoga**: Fixed `display: contents` nodes having `hasNewLayout` set incorrectly ([2546ce4d82](https://github.com/react/react-native/commit/2546ce4d8219050fcd1bf432c7c830c9fd70c9af) by [@j-piasecki](https://github.com/j-piasecki)) + +#### Android specific + +- **Networking**: `fetch()` response URL is now correct after a redirect ([fbe6a686e6](https://github.com/react/react-native/commit/fbe6a686e65e70dd61700413084ddc54c0b86765) by [@MarkCSmith](https://github.com/MarkCSmith)) +- **React Native DevTools**: Limit WebSocket queue size for the packager connection to prevent the Android inspector from being force-disconnected on large payloads ([7164f96d58](https://github.com/react/react-native/commit/7164f96d581115e6a7a5646a50ded8e5fdff7742) by [@huntie](https://github.com/huntie)) + +#### iOS specific + +- **CocoaPods**: Make Podfile.lock SPEC CHECKSUMS deterministic across machines by sorting Dir.glob results in Yoga.podspec and using a dynamically computed Pods-relative path in hermes-engine.podspec ([64c9663152](https://github.com/react/react-native/commit/64c9663152879a87d061a3f01b9e9c4e98cc73bc) by [@IsaacIsrael](https://github.com/IsaacIsrael)) +- **View**: Fixes crash when changing the value of `removeClippedSubviews` ([91e3f773b7](https://github.com/react/react-native/commit/91e3f773b7e571a503b57e09a1cb8a44ff26cd1e) by [@javache](https://github.com/javache)) + ## v0.83.8 ### Fixed @@ -669,7 +1029,6 @@ - **Appearance**: Fix color scheme in appearance state after setting it to unspecified ([08d1764530](https://github.com/facebook/react-native/commit/08d176453095db99300aa77632603ab42c57e152) by [@ismarbesic](https://github.com/ismarbesic)) - **Assets**: Handle `unstable_path` query param in asset URLs ([42986f27a0](https://github.com/facebook/react-native/commit/42986f27a0285e501f71cf5cedacedefdc44c74e) by [@tido64](https://github.com/tido64)) -- **Networking**: Fix incorrect `fetch()` response URL after redirect (https://github.com/facebook/react-native/issues/55248) ([fbe6a686e6](https://github.com/facebook/react-native/commit/fbe6a686e65e70dd61700413084ddc54c0b86765) by [@MarkCSmith](https://github.com/MarkCSmith)) #### Android specific diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 000000000000..43c994c2d361 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1 @@ +@AGENTS.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 786600c1a622..17b845f0ae1d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,7 +1,6 @@ # Contributing to React Native Thank you for your interest in contributing to React Native! From commenting on and triaging issues, to reviewing and sending Pull Requests, all contributions are welcome. -We aim to build a vibrant and inclusive [ecosystem of partners, core contributors, and community](ECOSYSTEM.md) that goes beyond the main React Native GitHub repository. To learn more about how to contribute check out the Contributing section on the React Native website: * https://reactnative.dev/contributing/overview diff --git a/ECOSYSTEM.md b/ECOSYSTEM.md index 2b7e0653221a..68c20f711446 100644 --- a/ECOSYSTEM.md +++ b/ECOSYSTEM.md @@ -1,85 +1,5 @@ # The React Native Ecosystem -We aim to build a vibrant and inclusive ecosystem of partners, core contributors, and community that goes beyond the main React Native GitHub repository. This document explains the roles and responsibilities of various stakeholders and provides guidelines for the community organization. The structure outlined in this document has been in place for a while but had not been written down before. +The React Native project is now part of the [React Foundation](https://react.foundation/). -There are three types of stakeholders: - -* **Partners:** Companies significantly invested in React Native and take responsibility for the React Native vision and community. -* **Core Contributors:** Individual people who contribute to the React Native project. -* **Community Contributors:** Individuals who support projects in the [react-native-community](https://github.com/react-native-community) organization. - -## Partners - -Partners are companies that are significantly invested in React Native and demonstrate ownership. Informed by their use of React Native, they push for improvements of the core and/or the ecosystem around it. Examples of this may include large scale contributions to `react-native` or owning essential tools or libraries. - -Partners think of React Native as a product; they understand the trade offs that the project makes as well as future plans and goals. Together we shape the vision for React Native to make it the best way to build applications. - -### Application process -To become a React Native partner, an existing partner needs to refer and champion your application. Partners will undergo a 3 month incubating period, after which Partners will vote to convert to full membership. - -Partnership is not a status symbol, it is a commitment to invest significant resources into improving React Native. - -Maintaining partner status requires consistently meeting the baseline responsibilities, including: -* Attending monthly meeting. -* Contributing to the release process. -* Engaging in the core contributor Discord. - -Examples of contributing to the release include being a [community releaser](https://reactnative.dev/contributing/release-roles-responsibilities#release-role-2-community-releaser), testing new releases, and technical support for release issues. - -### Current partners: -* **[Coinbase](https://www.coinbase.com/):** Publishes [posts](https://blog.coinbase.com/tagged/react-native) advocating React Native usage. Supports `@react-native-community/datetimepicker` and other community modules to migrate to the new architecture. Supports releases in testing and feedback. -* **[Callstack](https://callstack.com/):** Maintains [React Native Community CLI](https://github.com/react-native-community/cli), develops [RNEF](https://rnef.dev), [Re.Pack](https://re-pack.dev) and [other community libraries](https://github.com/callstack). Hosts [React Universe Conf](https://www.reactuniverseconf.com/) and [React Universe On Air](https://www.callstack.com/podcast). -* **[Expo](https://expo.dev/):** Builds [Expo Go and SDK](https://github.com/expo/expo), [Snack](https://snack.expo.dev/), and [Expo Application Services](https://expo.dev/eas). Maintains [React Native Directory](https://reactnative.directory/), stewards [React Navigation](https://reactnavigation.org/) along with other partners. -* **[Infinite Red](https://infinite.red/):** Maintains the [ignite cli/boilerplate](https://github.com/infinitered/ignite), organizes [Chain React Conf](https://cr.infinite.red/), hosts the [React Native Radio podcast](https://reactnativeradio.com), publishes the [React Native Newsletter](https://reactnativenewsletter.com) -* **[Meta](https://opensource.fb.com/):** Oversees the React Native product and maintains the [React Native core repo](https://reactnative.dev/) -* **[Microsoft](https://twitter.com/ReactNativeMSFT):** Develops [React Native Windows](https://github.com/Microsoft/react-native-windows) and [React Native macOS](https://github.com/microsoft/react-native-macos) for building apps that target Windows and macOS; maintains [rnx-kit](https://github.com/microsoft/rnx-kit), [react-native-test-app](https://github.com/microsoft/react-native-test-app) and coordinates cross-companies efforts such as the [bundle working group](https://github.com/microsoft/rnx-kit/discussions/categories/bundle-working-group). -* **[Shopify](https://www.shopify.com/):** Maintains React Native open source libraries such as [flash-list](https://github.com/Shopify/flash-list) or [@shopify/react-native-skia](https://github.com/Shopify/react-native-skia) and sponsors Software Mansion. -* **[Software Mansion](https://swmansion.com/):** Maintain core infrastructure including JSC, Animated, and other popular third-party plugins and organizes [App.js Conf](https://appjs.co/) -* **[Wix.com](https://wix.engineering/open-source):** Maintains a variety of React Native open source projects ([see all](https://github.com/orgs/wix/repositories?q=react-native)), including: [Detox](https://wix.github.io/Detox/) end-to-end testing library for React Native apps, [RN UILib](https://wix.github.io/react-native-ui-lib/), [RN Navigation](https://wix.github.io/react-native-navigation/), [RN Calendars](https://wix.github.io/react-native-calendars/) and [RN Notifications](https://github.com/wix/react-native-notifications). - -### Incubating partners: -* **[Expensify](https://expensify.com/):** Developing [Expensify Chat](https://github.com/Expensify/App), an open-source React Native app built by the community, while [sponsoring dependencies](https://github.com/orgs/Expensify/sponsoring), conferences, and New Architecture advancements. -* **[Sentry](https://sentry.io/for/react-native/):** Develops Error and Performance Monitoring [SDK for React Native](https://github.com/getsentry/sentry-react-native) and [New Architecture Turbo Modules Mixed Stack Traces](https://github.com/reactwg/react-native-new-architecture/discussions/122). - -When you are contributing to React Native, you'll most likely meet somebody who works at one of the partner companies and who is a core contributor. - -## Core Contributors - -Core contributors are individuals who contribute to the React Native project. A core contributor is somebody who displayed a lasting commitment to the evolution and maintenance of React Native. The work done by core contributors includes responsibilities mentioned in the โ€œPartnersโ€ section above, and concretely means that they: - -* Consistently contribute high quality changes, fixes and improvements -* Actively review changes and provide quality feedback to contributors -* Manage the release process of React Native by maintaining release branches, communicating changes to users and publishing releases -* Love to help out other users with issues on GitHub -* Mentor and encourage first time contributors -* Identify React Native community members who could be effective core contributors -* Help build an inclusive community with people from all backgrounds -* Are great at communicating with other contributors and the community in general - -These are behaviors we have observed in our existing core contributors. They aren't strict rules but rather outline their usual responsibilities. We do not expect every core contributor to do all of the above things all the time. Most importantly, we want to create a supportive and friendly environment that fosters collaboration. Above all else, **we are always polite and friendly.** - -Core contributor status is attained after consistently contributing and taking on the responsibilities outlined above and granted by other core contributors. Similarly, after a long period of inactivity (~6 months or more), a core contributor may be contacted to understand if theyโ€™re still interested in being part of the program. - -You can use this [form](https://forms.gle/4jpA4QeNUvAUDnNe8) to either: -* Apply yourself to become a Core Contributor. Make sure to include a list of valuable contributions you did to the React Native repository and ecosystem. -* Nominate someone to become a Core Contributor. - -As a core contributor, you will have access to the core contributor Discord which is used for light-weight coordination and discussion. - -**We aim to make contributing to React Native as easy and transparent as possible.** We have discussion groups dedicated to the [new architecture rollout](https://github.com/reactwg/react-native-new-architecture), [releases](https://github.com/reactwg/react-native-releases), and [general questions and proposals](https://github.com/react-native-community/discussions-and-proposals). We are always looking for active, enthusiastic members of the React Native community to become core contributors. - -## Community Contributors - -Community contributors are individuals who support projects in the [react-native-community](https://github.com/react-native-community) organization. This organization exists as an incubator for high quality components that extend the capabilities of React Native with functionality that many but not all applications require. Meta engineers will provide guidance to help build a vibrant community of people and components that make React Native better. - -This structure has multiple benefits: - -* Keep the core of React Native small, which improves performance and reduces the surface area -* Provide visibility to projects through shared representation, for example on the React Native website or on Twitter -* Ensure a consistent and high standard for code, documentation, user experience, stability and contributions for third-party components -* Upgrade the most important components right away when we make breaking changes and move the ecosystem forward at a fast pace -* Find new maintainers for projects that are important but were abandoned by previous owners - -Additionally, some companies may choose to sponsor the development of one or many of the packages that are part of the community organization. They will commit to maintain projects, triage issues, fix bugs and develop features. In turn, they will be able to gain visibility for their work, for example through a mention of active maintainers in the README of individual projects after a consistent period of contributions. Such a mention may be removed if maintainers abandon the project. - -If you are working on a popular component and would like to move it to the React Native community, please create an issue on the [discussions-and-proposals repository](https://github.com/react-native-community/discussions-and-proposals). +The ecosystem information previously maintained in this document has been superseded by the [React Foundation website](https://react.foundation/). Visit the website for current information about the React Native ecosystem. diff --git a/Gemfile b/Gemfile index e9b4cc2be6d7..e7162a4dadb6 100644 --- a/Gemfile +++ b/Gemfile @@ -3,10 +3,17 @@ source 'https://rubygems.org' # You may use http://rbenv.org/ or https://rvm.io/ to install and use this version ruby ">= 2.6.10" +# concurrent-ruby >= 1.3.5 no longer requires 'logger', and activesupport 6.1.x +# references Logger without requiring it, so `bundle exec pod` crashes with +# "uninitialized constant ActiveSupport::LoggerThreadSafeLevel::Logger". A bare +# `gem 'logger'` is not enough because bundler does not auto-require Gemfile gems; +# require it here so it is loaded before cocoapods loads active_support. +require 'logger' + gem 'cocoapods', '~> 1.13', '!= 1.15.0', '!= 1.15.1' gem 'activesupport', '>= 6.1.7.5', '< 7.1.0' gem 'xcodeproj', '< 1.26.0' -gem 'concurrent-ruby', '<= 1.3.4' +gem 'concurrent-ruby', '>= 1.3.7' # Ruby 3.4.0 has removed some libraries from the standard library. gem 'bigdecimal' diff --git a/Gemfile.lock b/Gemfile.lock index 8eb0039d4c08..cc3096498876 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -55,7 +55,7 @@ GEM netrc (~> 0.11) cocoapods-try (1.2.0) colored2 (3.1.2) - concurrent-ruby (1.2.2) + concurrent-ruby (1.3.7) escape (0.0.4) ethon (0.16.0) ffi (>= 1.15.0) @@ -97,7 +97,7 @@ DEPENDENCIES benchmark bigdecimal cocoapods (~> 1.13, != 1.15.1, != 1.15.0) - concurrent-ruby (<= 1.3.4) + concurrent-ruby (>= 1.3.7) logger mutex_m xcodeproj (< 1.26.0) diff --git a/README.md b/README.md index b4280bb6abd8..7a547ce921d1 100644 --- a/README.md +++ b/README.md @@ -1,34 +1,25 @@ -

- - React Native - -

+

+ + + + React Native logo + +

Learn once, write anywhere:
- Build mobile apps with React. + Create native apps for Android, iOS, and more using React

- - React Native is released under the MIT license. - - - Current npm package version. - - - PRs are welcome! - - - Follow @reactnative on X - - - Follow @reactnative.dev on Bluesky - + React Native is released under the MIT license + Current npm package version + Monthly npm downloads + Follow @reactnative on X

-

- Getting Started +

+ Getting Started ยท Learn the Basics ยท @@ -38,107 +29,77 @@ ยท Community ยท - Support -

- -React Native brings [**React**'s][r] declarative UI framework to iOS and Android. With React Native, you use native UI controls and have full access to the native platform. - -- **Declarative.** React makes it painless to create interactive UIs. Declarative views make your code more predictable and easier to debug. -- **Component-Based.** Build encapsulated components that manage their state, then compose them to make complex UIs. -- **Developer Velocity.** See local changes in seconds. Changes to JavaScript code can be live reloaded without rebuilding the native app. -- **Portability.** Reuse code across iOS, Android, and [other platforms][p]. + Support + -React Native is developed and supported by many companies and individual core contributors. Find out more in our [ecosystem overview][e]. +# React Native -[r]: https://react.dev/ -[p]: https://reactnative.dev/docs/out-of-tree-platforms -[e]: https://github.com/facebook/react-native/blob/HEAD/ECOSYSTEM.md +React Native lets you build native apps using [React](https://react.dev/). Written +in JavaScript, rendered with native code. -## Contents +- **Native UI.** React Native primitives render to native platform UI, meaning your app + uses the same native platform APIs other apps do. Gestures, text scaling, and + accessibility behave the way users expect on each OS. +- **React, everywhere.** Declarative UI, components, hooks, and Suspense, reused + across Android, iOS, and [other platforms](https://reactnative.dev/docs/out-of-tree-platforms). +- **Developer Velocity.** See local changes in seconds. Changes to JavaScript code are applied with Fast Refresh, without rebuilding the native app. +- **Extend it yourself.** Native Modules let you call platform code directly from JavaScript, synchronously and type-safe โ€” or reach for [thousands of existing libraries](https://reactnative.directory/). -- [Requirements](#-requirements) -- [Building your first React Native app](#-building-your-first-react-native-app) -- [Documentation](#-documentation) -- [Upgrading](#-upgrading) -- [How to Contribute](#-how-to-contribute) -- [Code of Conduct](#code-of-conduct) -- [License](#-license) +React Native is developed and supported by many companies and individual core contributors. Find out more on the [React Foundation website](https://react.foundation/). +## Building your first React Native app -## ๐Ÿ“‹ Requirements +Follow the [Getting Started guide](https://reactnative.dev/docs/environment-setup) for a new app, or [Integration with Existing Apps](https://reactnative.dev/docs/integration-with-existing-apps) to adopt React Native incrementally. -React Native apps may target iOS 15.1 and Android 7.0 (API 24) or newer. You may use Windows, macOS, or Linux as your development operating system, though building and running iOS apps is limited to macOS. Tools like [Expo](https://expo.dev) can be used to work around this. +### Using a Framework -## ๐ŸŽ‰ Building your first React Native app +We believe that the best way to experience React Native is through a Framework, a toolbox with all the necessary APIs to let you build production ready apps. [Expo](https://docs.expo.dev/get-started/set-up-your-environment/) is a production-grade React Native Framework, with file-based routing, a standard library of native modules, and much more. -Follow the [Getting Started guide](https://reactnative.dev/docs/getting-started). The recommended way to install React Native depends on your project. Here you can find short guides for the most common scenarios: +To create a new Expo project, run the following in your terminal: -- [Trying out React Native][hello-world] -- [Creating a New Application][new-app] -- [Adding React Native to an Existing Application][existing] + npx create-expo-app@latest -[hello-world]: https://snack.expo.dev/@samples/hello-world -[new-app]: https://reactnative.dev/docs/getting-started -[existing]: https://reactnative.dev/docs/integration-with-existing-apps +Then follow the rest of [Expo's getting started guide](https://docs.expo.dev/get-started/set-up-your-environment/) to start building. -## ๐Ÿ“– Documentation +### Without a Framework -The full documentation for React Native can be found on our [website][docs]. +You can also use React Native without a Framework, however we've found that most developers benefit from one โ€” navigation, native dependencies, and platform tooling are problems the ecosystem has already solved. If a Framework doesn't suit your app, follow [Getting Started Without a Framework](https://reactnative.dev/docs/getting-started-without-a-framework). -The React Native documentation discusses components, APIs, and topics that are specific to React Native. For further documentation on the React API that is shared between React Native and React DOM, refer to the [React documentation][r-docs]. +## Documentation -The source for the React Native documentation and website is hosted on a separate repository, [**@facebook/react-native-website**][repo-website]. +The full documentation for React Native can be found on our [website](https://reactnative.dev/docs/getting-started). -[docs]: https://reactnative.dev/docs/getting-started -[r-docs]: https://react.dev/learn -[repo-website]: https://github.com/facebook/react-native-website +- [Introduction](https://reactnative.dev/docs/getting-started) +- [Getting Started](https://reactnative.dev/docs/environment-setup) +- [Learn the Basics](https://reactnative.dev/docs/tutorial) +- [Components and APIs](https://reactnative.dev/docs/components-and-apis) +- [UI & Interaction](https://reactnative.dev/docs/style) +- [Native Modules](https://reactnative.dev/docs/native-platform) +- [Debugging](https://reactnative.dev/docs/debugging) +- [Upgrading](https://reactnative.dev/docs/upgrading) +- [Architecture](https://reactnative.dev/architecture/overview) -## ๐Ÿš€ Upgrading +The source for the React Native docs and website is hosted on a separate repository, [**react/react-native-website**](https://github.com/react/react-native-website). -Upgrading to new versions of React Native may give you access to more APIs, views, developer tools, and other goodies. See the [Upgrading Guide][u] for instructions. - -React Native releases are discussed [in this discussion repo](https://github.com/reactwg/react-native-releases/discussions). - -[u]: https://reactnative.dev/docs/upgrading -[repo-releases]: https://github.com/react-native-community/react-native-releases - -## ๐Ÿ‘ How to Contribute +## Contributing The main purpose of this repository is to continue evolving React Native core. We want to make contributing to this project as easy and transparent as possible, and we are grateful to the community for contributing bug fixes and improvements. Read below to learn how you can take part in improving React Native. -### [Code of Conduct][code] - -Facebook has adopted a Code of Conduct that we expect project participants to adhere to. -Please read the [full text][code] so that you can understand what actions will and will not be tolerated. +### [Code of Conduct](https://code.fb.com/codeofconduct/) -[code]: https://code.fb.com/codeofconduct/ +Meta has adopted a Code of Conduct that we expect project participants to adhere to. +Please read the [full text](https://code.fb.com/codeofconduct/) so that you can understand what actions will and will not be tolerated. -### [Contributing Guide][contribute] +### [Contributing Guide](https://reactnative.dev/docs/contributing) -Read our [**Contributing Guide**][contribute] to learn about our development process, how to propose bugfixes and improvements, and how to build and test your changes to React Native. - -[contribute]: https://reactnative.dev/docs/contributing - -### [Open Source Roadmap][roadmap] - -You can learn more about our vision for React Native in the [**Roadmap**][roadmap]. - -[roadmap]: https://github.com/facebook/react-native/wiki/Roadmap - -### Good First Issues - -We have a list of [good first issues][gfi] that contain bugs which have a relatively limited scope. This is a great place to get started, gain experience, and get familiar with our contribution process. - -[gfi]: https://github.com/facebook/react-native/labels/good%20first%20issue +Read our [**Contributing Guide**](https://reactnative.dev/docs/contributing) to learn about our development process, how to propose bugfixes and improvements, and how to build and test your changes to React Native. ### Discussions -Larger discussions and proposals are discussed in [**@react-native-community/discussions-and-proposals**][repo-meta]. - -[repo-meta]: https://github.com/react-native-community/discussions-and-proposals +Larger discussions and proposals are discussed in [**react-native-community/discussions-and-proposals**](https://github.com/react-native-community/discussions-and-proposals). -## ๐Ÿ“„ License +React Native releases are discussed in [**reactwg/react-native-releases**](https://github.com/reactwg/react-native-releases/discussions). -React Native is MIT licensed, as found in the [LICENSE][l] file. +## License -[l]: https://github.com/facebook/react-native/blob/main/LICENSE +React Native is MIT licensed, as found in the [LICENSE](https://github.com/react/react-native/blob/main/LICENSE) file. diff --git a/__docs__/README.md b/__docs__/README.md index dd25a3fd248d..6ce5cdddef3e 100644 --- a/__docs__/README.md +++ b/__docs__/README.md @@ -80,6 +80,7 @@ TODO: Explain the different components of React Native at a high level. - Build system - Android - iOS + - [SwiftPM](../packages/react-native/scripts/spm/__docs__/README.md) - C++ - JavaScript - Metro diff --git a/build.gradle.kts b/build.gradle.kts index d23181ed7ce7..19fcc1df1a66 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -26,11 +26,11 @@ fun getListReactAndroidProperty(name: String) = reactAndroidProperties.getProper apiValidation { ignoredPackages.addAll( - getListReactAndroidProperty("binaryCompatibilityValidator.ignoredPackages") + getListReactAndroidProperty("binaryCompatibilityValidator.ignoredPackages"), ) ignoredClasses.addAll(getListReactAndroidProperty("binaryCompatibilityValidator.ignoredClasses")) nonPublicMarkers.addAll( - getListReactAndroidProperty("binaryCompatibilityValidator.nonPublicMarkers") + getListReactAndroidProperty("binaryCompatibilityValidator.nonPublicMarkers"), ) validationDisabled = reactAndroidProperties @@ -53,8 +53,12 @@ val ndkPath by extra(System.getenv("ANDROID_NDK")) val ndkVersion by extra(System.getenv("ANDROID_NDK_VERSION") ?: libs.versions.ndkVersion.get()) val sonatypeUsername = findProperty("SONATYPE_USERNAME")?.toString() val sonatypePassword = findProperty("SONATYPE_PASSWORD")?.toString() +val sonatypeRepositoryDescription = findProperty("SONATYPE_REPOSITORY_DESCRIPTION")?.toString() nexusPublishing { + if (sonatypeRepositoryDescription != null) { + repositoryDescription.set(sonatypeRepositoryDescription) + } repositories { sonatype { username.set(sonatypeUsername) @@ -82,12 +86,12 @@ tasks.register("clean", Delete::class.java) { delete(rootProject.file("./packages/react-native/sdks/download/")) delete(rootProject.file("./packages/react-native/sdks/hermes/")) delete( - rootProject.file("./packages/react-native/ReactAndroid/src/main/jni/prebuilt/lib/arm64-v8a/") + rootProject.file("./packages/react-native/ReactAndroid/src/main/jni/prebuilt/lib/arm64-v8a/"), ) delete( rootProject.file( - "./packages/react-native/ReactAndroid/src/main/jni/prebuilt/lib/armeabi-v7a/" - ) + "./packages/react-native/ReactAndroid/src/main/jni/prebuilt/lib/armeabi-v7a/", + ), ) delete(rootProject.file("./packages/react-native/ReactAndroid/src/main/jni/prebuilt/lib/x86/")) delete(rootProject.file("./packages/react-native/ReactAndroid/src/main/jni/prebuilt/lib/x86_64/")) @@ -133,7 +137,7 @@ if (project.findProperty("react.internal.useHermesStable")?.toString()?.toBoolea if (hermesCompilerVersion == "0.0.0") { throw RuntimeException( - "Trying to use Hermes Nightly but hermes-compiler version is not specified" + "Trying to use Hermes Nightly but hermes-compiler version is not specified", ) } @@ -152,7 +156,7 @@ if (project.findProperty("react.internal.useHermesStable")?.toString()?.toBoolea That's fine for local development, but you should not commit this change. ******************************************************************************** """ - .trimIndent() + .trimIndent(), ) } @@ -188,17 +192,16 @@ listOf("ktfmtCheck", "ktfmtFormat").forEach { taskName -> allprojects { // Apply exclusions for specific files that should not be formatted - val excludePatterns = - listOf( - "**/build/**", - "**/hermes-engine/**", - "**/internal/featureflags/**", - "**/systeminfo/ReactNativeVersion.kt", - ) + val excludePatterns = listOf( + "**/build/**", + "**/hermes-engine/**", + "**/internal/featureflags/**", + "**/systeminfo/ReactNativeVersion.kt", + ) listOf( - com.ncorti.ktfmt.gradle.tasks.KtfmtCheckTask::class, - com.ncorti.ktfmt.gradle.tasks.KtfmtFormatTask::class, - ) + com.ncorti.ktfmt.gradle.tasks.KtfmtCheckTask::class, + com.ncorti.ktfmt.gradle.tasks.KtfmtFormatTask::class, + ) .forEach { tasks.withType(it) { exclude(excludePatterns) } } // Disable the problematic ktfmt script tasks due to symbolic link issues in subprojects diff --git a/flow-typed/environment/node.js b/flow-typed/environment/node.js index 1a99ec0dcbd2..05c98394452f 100644 --- a/flow-typed/environment/node.js +++ b/flow-typed/environment/node.js @@ -457,8 +457,7 @@ declare class child_process$ChildProcessTyped< TStdin extends stream$Writable | null, TStdout extends stream$Readable | null, TStderr extends stream$Readable | null, -> extends events$EventEmitter -{ +> extends events$EventEmitter { +stdin: TStdin; +stdout: TStdout; +stderr: TStderr; @@ -578,8 +577,7 @@ declare module 'child_process' { declare function execFile( file: string, argsOrCallback?: - | ReadonlyArray - | child_process$execFileCallback, + ReadonlyArray | child_process$execFileCallback, callback?: child_process$execFileCallback, ): child_process$ChildProcessTyped< stream$Writable, @@ -755,6 +753,46 @@ declare module 'cluster' { declare module.exports: Cluster; } +declare module 'console' { + declare function assert(value: any, ...message: any): void; + declare function dir( + obj: Object, + options: { + showHidden: boolean, + depth: number, + colors: boolean, + ... + }, + ): void; + declare function error(...data: any): void; + declare function info(...data: any): void; + declare function log(...data: any): void; + declare function time(label: any): void; + declare function timeEnd(label: any): void; + declare function trace(first: any, ...rest: any): void; + declare function warn(...data: any): void; + declare class Console { + constructor(stdout: stream$Writable, stdin?: stream$Writable): void; + assert(value: any, ...message: any): void; + dir( + obj: Object, + options: { + showHidden: boolean, + depth: number, + colors: boolean, + ... + }, + ): void; + error(...data: any): void; + info(...data: any): void; + log(...data: any): void; + time(label: any): void; + timeEnd(label: any): void; + trace(first: any, ...rest: any): void; + warn(...data: any): void; + } +} + type crypto$createCredentialsDetails = any; // TODO declare class crypto$Cipher extends stream$Duplex { @@ -928,14 +966,7 @@ type crypto$key = declare class crypto$KeyObject { +asymmetricKeyType?: - | 'rsa' - | 'rsa-pss' - | 'dsa' - | 'ec' - | 'ed25519' - | 'ed448' - | 'x25519' - | 'x448'; + 'rsa' | 'rsa-pss' | 'dsa' | 'ec' | 'ed25519' | 'ed448' | 'x25519' | 'x448'; +asymmetricKeySize?: number; +symmetricKeySize?: number; +type: 'secret' | 'public' | 'private'; @@ -2560,9 +2591,9 @@ declare class http$Agent<+SocketT = net$Socket> { sockets: {[name: string]: ReadonlyArray, ...}; } -declare class http$IncomingMessage - extends stream$Readable -{ +declare class http$IncomingMessage< + SocketT = net$Socket, +> extends stream$Readable { headers: Object; rawHeaders: Array; httpVersion: string; @@ -2578,9 +2609,9 @@ declare class http$IncomingMessage rawTrailers: Array; } -declare class http$ClientRequest<+SocketT = net$Socket> - extends stream$Writable -{ +declare class http$ClientRequest< + +SocketT = net$Socket, +> extends stream$Writable { abort(): void; aborted: boolean; +connection: SocketT | null; @@ -2878,10 +2909,7 @@ declare class net$Socket extends stream$Duplex { destroyed: boolean; end( chunkOrEncodingOrCallback?: - | Buffer - | Uint8Array - | string - | ((data: any) => void), + Buffer | Uint8Array | string | ((data: any) => void), encodingOrCallback?: string | ((data: any) => void), callback?: (data: any) => void, ): this; @@ -3211,9 +3239,9 @@ declare module 'perf_hooks' { +detail?: T; } - declare export class PerformanceMeasure - extends PerformanceEntry - { + declare export class PerformanceMeasure< + T = unknown, + > extends PerformanceEntry { +entryType: 'measure'; +detail?: T; } @@ -3398,11 +3426,7 @@ declare module 'querystring' { */ declare module 'node:sqlite' { declare export type SupportedValueType = - | null - | number - | bigint - | string - | Uint8Array; + null | number | bigint | string | Uint8Array; declare export type DatabaseSyncOptions = Readonly<{ open?: boolean, @@ -5565,9 +5589,7 @@ declare module 'repl' { writer?: (object: any, options?: util$InspectOptions) => string, completer?: readline$InterfaceCompleter, replMode?: - | $SymbolReplModeMagic - | $SymbolReplModeSloppy - | $SymbolReplModeStrict, + $SymbolReplModeMagic | $SymbolReplModeSloppy | $SymbolReplModeStrict, breakEvalOnSigint?: boolean, ... }): REPLServer; @@ -5892,6 +5914,11 @@ declare module 'node:assert/strict' { declare module.exports: $Exports<'assert'>['strict']; } +declare module 'node:buffer' { + export type * from 'buffer'; + declare module.exports: $Exports<'buffer'>; +} + declare module 'node:child_process' { export type * from 'child_process'; declare module.exports: $Exports<'child_process'>; @@ -5902,16 +5929,31 @@ declare module 'node:cluster' { declare module.exports: $Exports<'cluster'>; } +declare module 'node:console' { + export type * from 'console'; + declare module.exports: $Exports<'console'>; +} + declare module 'node:crypto' { export type * from 'crypto'; declare module.exports: $Exports<'crypto'>; } +declare module 'node:dgram' { + export type * from 'dgram'; + declare module.exports: $Exports<'dgram'>; +} + declare module 'node:dns' { export type * from 'dns'; declare module.exports: $Exports<'dns'>; } +declare module 'node:domain' { + export type * from 'domain'; + declare module.exports: $Exports<'domain'>; +} + declare module 'node:events' { export type * from 'events'; declare module.exports: $Exports<'events'>; @@ -5927,6 +5969,31 @@ declare module 'node:fs/promises' { declare module.exports: $Exports<'fs'>['promises']; } +declare module 'node:http' { + export type * from 'http'; + declare module.exports: $Exports<'http'>; +} + +declare module 'node:https' { + export type * from 'https'; + declare module.exports: $Exports<'https'>; +} + +declare module 'node:inspector' { + export type * from 'inspector'; + declare module.exports: $Exports<'inspector'>; +} + +declare module 'node:module' { + export type * from 'module'; + declare module.exports: $Exports<'module'>; +} + +declare module 'node:net' { + export type * from 'net'; + declare module.exports: $Exports<'net'>; +} + declare module 'node:os' { export type * from 'os'; declare module.exports: $Exports<'os'>; @@ -5947,6 +6014,36 @@ declare module 'node:process' { declare module.exports: $Exports<'process'>; } +declare module 'node:punycode' { + export type * from 'punycode'; + declare module.exports: $Exports<'punycode'>; +} + +declare module 'node:querystring' { + export type * from 'querystring'; + declare module.exports: $Exports<'querystring'>; +} + +declare module 'node:readline' { + export type * from 'readline'; + declare module.exports: $Exports<'readline'>; +} + +declare module 'node:repl' { + export type * from 'repl'; + declare module.exports: $Exports<'repl'>; +} + +declare module 'node:stream' { + export type * from 'stream'; + declare module.exports: $Exports<'stream'>; +} + +declare module 'node:string_decoder' { + export type * from 'string_decoder'; + declare module.exports: $Exports<'string_decoder'>; +} + declare module 'node:timers' { export type * from 'timers'; declare module.exports: $Exports<'timers'>; @@ -5957,6 +6054,16 @@ declare module 'node:timers/promises' { declare module.exports: $Exports<'timers/promises'>; } +declare module 'node:tls' { + export type * from 'tls'; + declare module.exports: $Exports<'tls'>; +} + +declare module 'node:tty' { + export type * from 'tty'; + declare module.exports: $Exports<'tty'>; +} + declare module 'node:url' { declare module.exports: $Exports<'url'>; } @@ -5971,7 +6078,17 @@ declare module 'node:v8' { declare module.exports: $Exports<'v8'>; } +declare module 'node:vm' { + export type * from 'vm'; + declare module.exports: $Exports<'vm'>; +} + declare module 'node:worker_threads' { export type * from 'worker_threads'; declare module.exports: $Exports<'worker_threads'>; } + +declare module 'node:zlib' { + export type * from 'zlib'; + declare module.exports: $Exports<'zlib'>; +} diff --git a/flow-typed/npm/@react-native-community/cli-server-api_v19.x.x.js b/flow-typed/npm/@react-native-community/cli-server-api_v19.x.x.js deleted file mode 100644 index 33f2f7d9fbad..000000000000 --- a/flow-typed/npm/@react-native-community/cli-server-api_v19.x.x.js +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow strict - * @format - */ - -declare module '@react-native-community/cli-server-api' { - import type {NextHandleFunction, Server} from 'connect'; - - declare type MiddlewareOptions = { - host?: string, - watchFolders: ReadonlyArray, - port: number, - }; - - declare export function createDevServerMiddleware( - options: MiddlewareOptions, - ): { - middleware: Server, - websocketEndpoints: { - [path: string]: ws$WebSocketServer, - }, - debuggerProxyEndpoint: { - server: ws$WebSocketServer, - isDebuggerConnected: () => boolean, - }, - messageSocketEndpoint: { - server: ws$WebSocketServer, - broadcast: ( - method: string, - params?: Record | null, - ) => void, - }, - eventsSocketEndpoint: { - server: ws$WebSocketServer, - reportEvent: (event: any) => void, - }, - ... - }; -} diff --git a/flow-typed/npm/babel-traverse_v7.x.x.js b/flow-typed/npm/babel-traverse_v7.x.x.js index e28bb4921fed..e947d24a18a8 100644 --- a/flow-typed/npm/babel-traverse_v7.x.x.js +++ b/flow-typed/npm/babel-traverse_v7.x.x.js @@ -15,6 +15,316 @@ 'use strict'; declare module '@babel/traverse' { + // BEGIN GENERATED BABEL TYPE IMPORTS + import type { + Node as BabelNode, + Accessor as BabelNodeAccessor, + AnyTypeAnnotation as BabelNodeAnyTypeAnnotation, + ArgumentPlaceholder as BabelNodeArgumentPlaceholder, + ArrayExpression as BabelNodeArrayExpression, + ArrayPattern as BabelNodeArrayPattern, + ArrayTypeAnnotation as BabelNodeArrayTypeAnnotation, + ArrowFunctionExpression as BabelNodeArrowFunctionExpression, + AssignmentExpression as BabelNodeAssignmentExpression, + AssignmentPattern as BabelNodeAssignmentPattern, + AwaitExpression as BabelNodeAwaitExpression, + BigIntLiteral as BabelNodeBigIntLiteral, + Binary as BabelNodeBinary, + BinaryExpression as BabelNodeBinaryExpression, + BindExpression as BabelNodeBindExpression, + Block as BabelNodeBlock, + BlockParent as BabelNodeBlockParent, + BlockStatement as BabelNodeBlockStatement, + BooleanLiteral as BabelNodeBooleanLiteral, + BooleanLiteralTypeAnnotation as BabelNodeBooleanLiteralTypeAnnotation, + BooleanTypeAnnotation as BabelNodeBooleanTypeAnnotation, + BreakStatement as BabelNodeBreakStatement, + CallExpression as BabelNodeCallExpression, + CatchClause as BabelNodeCatchClause, + Class as BabelNodeClass, + ClassAccessorProperty as BabelNodeClassAccessorProperty, + ClassBody as BabelNodeClassBody, + ClassDeclaration as BabelNodeClassDeclaration, + ClassExpression as BabelNodeClassExpression, + ClassImplements as BabelNodeClassImplements, + ClassMethod as BabelNodeClassMethod, + ClassPrivateMethod as BabelNodeClassPrivateMethod, + ClassPrivateProperty as BabelNodeClassPrivateProperty, + ClassProperty as BabelNodeClassProperty, + Comment as BabelNodeComment, + CompletionStatement as BabelNodeCompletionStatement, + Conditional as BabelNodeConditional, + ConditionalExpression as BabelNodeConditionalExpression, + ContinueStatement as BabelNodeContinueStatement, + DebuggerStatement as BabelNodeDebuggerStatement, + DecimalLiteral as BabelNodeDecimalLiteral, + Declaration as BabelNodeDeclaration, + DeclareClass as BabelNodeDeclareClass, + DeclareExportAllDeclaration as BabelNodeDeclareExportAllDeclaration, + DeclareExportDeclaration as BabelNodeDeclareExportDeclaration, + DeclareFunction as BabelNodeDeclareFunction, + DeclareInterface as BabelNodeDeclareInterface, + DeclareModule as BabelNodeDeclareModule, + DeclareModuleExports as BabelNodeDeclareModuleExports, + DeclareOpaqueType as BabelNodeDeclareOpaqueType, + DeclareTypeAlias as BabelNodeDeclareTypeAlias, + DeclareVariable as BabelNodeDeclareVariable, + DeclaredPredicate as BabelNodeDeclaredPredicate, + Decorator as BabelNodeDecorator, + Directive as BabelNodeDirective, + DirectiveLiteral as BabelNodeDirectiveLiteral, + DoExpression as BabelNodeDoExpression, + DoWhileStatement as BabelNodeDoWhileStatement, + EmptyStatement as BabelNodeEmptyStatement, + EmptyTypeAnnotation as BabelNodeEmptyTypeAnnotation, + EnumBody as BabelNodeEnumBody, + EnumBooleanBody as BabelNodeEnumBooleanBody, + EnumBooleanMember as BabelNodeEnumBooleanMember, + EnumDeclaration as BabelNodeEnumDeclaration, + EnumDefaultedMember as BabelNodeEnumDefaultedMember, + EnumMember as BabelNodeEnumMember, + EnumNumberBody as BabelNodeEnumNumberBody, + EnumNumberMember as BabelNodeEnumNumberMember, + EnumStringBody as BabelNodeEnumStringBody, + EnumStringMember as BabelNodeEnumStringMember, + EnumSymbolBody as BabelNodeEnumSymbolBody, + ExistsTypeAnnotation as BabelNodeExistsTypeAnnotation, + ExportAllDeclaration as BabelNodeExportAllDeclaration, + ExportDeclaration as BabelNodeExportDeclaration, + ExportDefaultDeclaration as BabelNodeExportDefaultDeclaration, + ExportDefaultSpecifier as BabelNodeExportDefaultSpecifier, + ExportNamedDeclaration as BabelNodeExportNamedDeclaration, + ExportNamespaceSpecifier as BabelNodeExportNamespaceSpecifier, + ExportSpecifier as BabelNodeExportSpecifier, + Expression as BabelNodeExpression, + ExpressionStatement as BabelNodeExpressionStatement, + ExpressionWrapper as BabelNodeExpressionWrapper, + Flow as BabelNodeFlow, + FlowBaseAnnotation as BabelNodeFlowBaseAnnotation, + FlowDeclaration as BabelNodeFlowDeclaration, + FlowPredicate as BabelNodeFlowPredicate, + FlowType as BabelNodeFlowType, + For as BabelNodeFor, + ForInStatement as BabelNodeForInStatement, + ForOfStatement as BabelNodeForOfStatement, + ForStatement as BabelNodeForStatement, + ForXStatement as BabelNodeForXStatement, + Function as BabelNodeFunction, + FunctionDeclaration as BabelNodeFunctionDeclaration, + FunctionExpression as BabelNodeFunctionExpression, + FunctionParameter as BabelNodeFunctionParameter, + FunctionParent as BabelNodeFunctionParent, + FunctionTypeAnnotation as BabelNodeFunctionTypeAnnotation, + FunctionTypeParam as BabelNodeFunctionTypeParam, + GenericTypeAnnotation as BabelNodeGenericTypeAnnotation, + Identifier as BabelNodeIdentifier, + IfStatement as BabelNodeIfStatement, + Immutable as BabelNodeImmutable, + Import as BabelNodeImport, + ImportAttribute as BabelNodeImportAttribute, + ImportDeclaration as BabelNodeImportDeclaration, + ImportDefaultSpecifier as BabelNodeImportDefaultSpecifier, + ImportExpression as BabelNodeImportExpression, + ImportNamespaceSpecifier as BabelNodeImportNamespaceSpecifier, + ImportOrExportDeclaration as BabelNodeImportOrExportDeclaration, + ImportSpecifier as BabelNodeImportSpecifier, + IndexedAccessType as BabelNodeIndexedAccessType, + InferredPredicate as BabelNodeInferredPredicate, + InterfaceDeclaration as BabelNodeInterfaceDeclaration, + InterfaceExtends as BabelNodeInterfaceExtends, + InterfaceTypeAnnotation as BabelNodeInterfaceTypeAnnotation, + InterpreterDirective as BabelNodeInterpreterDirective, + IntersectionTypeAnnotation as BabelNodeIntersectionTypeAnnotation, + JSX as BabelNodeJSX, + JSXAttribute as BabelNodeJSXAttribute, + JSXClosingElement as BabelNodeJSXClosingElement, + JSXClosingFragment as BabelNodeJSXClosingFragment, + JSXElement as BabelNodeJSXElement, + JSXEmptyExpression as BabelNodeJSXEmptyExpression, + JSXExpressionContainer as BabelNodeJSXExpressionContainer, + JSXFragment as BabelNodeJSXFragment, + JSXIdentifier as BabelNodeJSXIdentifier, + JSXMemberExpression as BabelNodeJSXMemberExpression, + JSXNamespacedName as BabelNodeJSXNamespacedName, + JSXOpeningElement as BabelNodeJSXOpeningElement, + JSXOpeningFragment as BabelNodeJSXOpeningFragment, + JSXSpreadAttribute as BabelNodeJSXSpreadAttribute, + JSXSpreadChild as BabelNodeJSXSpreadChild, + JSXText as BabelNodeJSXText, + LVal as BabelNodeLVal, + LabeledStatement as BabelNodeLabeledStatement, + Literal as BabelNodeLiteral, + LogicalExpression as BabelNodeLogicalExpression, + Loop as BabelNodeLoop, + MemberExpression as BabelNodeMemberExpression, + MetaProperty as BabelNodeMetaProperty, + Method as BabelNodeMethod, + Miscellaneous as BabelNodeMiscellaneous, + MixedTypeAnnotation as BabelNodeMixedTypeAnnotation, + ModuleDeclaration as BabelNodeModuleDeclaration, + ModuleExpression as BabelNodeModuleExpression, + ModuleSpecifier as BabelNodeModuleSpecifier, + NewExpression as BabelNodeNewExpression, + Noop as BabelNodeNoop, + NullLiteral as BabelNodeNullLiteral, + NullLiteralTypeAnnotation as BabelNodeNullLiteralTypeAnnotation, + NullableTypeAnnotation as BabelNodeNullableTypeAnnotation, + NumberLiteralTypeAnnotation as BabelNodeNumberLiteralTypeAnnotation, + NumberTypeAnnotation as BabelNodeNumberTypeAnnotation, + NumericLiteral as BabelNodeNumericLiteral, + ObjectExpression as BabelNodeObjectExpression, + ObjectMember as BabelNodeObjectMember, + ObjectMethod as BabelNodeObjectMethod, + ObjectPattern as BabelNodeObjectPattern, + ObjectProperty as BabelNodeObjectProperty, + ObjectTypeAnnotation as BabelNodeObjectTypeAnnotation, + ObjectTypeCallProperty as BabelNodeObjectTypeCallProperty, + ObjectTypeIndexer as BabelNodeObjectTypeIndexer, + ObjectTypeInternalSlot as BabelNodeObjectTypeInternalSlot, + ObjectTypeProperty as BabelNodeObjectTypeProperty, + ObjectTypeSpreadProperty as BabelNodeObjectTypeSpreadProperty, + OpaqueType as BabelNodeOpaqueType, + OptionalCallExpression as BabelNodeOptionalCallExpression, + OptionalIndexedAccessType as BabelNodeOptionalIndexedAccessType, + OptionalMemberExpression as BabelNodeOptionalMemberExpression, + ParenthesizedExpression as BabelNodeParenthesizedExpression, + Pattern as BabelNodePattern, + PatternLike as BabelNodePatternLike, + PipelineBareFunction as BabelNodePipelineBareFunction, + PipelinePrimaryTopicReference as BabelNodePipelinePrimaryTopicReference, + PipelineTopicExpression as BabelNodePipelineTopicExpression, + Placeholder as BabelNodePlaceholder, + Private as BabelNodePrivate, + PrivateName as BabelNodePrivateName, + Program as BabelNodeProgram, + Property as BabelNodeProperty, + Pureish as BabelNodePureish, + QualifiedTypeIdentifier as BabelNodeQualifiedTypeIdentifier, + RecordExpression as BabelNodeRecordExpression, + RegExpLiteral as BabelNodeRegExpLiteral, + RestElement as BabelNodeRestElement, + ReturnStatement as BabelNodeReturnStatement, + Scopable as BabelNodeScopable, + SequenceExpression as BabelNodeSequenceExpression, + SpreadElement as BabelNodeSpreadElement, + Standardized as BabelNodeStandardized, + Statement as BabelNodeStatement, + StaticBlock as BabelNodeStaticBlock, + StringLiteral as BabelNodeStringLiteral, + StringLiteralTypeAnnotation as BabelNodeStringLiteralTypeAnnotation, + StringTypeAnnotation as BabelNodeStringTypeAnnotation, + Super as BabelNodeSuper, + SwitchCase as BabelNodeSwitchCase, + SwitchStatement as BabelNodeSwitchStatement, + SymbolTypeAnnotation as BabelNodeSymbolTypeAnnotation, + TSAnyKeyword as BabelNodeTSAnyKeyword, + TSArrayType as BabelNodeTSArrayType, + TSAsExpression as BabelNodeTSAsExpression, + TSBaseType as BabelNodeTSBaseType, + TSBigIntKeyword as BabelNodeTSBigIntKeyword, + TSBooleanKeyword as BabelNodeTSBooleanKeyword, + TSCallSignatureDeclaration as BabelNodeTSCallSignatureDeclaration, + TSConditionalType as BabelNodeTSConditionalType, + TSConstructSignatureDeclaration as BabelNodeTSConstructSignatureDeclaration, + TSConstructorType as BabelNodeTSConstructorType, + TSDeclareFunction as BabelNodeTSDeclareFunction, + TSDeclareMethod as BabelNodeTSDeclareMethod, + TSEntityName as BabelNodeTSEntityName, + TSEnumBody as BabelNodeTSEnumBody, + TSEnumDeclaration as BabelNodeTSEnumDeclaration, + TSEnumMember as BabelNodeTSEnumMember, + TSExportAssignment as BabelNodeTSExportAssignment, + TSExpressionWithTypeArguments as BabelNodeTSExpressionWithTypeArguments, + TSExternalModuleReference as BabelNodeTSExternalModuleReference, + TSFunctionType as BabelNodeTSFunctionType, + TSImportEqualsDeclaration as BabelNodeTSImportEqualsDeclaration, + TSImportType as BabelNodeTSImportType, + TSIndexSignature as BabelNodeTSIndexSignature, + TSIndexedAccessType as BabelNodeTSIndexedAccessType, + TSInferType as BabelNodeTSInferType, + TSInstantiationExpression as BabelNodeTSInstantiationExpression, + TSInterfaceBody as BabelNodeTSInterfaceBody, + TSInterfaceDeclaration as BabelNodeTSInterfaceDeclaration, + TSIntersectionType as BabelNodeTSIntersectionType, + TSIntrinsicKeyword as BabelNodeTSIntrinsicKeyword, + TSLiteralType as BabelNodeTSLiteralType, + TSMappedType as BabelNodeTSMappedType, + TSMethodSignature as BabelNodeTSMethodSignature, + TSModuleBlock as BabelNodeTSModuleBlock, + TSModuleDeclaration as BabelNodeTSModuleDeclaration, + TSNamedTupleMember as BabelNodeTSNamedTupleMember, + TSNamespaceExportDeclaration as BabelNodeTSNamespaceExportDeclaration, + TSNeverKeyword as BabelNodeTSNeverKeyword, + TSNonNullExpression as BabelNodeTSNonNullExpression, + TSNullKeyword as BabelNodeTSNullKeyword, + TSNumberKeyword as BabelNodeTSNumberKeyword, + TSObjectKeyword as BabelNodeTSObjectKeyword, + TSOptionalType as BabelNodeTSOptionalType, + TSParameterProperty as BabelNodeTSParameterProperty, + TSParenthesizedType as BabelNodeTSParenthesizedType, + TSPropertySignature as BabelNodeTSPropertySignature, + TSQualifiedName as BabelNodeTSQualifiedName, + TSRestType as BabelNodeTSRestType, + TSSatisfiesExpression as BabelNodeTSSatisfiesExpression, + TSStringKeyword as BabelNodeTSStringKeyword, + TSSymbolKeyword as BabelNodeTSSymbolKeyword, + TSTemplateLiteralType as BabelNodeTSTemplateLiteralType, + TSThisType as BabelNodeTSThisType, + TSTupleType as BabelNodeTSTupleType, + TSType as BabelNodeTSType, + TSTypeAliasDeclaration as BabelNodeTSTypeAliasDeclaration, + TSTypeAnnotation as BabelNodeTSTypeAnnotation, + TSTypeAssertion as BabelNodeTSTypeAssertion, + TSTypeElement as BabelNodeTSTypeElement, + TSTypeLiteral as BabelNodeTSTypeLiteral, + TSTypeOperator as BabelNodeTSTypeOperator, + TSTypeParameter as BabelNodeTSTypeParameter, + TSTypeParameterDeclaration as BabelNodeTSTypeParameterDeclaration, + TSTypeParameterInstantiation as BabelNodeTSTypeParameterInstantiation, + TSTypePredicate as BabelNodeTSTypePredicate, + TSTypeQuery as BabelNodeTSTypeQuery, + TSTypeReference as BabelNodeTSTypeReference, + TSUndefinedKeyword as BabelNodeTSUndefinedKeyword, + TSUnionType as BabelNodeTSUnionType, + TSUnknownKeyword as BabelNodeTSUnknownKeyword, + TSVoidKeyword as BabelNodeTSVoidKeyword, + TaggedTemplateExpression as BabelNodeTaggedTemplateExpression, + TemplateElement as BabelNodeTemplateElement, + TemplateLiteral as BabelNodeTemplateLiteral, + Terminatorless as BabelNodeTerminatorless, + ThisExpression as BabelNodeThisExpression, + ThisTypeAnnotation as BabelNodeThisTypeAnnotation, + ThrowStatement as BabelNodeThrowStatement, + TopicReference as BabelNodeTopicReference, + TryStatement as BabelNodeTryStatement, + TupleExpression as BabelNodeTupleExpression, + TupleTypeAnnotation as BabelNodeTupleTypeAnnotation, + TypeAlias as BabelNodeTypeAlias, + TypeAnnotation as BabelNodeTypeAnnotation, + TypeCastExpression as BabelNodeTypeCastExpression, + TypeParameter as BabelNodeTypeParameter, + TypeParameterDeclaration as BabelNodeTypeParameterDeclaration, + TypeParameterInstantiation as BabelNodeTypeParameterInstantiation, + TypeScript as BabelNodeTypeScript, + TypeofTypeAnnotation as BabelNodeTypeofTypeAnnotation, + UnaryExpression as BabelNodeUnaryExpression, + UnaryLike as BabelNodeUnaryLike, + UnionTypeAnnotation as BabelNodeUnionTypeAnnotation, + UpdateExpression as BabelNodeUpdateExpression, + UserWhitespacable as BabelNodeUserWhitespacable, + V8IntrinsicIdentifier as BabelNodeV8IntrinsicIdentifier, + VariableDeclaration as BabelNodeVariableDeclaration, + VariableDeclarator as BabelNodeVariableDeclarator, + Variance as BabelNodeVariance, + VoidPattern as BabelNodeVoidPattern, + VoidTypeAnnotation as BabelNodeVoidTypeAnnotation, + While as BabelNodeWhile, + WhileStatement as BabelNodeWhileStatement, + WithStatement as BabelNodeWithStatement, + YieldExpression as BabelNodeYieldExpression, + } from '@babel/types'; + // END GENERATED BABEL TYPE IMPORTS + declare export type TraverseOptions = { ...Visitor, scope?: Scope, @@ -83,10 +393,10 @@ declare module '@babel/traverse' { constructor(path: NodePath<>): Scope; path: NodePath<>; block: BabelNode; - +labels: Map>; - +parentBlock: BabelNode; - +parent: Scope; - +hub: HubInterface; + readonly labels: Map>; + readonly parentBlock: BabelNode; + readonly parent: Scope; + readonly hub: HubInterface; bindings?: {[name: string]: Binding}; references?: {[name: string]: boolean}; globals?: {[name: string]: BabelNode}; @@ -246,12 +556,7 @@ declare module '@babel/traverse' { } declare export type BindingKind = - | 'var' - | 'let' - | 'const' - | 'module' - | 'hoisted' - | 'unknown'; + 'var' | 'let' | 'const' | 'module' | 'hoisted' | 'unknown'; declare export class Binding { constructor(opts: { @@ -294,7 +599,7 @@ declare module '@babel/traverse' { declare type Opts = {...}; - declare export class NodePath<+TNode extends BabelNode = BabelNode> { + declare export class NodePath { parent: BabelNode; hub: HubInterface; contexts: Array; @@ -303,7 +608,7 @@ declare module '@babel/traverse' { shouldStop: boolean; removed: boolean; state: unknown; - +opts: Readonly> | null; + readonly opts: Readonly> | null; skipKeys: null | {[key: string]: boolean}; parentPath: ?NodePath<>; context: TraversalContext; @@ -316,7 +621,7 @@ declare module '@babel/traverse' { * work with `NodePath`, e.g. that passing `NodePath` to a * `NodePath works. */ - +node: TNode; + readonly node: TNode; parentKey: string; scope: Scope; @@ -435,13 +740,7 @@ declare module '@babel/traverse' { isBaseType(baseName: string, soft?: boolean): boolean; couldBeBaseType( name: - | 'string' - | 'number' - | 'boolean' - | 'any' - | 'mixed' - | 'empty' - | 'void', + 'string' | 'number' | 'boolean' | 'any' | 'mixed' | 'empty' | 'void', ): boolean; baseTypeStrictlyMatches(right: NodePath<>): ?boolean; isGenericType(genericName: string): boolean; @@ -1432,22 +1731,21 @@ declare module '@babel/traverse' { // END GENERATED NODE PATH METHODS } - declare export type VisitNodeFunction<-TNode extends BabelNode, TState> = ( + declare export type VisitNodeFunction = ( path: NodePath, state: TState, ) => void; declare export type VisitNodeObject< - -TNode extends BabelNode, + in TNode extends BabelNode, TState, > = Partial<{ enter(path: NodePath, state: TState): void, exit(path: NodePath, state: TState): void, }>; - declare export type VisitNode<-TNode extends BabelNode, TState> = - | VisitNodeFunction - | VisitNodeObject; + declare export type VisitNode = + VisitNodeFunction | VisitNodeObject; declare export type Visitor = Readonly<{ enter?: VisitNodeFunction, @@ -1904,10 +2202,10 @@ declare module '@babel/traverse' { parentPath?: ?NodePath, ): void, - +cache: Cache, - +visitors: Visitors, - +verify: Visitors['verify'], - +explode: Visitors['explode'], + readonly cache: Cache, + readonly visitors: Visitors, + readonly verify: Visitors['verify'], + readonly explode: Visitors['explode'], cheap( node: BabelNode, diff --git a/flow-typed/npm/babel-types_v7.x.x.js b/flow-typed/npm/babel-types_v7.x.x.js index 00aaa15964bf..494f1eb6dc50 100644 --- a/flow-typed/npm/babel-types_v7.x.x.js +++ b/flow-typed/npm/babel-types_v7.x.x.js @@ -8,3251 +8,3251 @@ * @flow strict */ -declare type BabelNodeBaseComment = { - value: string; - start: number; - end: number; - loc: BabelNodeSourceLocation; -}; - -declare type BabelNodeCommentBlock = { - ...BabelNodeBaseComment; - type: "CommentBlock"; -}; - -declare type BabelNodeCommentLine ={ - ...BabelNodeBaseComment, - type: "CommentLine"; -}; - -declare type BabelNodeComment = BabelNodeCommentBlock | BabelNodeCommentLine; - -declare type BabelNodeSourceLocation = { - start: { - line: number; - column: number; - }; - - end: { - line: number; - column: number; - }; -}; - - -declare type BabelNodeArrayExpression = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ArrayExpression"; - elements?: Array; -}; - -declare type BabelNodeAssignmentExpression = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "AssignmentExpression"; - operator: string; - left: BabelNodeLVal | BabelNodeOptionalMemberExpression; - right: BabelNodeExpression; -}; - -declare type BabelNodeBinaryExpression = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "BinaryExpression"; - operator: "+" | "-" | "/" | "%" | "*" | "**" | "&" | "|" | ">>" | ">>>" | "<<" | "^" | "==" | "===" | "!=" | "!==" | "in" | "instanceof" | ">" | "<" | ">=" | "<=" | "|>"; - left: BabelNodeExpression | BabelNodePrivateName; - right: BabelNodeExpression; -}; - -declare type BabelNodeInterpreterDirective = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "InterpreterDirective"; - value: string; -}; - -declare type BabelNodeDirective = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "Directive"; - value: BabelNodeDirectiveLiteral; -}; - -declare type BabelNodeDirectiveLiteral = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "DirectiveLiteral"; - value: string; -}; - -declare type BabelNodeBlockStatement = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "BlockStatement"; - body: Array; - directives?: Array; -}; - -declare type BabelNodeBreakStatement = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "BreakStatement"; - label?: BabelNodeIdentifier; -}; - -declare type BabelNodeCallExpression = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "CallExpression"; - callee: BabelNodeExpression | BabelNodeSuper | BabelNodeV8IntrinsicIdentifier; - arguments: Array; - optional?: boolean; - typeArguments?: BabelNodeTypeParameterInstantiation; - typeParameters?: BabelNodeTSTypeParameterInstantiation; -}; - -declare type BabelNodeCatchClause = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "CatchClause"; - param?: BabelNodeIdentifier | BabelNodeArrayPattern | BabelNodeObjectPattern; - body: BabelNodeBlockStatement; -}; - -declare type BabelNodeConditionalExpression = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ConditionalExpression"; - test: BabelNodeExpression; - consequent: BabelNodeExpression; - alternate: BabelNodeExpression; -}; - -declare type BabelNodeContinueStatement = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ContinueStatement"; - label?: BabelNodeIdentifier; -}; - -declare type BabelNodeDebuggerStatement = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "DebuggerStatement"; -}; - -declare type BabelNodeDoWhileStatement = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "DoWhileStatement"; - test: BabelNodeExpression; - body: BabelNodeStatement; -}; - -declare type BabelNodeEmptyStatement = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "EmptyStatement"; -}; - -declare type BabelNodeExpressionStatement = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ExpressionStatement"; - expression: BabelNodeExpression; -}; - -declare type BabelNodeFile = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "File"; - program: BabelNodeProgram; - comments?: Array; - tokens?: Array; -}; - -declare type BabelNodeForInStatement = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ForInStatement"; - left: BabelNodeVariableDeclaration | BabelNodeLVal; - right: BabelNodeExpression; - body: BabelNodeStatement; -}; - -declare type BabelNodeForStatement = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ForStatement"; - init?: BabelNodeVariableDeclaration | BabelNodeExpression; - test?: BabelNodeExpression; - update?: BabelNodeExpression; - body: BabelNodeStatement; -}; - -declare type BabelNodeFunctionDeclaration = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "FunctionDeclaration"; - id?: BabelNodeIdentifier; - params: Array; - body: BabelNodeBlockStatement; - generator?: boolean; - async?: boolean; - declare?: boolean; - predicate?: BabelNodeDeclaredPredicate | BabelNodeInferredPredicate; - returnType?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; - typeParameters?: BabelNodeTypeParameterDeclaration | BabelNodeTSTypeParameterDeclaration | BabelNodeNoop; -}; - -declare type BabelNodeFunctionExpression = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "FunctionExpression"; - id?: BabelNodeIdentifier; - params: Array; - body: BabelNodeBlockStatement; - generator?: boolean; - async?: boolean; - predicate?: BabelNodeDeclaredPredicate | BabelNodeInferredPredicate; - returnType?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; - typeParameters?: BabelNodeTypeParameterDeclaration | BabelNodeTSTypeParameterDeclaration | BabelNodeNoop; -}; - -declare type BabelNodeIdentifier = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "Identifier"; - name: string; - decorators?: Array; - optional?: boolean; - typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; -}; - -declare type BabelNodeIfStatement = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "IfStatement"; - test: BabelNodeExpression; - consequent: BabelNodeStatement; - alternate?: BabelNodeStatement; -}; - -declare type BabelNodeLabeledStatement = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "LabeledStatement"; - label: BabelNodeIdentifier; - body: BabelNodeStatement; -}; - -declare type BabelNodeStringLiteral = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "StringLiteral"; - value: string; -}; - -declare type BabelNodeNumericLiteral = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "NumericLiteral"; - value: number; -}; - -declare type BabelNodeNullLiteral = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "NullLiteral"; -}; - -declare type BabelNodeBooleanLiteral = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "BooleanLiteral"; - value: boolean; -}; - -declare type BabelNodeRegExpLiteral = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "RegExpLiteral"; - pattern: string; - flags?: string; -}; - -declare type BabelNodeLogicalExpression = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "LogicalExpression"; - operator: "||" | "&&" | "??"; - left: BabelNodeExpression; - right: BabelNodeExpression; -}; - -declare type BabelNodeMemberExpression = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "MemberExpression"; - object: BabelNodeExpression | BabelNodeSuper; - property: BabelNodeExpression | BabelNodeIdentifier | BabelNodePrivateName; - computed?: boolean; - optional?: boolean; -}; - -declare type BabelNodeNewExpression = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "NewExpression"; - callee: BabelNodeExpression | BabelNodeSuper | BabelNodeV8IntrinsicIdentifier; - arguments: Array; - optional?: boolean; - typeArguments?: BabelNodeTypeParameterInstantiation; - typeParameters?: BabelNodeTSTypeParameterInstantiation; -}; - -declare type BabelNodeProgram = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "Program"; - body: Array; - directives?: Array; - sourceType?: "script" | "module"; - interpreter?: BabelNodeInterpreterDirective; -}; - -declare type BabelNodeObjectExpression = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ObjectExpression"; - properties: Array; -}; - -declare type BabelNodeObjectMethod = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ObjectMethod"; - kind?: "method" | "get" | "set"; - key: BabelNodeExpression | BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeBigIntLiteral; - params: Array; - body: BabelNodeBlockStatement; - computed?: boolean; - generator?: boolean; - async?: boolean; - decorators?: Array; - returnType?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; - typeParameters?: BabelNodeTypeParameterDeclaration | BabelNodeTSTypeParameterDeclaration | BabelNodeNoop; -}; - -declare type BabelNodeObjectProperty = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ObjectProperty"; - key: BabelNodeExpression | BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeBigIntLiteral | BabelNodeDecimalLiteral | BabelNodePrivateName; - value: BabelNodeExpression | BabelNodePatternLike; - computed?: boolean; - shorthand?: boolean; - decorators?: Array; -}; - -declare type BabelNodeRestElement = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "RestElement"; - argument: BabelNodeIdentifier | BabelNodeArrayPattern | BabelNodeObjectPattern | BabelNodeMemberExpression | BabelNodeTSAsExpression | BabelNodeTSSatisfiesExpression | BabelNodeTSTypeAssertion | BabelNodeTSNonNullExpression | BabelNodeRestElement | BabelNodeAssignmentPattern; - decorators?: Array; - optional?: boolean; - typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; -}; - -declare type BabelNodeReturnStatement = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ReturnStatement"; - argument?: BabelNodeExpression; -}; - -declare type BabelNodeSequenceExpression = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "SequenceExpression"; - expressions: Array; -}; - -declare type BabelNodeParenthesizedExpression = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ParenthesizedExpression"; - expression: BabelNodeExpression; -}; - -declare type BabelNodeSwitchCase = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "SwitchCase"; - test?: BabelNodeExpression; - consequent: Array; -}; - -declare type BabelNodeSwitchStatement = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "SwitchStatement"; - discriminant: BabelNodeExpression; - cases: Array; -}; - -declare type BabelNodeThisExpression = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ThisExpression"; -}; - -declare type BabelNodeThrowStatement = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ThrowStatement"; - argument: BabelNodeExpression; -}; - -declare type BabelNodeTryStatement = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TryStatement"; - block: BabelNodeBlockStatement; - handler?: BabelNodeCatchClause; - finalizer?: BabelNodeBlockStatement; -}; - -declare type BabelNodeUnaryExpression = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "UnaryExpression"; - operator: "void" | "throw" | "delete" | "!" | "+" | "-" | "~" | "typeof"; - argument: BabelNodeExpression; - prefix?: boolean; -}; - -declare type BabelNodeUpdateExpression = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "UpdateExpression"; - operator: "++" | "--"; - argument: BabelNodeExpression; - prefix?: boolean; -}; - -declare type BabelNodeVariableDeclaration = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "VariableDeclaration"; - kind: "var" | "let" | "const" | "using" | "await using"; - declarations: Array; - declare?: boolean; -}; - -declare type BabelNodeVariableDeclarator = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "VariableDeclarator"; - id: BabelNodeLVal | BabelNodeVoidPattern; - init?: BabelNodeExpression; - definite?: boolean; -}; - -declare type BabelNodeWhileStatement = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "WhileStatement"; - test: BabelNodeExpression; - body: BabelNodeStatement; -}; - -declare type BabelNodeWithStatement = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "WithStatement"; - object: BabelNodeExpression; - body: BabelNodeStatement; -}; - -declare type BabelNodeAssignmentPattern = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "AssignmentPattern"; - left: BabelNodeIdentifier | BabelNodeObjectPattern | BabelNodeArrayPattern | BabelNodeMemberExpression | BabelNodeTSAsExpression | BabelNodeTSSatisfiesExpression | BabelNodeTSTypeAssertion | BabelNodeTSNonNullExpression; - right: BabelNodeExpression; - decorators?: Array; - optional?: boolean; - typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; -}; - -declare type BabelNodeArrayPattern = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ArrayPattern"; - elements: Array; - decorators?: Array; - optional?: boolean; - typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; -}; - -declare type BabelNodeArrowFunctionExpression = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ArrowFunctionExpression"; - params: Array; - body: BabelNodeBlockStatement | BabelNodeExpression; - async?: boolean; - expression: boolean; - generator?: boolean; - predicate?: BabelNodeDeclaredPredicate | BabelNodeInferredPredicate; - returnType?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; - typeParameters?: BabelNodeTypeParameterDeclaration | BabelNodeTSTypeParameterDeclaration | BabelNodeNoop; -}; - -declare type BabelNodeClassBody = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ClassBody"; - body: Array; -}; - -declare type BabelNodeClassExpression = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ClassExpression"; - id?: BabelNodeIdentifier; - superClass?: BabelNodeExpression; - body: BabelNodeClassBody; - decorators?: Array; - implements?: Array; - mixins?: BabelNodeInterfaceExtends; - superTypeParameters?: BabelNodeTypeParameterInstantiation | BabelNodeTSTypeParameterInstantiation; - typeParameters?: BabelNodeTypeParameterDeclaration | BabelNodeTSTypeParameterDeclaration | BabelNodeNoop; -}; - -declare type BabelNodeClassDeclaration = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ClassDeclaration"; - id?: BabelNodeIdentifier; - superClass?: BabelNodeExpression; - body: BabelNodeClassBody; - decorators?: Array; - abstract?: boolean; - declare?: boolean; - implements?: Array; - mixins?: BabelNodeInterfaceExtends; - superTypeParameters?: BabelNodeTypeParameterInstantiation | BabelNodeTSTypeParameterInstantiation; - typeParameters?: BabelNodeTypeParameterDeclaration | BabelNodeTSTypeParameterDeclaration | BabelNodeNoop; -}; - -declare type BabelNodeExportAllDeclaration = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ExportAllDeclaration"; - source: BabelNodeStringLiteral; - attributes?: Array; - assertions?: Array; - exportKind?: "type" | "value"; -}; - -declare type BabelNodeExportDefaultDeclaration = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ExportDefaultDeclaration"; - declaration: BabelNodeTSDeclareFunction | BabelNodeFunctionDeclaration | BabelNodeClassDeclaration | BabelNodeExpression; - exportKind?: "value"; -}; - -declare type BabelNodeExportNamedDeclaration = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ExportNamedDeclaration"; - declaration?: BabelNodeDeclaration; - specifiers?: Array; - source?: BabelNodeStringLiteral; - attributes?: Array; - assertions?: Array; - exportKind?: "type" | "value"; -}; - -declare type BabelNodeExportSpecifier = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ExportSpecifier"; - local: BabelNodeIdentifier; - exported: BabelNodeIdentifier | BabelNodeStringLiteral; - exportKind?: "type" | "value"; -}; - -declare type BabelNodeForOfStatement = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ForOfStatement"; - left: BabelNodeVariableDeclaration | BabelNodeLVal; - right: BabelNodeExpression; - body: BabelNodeStatement; - await?: boolean; -}; - -declare type BabelNodeImportDeclaration = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ImportDeclaration"; - specifiers: Array; - source: BabelNodeStringLiteral; - attributes?: Array; - assertions?: Array; - importKind?: "type" | "typeof" | "value"; - module?: boolean; - phase?: "source" | "defer"; -}; - -declare type BabelNodeImportDefaultSpecifier = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ImportDefaultSpecifier"; - local: BabelNodeIdentifier; -}; - -declare type BabelNodeImportNamespaceSpecifier = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ImportNamespaceSpecifier"; - local: BabelNodeIdentifier; -}; - -declare type BabelNodeImportSpecifier = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ImportSpecifier"; - local: BabelNodeIdentifier; - imported: BabelNodeIdentifier | BabelNodeStringLiteral; - importKind?: "type" | "typeof" | "value"; -}; - -declare type BabelNodeImportExpression = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ImportExpression"; - source: BabelNodeExpression; - options?: BabelNodeExpression; - phase?: "source" | "defer"; -}; - -declare type BabelNodeMetaProperty = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "MetaProperty"; - meta: BabelNodeIdentifier; - property: BabelNodeIdentifier; -}; - -declare type BabelNodeClassMethod = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ClassMethod"; - kind?: "get" | "set" | "method" | "constructor"; - key: BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeBigIntLiteral | BabelNodeExpression; - params: Array; - body: BabelNodeBlockStatement; - computed?: boolean; - static?: boolean; - generator?: boolean; - async?: boolean; - abstract?: boolean; - access?: "public" | "private" | "protected"; - accessibility?: "public" | "private" | "protected"; - decorators?: Array; - optional?: boolean; - override?: boolean; - returnType?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; - typeParameters?: BabelNodeTypeParameterDeclaration | BabelNodeTSTypeParameterDeclaration | BabelNodeNoop; -}; - -declare type BabelNodeObjectPattern = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ObjectPattern"; - properties: Array; - decorators?: Array; - optional?: boolean; - typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; -}; - -declare type BabelNodeSpreadElement = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "SpreadElement"; - argument: BabelNodeExpression; -}; - -declare type BabelNodeSuper = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "Super"; -}; - -declare type BabelNodeTaggedTemplateExpression = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TaggedTemplateExpression"; - tag: BabelNodeExpression; - quasi: BabelNodeTemplateLiteral; - typeParameters?: BabelNodeTypeParameterInstantiation | BabelNodeTSTypeParameterInstantiation; -}; - -declare type BabelNodeTemplateElement = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TemplateElement"; - value: any; - tail?: boolean; -}; - -declare type BabelNodeTemplateLiteral = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TemplateLiteral"; - quasis: Array; - expressions: Array; -}; - -declare type BabelNodeYieldExpression = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "YieldExpression"; - argument?: BabelNodeExpression; - delegate?: boolean; -}; - -declare type BabelNodeAwaitExpression = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "AwaitExpression"; - argument: BabelNodeExpression; -}; - -declare type BabelNodeImport = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "Import"; -}; - -declare type BabelNodeBigIntLiteral = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "BigIntLiteral"; - value: string; -}; - -declare type BabelNodeExportNamespaceSpecifier = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ExportNamespaceSpecifier"; - exported: BabelNodeIdentifier; -}; - -declare type BabelNodeOptionalMemberExpression = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "OptionalMemberExpression"; - object: BabelNodeExpression; - property: BabelNodeExpression | BabelNodeIdentifier; - computed?: boolean; - optional: boolean; -}; - -declare type BabelNodeOptionalCallExpression = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "OptionalCallExpression"; - callee: BabelNodeExpression; - arguments: Array; - optional: boolean; - typeArguments?: BabelNodeTypeParameterInstantiation; - typeParameters?: BabelNodeTSTypeParameterInstantiation; -}; - -declare type BabelNodeClassProperty = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ClassProperty"; - key: BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeBigIntLiteral | BabelNodeExpression; - value?: BabelNodeExpression; - typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; - decorators?: Array; - computed?: boolean; - static?: boolean; - abstract?: boolean; - accessibility?: "public" | "private" | "protected"; - declare?: boolean; - definite?: boolean; - optional?: boolean; - override?: boolean; - readonly?: boolean; - variance?: BabelNodeVariance; -}; - -declare type BabelNodeClassAccessorProperty = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ClassAccessorProperty"; - key: BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeBigIntLiteral | BabelNodeExpression | BabelNodePrivateName; - value?: BabelNodeExpression; - typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; - decorators?: Array; - computed?: boolean; - static?: boolean; - abstract?: boolean; - accessibility?: "public" | "private" | "protected"; - declare?: boolean; - definite?: boolean; - optional?: boolean; - override?: boolean; - readonly?: boolean; - variance?: BabelNodeVariance; -}; - -declare type BabelNodeClassPrivateProperty = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ClassPrivateProperty"; - key: BabelNodePrivateName; - value?: BabelNodeExpression; - decorators?: Array; - static?: boolean; - definite?: boolean; - optional?: boolean; - readonly?: boolean; - typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; - variance?: BabelNodeVariance; -}; - -declare type BabelNodeClassPrivateMethod = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ClassPrivateMethod"; - kind?: "get" | "set" | "method"; - key: BabelNodePrivateName; - params: Array; - body: BabelNodeBlockStatement; - static?: boolean; - abstract?: boolean; - access?: "public" | "private" | "protected"; - accessibility?: "public" | "private" | "protected"; - async?: boolean; - computed?: boolean; - decorators?: Array; - generator?: boolean; - optional?: boolean; - override?: boolean; - returnType?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; - typeParameters?: BabelNodeTypeParameterDeclaration | BabelNodeTSTypeParameterDeclaration | BabelNodeNoop; -}; - -declare type BabelNodePrivateName = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "PrivateName"; - id: BabelNodeIdentifier; -}; - -declare type BabelNodeStaticBlock = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "StaticBlock"; - body: Array; -}; - -declare type BabelNodeImportAttribute = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ImportAttribute"; - key: BabelNodeIdentifier | BabelNodeStringLiteral; - value: BabelNodeStringLiteral; -}; - -declare type BabelNodeAnyTypeAnnotation = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "AnyTypeAnnotation"; -}; - -declare type BabelNodeArrayTypeAnnotation = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ArrayTypeAnnotation"; - elementType: BabelNodeFlowType; -}; - -declare type BabelNodeBooleanTypeAnnotation = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "BooleanTypeAnnotation"; -}; - -declare type BabelNodeBooleanLiteralTypeAnnotation = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "BooleanLiteralTypeAnnotation"; - value: boolean; -}; - -declare type BabelNodeNullLiteralTypeAnnotation = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "NullLiteralTypeAnnotation"; -}; - -declare type BabelNodeClassImplements = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ClassImplements"; - id: BabelNodeIdentifier; - typeParameters?: BabelNodeTypeParameterInstantiation; -}; - -declare type BabelNodeDeclareClass = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "DeclareClass"; - id: BabelNodeIdentifier; - typeParameters?: BabelNodeTypeParameterDeclaration; - extends?: Array; - body: BabelNodeObjectTypeAnnotation; - implements?: Array; - mixins?: Array; -}; - -declare type BabelNodeDeclareFunction = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "DeclareFunction"; - id: BabelNodeIdentifier; - predicate?: BabelNodeDeclaredPredicate; -}; - -declare type BabelNodeDeclareInterface = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "DeclareInterface"; - id: BabelNodeIdentifier; - typeParameters?: BabelNodeTypeParameterDeclaration; - extends?: Array; - body: BabelNodeObjectTypeAnnotation; -}; - -declare type BabelNodeDeclareModule = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "DeclareModule"; - id: BabelNodeIdentifier | BabelNodeStringLiteral; - body: BabelNodeBlockStatement; - kind?: "CommonJS" | "ES"; -}; - -declare type BabelNodeDeclareModuleExports = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "DeclareModuleExports"; - typeAnnotation: BabelNodeTypeAnnotation; -}; - -declare type BabelNodeDeclareTypeAlias = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "DeclareTypeAlias"; - id: BabelNodeIdentifier; - typeParameters?: BabelNodeTypeParameterDeclaration; - right: BabelNodeFlowType; -}; - -declare type BabelNodeDeclareOpaqueType = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "DeclareOpaqueType"; - id: BabelNodeIdentifier; - typeParameters?: BabelNodeTypeParameterDeclaration; - supertype?: BabelNodeFlowType; - impltype?: BabelNodeFlowType; -}; - -declare type BabelNodeDeclareVariable = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "DeclareVariable"; - id: BabelNodeIdentifier; -}; - -declare type BabelNodeDeclareExportDeclaration = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "DeclareExportDeclaration"; - declaration?: BabelNodeFlow; - specifiers?: Array; - source?: BabelNodeStringLiteral; - attributes?: Array; - assertions?: Array; - default?: boolean; -}; - -declare type BabelNodeDeclareExportAllDeclaration = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "DeclareExportAllDeclaration"; - source: BabelNodeStringLiteral; - attributes?: Array; - assertions?: Array; - exportKind?: "type" | "value"; -}; - -declare type BabelNodeDeclaredPredicate = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "DeclaredPredicate"; - value: BabelNodeFlow; -}; - -declare type BabelNodeExistsTypeAnnotation = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ExistsTypeAnnotation"; -}; - -declare type BabelNodeFunctionTypeAnnotation = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "FunctionTypeAnnotation"; - typeParameters?: BabelNodeTypeParameterDeclaration; - params: Array; - rest?: BabelNodeFunctionTypeParam; - returnType: BabelNodeFlowType; - this?: BabelNodeFunctionTypeParam; -}; - -declare type BabelNodeFunctionTypeParam = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "FunctionTypeParam"; - name?: BabelNodeIdentifier; - typeAnnotation: BabelNodeFlowType; - optional?: boolean; -}; - -declare type BabelNodeGenericTypeAnnotation = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "GenericTypeAnnotation"; - id: BabelNodeIdentifier | BabelNodeQualifiedTypeIdentifier; - typeParameters?: BabelNodeTypeParameterInstantiation; -}; - -declare type BabelNodeInferredPredicate = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "InferredPredicate"; -}; - -declare type BabelNodeInterfaceExtends = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "InterfaceExtends"; - id: BabelNodeIdentifier | BabelNodeQualifiedTypeIdentifier; - typeParameters?: BabelNodeTypeParameterInstantiation; -}; - -declare type BabelNodeInterfaceDeclaration = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "InterfaceDeclaration"; - id: BabelNodeIdentifier; - typeParameters?: BabelNodeTypeParameterDeclaration; - extends?: Array; - body: BabelNodeObjectTypeAnnotation; -}; - -declare type BabelNodeInterfaceTypeAnnotation = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "InterfaceTypeAnnotation"; - extends?: Array; - body: BabelNodeObjectTypeAnnotation; -}; - -declare type BabelNodeIntersectionTypeAnnotation = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "IntersectionTypeAnnotation"; - types: Array; -}; - -declare type BabelNodeMixedTypeAnnotation = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "MixedTypeAnnotation"; -}; - -declare type BabelNodeEmptyTypeAnnotation = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "EmptyTypeAnnotation"; -}; - -declare type BabelNodeNullableTypeAnnotation = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "NullableTypeAnnotation"; - typeAnnotation: BabelNodeFlowType; -}; - -declare type BabelNodeNumberLiteralTypeAnnotation = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "NumberLiteralTypeAnnotation"; - value: number; -}; - -declare type BabelNodeNumberTypeAnnotation = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "NumberTypeAnnotation"; -}; - -declare type BabelNodeObjectTypeAnnotation = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ObjectTypeAnnotation"; - properties: Array; - indexers?: Array; - callProperties?: Array; - internalSlots?: Array; - exact?: boolean; - inexact?: boolean; -}; - -declare type BabelNodeObjectTypeInternalSlot = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ObjectTypeInternalSlot"; - id: BabelNodeIdentifier; - value: BabelNodeFlowType; - optional: boolean; - static: boolean; - method: boolean; -}; - -declare type BabelNodeObjectTypeCallProperty = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ObjectTypeCallProperty"; - value: BabelNodeFlowType; - static: boolean; -}; - -declare type BabelNodeObjectTypeIndexer = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ObjectTypeIndexer"; - id?: BabelNodeIdentifier; - key: BabelNodeFlowType; - value: BabelNodeFlowType; - variance?: BabelNodeVariance; - static: boolean; -}; - -declare type BabelNodeObjectTypeProperty = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ObjectTypeProperty"; - key: BabelNodeIdentifier | BabelNodeStringLiteral; - value: BabelNodeFlowType; - variance?: BabelNodeVariance; - kind: "init" | "get" | "set"; - method: boolean; - optional: boolean; - proto: boolean; - static: boolean; -}; - -declare type BabelNodeObjectTypeSpreadProperty = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ObjectTypeSpreadProperty"; - argument: BabelNodeFlowType; -}; - -declare type BabelNodeOpaqueType = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "OpaqueType"; - id: BabelNodeIdentifier; - typeParameters?: BabelNodeTypeParameterDeclaration; - supertype?: BabelNodeFlowType; - impltype: BabelNodeFlowType; -}; - -declare type BabelNodeQualifiedTypeIdentifier = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "QualifiedTypeIdentifier"; - id: BabelNodeIdentifier; - qualification: BabelNodeIdentifier | BabelNodeQualifiedTypeIdentifier; -}; - -declare type BabelNodeStringLiteralTypeAnnotation = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "StringLiteralTypeAnnotation"; - value: string; -}; - -declare type BabelNodeStringTypeAnnotation = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "StringTypeAnnotation"; -}; - -declare type BabelNodeSymbolTypeAnnotation = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "SymbolTypeAnnotation"; -}; - -declare type BabelNodeThisTypeAnnotation = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ThisTypeAnnotation"; -}; - -declare type BabelNodeTupleTypeAnnotation = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TupleTypeAnnotation"; - types: Array; -}; - -declare type BabelNodeTypeofTypeAnnotation = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TypeofTypeAnnotation"; - argument: BabelNodeFlowType; -}; - -declare type BabelNodeTypeAlias = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TypeAlias"; - id: BabelNodeIdentifier; - typeParameters?: BabelNodeTypeParameterDeclaration; - right: BabelNodeFlowType; -}; - -declare type BabelNodeTypeAnnotation = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TypeAnnotation"; - typeAnnotation: BabelNodeFlowType; -}; - -declare type BabelNodeTypeCastExpression = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TypeCastExpression"; - expression: BabelNodeExpression; - typeAnnotation: BabelNodeTypeAnnotation; -}; - -declare type BabelNodeTypeParameter = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TypeParameter"; - bound?: BabelNodeTypeAnnotation; - default?: BabelNodeFlowType; - variance?: BabelNodeVariance; - name: string; -}; - -declare type BabelNodeTypeParameterDeclaration = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TypeParameterDeclaration"; - params: Array; -}; - -declare type BabelNodeTypeParameterInstantiation = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TypeParameterInstantiation"; - params: Array; -}; - -declare type BabelNodeUnionTypeAnnotation = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "UnionTypeAnnotation"; - types: Array; -}; - -declare type BabelNodeVariance = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "Variance"; - kind: "minus" | "plus"; -}; - -declare type BabelNodeVoidTypeAnnotation = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "VoidTypeAnnotation"; -}; - -declare type BabelNodeEnumDeclaration = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "EnumDeclaration"; - id: BabelNodeIdentifier; - body: BabelNodeEnumBooleanBody | BabelNodeEnumNumberBody | BabelNodeEnumStringBody | BabelNodeEnumSymbolBody; -}; - -declare type BabelNodeEnumBooleanBody = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "EnumBooleanBody"; - members: Array; - explicitType: boolean; - hasUnknownMembers: boolean; -}; - -declare type BabelNodeEnumNumberBody = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "EnumNumberBody"; - members: Array; - explicitType: boolean; - hasUnknownMembers: boolean; -}; - -declare type BabelNodeEnumStringBody = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "EnumStringBody"; - members: Array; - explicitType: boolean; - hasUnknownMembers: boolean; -}; - -declare type BabelNodeEnumSymbolBody = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "EnumSymbolBody"; - members: Array; - hasUnknownMembers: boolean; -}; - -declare type BabelNodeEnumBooleanMember = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "EnumBooleanMember"; - id: BabelNodeIdentifier; - init: BabelNodeBooleanLiteral; -}; - -declare type BabelNodeEnumNumberMember = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "EnumNumberMember"; - id: BabelNodeIdentifier; - init: BabelNodeNumericLiteral; -}; - -declare type BabelNodeEnumStringMember = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "EnumStringMember"; - id: BabelNodeIdentifier; - init: BabelNodeStringLiteral; -}; - -declare type BabelNodeEnumDefaultedMember = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "EnumDefaultedMember"; - id: BabelNodeIdentifier; -}; - -declare type BabelNodeIndexedAccessType = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "IndexedAccessType"; - objectType: BabelNodeFlowType; - indexType: BabelNodeFlowType; -}; - -declare type BabelNodeOptionalIndexedAccessType = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "OptionalIndexedAccessType"; - objectType: BabelNodeFlowType; - indexType: BabelNodeFlowType; - optional: boolean; -}; - -declare type BabelNodeJSXAttribute = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "JSXAttribute"; - name: BabelNodeJSXIdentifier | BabelNodeJSXNamespacedName; - value?: BabelNodeJSXElement | BabelNodeJSXFragment | BabelNodeStringLiteral | BabelNodeJSXExpressionContainer; -}; - -declare type BabelNodeJSXClosingElement = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "JSXClosingElement"; - name: BabelNodeJSXIdentifier | BabelNodeJSXMemberExpression | BabelNodeJSXNamespacedName; -}; - -declare type BabelNodeJSXElement = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "JSXElement"; - openingElement: BabelNodeJSXOpeningElement; - closingElement?: BabelNodeJSXClosingElement; - children: Array; - selfClosing?: boolean; -}; - -declare type BabelNodeJSXEmptyExpression = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "JSXEmptyExpression"; -}; - -declare type BabelNodeJSXExpressionContainer = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "JSXExpressionContainer"; - expression: BabelNodeExpression | BabelNodeJSXEmptyExpression; -}; - -declare type BabelNodeJSXSpreadChild = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "JSXSpreadChild"; - expression: BabelNodeExpression; -}; - -declare type BabelNodeJSXIdentifier = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "JSXIdentifier"; - name: string; -}; - -declare type BabelNodeJSXMemberExpression = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "JSXMemberExpression"; - object: BabelNodeJSXMemberExpression | BabelNodeJSXIdentifier; - property: BabelNodeJSXIdentifier; -}; - -declare type BabelNodeJSXNamespacedName = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "JSXNamespacedName"; - namespace: BabelNodeJSXIdentifier; - name: BabelNodeJSXIdentifier; -}; - -declare type BabelNodeJSXOpeningElement = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "JSXOpeningElement"; - name: BabelNodeJSXIdentifier | BabelNodeJSXMemberExpression | BabelNodeJSXNamespacedName; - attributes: Array; - selfClosing?: boolean; - typeArguments?: BabelNodeTypeParameterInstantiation; - typeParameters?: BabelNodeTSTypeParameterInstantiation; -}; - -declare type BabelNodeJSXSpreadAttribute = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "JSXSpreadAttribute"; - argument: BabelNodeExpression; -}; - -declare type BabelNodeJSXText = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "JSXText"; - value: string; -}; - -declare type BabelNodeJSXFragment = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "JSXFragment"; - openingFragment: BabelNodeJSXOpeningFragment; - closingFragment: BabelNodeJSXClosingFragment; - children: Array; -}; - -declare type BabelNodeJSXOpeningFragment = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "JSXOpeningFragment"; -}; - -declare type BabelNodeJSXClosingFragment = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "JSXClosingFragment"; -}; - -declare type BabelNodeNoop = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "Noop"; -}; - -declare type BabelNodePlaceholder = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "Placeholder"; - expectedNode: "Identifier" | "StringLiteral" | "Expression" | "Statement" | "Declaration" | "BlockStatement" | "ClassBody" | "Pattern"; - name: BabelNodeIdentifier; - decorators?: Array; - optional?: boolean; - typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; -}; - -declare type BabelNodeV8IntrinsicIdentifier = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "V8IntrinsicIdentifier"; - name: string; -}; - -declare type BabelNodeArgumentPlaceholder = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ArgumentPlaceholder"; -}; - -declare type BabelNodeBindExpression = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "BindExpression"; - object: BabelNodeExpression; - callee: BabelNodeExpression; -}; - -declare type BabelNodeDecorator = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "Decorator"; - expression: BabelNodeExpression; -}; - -declare type BabelNodeDoExpression = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "DoExpression"; - body: BabelNodeBlockStatement; - async?: boolean; -}; - -declare type BabelNodeExportDefaultSpecifier = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ExportDefaultSpecifier"; - exported: BabelNodeIdentifier; -}; - -declare type BabelNodeRecordExpression = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "RecordExpression"; - properties: Array; -}; - -declare type BabelNodeTupleExpression = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TupleExpression"; - elements?: Array; -}; - -declare type BabelNodeDecimalLiteral = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "DecimalLiteral"; - value: string; -}; - -declare type BabelNodeModuleExpression = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "ModuleExpression"; - body: BabelNodeProgram; -}; - -declare type BabelNodeTopicReference = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TopicReference"; -}; - -declare type BabelNodePipelineTopicExpression = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "PipelineTopicExpression"; - expression: BabelNodeExpression; -}; - -declare type BabelNodePipelineBareFunction = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "PipelineBareFunction"; - callee: BabelNodeExpression; -}; - -declare type BabelNodePipelinePrimaryTopicReference = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "PipelinePrimaryTopicReference"; -}; - -declare type BabelNodeVoidPattern = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "VoidPattern"; -}; - -declare type BabelNodeTSParameterProperty = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSParameterProperty"; - parameter: BabelNodeIdentifier | BabelNodeAssignmentPattern; - accessibility?: "public" | "private" | "protected"; - decorators?: Array; - override?: boolean; - readonly?: boolean; -}; - -declare type BabelNodeTSDeclareFunction = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSDeclareFunction"; - id?: BabelNodeIdentifier; - typeParameters?: BabelNodeTSTypeParameterDeclaration | BabelNodeNoop; - params: Array; - returnType?: BabelNodeTSTypeAnnotation | BabelNodeNoop; - async?: boolean; - declare?: boolean; - generator?: boolean; -}; - -declare type BabelNodeTSDeclareMethod = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSDeclareMethod"; - decorators?: Array; - key: BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeBigIntLiteral | BabelNodeExpression; - typeParameters?: BabelNodeTSTypeParameterDeclaration | BabelNodeNoop; - params: Array; - returnType?: BabelNodeTSTypeAnnotation | BabelNodeNoop; - abstract?: boolean; - access?: "public" | "private" | "protected"; - accessibility?: "public" | "private" | "protected"; - async?: boolean; - computed?: boolean; - generator?: boolean; - kind?: "get" | "set" | "method" | "constructor"; - optional?: boolean; - override?: boolean; - static?: boolean; -}; - -declare type BabelNodeTSQualifiedName = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSQualifiedName"; - left: BabelNodeTSEntityName; - right: BabelNodeIdentifier; -}; - -declare type BabelNodeTSCallSignatureDeclaration = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSCallSignatureDeclaration"; - typeParameters?: BabelNodeTSTypeParameterDeclaration; - parameters: Array; - typeAnnotation?: BabelNodeTSTypeAnnotation; -}; - -declare type BabelNodeTSConstructSignatureDeclaration = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSConstructSignatureDeclaration"; - typeParameters?: BabelNodeTSTypeParameterDeclaration; - parameters: Array; - typeAnnotation?: BabelNodeTSTypeAnnotation; -}; - -declare type BabelNodeTSPropertySignature = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSPropertySignature"; - key: BabelNodeExpression; - typeAnnotation?: BabelNodeTSTypeAnnotation; - computed?: boolean; - kind?: "get" | "set"; - optional?: boolean; - readonly?: boolean; -}; - -declare type BabelNodeTSMethodSignature = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSMethodSignature"; - key: BabelNodeExpression; - typeParameters?: BabelNodeTSTypeParameterDeclaration; - parameters: Array; - typeAnnotation?: BabelNodeTSTypeAnnotation; - computed?: boolean; - kind: "method" | "get" | "set"; - optional?: boolean; -}; - -declare type BabelNodeTSIndexSignature = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSIndexSignature"; - parameters: Array; - typeAnnotation?: BabelNodeTSTypeAnnotation; - readonly?: boolean; - static?: boolean; -}; - -declare type BabelNodeTSAnyKeyword = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSAnyKeyword"; -}; - -declare type BabelNodeTSBooleanKeyword = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSBooleanKeyword"; -}; - -declare type BabelNodeTSBigIntKeyword = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSBigIntKeyword"; -}; - -declare type BabelNodeTSIntrinsicKeyword = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSIntrinsicKeyword"; -}; - -declare type BabelNodeTSNeverKeyword = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSNeverKeyword"; -}; - -declare type BabelNodeTSNullKeyword = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSNullKeyword"; -}; - -declare type BabelNodeTSNumberKeyword = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSNumberKeyword"; -}; - -declare type BabelNodeTSObjectKeyword = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSObjectKeyword"; -}; - -declare type BabelNodeTSStringKeyword = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSStringKeyword"; -}; - -declare type BabelNodeTSSymbolKeyword = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSSymbolKeyword"; -}; - -declare type BabelNodeTSUndefinedKeyword = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSUndefinedKeyword"; -}; - -declare type BabelNodeTSUnknownKeyword = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSUnknownKeyword"; -}; - -declare type BabelNodeTSVoidKeyword = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSVoidKeyword"; -}; - -declare type BabelNodeTSThisType = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSThisType"; -}; - -declare type BabelNodeTSFunctionType = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSFunctionType"; - typeParameters?: BabelNodeTSTypeParameterDeclaration; - parameters: Array; - typeAnnotation?: BabelNodeTSTypeAnnotation; -}; - -declare type BabelNodeTSConstructorType = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSConstructorType"; - typeParameters?: BabelNodeTSTypeParameterDeclaration; - parameters: Array; - typeAnnotation?: BabelNodeTSTypeAnnotation; - abstract?: boolean; -}; - -declare type BabelNodeTSTypeReference = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSTypeReference"; - typeName: BabelNodeTSEntityName; - typeParameters?: BabelNodeTSTypeParameterInstantiation; -}; - -declare type BabelNodeTSTypePredicate = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSTypePredicate"; - parameterName: BabelNodeIdentifier | BabelNodeTSThisType; - typeAnnotation?: BabelNodeTSTypeAnnotation; - asserts?: boolean; -}; - -declare type BabelNodeTSTypeQuery = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSTypeQuery"; - exprName: BabelNodeTSEntityName | BabelNodeTSImportType; - typeParameters?: BabelNodeTSTypeParameterInstantiation; -}; - -declare type BabelNodeTSTypeLiteral = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSTypeLiteral"; - members: Array; -}; - -declare type BabelNodeTSArrayType = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSArrayType"; - elementType: BabelNodeTSType; -}; - -declare type BabelNodeTSTupleType = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSTupleType"; - elementTypes: Array; -}; - -declare type BabelNodeTSOptionalType = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSOptionalType"; - typeAnnotation: BabelNodeTSType; -}; - -declare type BabelNodeTSRestType = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSRestType"; - typeAnnotation: BabelNodeTSType; -}; - -declare type BabelNodeTSNamedTupleMember = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSNamedTupleMember"; - label: BabelNodeIdentifier; - elementType: BabelNodeTSType; - optional?: boolean; -}; - -declare type BabelNodeTSUnionType = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSUnionType"; - types: Array; -}; - -declare type BabelNodeTSIntersectionType = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSIntersectionType"; - types: Array; -}; - -declare type BabelNodeTSConditionalType = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSConditionalType"; - checkType: BabelNodeTSType; - extendsType: BabelNodeTSType; - trueType: BabelNodeTSType; - falseType: BabelNodeTSType; -}; - -declare type BabelNodeTSInferType = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSInferType"; - typeParameter: BabelNodeTSTypeParameter; -}; - -declare type BabelNodeTSParenthesizedType = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSParenthesizedType"; - typeAnnotation: BabelNodeTSType; -}; - -declare type BabelNodeTSTypeOperator = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSTypeOperator"; - typeAnnotation: BabelNodeTSType; - operator?: string; -}; - -declare type BabelNodeTSIndexedAccessType = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSIndexedAccessType"; - objectType: BabelNodeTSType; - indexType: BabelNodeTSType; -}; - -declare type BabelNodeTSMappedType = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSMappedType"; - typeParameter: BabelNodeTSTypeParameter; - typeAnnotation?: BabelNodeTSType; - nameType?: BabelNodeTSType; - optional?: true | false | "+" | "-"; - readonly?: true | false | "+" | "-"; -}; - -declare type BabelNodeTSTemplateLiteralType = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSTemplateLiteralType"; - quasis: Array; - types: Array; -}; - -declare type BabelNodeTSLiteralType = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSLiteralType"; - literal: BabelNodeNumericLiteral | BabelNodeStringLiteral | BabelNodeBooleanLiteral | BabelNodeBigIntLiteral | BabelNodeTemplateLiteral | BabelNodeUnaryExpression; -}; - -declare type BabelNodeTSExpressionWithTypeArguments = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSExpressionWithTypeArguments"; - expression: BabelNodeTSEntityName; - typeParameters?: BabelNodeTSTypeParameterInstantiation; -}; - -declare type BabelNodeTSInterfaceDeclaration = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSInterfaceDeclaration"; - id: BabelNodeIdentifier; - typeParameters?: BabelNodeTSTypeParameterDeclaration; - extends?: Array; - body: BabelNodeTSInterfaceBody; - declare?: boolean; -}; - -declare type BabelNodeTSInterfaceBody = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSInterfaceBody"; - body: Array; -}; - -declare type BabelNodeTSTypeAliasDeclaration = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSTypeAliasDeclaration"; - id: BabelNodeIdentifier; - typeParameters?: BabelNodeTSTypeParameterDeclaration; - typeAnnotation: BabelNodeTSType; - declare?: boolean; -}; - -declare type BabelNodeTSInstantiationExpression = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSInstantiationExpression"; - expression: BabelNodeExpression; - typeParameters?: BabelNodeTSTypeParameterInstantiation; -}; - -declare type BabelNodeTSAsExpression = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSAsExpression"; - expression: BabelNodeExpression; - typeAnnotation: BabelNodeTSType; -}; - -declare type BabelNodeTSSatisfiesExpression = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSSatisfiesExpression"; - expression: BabelNodeExpression; - typeAnnotation: BabelNodeTSType; -}; - -declare type BabelNodeTSTypeAssertion = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSTypeAssertion"; - typeAnnotation: BabelNodeTSType; - expression: BabelNodeExpression; -}; - -declare type BabelNodeTSEnumBody = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSEnumBody"; - members: Array; -}; - -declare type BabelNodeTSEnumDeclaration = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSEnumDeclaration"; - id: BabelNodeIdentifier; - members: Array; - body?: BabelNodeTSEnumBody; - const?: boolean; - declare?: boolean; - initializer?: BabelNodeExpression; -}; - -declare type BabelNodeTSEnumMember = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSEnumMember"; - id: BabelNodeIdentifier | BabelNodeStringLiteral; - initializer?: BabelNodeExpression; -}; - -declare type BabelNodeTSModuleDeclaration = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSModuleDeclaration"; - id: BabelNodeIdentifier | BabelNodeStringLiteral; - body: BabelNodeTSModuleBlock | BabelNodeTSModuleDeclaration; - declare?: boolean; - global?: boolean; - kind: "global" | "module" | "namespace"; -}; - -declare type BabelNodeTSModuleBlock = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSModuleBlock"; - body: Array; -}; - -declare type BabelNodeTSImportType = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSImportType"; - argument: BabelNodeStringLiteral; - qualifier?: BabelNodeTSEntityName; - typeParameters?: BabelNodeTSTypeParameterInstantiation; - options?: BabelNodeObjectExpression; -}; - -declare type BabelNodeTSImportEqualsDeclaration = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSImportEqualsDeclaration"; - id: BabelNodeIdentifier; - moduleReference: BabelNodeTSEntityName | BabelNodeTSExternalModuleReference; - importKind?: "type" | "value"; - isExport: boolean; -}; - -declare type BabelNodeTSExternalModuleReference = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSExternalModuleReference"; - expression: BabelNodeStringLiteral; -}; - -declare type BabelNodeTSNonNullExpression = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSNonNullExpression"; - expression: BabelNodeExpression; -}; - -declare type BabelNodeTSExportAssignment = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSExportAssignment"; - expression: BabelNodeExpression; -}; - -declare type BabelNodeTSNamespaceExportDeclaration = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSNamespaceExportDeclaration"; - id: BabelNodeIdentifier; -}; - -declare type BabelNodeTSTypeAnnotation = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSTypeAnnotation"; - typeAnnotation: BabelNodeTSType; -}; - -declare type BabelNodeTSTypeParameterInstantiation = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSTypeParameterInstantiation"; - params: Array; -}; - -declare type BabelNodeTSTypeParameterDeclaration = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSTypeParameterDeclaration"; - params: Array; -}; - -declare type BabelNodeTSTypeParameter = { - leadingComments?: Array; - innerComments?: Array; - trailingComments?: Array; - start: ?number; - end: ?number; - loc: ?BabelNodeSourceLocation, - type: "TSTypeParameter"; - constraint?: BabelNodeTSType; - default?: BabelNodeTSType; - name: string; - const?: boolean; - in?: boolean; - out?: boolean; -}; - -declare type BabelNode = BabelNodeArrayExpression | BabelNodeAssignmentExpression | BabelNodeBinaryExpression | BabelNodeInterpreterDirective | BabelNodeDirective | BabelNodeDirectiveLiteral | BabelNodeBlockStatement | BabelNodeBreakStatement | BabelNodeCallExpression | BabelNodeCatchClause | BabelNodeConditionalExpression | BabelNodeContinueStatement | BabelNodeDebuggerStatement | BabelNodeDoWhileStatement | BabelNodeEmptyStatement | BabelNodeExpressionStatement | BabelNodeFile | BabelNodeForInStatement | BabelNodeForStatement | BabelNodeFunctionDeclaration | BabelNodeFunctionExpression | BabelNodeIdentifier | BabelNodeIfStatement | BabelNodeLabeledStatement | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeNullLiteral | BabelNodeBooleanLiteral | BabelNodeRegExpLiteral | BabelNodeLogicalExpression | BabelNodeMemberExpression | BabelNodeNewExpression | BabelNodeProgram | BabelNodeObjectExpression | BabelNodeObjectMethod | BabelNodeObjectProperty | BabelNodeRestElement | BabelNodeReturnStatement | BabelNodeSequenceExpression | BabelNodeParenthesizedExpression | BabelNodeSwitchCase | BabelNodeSwitchStatement | BabelNodeThisExpression | BabelNodeThrowStatement | BabelNodeTryStatement | BabelNodeUnaryExpression | BabelNodeUpdateExpression | BabelNodeVariableDeclaration | BabelNodeVariableDeclarator | BabelNodeWhileStatement | BabelNodeWithStatement | BabelNodeAssignmentPattern | BabelNodeArrayPattern | BabelNodeArrowFunctionExpression | BabelNodeClassBody | BabelNodeClassExpression | BabelNodeClassDeclaration | BabelNodeExportAllDeclaration | BabelNodeExportDefaultDeclaration | BabelNodeExportNamedDeclaration | BabelNodeExportSpecifier | BabelNodeForOfStatement | BabelNodeImportDeclaration | BabelNodeImportDefaultSpecifier | BabelNodeImportNamespaceSpecifier | BabelNodeImportSpecifier | BabelNodeImportExpression | BabelNodeMetaProperty | BabelNodeClassMethod | BabelNodeObjectPattern | BabelNodeSpreadElement | BabelNodeSuper | BabelNodeTaggedTemplateExpression | BabelNodeTemplateElement | BabelNodeTemplateLiteral | BabelNodeYieldExpression | BabelNodeAwaitExpression | BabelNodeImport | BabelNodeBigIntLiteral | BabelNodeExportNamespaceSpecifier | BabelNodeOptionalMemberExpression | BabelNodeOptionalCallExpression | BabelNodeClassProperty | BabelNodeClassAccessorProperty | BabelNodeClassPrivateProperty | BabelNodeClassPrivateMethod | BabelNodePrivateName | BabelNodeStaticBlock | BabelNodeImportAttribute | BabelNodeAnyTypeAnnotation | BabelNodeArrayTypeAnnotation | BabelNodeBooleanTypeAnnotation | BabelNodeBooleanLiteralTypeAnnotation | BabelNodeNullLiteralTypeAnnotation | BabelNodeClassImplements | BabelNodeDeclareClass | BabelNodeDeclareFunction | BabelNodeDeclareInterface | BabelNodeDeclareModule | BabelNodeDeclareModuleExports | BabelNodeDeclareTypeAlias | BabelNodeDeclareOpaqueType | BabelNodeDeclareVariable | BabelNodeDeclareExportDeclaration | BabelNodeDeclareExportAllDeclaration | BabelNodeDeclaredPredicate | BabelNodeExistsTypeAnnotation | BabelNodeFunctionTypeAnnotation | BabelNodeFunctionTypeParam | BabelNodeGenericTypeAnnotation | BabelNodeInferredPredicate | BabelNodeInterfaceExtends | BabelNodeInterfaceDeclaration | BabelNodeInterfaceTypeAnnotation | BabelNodeIntersectionTypeAnnotation | BabelNodeMixedTypeAnnotation | BabelNodeEmptyTypeAnnotation | BabelNodeNullableTypeAnnotation | BabelNodeNumberLiteralTypeAnnotation | BabelNodeNumberTypeAnnotation | BabelNodeObjectTypeAnnotation | BabelNodeObjectTypeInternalSlot | BabelNodeObjectTypeCallProperty | BabelNodeObjectTypeIndexer | BabelNodeObjectTypeProperty | BabelNodeObjectTypeSpreadProperty | BabelNodeOpaqueType | BabelNodeQualifiedTypeIdentifier | BabelNodeStringLiteralTypeAnnotation | BabelNodeStringTypeAnnotation | BabelNodeSymbolTypeAnnotation | BabelNodeThisTypeAnnotation | BabelNodeTupleTypeAnnotation | BabelNodeTypeofTypeAnnotation | BabelNodeTypeAlias | BabelNodeTypeAnnotation | BabelNodeTypeCastExpression | BabelNodeTypeParameter | BabelNodeTypeParameterDeclaration | BabelNodeTypeParameterInstantiation | BabelNodeUnionTypeAnnotation | BabelNodeVariance | BabelNodeVoidTypeAnnotation | BabelNodeEnumDeclaration | BabelNodeEnumBooleanBody | BabelNodeEnumNumberBody | BabelNodeEnumStringBody | BabelNodeEnumSymbolBody | BabelNodeEnumBooleanMember | BabelNodeEnumNumberMember | BabelNodeEnumStringMember | BabelNodeEnumDefaultedMember | BabelNodeIndexedAccessType | BabelNodeOptionalIndexedAccessType | BabelNodeJSXAttribute | BabelNodeJSXClosingElement | BabelNodeJSXElement | BabelNodeJSXEmptyExpression | BabelNodeJSXExpressionContainer | BabelNodeJSXSpreadChild | BabelNodeJSXIdentifier | BabelNodeJSXMemberExpression | BabelNodeJSXNamespacedName | BabelNodeJSXOpeningElement | BabelNodeJSXSpreadAttribute | BabelNodeJSXText | BabelNodeJSXFragment | BabelNodeJSXOpeningFragment | BabelNodeJSXClosingFragment | BabelNodeNoop | BabelNodePlaceholder | BabelNodeV8IntrinsicIdentifier | BabelNodeArgumentPlaceholder | BabelNodeBindExpression | BabelNodeDecorator | BabelNodeDoExpression | BabelNodeExportDefaultSpecifier | BabelNodeRecordExpression | BabelNodeTupleExpression | BabelNodeDecimalLiteral | BabelNodeModuleExpression | BabelNodeTopicReference | BabelNodePipelineTopicExpression | BabelNodePipelineBareFunction | BabelNodePipelinePrimaryTopicReference | BabelNodeVoidPattern | BabelNodeTSParameterProperty | BabelNodeTSDeclareFunction | BabelNodeTSDeclareMethod | BabelNodeTSQualifiedName | BabelNodeTSCallSignatureDeclaration | BabelNodeTSConstructSignatureDeclaration | BabelNodeTSPropertySignature | BabelNodeTSMethodSignature | BabelNodeTSIndexSignature | BabelNodeTSAnyKeyword | BabelNodeTSBooleanKeyword | BabelNodeTSBigIntKeyword | BabelNodeTSIntrinsicKeyword | BabelNodeTSNeverKeyword | BabelNodeTSNullKeyword | BabelNodeTSNumberKeyword | BabelNodeTSObjectKeyword | BabelNodeTSStringKeyword | BabelNodeTSSymbolKeyword | BabelNodeTSUndefinedKeyword | BabelNodeTSUnknownKeyword | BabelNodeTSVoidKeyword | BabelNodeTSThisType | BabelNodeTSFunctionType | BabelNodeTSConstructorType | BabelNodeTSTypeReference | BabelNodeTSTypePredicate | BabelNodeTSTypeQuery | BabelNodeTSTypeLiteral | BabelNodeTSArrayType | BabelNodeTSTupleType | BabelNodeTSOptionalType | BabelNodeTSRestType | BabelNodeTSNamedTupleMember | BabelNodeTSUnionType | BabelNodeTSIntersectionType | BabelNodeTSConditionalType | BabelNodeTSInferType | BabelNodeTSParenthesizedType | BabelNodeTSTypeOperator | BabelNodeTSIndexedAccessType | BabelNodeTSMappedType | BabelNodeTSTemplateLiteralType | BabelNodeTSLiteralType | BabelNodeTSExpressionWithTypeArguments | BabelNodeTSInterfaceDeclaration | BabelNodeTSInterfaceBody | BabelNodeTSTypeAliasDeclaration | BabelNodeTSInstantiationExpression | BabelNodeTSAsExpression | BabelNodeTSSatisfiesExpression | BabelNodeTSTypeAssertion | BabelNodeTSEnumBody | BabelNodeTSEnumDeclaration | BabelNodeTSEnumMember | BabelNodeTSModuleDeclaration | BabelNodeTSModuleBlock | BabelNodeTSImportType | BabelNodeTSImportEqualsDeclaration | BabelNodeTSExternalModuleReference | BabelNodeTSNonNullExpression | BabelNodeTSExportAssignment | BabelNodeTSNamespaceExportDeclaration | BabelNodeTSTypeAnnotation | BabelNodeTSTypeParameterInstantiation | BabelNodeTSTypeParameterDeclaration | BabelNodeTSTypeParameter; -declare type BabelNodeStandardized = BabelNodeArrayExpression | BabelNodeAssignmentExpression | BabelNodeBinaryExpression | BabelNodeInterpreterDirective | BabelNodeDirective | BabelNodeDirectiveLiteral | BabelNodeBlockStatement | BabelNodeBreakStatement | BabelNodeCallExpression | BabelNodeCatchClause | BabelNodeConditionalExpression | BabelNodeContinueStatement | BabelNodeDebuggerStatement | BabelNodeDoWhileStatement | BabelNodeEmptyStatement | BabelNodeExpressionStatement | BabelNodeFile | BabelNodeForInStatement | BabelNodeForStatement | BabelNodeFunctionDeclaration | BabelNodeFunctionExpression | BabelNodeIdentifier | BabelNodeIfStatement | BabelNodeLabeledStatement | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeNullLiteral | BabelNodeBooleanLiteral | BabelNodeRegExpLiteral | BabelNodeLogicalExpression | BabelNodeMemberExpression | BabelNodeNewExpression | BabelNodeProgram | BabelNodeObjectExpression | BabelNodeObjectMethod | BabelNodeObjectProperty | BabelNodeRestElement | BabelNodeReturnStatement | BabelNodeSequenceExpression | BabelNodeParenthesizedExpression | BabelNodeSwitchCase | BabelNodeSwitchStatement | BabelNodeThisExpression | BabelNodeThrowStatement | BabelNodeTryStatement | BabelNodeUnaryExpression | BabelNodeUpdateExpression | BabelNodeVariableDeclaration | BabelNodeVariableDeclarator | BabelNodeWhileStatement | BabelNodeWithStatement | BabelNodeAssignmentPattern | BabelNodeArrayPattern | BabelNodeArrowFunctionExpression | BabelNodeClassBody | BabelNodeClassExpression | BabelNodeClassDeclaration | BabelNodeExportAllDeclaration | BabelNodeExportDefaultDeclaration | BabelNodeExportNamedDeclaration | BabelNodeExportSpecifier | BabelNodeForOfStatement | BabelNodeImportDeclaration | BabelNodeImportDefaultSpecifier | BabelNodeImportNamespaceSpecifier | BabelNodeImportSpecifier | BabelNodeImportExpression | BabelNodeMetaProperty | BabelNodeClassMethod | BabelNodeObjectPattern | BabelNodeSpreadElement | BabelNodeSuper | BabelNodeTaggedTemplateExpression | BabelNodeTemplateElement | BabelNodeTemplateLiteral | BabelNodeYieldExpression | BabelNodeAwaitExpression | BabelNodeImport | BabelNodeBigIntLiteral | BabelNodeExportNamespaceSpecifier | BabelNodeOptionalMemberExpression | BabelNodeOptionalCallExpression | BabelNodeClassProperty | BabelNodeClassAccessorProperty | BabelNodeClassPrivateProperty | BabelNodeClassPrivateMethod | BabelNodePrivateName | BabelNodeStaticBlock | BabelNodeImportAttribute; -declare type BabelNodeExpression = BabelNodeArrayExpression | BabelNodeAssignmentExpression | BabelNodeBinaryExpression | BabelNodeCallExpression | BabelNodeConditionalExpression | BabelNodeFunctionExpression | BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeNullLiteral | BabelNodeBooleanLiteral | BabelNodeRegExpLiteral | BabelNodeLogicalExpression | BabelNodeMemberExpression | BabelNodeNewExpression | BabelNodeObjectExpression | BabelNodeSequenceExpression | BabelNodeParenthesizedExpression | BabelNodeThisExpression | BabelNodeUnaryExpression | BabelNodeUpdateExpression | BabelNodeArrowFunctionExpression | BabelNodeClassExpression | BabelNodeImportExpression | BabelNodeMetaProperty | BabelNodeSuper | BabelNodeTaggedTemplateExpression | BabelNodeTemplateLiteral | BabelNodeYieldExpression | BabelNodeAwaitExpression | BabelNodeImport | BabelNodeBigIntLiteral | BabelNodeOptionalMemberExpression | BabelNodeOptionalCallExpression | BabelNodeTypeCastExpression | BabelNodeJSXElement | BabelNodeJSXFragment | BabelNodeBindExpression | BabelNodeDoExpression | BabelNodeRecordExpression | BabelNodeTupleExpression | BabelNodeDecimalLiteral | BabelNodeModuleExpression | BabelNodeTopicReference | BabelNodePipelineTopicExpression | BabelNodePipelineBareFunction | BabelNodePipelinePrimaryTopicReference | BabelNodeTSInstantiationExpression | BabelNodeTSAsExpression | BabelNodeTSSatisfiesExpression | BabelNodeTSTypeAssertion | BabelNodeTSNonNullExpression; -declare type BabelNodeBinary = BabelNodeBinaryExpression | BabelNodeLogicalExpression; -declare type BabelNodeScopable = BabelNodeBlockStatement | BabelNodeCatchClause | BabelNodeDoWhileStatement | BabelNodeForInStatement | BabelNodeForStatement | BabelNodeFunctionDeclaration | BabelNodeFunctionExpression | BabelNodeProgram | BabelNodeObjectMethod | BabelNodeSwitchStatement | BabelNodeWhileStatement | BabelNodeArrowFunctionExpression | BabelNodeClassExpression | BabelNodeClassDeclaration | BabelNodeForOfStatement | BabelNodeClassMethod | BabelNodeClassPrivateMethod | BabelNodeStaticBlock | BabelNodeTSModuleBlock; -declare type BabelNodeBlockParent = BabelNodeBlockStatement | BabelNodeCatchClause | BabelNodeDoWhileStatement | BabelNodeForInStatement | BabelNodeForStatement | BabelNodeFunctionDeclaration | BabelNodeFunctionExpression | BabelNodeProgram | BabelNodeObjectMethod | BabelNodeSwitchStatement | BabelNodeWhileStatement | BabelNodeArrowFunctionExpression | BabelNodeForOfStatement | BabelNodeClassMethod | BabelNodeClassPrivateMethod | BabelNodeStaticBlock | BabelNodeTSModuleBlock; -declare type BabelNodeBlock = BabelNodeBlockStatement | BabelNodeProgram | BabelNodeTSModuleBlock; -declare type BabelNodeStatement = BabelNodeBlockStatement | BabelNodeBreakStatement | BabelNodeContinueStatement | BabelNodeDebuggerStatement | BabelNodeDoWhileStatement | BabelNodeEmptyStatement | BabelNodeExpressionStatement | BabelNodeForInStatement | BabelNodeForStatement | BabelNodeFunctionDeclaration | BabelNodeIfStatement | BabelNodeLabeledStatement | BabelNodeReturnStatement | BabelNodeSwitchStatement | BabelNodeThrowStatement | BabelNodeTryStatement | BabelNodeVariableDeclaration | BabelNodeWhileStatement | BabelNodeWithStatement | BabelNodeClassDeclaration | BabelNodeExportAllDeclaration | BabelNodeExportDefaultDeclaration | BabelNodeExportNamedDeclaration | BabelNodeForOfStatement | BabelNodeImportDeclaration | BabelNodeDeclareClass | BabelNodeDeclareFunction | BabelNodeDeclareInterface | BabelNodeDeclareModule | BabelNodeDeclareModuleExports | BabelNodeDeclareTypeAlias | BabelNodeDeclareOpaqueType | BabelNodeDeclareVariable | BabelNodeDeclareExportDeclaration | BabelNodeDeclareExportAllDeclaration | BabelNodeInterfaceDeclaration | BabelNodeOpaqueType | BabelNodeTypeAlias | BabelNodeEnumDeclaration | BabelNodeTSDeclareFunction | BabelNodeTSInterfaceDeclaration | BabelNodeTSTypeAliasDeclaration | BabelNodeTSEnumDeclaration | BabelNodeTSModuleDeclaration | BabelNodeTSImportEqualsDeclaration | BabelNodeTSExportAssignment | BabelNodeTSNamespaceExportDeclaration; -declare type BabelNodeTerminatorless = BabelNodeBreakStatement | BabelNodeContinueStatement | BabelNodeReturnStatement | BabelNodeThrowStatement | BabelNodeYieldExpression | BabelNodeAwaitExpression; -declare type BabelNodeCompletionStatement = BabelNodeBreakStatement | BabelNodeContinueStatement | BabelNodeReturnStatement | BabelNodeThrowStatement; -declare type BabelNodeConditional = BabelNodeConditionalExpression | BabelNodeIfStatement; -declare type BabelNodeLoop = BabelNodeDoWhileStatement | BabelNodeForInStatement | BabelNodeForStatement | BabelNodeWhileStatement | BabelNodeForOfStatement; -declare type BabelNodeWhile = BabelNodeDoWhileStatement | BabelNodeWhileStatement; -declare type BabelNodeExpressionWrapper = BabelNodeExpressionStatement | BabelNodeParenthesizedExpression | BabelNodeTypeCastExpression; -declare type BabelNodeFor = BabelNodeForInStatement | BabelNodeForStatement | BabelNodeForOfStatement; -declare type BabelNodeForXStatement = BabelNodeForInStatement | BabelNodeForOfStatement; -declare type BabelNodeFunction = BabelNodeFunctionDeclaration | BabelNodeFunctionExpression | BabelNodeObjectMethod | BabelNodeArrowFunctionExpression | BabelNodeClassMethod | BabelNodeClassPrivateMethod; -declare type BabelNodeFunctionParent = BabelNodeFunctionDeclaration | BabelNodeFunctionExpression | BabelNodeObjectMethod | BabelNodeArrowFunctionExpression | BabelNodeClassMethod | BabelNodeClassPrivateMethod | BabelNodeStaticBlock | BabelNodeTSModuleBlock; -declare type BabelNodePureish = BabelNodeFunctionDeclaration | BabelNodeFunctionExpression | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeNullLiteral | BabelNodeBooleanLiteral | BabelNodeRegExpLiteral | BabelNodeArrowFunctionExpression | BabelNodeBigIntLiteral | BabelNodeDecimalLiteral; -declare type BabelNodeDeclaration = BabelNodeFunctionDeclaration | BabelNodeVariableDeclaration | BabelNodeClassDeclaration | BabelNodeExportAllDeclaration | BabelNodeExportDefaultDeclaration | BabelNodeExportNamedDeclaration | BabelNodeImportDeclaration | BabelNodeDeclareClass | BabelNodeDeclareFunction | BabelNodeDeclareInterface | BabelNodeDeclareModule | BabelNodeDeclareModuleExports | BabelNodeDeclareTypeAlias | BabelNodeDeclareOpaqueType | BabelNodeDeclareVariable | BabelNodeDeclareExportDeclaration | BabelNodeDeclareExportAllDeclaration | BabelNodeInterfaceDeclaration | BabelNodeOpaqueType | BabelNodeTypeAlias | BabelNodeEnumDeclaration | BabelNodeTSDeclareFunction | BabelNodeTSInterfaceDeclaration | BabelNodeTSTypeAliasDeclaration | BabelNodeTSEnumDeclaration | BabelNodeTSModuleDeclaration | BabelNodeTSImportEqualsDeclaration; -declare type BabelNodeFunctionParameter = BabelNodeIdentifier | BabelNodeRestElement | BabelNodeAssignmentPattern | BabelNodeArrayPattern | BabelNodeObjectPattern | BabelNodeVoidPattern; -declare type BabelNodePatternLike = BabelNodeIdentifier | BabelNodeMemberExpression | BabelNodeRestElement | BabelNodeAssignmentPattern | BabelNodeArrayPattern | BabelNodeObjectPattern | BabelNodeVoidPattern | BabelNodeTSAsExpression | BabelNodeTSSatisfiesExpression | BabelNodeTSTypeAssertion | BabelNodeTSNonNullExpression; -declare type BabelNodeLVal = BabelNodeIdentifier | BabelNodeMemberExpression | BabelNodeRestElement | BabelNodeAssignmentPattern | BabelNodeArrayPattern | BabelNodeObjectPattern | BabelNodeTSParameterProperty | BabelNodeTSAsExpression | BabelNodeTSSatisfiesExpression | BabelNodeTSTypeAssertion | BabelNodeTSNonNullExpression; -declare type BabelNodeTSEntityName = BabelNodeIdentifier | BabelNodeTSQualifiedName; -declare type BabelNodeLiteral = BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeNullLiteral | BabelNodeBooleanLiteral | BabelNodeRegExpLiteral | BabelNodeTemplateLiteral | BabelNodeBigIntLiteral | BabelNodeDecimalLiteral; -declare type BabelNodeImmutable = BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeNullLiteral | BabelNodeBooleanLiteral | BabelNodeBigIntLiteral | BabelNodeJSXAttribute | BabelNodeJSXClosingElement | BabelNodeJSXElement | BabelNodeJSXExpressionContainer | BabelNodeJSXSpreadChild | BabelNodeJSXOpeningElement | BabelNodeJSXText | BabelNodeJSXFragment | BabelNodeJSXOpeningFragment | BabelNodeJSXClosingFragment | BabelNodeDecimalLiteral; -declare type BabelNodeUserWhitespacable = BabelNodeObjectMethod | BabelNodeObjectProperty | BabelNodeObjectTypeInternalSlot | BabelNodeObjectTypeCallProperty | BabelNodeObjectTypeIndexer | BabelNodeObjectTypeProperty | BabelNodeObjectTypeSpreadProperty; -declare type BabelNodeMethod = BabelNodeObjectMethod | BabelNodeClassMethod | BabelNodeClassPrivateMethod; -declare type BabelNodeObjectMember = BabelNodeObjectMethod | BabelNodeObjectProperty; -declare type BabelNodeProperty = BabelNodeObjectProperty | BabelNodeClassProperty | BabelNodeClassAccessorProperty | BabelNodeClassPrivateProperty; -declare type BabelNodeUnaryLike = BabelNodeUnaryExpression | BabelNodeSpreadElement; -declare type BabelNodePattern = BabelNodeAssignmentPattern | BabelNodeArrayPattern | BabelNodeObjectPattern | BabelNodeVoidPattern; -declare type BabelNodeClass = BabelNodeClassExpression | BabelNodeClassDeclaration; -declare type BabelNodeImportOrExportDeclaration = BabelNodeExportAllDeclaration | BabelNodeExportDefaultDeclaration | BabelNodeExportNamedDeclaration | BabelNodeImportDeclaration; -declare type BabelNodeExportDeclaration = BabelNodeExportAllDeclaration | BabelNodeExportDefaultDeclaration | BabelNodeExportNamedDeclaration; -declare type BabelNodeModuleSpecifier = BabelNodeExportSpecifier | BabelNodeImportDefaultSpecifier | BabelNodeImportNamespaceSpecifier | BabelNodeImportSpecifier | BabelNodeExportNamespaceSpecifier | BabelNodeExportDefaultSpecifier; -declare type BabelNodeAccessor = BabelNodeClassAccessorProperty; -declare type BabelNodePrivate = BabelNodeClassPrivateProperty | BabelNodeClassPrivateMethod | BabelNodePrivateName; -declare type BabelNodeFlow = BabelNodeAnyTypeAnnotation | BabelNodeArrayTypeAnnotation | BabelNodeBooleanTypeAnnotation | BabelNodeBooleanLiteralTypeAnnotation | BabelNodeNullLiteralTypeAnnotation | BabelNodeClassImplements | BabelNodeDeclareClass | BabelNodeDeclareFunction | BabelNodeDeclareInterface | BabelNodeDeclareModule | BabelNodeDeclareModuleExports | BabelNodeDeclareTypeAlias | BabelNodeDeclareOpaqueType | BabelNodeDeclareVariable | BabelNodeDeclareExportDeclaration | BabelNodeDeclareExportAllDeclaration | BabelNodeDeclaredPredicate | BabelNodeExistsTypeAnnotation | BabelNodeFunctionTypeAnnotation | BabelNodeFunctionTypeParam | BabelNodeGenericTypeAnnotation | BabelNodeInferredPredicate | BabelNodeInterfaceExtends | BabelNodeInterfaceDeclaration | BabelNodeInterfaceTypeAnnotation | BabelNodeIntersectionTypeAnnotation | BabelNodeMixedTypeAnnotation | BabelNodeEmptyTypeAnnotation | BabelNodeNullableTypeAnnotation | BabelNodeNumberLiteralTypeAnnotation | BabelNodeNumberTypeAnnotation | BabelNodeObjectTypeAnnotation | BabelNodeObjectTypeInternalSlot | BabelNodeObjectTypeCallProperty | BabelNodeObjectTypeIndexer | BabelNodeObjectTypeProperty | BabelNodeObjectTypeSpreadProperty | BabelNodeOpaqueType | BabelNodeQualifiedTypeIdentifier | BabelNodeStringLiteralTypeAnnotation | BabelNodeStringTypeAnnotation | BabelNodeSymbolTypeAnnotation | BabelNodeThisTypeAnnotation | BabelNodeTupleTypeAnnotation | BabelNodeTypeofTypeAnnotation | BabelNodeTypeAlias | BabelNodeTypeAnnotation | BabelNodeTypeCastExpression | BabelNodeTypeParameter | BabelNodeTypeParameterDeclaration | BabelNodeTypeParameterInstantiation | BabelNodeUnionTypeAnnotation | BabelNodeVariance | BabelNodeVoidTypeAnnotation | BabelNodeEnumDeclaration | BabelNodeEnumBooleanBody | BabelNodeEnumNumberBody | BabelNodeEnumStringBody | BabelNodeEnumSymbolBody | BabelNodeEnumBooleanMember | BabelNodeEnumNumberMember | BabelNodeEnumStringMember | BabelNodeEnumDefaultedMember | BabelNodeIndexedAccessType | BabelNodeOptionalIndexedAccessType; -declare type BabelNodeFlowType = BabelNodeAnyTypeAnnotation | BabelNodeArrayTypeAnnotation | BabelNodeBooleanTypeAnnotation | BabelNodeBooleanLiteralTypeAnnotation | BabelNodeNullLiteralTypeAnnotation | BabelNodeExistsTypeAnnotation | BabelNodeFunctionTypeAnnotation | BabelNodeGenericTypeAnnotation | BabelNodeInterfaceTypeAnnotation | BabelNodeIntersectionTypeAnnotation | BabelNodeMixedTypeAnnotation | BabelNodeEmptyTypeAnnotation | BabelNodeNullableTypeAnnotation | BabelNodeNumberLiteralTypeAnnotation | BabelNodeNumberTypeAnnotation | BabelNodeObjectTypeAnnotation | BabelNodeStringLiteralTypeAnnotation | BabelNodeStringTypeAnnotation | BabelNodeSymbolTypeAnnotation | BabelNodeThisTypeAnnotation | BabelNodeTupleTypeAnnotation | BabelNodeTypeofTypeAnnotation | BabelNodeUnionTypeAnnotation | BabelNodeVoidTypeAnnotation | BabelNodeIndexedAccessType | BabelNodeOptionalIndexedAccessType; -declare type BabelNodeFlowBaseAnnotation = BabelNodeAnyTypeAnnotation | BabelNodeBooleanTypeAnnotation | BabelNodeNullLiteralTypeAnnotation | BabelNodeMixedTypeAnnotation | BabelNodeEmptyTypeAnnotation | BabelNodeNumberTypeAnnotation | BabelNodeStringTypeAnnotation | BabelNodeSymbolTypeAnnotation | BabelNodeThisTypeAnnotation | BabelNodeVoidTypeAnnotation; -declare type BabelNodeFlowDeclaration = BabelNodeDeclareClass | BabelNodeDeclareFunction | BabelNodeDeclareInterface | BabelNodeDeclareModule | BabelNodeDeclareModuleExports | BabelNodeDeclareTypeAlias | BabelNodeDeclareOpaqueType | BabelNodeDeclareVariable | BabelNodeDeclareExportDeclaration | BabelNodeDeclareExportAllDeclaration | BabelNodeInterfaceDeclaration | BabelNodeOpaqueType | BabelNodeTypeAlias; -declare type BabelNodeFlowPredicate = BabelNodeDeclaredPredicate | BabelNodeInferredPredicate; -declare type BabelNodeEnumBody = BabelNodeEnumBooleanBody | BabelNodeEnumNumberBody | BabelNodeEnumStringBody | BabelNodeEnumSymbolBody; -declare type BabelNodeEnumMember = BabelNodeEnumBooleanMember | BabelNodeEnumNumberMember | BabelNodeEnumStringMember | BabelNodeEnumDefaultedMember; -declare type BabelNodeJSX = BabelNodeJSXAttribute | BabelNodeJSXClosingElement | BabelNodeJSXElement | BabelNodeJSXEmptyExpression | BabelNodeJSXExpressionContainer | BabelNodeJSXSpreadChild | BabelNodeJSXIdentifier | BabelNodeJSXMemberExpression | BabelNodeJSXNamespacedName | BabelNodeJSXOpeningElement | BabelNodeJSXSpreadAttribute | BabelNodeJSXText | BabelNodeJSXFragment | BabelNodeJSXOpeningFragment | BabelNodeJSXClosingFragment; -declare type BabelNodeMiscellaneous = BabelNodeNoop | BabelNodePlaceholder | BabelNodeV8IntrinsicIdentifier; -declare type BabelNodeTypeScript = BabelNodeTSParameterProperty | BabelNodeTSDeclareFunction | BabelNodeTSDeclareMethod | BabelNodeTSQualifiedName | BabelNodeTSCallSignatureDeclaration | BabelNodeTSConstructSignatureDeclaration | BabelNodeTSPropertySignature | BabelNodeTSMethodSignature | BabelNodeTSIndexSignature | BabelNodeTSAnyKeyword | BabelNodeTSBooleanKeyword | BabelNodeTSBigIntKeyword | BabelNodeTSIntrinsicKeyword | BabelNodeTSNeverKeyword | BabelNodeTSNullKeyword | BabelNodeTSNumberKeyword | BabelNodeTSObjectKeyword | BabelNodeTSStringKeyword | BabelNodeTSSymbolKeyword | BabelNodeTSUndefinedKeyword | BabelNodeTSUnknownKeyword | BabelNodeTSVoidKeyword | BabelNodeTSThisType | BabelNodeTSFunctionType | BabelNodeTSConstructorType | BabelNodeTSTypeReference | BabelNodeTSTypePredicate | BabelNodeTSTypeQuery | BabelNodeTSTypeLiteral | BabelNodeTSArrayType | BabelNodeTSTupleType | BabelNodeTSOptionalType | BabelNodeTSRestType | BabelNodeTSNamedTupleMember | BabelNodeTSUnionType | BabelNodeTSIntersectionType | BabelNodeTSConditionalType | BabelNodeTSInferType | BabelNodeTSParenthesizedType | BabelNodeTSTypeOperator | BabelNodeTSIndexedAccessType | BabelNodeTSMappedType | BabelNodeTSTemplateLiteralType | BabelNodeTSLiteralType | BabelNodeTSExpressionWithTypeArguments | BabelNodeTSInterfaceDeclaration | BabelNodeTSInterfaceBody | BabelNodeTSTypeAliasDeclaration | BabelNodeTSInstantiationExpression | BabelNodeTSAsExpression | BabelNodeTSSatisfiesExpression | BabelNodeTSTypeAssertion | BabelNodeTSEnumBody | BabelNodeTSEnumDeclaration | BabelNodeTSEnumMember | BabelNodeTSModuleDeclaration | BabelNodeTSModuleBlock | BabelNodeTSImportType | BabelNodeTSImportEqualsDeclaration | BabelNodeTSExternalModuleReference | BabelNodeTSNonNullExpression | BabelNodeTSExportAssignment | BabelNodeTSNamespaceExportDeclaration | BabelNodeTSTypeAnnotation | BabelNodeTSTypeParameterInstantiation | BabelNodeTSTypeParameterDeclaration | BabelNodeTSTypeParameter; -declare type BabelNodeTSTypeElement = BabelNodeTSCallSignatureDeclaration | BabelNodeTSConstructSignatureDeclaration | BabelNodeTSPropertySignature | BabelNodeTSMethodSignature | BabelNodeTSIndexSignature; -declare type BabelNodeTSType = BabelNodeTSAnyKeyword | BabelNodeTSBooleanKeyword | BabelNodeTSBigIntKeyword | BabelNodeTSIntrinsicKeyword | BabelNodeTSNeverKeyword | BabelNodeTSNullKeyword | BabelNodeTSNumberKeyword | BabelNodeTSObjectKeyword | BabelNodeTSStringKeyword | BabelNodeTSSymbolKeyword | BabelNodeTSUndefinedKeyword | BabelNodeTSUnknownKeyword | BabelNodeTSVoidKeyword | BabelNodeTSThisType | BabelNodeTSFunctionType | BabelNodeTSConstructorType | BabelNodeTSTypeReference | BabelNodeTSTypePredicate | BabelNodeTSTypeQuery | BabelNodeTSTypeLiteral | BabelNodeTSArrayType | BabelNodeTSTupleType | BabelNodeTSOptionalType | BabelNodeTSRestType | BabelNodeTSUnionType | BabelNodeTSIntersectionType | BabelNodeTSConditionalType | BabelNodeTSInferType | BabelNodeTSParenthesizedType | BabelNodeTSTypeOperator | BabelNodeTSIndexedAccessType | BabelNodeTSMappedType | BabelNodeTSTemplateLiteralType | BabelNodeTSLiteralType | BabelNodeTSExpressionWithTypeArguments | BabelNodeTSImportType; -declare type BabelNodeTSBaseType = BabelNodeTSAnyKeyword | BabelNodeTSBooleanKeyword | BabelNodeTSBigIntKeyword | BabelNodeTSIntrinsicKeyword | BabelNodeTSNeverKeyword | BabelNodeTSNullKeyword | BabelNodeTSNumberKeyword | BabelNodeTSObjectKeyword | BabelNodeTSStringKeyword | BabelNodeTSSymbolKeyword | BabelNodeTSUndefinedKeyword | BabelNodeTSUnknownKeyword | BabelNodeTSVoidKeyword | BabelNodeTSThisType | BabelNodeTSTemplateLiteralType | BabelNodeTSLiteralType; -declare type BabelNodeModuleDeclaration = BabelNodeExportAllDeclaration | BabelNodeExportDefaultDeclaration | BabelNodeExportNamedDeclaration | BabelNodeImportDeclaration; +declare module "@babel/types" { + declare type BabelNodeBaseComment = { + value: string; + start: number; + end: number; + loc: BabelNodeSourceLocation; + }; + + declare type BabelNodeCommentBlock = { + ...BabelNodeBaseComment; + type: "CommentBlock"; + }; + + declare type BabelNodeCommentLine ={ + ...BabelNodeBaseComment, + type: "CommentLine"; + }; + + declare type BabelNodeComment = BabelNodeCommentBlock | BabelNodeCommentLine; + + declare type BabelNodeSourceLocation = { + start: { + line: number; + column: number; + }; + + end: { + line: number; + column: number; + }; + }; + + + declare type BabelNodeArrayExpression = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ArrayExpression"; + elements?: Array; + }; + + declare type BabelNodeAssignmentExpression = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "AssignmentExpression"; + operator: string; + left: BabelNodeLVal | BabelNodeOptionalMemberExpression; + right: BabelNodeExpression; + }; + + declare type BabelNodeBinaryExpression = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "BinaryExpression"; + operator: "+" | "-" | "/" | "%" | "*" | "**" | "&" | "|" | ">>" | ">>>" | "<<" | "^" | "==" | "===" | "!=" | "!==" | "in" | "instanceof" | ">" | "<" | ">=" | "<=" | "|>"; + left: BabelNodeExpression | BabelNodePrivateName; + right: BabelNodeExpression; + }; + + declare type BabelNodeInterpreterDirective = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "InterpreterDirective"; + value: string; + }; + + declare type BabelNodeDirective = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "Directive"; + value: BabelNodeDirectiveLiteral; + }; + + declare type BabelNodeDirectiveLiteral = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "DirectiveLiteral"; + value: string; + }; + + declare type BabelNodeBlockStatement = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "BlockStatement"; + body: Array; + directives?: Array; + }; + + declare type BabelNodeBreakStatement = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "BreakStatement"; + label?: BabelNodeIdentifier; + }; + + declare type BabelNodeCallExpression = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "CallExpression"; + callee: BabelNodeExpression | BabelNodeSuper | BabelNodeV8IntrinsicIdentifier; + arguments: Array; + optional?: boolean; + typeArguments?: BabelNodeTypeParameterInstantiation; + typeParameters?: BabelNodeTSTypeParameterInstantiation; + }; + + declare type BabelNodeCatchClause = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "CatchClause"; + param?: BabelNodeIdentifier | BabelNodeArrayPattern | BabelNodeObjectPattern; + body: BabelNodeBlockStatement; + }; + + declare type BabelNodeConditionalExpression = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ConditionalExpression"; + test: BabelNodeExpression; + consequent: BabelNodeExpression; + alternate: BabelNodeExpression; + }; + + declare type BabelNodeContinueStatement = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ContinueStatement"; + label?: BabelNodeIdentifier; + }; + + declare type BabelNodeDebuggerStatement = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "DebuggerStatement"; + }; + + declare type BabelNodeDoWhileStatement = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "DoWhileStatement"; + test: BabelNodeExpression; + body: BabelNodeStatement; + }; + + declare type BabelNodeEmptyStatement = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "EmptyStatement"; + }; + + declare type BabelNodeExpressionStatement = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ExpressionStatement"; + expression: BabelNodeExpression; + }; + + declare type BabelNodeFile = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "File"; + program: BabelNodeProgram; + comments?: Array; + tokens?: Array; + }; + + declare type BabelNodeForInStatement = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ForInStatement"; + left: BabelNodeVariableDeclaration | BabelNodeLVal; + right: BabelNodeExpression; + body: BabelNodeStatement; + }; + + declare type BabelNodeForStatement = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ForStatement"; + init?: BabelNodeVariableDeclaration | BabelNodeExpression; + test?: BabelNodeExpression; + update?: BabelNodeExpression; + body: BabelNodeStatement; + }; + + declare type BabelNodeFunctionDeclaration = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "FunctionDeclaration"; + id?: BabelNodeIdentifier; + params: Array; + body: BabelNodeBlockStatement; + generator?: boolean; + async?: boolean; + declare?: boolean; + predicate?: BabelNodeDeclaredPredicate | BabelNodeInferredPredicate; + returnType?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; + typeParameters?: BabelNodeTypeParameterDeclaration | BabelNodeTSTypeParameterDeclaration | BabelNodeNoop; + }; + + declare type BabelNodeFunctionExpression = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "FunctionExpression"; + id?: BabelNodeIdentifier; + params: Array; + body: BabelNodeBlockStatement; + generator?: boolean; + async?: boolean; + predicate?: BabelNodeDeclaredPredicate | BabelNodeInferredPredicate; + returnType?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; + typeParameters?: BabelNodeTypeParameterDeclaration | BabelNodeTSTypeParameterDeclaration | BabelNodeNoop; + }; + + declare type BabelNodeIdentifier = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "Identifier"; + name: string; + decorators?: Array; + optional?: boolean; + typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; + }; + + declare type BabelNodeIfStatement = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "IfStatement"; + test: BabelNodeExpression; + consequent: BabelNodeStatement; + alternate?: BabelNodeStatement; + }; + + declare type BabelNodeLabeledStatement = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "LabeledStatement"; + label: BabelNodeIdentifier; + body: BabelNodeStatement; + }; + + declare type BabelNodeStringLiteral = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "StringLiteral"; + value: string; + }; + + declare type BabelNodeNumericLiteral = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "NumericLiteral"; + value: number; + }; + + declare type BabelNodeNullLiteral = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "NullLiteral"; + }; + + declare type BabelNodeBooleanLiteral = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "BooleanLiteral"; + value: boolean; + }; + + declare type BabelNodeRegExpLiteral = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "RegExpLiteral"; + pattern: string; + flags?: string; + }; + + declare type BabelNodeLogicalExpression = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "LogicalExpression"; + operator: "||" | "&&" | "??"; + left: BabelNodeExpression; + right: BabelNodeExpression; + }; + + declare type BabelNodeMemberExpression = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "MemberExpression"; + object: BabelNodeExpression | BabelNodeSuper; + property: BabelNodeExpression | BabelNodeIdentifier | BabelNodePrivateName; + computed?: boolean; + optional?: boolean; + }; + + declare type BabelNodeNewExpression = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "NewExpression"; + callee: BabelNodeExpression | BabelNodeSuper | BabelNodeV8IntrinsicIdentifier; + arguments: Array; + optional?: boolean; + typeArguments?: BabelNodeTypeParameterInstantiation; + typeParameters?: BabelNodeTSTypeParameterInstantiation; + }; + + declare type BabelNodeProgram = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "Program"; + body: Array; + directives?: Array; + sourceType?: "script" | "module"; + interpreter?: BabelNodeInterpreterDirective; + }; + + declare type BabelNodeObjectExpression = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ObjectExpression"; + properties: Array; + }; + + declare type BabelNodeObjectMethod = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ObjectMethod"; + kind?: "method" | "get" | "set"; + key: BabelNodeExpression | BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeBigIntLiteral; + params: Array; + body: BabelNodeBlockStatement; + computed?: boolean; + generator?: boolean; + async?: boolean; + decorators?: Array; + returnType?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; + typeParameters?: BabelNodeTypeParameterDeclaration | BabelNodeTSTypeParameterDeclaration | BabelNodeNoop; + }; + + declare type BabelNodeObjectProperty = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ObjectProperty"; + key: BabelNodeExpression | BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeBigIntLiteral | BabelNodeDecimalLiteral | BabelNodePrivateName; + value: BabelNodeExpression | BabelNodePatternLike; + computed?: boolean; + shorthand?: boolean; + decorators?: Array; + }; + + declare type BabelNodeRestElement = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "RestElement"; + argument: BabelNodeIdentifier | BabelNodeArrayPattern | BabelNodeObjectPattern | BabelNodeMemberExpression | BabelNodeTSAsExpression | BabelNodeTSSatisfiesExpression | BabelNodeTSTypeAssertion | BabelNodeTSNonNullExpression | BabelNodeRestElement | BabelNodeAssignmentPattern; + decorators?: Array; + optional?: boolean; + typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; + }; + + declare type BabelNodeReturnStatement = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ReturnStatement"; + argument?: BabelNodeExpression; + }; + + declare type BabelNodeSequenceExpression = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "SequenceExpression"; + expressions: Array; + }; + + declare type BabelNodeParenthesizedExpression = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ParenthesizedExpression"; + expression: BabelNodeExpression; + }; + + declare type BabelNodeSwitchCase = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "SwitchCase"; + test?: BabelNodeExpression; + consequent: Array; + }; + + declare type BabelNodeSwitchStatement = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "SwitchStatement"; + discriminant: BabelNodeExpression; + cases: Array; + }; + + declare type BabelNodeThisExpression = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ThisExpression"; + }; + + declare type BabelNodeThrowStatement = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ThrowStatement"; + argument: BabelNodeExpression; + }; + + declare type BabelNodeTryStatement = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TryStatement"; + block: BabelNodeBlockStatement; + handler?: BabelNodeCatchClause; + finalizer?: BabelNodeBlockStatement; + }; + + declare type BabelNodeUnaryExpression = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "UnaryExpression"; + operator: "void" | "throw" | "delete" | "!" | "+" | "-" | "~" | "typeof"; + argument: BabelNodeExpression; + prefix?: boolean; + }; + + declare type BabelNodeUpdateExpression = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "UpdateExpression"; + operator: "++" | "--"; + argument: BabelNodeExpression; + prefix?: boolean; + }; + + declare type BabelNodeVariableDeclaration = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "VariableDeclaration"; + kind: "var" | "let" | "const" | "using" | "await using"; + declarations: Array; + declare?: boolean; + }; + + declare type BabelNodeVariableDeclarator = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "VariableDeclarator"; + id: BabelNodeLVal | BabelNodeVoidPattern; + init?: BabelNodeExpression; + definite?: boolean; + }; + + declare type BabelNodeWhileStatement = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "WhileStatement"; + test: BabelNodeExpression; + body: BabelNodeStatement; + }; + + declare type BabelNodeWithStatement = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "WithStatement"; + object: BabelNodeExpression; + body: BabelNodeStatement; + }; + + declare type BabelNodeAssignmentPattern = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "AssignmentPattern"; + left: BabelNodeIdentifier | BabelNodeObjectPattern | BabelNodeArrayPattern | BabelNodeMemberExpression | BabelNodeTSAsExpression | BabelNodeTSSatisfiesExpression | BabelNodeTSTypeAssertion | BabelNodeTSNonNullExpression; + right: BabelNodeExpression; + decorators?: Array; + optional?: boolean; + typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; + }; + + declare type BabelNodeArrayPattern = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ArrayPattern"; + elements: Array; + decorators?: Array; + optional?: boolean; + typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; + }; + + declare type BabelNodeArrowFunctionExpression = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ArrowFunctionExpression"; + params: Array; + body: BabelNodeBlockStatement | BabelNodeExpression; + async?: boolean; + expression: boolean; + generator?: boolean; + predicate?: BabelNodeDeclaredPredicate | BabelNodeInferredPredicate; + returnType?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; + typeParameters?: BabelNodeTypeParameterDeclaration | BabelNodeTSTypeParameterDeclaration | BabelNodeNoop; + }; + + declare type BabelNodeClassBody = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ClassBody"; + body: Array; + }; + + declare type BabelNodeClassExpression = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ClassExpression"; + id?: BabelNodeIdentifier; + superClass?: BabelNodeExpression; + body: BabelNodeClassBody; + decorators?: Array; + implements?: Array; + mixins?: BabelNodeInterfaceExtends; + superTypeParameters?: BabelNodeTypeParameterInstantiation | BabelNodeTSTypeParameterInstantiation; + typeParameters?: BabelNodeTypeParameterDeclaration | BabelNodeTSTypeParameterDeclaration | BabelNodeNoop; + }; + + declare type BabelNodeClassDeclaration = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ClassDeclaration"; + id?: BabelNodeIdentifier; + superClass?: BabelNodeExpression; + body: BabelNodeClassBody; + decorators?: Array; + abstract?: boolean; + declare?: boolean; + implements?: Array; + mixins?: BabelNodeInterfaceExtends; + superTypeParameters?: BabelNodeTypeParameterInstantiation | BabelNodeTSTypeParameterInstantiation; + typeParameters?: BabelNodeTypeParameterDeclaration | BabelNodeTSTypeParameterDeclaration | BabelNodeNoop; + }; + + declare type BabelNodeExportAllDeclaration = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ExportAllDeclaration"; + source: BabelNodeStringLiteral; + attributes?: Array; + assertions?: Array; + exportKind?: "type" | "value"; + }; + + declare type BabelNodeExportDefaultDeclaration = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ExportDefaultDeclaration"; + declaration: BabelNodeTSDeclareFunction | BabelNodeFunctionDeclaration | BabelNodeClassDeclaration | BabelNodeExpression; + exportKind?: "value"; + }; + + declare type BabelNodeExportNamedDeclaration = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ExportNamedDeclaration"; + declaration?: BabelNodeDeclaration; + specifiers?: Array; + source?: BabelNodeStringLiteral; + attributes?: Array; + assertions?: Array; + exportKind?: "type" | "value"; + }; + + declare type BabelNodeExportSpecifier = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ExportSpecifier"; + local: BabelNodeIdentifier; + exported: BabelNodeIdentifier | BabelNodeStringLiteral; + exportKind?: "type" | "value"; + }; + + declare type BabelNodeForOfStatement = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ForOfStatement"; + left: BabelNodeVariableDeclaration | BabelNodeLVal; + right: BabelNodeExpression; + body: BabelNodeStatement; + await?: boolean; + }; + + declare type BabelNodeImportDeclaration = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ImportDeclaration"; + specifiers: Array; + source: BabelNodeStringLiteral; + attributes?: Array; + assertions?: Array; + importKind?: "type" | "typeof" | "value"; + module?: boolean; + phase?: "source" | "defer"; + }; + + declare type BabelNodeImportDefaultSpecifier = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ImportDefaultSpecifier"; + local: BabelNodeIdentifier; + }; + + declare type BabelNodeImportNamespaceSpecifier = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ImportNamespaceSpecifier"; + local: BabelNodeIdentifier; + }; + + declare type BabelNodeImportSpecifier = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ImportSpecifier"; + local: BabelNodeIdentifier; + imported: BabelNodeIdentifier | BabelNodeStringLiteral; + importKind?: "type" | "typeof" | "value"; + }; + + declare type BabelNodeImportExpression = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ImportExpression"; + source: BabelNodeExpression; + options?: BabelNodeExpression; + phase?: "source" | "defer"; + }; + + declare type BabelNodeMetaProperty = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "MetaProperty"; + meta: BabelNodeIdentifier; + property: BabelNodeIdentifier; + }; + + declare type BabelNodeClassMethod = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ClassMethod"; + kind?: "get" | "set" | "method" | "constructor"; + key: BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeBigIntLiteral | BabelNodeExpression; + params: Array; + body: BabelNodeBlockStatement; + computed?: boolean; + static?: boolean; + generator?: boolean; + async?: boolean; + abstract?: boolean; + access?: "public" | "private" | "protected"; + accessibility?: "public" | "private" | "protected"; + decorators?: Array; + optional?: boolean; + override?: boolean; + returnType?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; + typeParameters?: BabelNodeTypeParameterDeclaration | BabelNodeTSTypeParameterDeclaration | BabelNodeNoop; + }; + + declare type BabelNodeObjectPattern = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ObjectPattern"; + properties: Array; + decorators?: Array; + optional?: boolean; + typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; + }; + + declare type BabelNodeSpreadElement = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "SpreadElement"; + argument: BabelNodeExpression; + }; + + declare type BabelNodeSuper = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "Super"; + }; + + declare type BabelNodeTaggedTemplateExpression = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TaggedTemplateExpression"; + tag: BabelNodeExpression; + quasi: BabelNodeTemplateLiteral; + typeParameters?: BabelNodeTypeParameterInstantiation | BabelNodeTSTypeParameterInstantiation; + }; + + declare type BabelNodeTemplateElement = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TemplateElement"; + value: any; + tail?: boolean; + }; + + declare type BabelNodeTemplateLiteral = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TemplateLiteral"; + quasis: Array; + expressions: Array; + }; + + declare type BabelNodeYieldExpression = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "YieldExpression"; + argument?: BabelNodeExpression; + delegate?: boolean; + }; + + declare type BabelNodeAwaitExpression = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "AwaitExpression"; + argument: BabelNodeExpression; + }; + + declare type BabelNodeImport = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "Import"; + }; + + declare type BabelNodeBigIntLiteral = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "BigIntLiteral"; + value: string; + }; + + declare type BabelNodeExportNamespaceSpecifier = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ExportNamespaceSpecifier"; + exported: BabelNodeIdentifier; + }; + + declare type BabelNodeOptionalMemberExpression = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "OptionalMemberExpression"; + object: BabelNodeExpression; + property: BabelNodeExpression | BabelNodeIdentifier; + computed?: boolean; + optional: boolean; + }; + + declare type BabelNodeOptionalCallExpression = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "OptionalCallExpression"; + callee: BabelNodeExpression; + arguments: Array; + optional: boolean; + typeArguments?: BabelNodeTypeParameterInstantiation; + typeParameters?: BabelNodeTSTypeParameterInstantiation; + }; + + declare type BabelNodeClassProperty = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ClassProperty"; + key: BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeBigIntLiteral | BabelNodeExpression; + value?: BabelNodeExpression; + typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; + decorators?: Array; + computed?: boolean; + static?: boolean; + abstract?: boolean; + accessibility?: "public" | "private" | "protected"; + declare?: boolean; + definite?: boolean; + optional?: boolean; + override?: boolean; + readonly?: boolean; + variance?: BabelNodeVariance; + }; + + declare type BabelNodeClassAccessorProperty = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ClassAccessorProperty"; + key: BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeBigIntLiteral | BabelNodeExpression | BabelNodePrivateName; + value?: BabelNodeExpression; + typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; + decorators?: Array; + computed?: boolean; + static?: boolean; + abstract?: boolean; + accessibility?: "public" | "private" | "protected"; + declare?: boolean; + definite?: boolean; + optional?: boolean; + override?: boolean; + readonly?: boolean; + variance?: BabelNodeVariance; + }; + + declare type BabelNodeClassPrivateProperty = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ClassPrivateProperty"; + key: BabelNodePrivateName; + value?: BabelNodeExpression; + decorators?: Array; + static?: boolean; + definite?: boolean; + optional?: boolean; + readonly?: boolean; + typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; + variance?: BabelNodeVariance; + }; + + declare type BabelNodeClassPrivateMethod = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ClassPrivateMethod"; + kind?: "get" | "set" | "method"; + key: BabelNodePrivateName; + params: Array; + body: BabelNodeBlockStatement; + static?: boolean; + abstract?: boolean; + access?: "public" | "private" | "protected"; + accessibility?: "public" | "private" | "protected"; + async?: boolean; + computed?: boolean; + decorators?: Array; + generator?: boolean; + optional?: boolean; + override?: boolean; + returnType?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; + typeParameters?: BabelNodeTypeParameterDeclaration | BabelNodeTSTypeParameterDeclaration | BabelNodeNoop; + }; + + declare type BabelNodePrivateName = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "PrivateName"; + id: BabelNodeIdentifier; + }; + + declare type BabelNodeStaticBlock = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "StaticBlock"; + body: Array; + }; + + declare type BabelNodeImportAttribute = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ImportAttribute"; + key: BabelNodeIdentifier | BabelNodeStringLiteral; + value: BabelNodeStringLiteral; + }; + + declare type BabelNodeAnyTypeAnnotation = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "AnyTypeAnnotation"; + }; + + declare type BabelNodeArrayTypeAnnotation = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ArrayTypeAnnotation"; + elementType: BabelNodeFlowType; + }; + + declare type BabelNodeBooleanTypeAnnotation = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "BooleanTypeAnnotation"; + }; + + declare type BabelNodeBooleanLiteralTypeAnnotation = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "BooleanLiteralTypeAnnotation"; + value: boolean; + }; + + declare type BabelNodeNullLiteralTypeAnnotation = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "NullLiteralTypeAnnotation"; + }; + + declare type BabelNodeClassImplements = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ClassImplements"; + id: BabelNodeIdentifier; + typeParameters?: BabelNodeTypeParameterInstantiation; + }; + + declare type BabelNodeDeclareClass = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "DeclareClass"; + id: BabelNodeIdentifier; + typeParameters?: BabelNodeTypeParameterDeclaration; + extends?: Array; + body: BabelNodeObjectTypeAnnotation; + implements?: Array; + mixins?: Array; + }; + + declare type BabelNodeDeclareFunction = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "DeclareFunction"; + id: BabelNodeIdentifier; + predicate?: BabelNodeDeclaredPredicate; + }; + + declare type BabelNodeDeclareInterface = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "DeclareInterface"; + id: BabelNodeIdentifier; + typeParameters?: BabelNodeTypeParameterDeclaration; + extends?: Array; + body: BabelNodeObjectTypeAnnotation; + }; + + declare type BabelNodeDeclareModule = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "DeclareModule"; + id: BabelNodeIdentifier | BabelNodeStringLiteral; + body: BabelNodeBlockStatement; + kind?: "CommonJS" | "ES"; + }; + + declare type BabelNodeDeclareModuleExports = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "DeclareModuleExports"; + typeAnnotation: BabelNodeTypeAnnotation; + }; + + declare type BabelNodeDeclareTypeAlias = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "DeclareTypeAlias"; + id: BabelNodeIdentifier; + typeParameters?: BabelNodeTypeParameterDeclaration; + right: BabelNodeFlowType; + }; + + declare type BabelNodeDeclareOpaqueType = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "DeclareOpaqueType"; + id: BabelNodeIdentifier; + typeParameters?: BabelNodeTypeParameterDeclaration; + supertype?: BabelNodeFlowType; + impltype?: BabelNodeFlowType; + }; + + declare type BabelNodeDeclareVariable = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "DeclareVariable"; + id: BabelNodeIdentifier; + }; + + declare type BabelNodeDeclareExportDeclaration = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "DeclareExportDeclaration"; + declaration?: BabelNodeFlow; + specifiers?: Array; + source?: BabelNodeStringLiteral; + attributes?: Array; + assertions?: Array; + default?: boolean; + }; + + declare type BabelNodeDeclareExportAllDeclaration = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "DeclareExportAllDeclaration"; + source: BabelNodeStringLiteral; + attributes?: Array; + assertions?: Array; + exportKind?: "type" | "value"; + }; + + declare type BabelNodeDeclaredPredicate = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "DeclaredPredicate"; + value: BabelNodeFlow; + }; + + declare type BabelNodeExistsTypeAnnotation = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ExistsTypeAnnotation"; + }; + + declare type BabelNodeFunctionTypeAnnotation = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "FunctionTypeAnnotation"; + typeParameters?: BabelNodeTypeParameterDeclaration; + params: Array; + rest?: BabelNodeFunctionTypeParam; + returnType: BabelNodeFlowType; + this?: BabelNodeFunctionTypeParam; + }; + + declare type BabelNodeFunctionTypeParam = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "FunctionTypeParam"; + name?: BabelNodeIdentifier; + typeAnnotation: BabelNodeFlowType; + optional?: boolean; + }; + + declare type BabelNodeGenericTypeAnnotation = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "GenericTypeAnnotation"; + id: BabelNodeIdentifier | BabelNodeQualifiedTypeIdentifier; + typeParameters?: BabelNodeTypeParameterInstantiation; + }; + + declare type BabelNodeInferredPredicate = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "InferredPredicate"; + }; + + declare type BabelNodeInterfaceExtends = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "InterfaceExtends"; + id: BabelNodeIdentifier | BabelNodeQualifiedTypeIdentifier; + typeParameters?: BabelNodeTypeParameterInstantiation; + }; + + declare type BabelNodeInterfaceDeclaration = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "InterfaceDeclaration"; + id: BabelNodeIdentifier; + typeParameters?: BabelNodeTypeParameterDeclaration; + extends?: Array; + body: BabelNodeObjectTypeAnnotation; + }; + + declare type BabelNodeInterfaceTypeAnnotation = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "InterfaceTypeAnnotation"; + extends?: Array; + body: BabelNodeObjectTypeAnnotation; + }; + + declare type BabelNodeIntersectionTypeAnnotation = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "IntersectionTypeAnnotation"; + types: Array; + }; + + declare type BabelNodeMixedTypeAnnotation = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "MixedTypeAnnotation"; + }; + + declare type BabelNodeEmptyTypeAnnotation = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "EmptyTypeAnnotation"; + }; + + declare type BabelNodeNullableTypeAnnotation = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "NullableTypeAnnotation"; + typeAnnotation: BabelNodeFlowType; + }; + + declare type BabelNodeNumberLiteralTypeAnnotation = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "NumberLiteralTypeAnnotation"; + value: number; + }; + + declare type BabelNodeNumberTypeAnnotation = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "NumberTypeAnnotation"; + }; + + declare type BabelNodeObjectTypeAnnotation = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ObjectTypeAnnotation"; + properties: Array; + indexers?: Array; + callProperties?: Array; + internalSlots?: Array; + exact?: boolean; + inexact?: boolean; + }; + + declare type BabelNodeObjectTypeInternalSlot = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ObjectTypeInternalSlot"; + id: BabelNodeIdentifier; + value: BabelNodeFlowType; + optional: boolean; + static: boolean; + method: boolean; + }; + + declare type BabelNodeObjectTypeCallProperty = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ObjectTypeCallProperty"; + value: BabelNodeFlowType; + static: boolean; + }; + + declare type BabelNodeObjectTypeIndexer = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ObjectTypeIndexer"; + id?: BabelNodeIdentifier; + key: BabelNodeFlowType; + value: BabelNodeFlowType; + variance?: BabelNodeVariance; + static: boolean; + }; + + declare type BabelNodeObjectTypeProperty = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ObjectTypeProperty"; + key: BabelNodeIdentifier | BabelNodeStringLiteral; + value: BabelNodeFlowType; + variance?: BabelNodeVariance; + kind: "init" | "get" | "set"; + method: boolean; + optional: boolean; + proto: boolean; + static: boolean; + }; + + declare type BabelNodeObjectTypeSpreadProperty = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ObjectTypeSpreadProperty"; + argument: BabelNodeFlowType; + }; + + declare type BabelNodeOpaqueType = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "OpaqueType"; + id: BabelNodeIdentifier; + typeParameters?: BabelNodeTypeParameterDeclaration; + supertype?: BabelNodeFlowType; + impltype: BabelNodeFlowType; + }; + + declare type BabelNodeQualifiedTypeIdentifier = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "QualifiedTypeIdentifier"; + id: BabelNodeIdentifier; + qualification: BabelNodeIdentifier | BabelNodeQualifiedTypeIdentifier; + }; + + declare type BabelNodeStringLiteralTypeAnnotation = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "StringLiteralTypeAnnotation"; + value: string; + }; + + declare type BabelNodeStringTypeAnnotation = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "StringTypeAnnotation"; + }; + + declare type BabelNodeSymbolTypeAnnotation = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "SymbolTypeAnnotation"; + }; + + declare type BabelNodeThisTypeAnnotation = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ThisTypeAnnotation"; + }; + + declare type BabelNodeTupleTypeAnnotation = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TupleTypeAnnotation"; + types: Array; + }; + + declare type BabelNodeTypeofTypeAnnotation = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TypeofTypeAnnotation"; + argument: BabelNodeFlowType; + }; + + declare type BabelNodeTypeAlias = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TypeAlias"; + id: BabelNodeIdentifier; + typeParameters?: BabelNodeTypeParameterDeclaration; + right: BabelNodeFlowType; + }; + + declare type BabelNodeTypeAnnotation = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TypeAnnotation"; + typeAnnotation: BabelNodeFlowType; + }; + + declare type BabelNodeTypeCastExpression = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TypeCastExpression"; + expression: BabelNodeExpression; + typeAnnotation: BabelNodeTypeAnnotation; + }; + + declare type BabelNodeTypeParameter = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TypeParameter"; + bound?: BabelNodeTypeAnnotation; + default?: BabelNodeFlowType; + variance?: BabelNodeVariance; + name: string; + }; + + declare type BabelNodeTypeParameterDeclaration = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TypeParameterDeclaration"; + params: Array; + }; + + declare type BabelNodeTypeParameterInstantiation = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TypeParameterInstantiation"; + params: Array; + }; + + declare type BabelNodeUnionTypeAnnotation = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "UnionTypeAnnotation"; + types: Array; + }; + + declare type BabelNodeVariance = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "Variance"; + kind: "minus" | "plus"; + }; + + declare type BabelNodeVoidTypeAnnotation = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "VoidTypeAnnotation"; + }; + + declare type BabelNodeEnumDeclaration = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "EnumDeclaration"; + id: BabelNodeIdentifier; + body: BabelNodeEnumBooleanBody | BabelNodeEnumNumberBody | BabelNodeEnumStringBody | BabelNodeEnumSymbolBody; + }; + + declare type BabelNodeEnumBooleanBody = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "EnumBooleanBody"; + members: Array; + explicitType: boolean; + hasUnknownMembers: boolean; + }; + + declare type BabelNodeEnumNumberBody = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "EnumNumberBody"; + members: Array; + explicitType: boolean; + hasUnknownMembers: boolean; + }; + + declare type BabelNodeEnumStringBody = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "EnumStringBody"; + members: Array; + explicitType: boolean; + hasUnknownMembers: boolean; + }; + + declare type BabelNodeEnumSymbolBody = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "EnumSymbolBody"; + members: Array; + hasUnknownMembers: boolean; + }; + + declare type BabelNodeEnumBooleanMember = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "EnumBooleanMember"; + id: BabelNodeIdentifier; + init: BabelNodeBooleanLiteral; + }; + + declare type BabelNodeEnumNumberMember = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "EnumNumberMember"; + id: BabelNodeIdentifier; + init: BabelNodeNumericLiteral; + }; + + declare type BabelNodeEnumStringMember = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "EnumStringMember"; + id: BabelNodeIdentifier; + init: BabelNodeStringLiteral; + }; + + declare type BabelNodeEnumDefaultedMember = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "EnumDefaultedMember"; + id: BabelNodeIdentifier; + }; + + declare type BabelNodeIndexedAccessType = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "IndexedAccessType"; + objectType: BabelNodeFlowType; + indexType: BabelNodeFlowType; + }; + + declare type BabelNodeOptionalIndexedAccessType = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "OptionalIndexedAccessType"; + objectType: BabelNodeFlowType; + indexType: BabelNodeFlowType; + optional: boolean; + }; + + declare type BabelNodeJSXAttribute = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "JSXAttribute"; + name: BabelNodeJSXIdentifier | BabelNodeJSXNamespacedName; + value?: BabelNodeJSXElement | BabelNodeJSXFragment | BabelNodeStringLiteral | BabelNodeJSXExpressionContainer; + }; + + declare type BabelNodeJSXClosingElement = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "JSXClosingElement"; + name: BabelNodeJSXIdentifier | BabelNodeJSXMemberExpression | BabelNodeJSXNamespacedName; + }; + + declare type BabelNodeJSXElement = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "JSXElement"; + openingElement: BabelNodeJSXOpeningElement; + closingElement?: BabelNodeJSXClosingElement; + children: Array; + selfClosing?: boolean; + }; + + declare type BabelNodeJSXEmptyExpression = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "JSXEmptyExpression"; + }; + + declare type BabelNodeJSXExpressionContainer = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "JSXExpressionContainer"; + expression: BabelNodeExpression | BabelNodeJSXEmptyExpression; + }; + + declare type BabelNodeJSXSpreadChild = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "JSXSpreadChild"; + expression: BabelNodeExpression; + }; + + declare type BabelNodeJSXIdentifier = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "JSXIdentifier"; + name: string; + }; + + declare type BabelNodeJSXMemberExpression = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "JSXMemberExpression"; + object: BabelNodeJSXMemberExpression | BabelNodeJSXIdentifier; + property: BabelNodeJSXIdentifier; + }; + + declare type BabelNodeJSXNamespacedName = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "JSXNamespacedName"; + namespace: BabelNodeJSXIdentifier; + name: BabelNodeJSXIdentifier; + }; + + declare type BabelNodeJSXOpeningElement = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "JSXOpeningElement"; + name: BabelNodeJSXIdentifier | BabelNodeJSXMemberExpression | BabelNodeJSXNamespacedName; + attributes: Array; + selfClosing?: boolean; + typeArguments?: BabelNodeTypeParameterInstantiation; + typeParameters?: BabelNodeTSTypeParameterInstantiation; + }; + + declare type BabelNodeJSXSpreadAttribute = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "JSXSpreadAttribute"; + argument: BabelNodeExpression; + }; + + declare type BabelNodeJSXText = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "JSXText"; + value: string; + }; + + declare type BabelNodeJSXFragment = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "JSXFragment"; + openingFragment: BabelNodeJSXOpeningFragment; + closingFragment: BabelNodeJSXClosingFragment; + children: Array; + }; + + declare type BabelNodeJSXOpeningFragment = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "JSXOpeningFragment"; + }; + + declare type BabelNodeJSXClosingFragment = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "JSXClosingFragment"; + }; + + declare type BabelNodeNoop = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "Noop"; + }; + + declare type BabelNodePlaceholder = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "Placeholder"; + expectedNode: "Identifier" | "StringLiteral" | "Expression" | "Statement" | "Declaration" | "BlockStatement" | "ClassBody" | "Pattern"; + name: BabelNodeIdentifier; + decorators?: Array; + optional?: boolean; + typeAnnotation?: BabelNodeTypeAnnotation | BabelNodeTSTypeAnnotation | BabelNodeNoop; + }; + + declare type BabelNodeV8IntrinsicIdentifier = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "V8IntrinsicIdentifier"; + name: string; + }; + + declare type BabelNodeArgumentPlaceholder = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ArgumentPlaceholder"; + }; + + declare type BabelNodeBindExpression = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "BindExpression"; + object: BabelNodeExpression; + callee: BabelNodeExpression; + }; + + declare type BabelNodeDecorator = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "Decorator"; + expression: BabelNodeExpression; + }; + + declare type BabelNodeDoExpression = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "DoExpression"; + body: BabelNodeBlockStatement; + async?: boolean; + }; + + declare type BabelNodeExportDefaultSpecifier = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ExportDefaultSpecifier"; + exported: BabelNodeIdentifier; + }; + + declare type BabelNodeRecordExpression = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "RecordExpression"; + properties: Array; + }; + + declare type BabelNodeTupleExpression = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TupleExpression"; + elements?: Array; + }; + + declare type BabelNodeDecimalLiteral = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "DecimalLiteral"; + value: string; + }; + + declare type BabelNodeModuleExpression = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "ModuleExpression"; + body: BabelNodeProgram; + }; + + declare type BabelNodeTopicReference = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TopicReference"; + }; + + declare type BabelNodePipelineTopicExpression = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "PipelineTopicExpression"; + expression: BabelNodeExpression; + }; + + declare type BabelNodePipelineBareFunction = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "PipelineBareFunction"; + callee: BabelNodeExpression; + }; + + declare type BabelNodePipelinePrimaryTopicReference = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "PipelinePrimaryTopicReference"; + }; + + declare type BabelNodeVoidPattern = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "VoidPattern"; + }; + + declare type BabelNodeTSParameterProperty = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSParameterProperty"; + parameter: BabelNodeIdentifier | BabelNodeAssignmentPattern; + accessibility?: "public" | "private" | "protected"; + decorators?: Array; + override?: boolean; + readonly?: boolean; + }; + + declare type BabelNodeTSDeclareFunction = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSDeclareFunction"; + id?: BabelNodeIdentifier; + typeParameters?: BabelNodeTSTypeParameterDeclaration | BabelNodeNoop; + params: Array; + returnType?: BabelNodeTSTypeAnnotation | BabelNodeNoop; + async?: boolean; + declare?: boolean; + generator?: boolean; + }; + + declare type BabelNodeTSDeclareMethod = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSDeclareMethod"; + decorators?: Array; + key: BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeBigIntLiteral | BabelNodeExpression; + typeParameters?: BabelNodeTSTypeParameterDeclaration | BabelNodeNoop; + params: Array; + returnType?: BabelNodeTSTypeAnnotation | BabelNodeNoop; + abstract?: boolean; + access?: "public" | "private" | "protected"; + accessibility?: "public" | "private" | "protected"; + async?: boolean; + computed?: boolean; + generator?: boolean; + kind?: "get" | "set" | "method" | "constructor"; + optional?: boolean; + override?: boolean; + static?: boolean; + }; + + declare type BabelNodeTSQualifiedName = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSQualifiedName"; + left: BabelNodeTSEntityName; + right: BabelNodeIdentifier; + }; + + declare type BabelNodeTSCallSignatureDeclaration = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSCallSignatureDeclaration"; + typeParameters?: BabelNodeTSTypeParameterDeclaration; + parameters: Array; + typeAnnotation?: BabelNodeTSTypeAnnotation; + }; + + declare type BabelNodeTSConstructSignatureDeclaration = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSConstructSignatureDeclaration"; + typeParameters?: BabelNodeTSTypeParameterDeclaration; + parameters: Array; + typeAnnotation?: BabelNodeTSTypeAnnotation; + }; + + declare type BabelNodeTSPropertySignature = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSPropertySignature"; + key: BabelNodeExpression; + typeAnnotation?: BabelNodeTSTypeAnnotation; + computed?: boolean; + kind?: "get" | "set"; + optional?: boolean; + readonly?: boolean; + }; + + declare type BabelNodeTSMethodSignature = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSMethodSignature"; + key: BabelNodeExpression; + typeParameters?: BabelNodeTSTypeParameterDeclaration; + parameters: Array; + typeAnnotation?: BabelNodeTSTypeAnnotation; + computed?: boolean; + kind: "method" | "get" | "set"; + optional?: boolean; + }; + + declare type BabelNodeTSIndexSignature = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSIndexSignature"; + parameters: Array; + typeAnnotation?: BabelNodeTSTypeAnnotation; + readonly?: boolean; + static?: boolean; + }; + + declare type BabelNodeTSAnyKeyword = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSAnyKeyword"; + }; + + declare type BabelNodeTSBooleanKeyword = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSBooleanKeyword"; + }; + + declare type BabelNodeTSBigIntKeyword = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSBigIntKeyword"; + }; + + declare type BabelNodeTSIntrinsicKeyword = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSIntrinsicKeyword"; + }; + + declare type BabelNodeTSNeverKeyword = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSNeverKeyword"; + }; + + declare type BabelNodeTSNullKeyword = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSNullKeyword"; + }; + + declare type BabelNodeTSNumberKeyword = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSNumberKeyword"; + }; + + declare type BabelNodeTSObjectKeyword = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSObjectKeyword"; + }; + + declare type BabelNodeTSStringKeyword = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSStringKeyword"; + }; + + declare type BabelNodeTSSymbolKeyword = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSSymbolKeyword"; + }; + + declare type BabelNodeTSUndefinedKeyword = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSUndefinedKeyword"; + }; + + declare type BabelNodeTSUnknownKeyword = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSUnknownKeyword"; + }; + + declare type BabelNodeTSVoidKeyword = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSVoidKeyword"; + }; + + declare type BabelNodeTSThisType = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSThisType"; + }; + + declare type BabelNodeTSFunctionType = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSFunctionType"; + typeParameters?: BabelNodeTSTypeParameterDeclaration; + parameters: Array; + typeAnnotation?: BabelNodeTSTypeAnnotation; + }; + + declare type BabelNodeTSConstructorType = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSConstructorType"; + typeParameters?: BabelNodeTSTypeParameterDeclaration; + parameters: Array; + typeAnnotation?: BabelNodeTSTypeAnnotation; + abstract?: boolean; + }; + + declare type BabelNodeTSTypeReference = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSTypeReference"; + typeName: BabelNodeTSEntityName; + typeParameters?: BabelNodeTSTypeParameterInstantiation; + }; + + declare type BabelNodeTSTypePredicate = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSTypePredicate"; + parameterName: BabelNodeIdentifier | BabelNodeTSThisType; + typeAnnotation?: BabelNodeTSTypeAnnotation; + asserts?: boolean; + }; + + declare type BabelNodeTSTypeQuery = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSTypeQuery"; + exprName: BabelNodeTSEntityName | BabelNodeTSImportType; + typeParameters?: BabelNodeTSTypeParameterInstantiation; + }; + + declare type BabelNodeTSTypeLiteral = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSTypeLiteral"; + members: Array; + }; + + declare type BabelNodeTSArrayType = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSArrayType"; + elementType: BabelNodeTSType; + }; + + declare type BabelNodeTSTupleType = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSTupleType"; + elementTypes: Array; + }; + + declare type BabelNodeTSOptionalType = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSOptionalType"; + typeAnnotation: BabelNodeTSType; + }; + + declare type BabelNodeTSRestType = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSRestType"; + typeAnnotation: BabelNodeTSType; + }; + + declare type BabelNodeTSNamedTupleMember = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSNamedTupleMember"; + label: BabelNodeIdentifier; + elementType: BabelNodeTSType; + optional?: boolean; + }; + + declare type BabelNodeTSUnionType = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSUnionType"; + types: Array; + }; + + declare type BabelNodeTSIntersectionType = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSIntersectionType"; + types: Array; + }; + + declare type BabelNodeTSConditionalType = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSConditionalType"; + checkType: BabelNodeTSType; + extendsType: BabelNodeTSType; + trueType: BabelNodeTSType; + falseType: BabelNodeTSType; + }; + + declare type BabelNodeTSInferType = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSInferType"; + typeParameter: BabelNodeTSTypeParameter; + }; + + declare type BabelNodeTSParenthesizedType = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSParenthesizedType"; + typeAnnotation: BabelNodeTSType; + }; + + declare type BabelNodeTSTypeOperator = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSTypeOperator"; + typeAnnotation: BabelNodeTSType; + operator?: string; + }; + + declare type BabelNodeTSIndexedAccessType = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSIndexedAccessType"; + objectType: BabelNodeTSType; + indexType: BabelNodeTSType; + }; + + declare type BabelNodeTSMappedType = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSMappedType"; + typeParameter: BabelNodeTSTypeParameter; + typeAnnotation?: BabelNodeTSType; + nameType?: BabelNodeTSType; + optional?: true | false | "+" | "-"; + readonly?: true | false | "+" | "-"; + }; + + declare type BabelNodeTSTemplateLiteralType = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSTemplateLiteralType"; + quasis: Array; + types: Array; + }; + + declare type BabelNodeTSLiteralType = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSLiteralType"; + literal: BabelNodeNumericLiteral | BabelNodeStringLiteral | BabelNodeBooleanLiteral | BabelNodeBigIntLiteral | BabelNodeTemplateLiteral | BabelNodeUnaryExpression; + }; + + declare type BabelNodeTSExpressionWithTypeArguments = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSExpressionWithTypeArguments"; + expression: BabelNodeTSEntityName; + typeParameters?: BabelNodeTSTypeParameterInstantiation; + }; + + declare type BabelNodeTSInterfaceDeclaration = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSInterfaceDeclaration"; + id: BabelNodeIdentifier; + typeParameters?: BabelNodeTSTypeParameterDeclaration; + extends?: Array; + body: BabelNodeTSInterfaceBody; + declare?: boolean; + }; + + declare type BabelNodeTSInterfaceBody = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSInterfaceBody"; + body: Array; + }; + + declare type BabelNodeTSTypeAliasDeclaration = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSTypeAliasDeclaration"; + id: BabelNodeIdentifier; + typeParameters?: BabelNodeTSTypeParameterDeclaration; + typeAnnotation: BabelNodeTSType; + declare?: boolean; + }; + + declare type BabelNodeTSInstantiationExpression = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSInstantiationExpression"; + expression: BabelNodeExpression; + typeParameters?: BabelNodeTSTypeParameterInstantiation; + }; + + declare type BabelNodeTSAsExpression = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSAsExpression"; + expression: BabelNodeExpression; + typeAnnotation: BabelNodeTSType; + }; + + declare type BabelNodeTSSatisfiesExpression = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSSatisfiesExpression"; + expression: BabelNodeExpression; + typeAnnotation: BabelNodeTSType; + }; + + declare type BabelNodeTSTypeAssertion = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSTypeAssertion"; + typeAnnotation: BabelNodeTSType; + expression: BabelNodeExpression; + }; + + declare type BabelNodeTSEnumBody = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSEnumBody"; + members: Array; + }; + + declare type BabelNodeTSEnumDeclaration = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSEnumDeclaration"; + id: BabelNodeIdentifier; + members: Array; + body?: BabelNodeTSEnumBody; + const?: boolean; + declare?: boolean; + initializer?: BabelNodeExpression; + }; + + declare type BabelNodeTSEnumMember = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSEnumMember"; + id: BabelNodeIdentifier | BabelNodeStringLiteral; + initializer?: BabelNodeExpression; + }; + + declare type BabelNodeTSModuleDeclaration = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSModuleDeclaration"; + id: BabelNodeIdentifier | BabelNodeStringLiteral; + body: BabelNodeTSModuleBlock | BabelNodeTSModuleDeclaration; + declare?: boolean; + global?: boolean; + kind: "global" | "module" | "namespace"; + }; + + declare type BabelNodeTSModuleBlock = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSModuleBlock"; + body: Array; + }; + + declare type BabelNodeTSImportType = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSImportType"; + argument: BabelNodeStringLiteral; + qualifier?: BabelNodeTSEntityName; + typeParameters?: BabelNodeTSTypeParameterInstantiation; + options?: BabelNodeObjectExpression; + }; + + declare type BabelNodeTSImportEqualsDeclaration = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSImportEqualsDeclaration"; + id: BabelNodeIdentifier; + moduleReference: BabelNodeTSEntityName | BabelNodeTSExternalModuleReference; + importKind?: "type" | "value"; + isExport: boolean; + }; + + declare type BabelNodeTSExternalModuleReference = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSExternalModuleReference"; + expression: BabelNodeStringLiteral; + }; + + declare type BabelNodeTSNonNullExpression = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSNonNullExpression"; + expression: BabelNodeExpression; + }; + + declare type BabelNodeTSExportAssignment = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSExportAssignment"; + expression: BabelNodeExpression; + }; + + declare type BabelNodeTSNamespaceExportDeclaration = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSNamespaceExportDeclaration"; + id: BabelNodeIdentifier; + }; + + declare type BabelNodeTSTypeAnnotation = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSTypeAnnotation"; + typeAnnotation: BabelNodeTSType; + }; + + declare type BabelNodeTSTypeParameterInstantiation = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSTypeParameterInstantiation"; + params: Array; + }; + + declare type BabelNodeTSTypeParameterDeclaration = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSTypeParameterDeclaration"; + params: Array; + }; + + declare type BabelNodeTSTypeParameter = { + leadingComments?: Array; + innerComments?: Array; + trailingComments?: Array; + start: ?number; + end: ?number; + loc: ?BabelNodeSourceLocation, + type: "TSTypeParameter"; + constraint?: BabelNodeTSType; + default?: BabelNodeTSType; + name: string; + const?: boolean; + in?: boolean; + out?: boolean; + }; + + declare type BabelNode = BabelNodeArrayExpression | BabelNodeAssignmentExpression | BabelNodeBinaryExpression | BabelNodeInterpreterDirective | BabelNodeDirective | BabelNodeDirectiveLiteral | BabelNodeBlockStatement | BabelNodeBreakStatement | BabelNodeCallExpression | BabelNodeCatchClause | BabelNodeConditionalExpression | BabelNodeContinueStatement | BabelNodeDebuggerStatement | BabelNodeDoWhileStatement | BabelNodeEmptyStatement | BabelNodeExpressionStatement | BabelNodeFile | BabelNodeForInStatement | BabelNodeForStatement | BabelNodeFunctionDeclaration | BabelNodeFunctionExpression | BabelNodeIdentifier | BabelNodeIfStatement | BabelNodeLabeledStatement | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeNullLiteral | BabelNodeBooleanLiteral | BabelNodeRegExpLiteral | BabelNodeLogicalExpression | BabelNodeMemberExpression | BabelNodeNewExpression | BabelNodeProgram | BabelNodeObjectExpression | BabelNodeObjectMethod | BabelNodeObjectProperty | BabelNodeRestElement | BabelNodeReturnStatement | BabelNodeSequenceExpression | BabelNodeParenthesizedExpression | BabelNodeSwitchCase | BabelNodeSwitchStatement | BabelNodeThisExpression | BabelNodeThrowStatement | BabelNodeTryStatement | BabelNodeUnaryExpression | BabelNodeUpdateExpression | BabelNodeVariableDeclaration | BabelNodeVariableDeclarator | BabelNodeWhileStatement | BabelNodeWithStatement | BabelNodeAssignmentPattern | BabelNodeArrayPattern | BabelNodeArrowFunctionExpression | BabelNodeClassBody | BabelNodeClassExpression | BabelNodeClassDeclaration | BabelNodeExportAllDeclaration | BabelNodeExportDefaultDeclaration | BabelNodeExportNamedDeclaration | BabelNodeExportSpecifier | BabelNodeForOfStatement | BabelNodeImportDeclaration | BabelNodeImportDefaultSpecifier | BabelNodeImportNamespaceSpecifier | BabelNodeImportSpecifier | BabelNodeImportExpression | BabelNodeMetaProperty | BabelNodeClassMethod | BabelNodeObjectPattern | BabelNodeSpreadElement | BabelNodeSuper | BabelNodeTaggedTemplateExpression | BabelNodeTemplateElement | BabelNodeTemplateLiteral | BabelNodeYieldExpression | BabelNodeAwaitExpression | BabelNodeImport | BabelNodeBigIntLiteral | BabelNodeExportNamespaceSpecifier | BabelNodeOptionalMemberExpression | BabelNodeOptionalCallExpression | BabelNodeClassProperty | BabelNodeClassAccessorProperty | BabelNodeClassPrivateProperty | BabelNodeClassPrivateMethod | BabelNodePrivateName | BabelNodeStaticBlock | BabelNodeImportAttribute | BabelNodeAnyTypeAnnotation | BabelNodeArrayTypeAnnotation | BabelNodeBooleanTypeAnnotation | BabelNodeBooleanLiteralTypeAnnotation | BabelNodeNullLiteralTypeAnnotation | BabelNodeClassImplements | BabelNodeDeclareClass | BabelNodeDeclareFunction | BabelNodeDeclareInterface | BabelNodeDeclareModule | BabelNodeDeclareModuleExports | BabelNodeDeclareTypeAlias | BabelNodeDeclareOpaqueType | BabelNodeDeclareVariable | BabelNodeDeclareExportDeclaration | BabelNodeDeclareExportAllDeclaration | BabelNodeDeclaredPredicate | BabelNodeExistsTypeAnnotation | BabelNodeFunctionTypeAnnotation | BabelNodeFunctionTypeParam | BabelNodeGenericTypeAnnotation | BabelNodeInferredPredicate | BabelNodeInterfaceExtends | BabelNodeInterfaceDeclaration | BabelNodeInterfaceTypeAnnotation | BabelNodeIntersectionTypeAnnotation | BabelNodeMixedTypeAnnotation | BabelNodeEmptyTypeAnnotation | BabelNodeNullableTypeAnnotation | BabelNodeNumberLiteralTypeAnnotation | BabelNodeNumberTypeAnnotation | BabelNodeObjectTypeAnnotation | BabelNodeObjectTypeInternalSlot | BabelNodeObjectTypeCallProperty | BabelNodeObjectTypeIndexer | BabelNodeObjectTypeProperty | BabelNodeObjectTypeSpreadProperty | BabelNodeOpaqueType | BabelNodeQualifiedTypeIdentifier | BabelNodeStringLiteralTypeAnnotation | BabelNodeStringTypeAnnotation | BabelNodeSymbolTypeAnnotation | BabelNodeThisTypeAnnotation | BabelNodeTupleTypeAnnotation | BabelNodeTypeofTypeAnnotation | BabelNodeTypeAlias | BabelNodeTypeAnnotation | BabelNodeTypeCastExpression | BabelNodeTypeParameter | BabelNodeTypeParameterDeclaration | BabelNodeTypeParameterInstantiation | BabelNodeUnionTypeAnnotation | BabelNodeVariance | BabelNodeVoidTypeAnnotation | BabelNodeEnumDeclaration | BabelNodeEnumBooleanBody | BabelNodeEnumNumberBody | BabelNodeEnumStringBody | BabelNodeEnumSymbolBody | BabelNodeEnumBooleanMember | BabelNodeEnumNumberMember | BabelNodeEnumStringMember | BabelNodeEnumDefaultedMember | BabelNodeIndexedAccessType | BabelNodeOptionalIndexedAccessType | BabelNodeJSXAttribute | BabelNodeJSXClosingElement | BabelNodeJSXElement | BabelNodeJSXEmptyExpression | BabelNodeJSXExpressionContainer | BabelNodeJSXSpreadChild | BabelNodeJSXIdentifier | BabelNodeJSXMemberExpression | BabelNodeJSXNamespacedName | BabelNodeJSXOpeningElement | BabelNodeJSXSpreadAttribute | BabelNodeJSXText | BabelNodeJSXFragment | BabelNodeJSXOpeningFragment | BabelNodeJSXClosingFragment | BabelNodeNoop | BabelNodePlaceholder | BabelNodeV8IntrinsicIdentifier | BabelNodeArgumentPlaceholder | BabelNodeBindExpression | BabelNodeDecorator | BabelNodeDoExpression | BabelNodeExportDefaultSpecifier | BabelNodeRecordExpression | BabelNodeTupleExpression | BabelNodeDecimalLiteral | BabelNodeModuleExpression | BabelNodeTopicReference | BabelNodePipelineTopicExpression | BabelNodePipelineBareFunction | BabelNodePipelinePrimaryTopicReference | BabelNodeVoidPattern | BabelNodeTSParameterProperty | BabelNodeTSDeclareFunction | BabelNodeTSDeclareMethod | BabelNodeTSQualifiedName | BabelNodeTSCallSignatureDeclaration | BabelNodeTSConstructSignatureDeclaration | BabelNodeTSPropertySignature | BabelNodeTSMethodSignature | BabelNodeTSIndexSignature | BabelNodeTSAnyKeyword | BabelNodeTSBooleanKeyword | BabelNodeTSBigIntKeyword | BabelNodeTSIntrinsicKeyword | BabelNodeTSNeverKeyword | BabelNodeTSNullKeyword | BabelNodeTSNumberKeyword | BabelNodeTSObjectKeyword | BabelNodeTSStringKeyword | BabelNodeTSSymbolKeyword | BabelNodeTSUndefinedKeyword | BabelNodeTSUnknownKeyword | BabelNodeTSVoidKeyword | BabelNodeTSThisType | BabelNodeTSFunctionType | BabelNodeTSConstructorType | BabelNodeTSTypeReference | BabelNodeTSTypePredicate | BabelNodeTSTypeQuery | BabelNodeTSTypeLiteral | BabelNodeTSArrayType | BabelNodeTSTupleType | BabelNodeTSOptionalType | BabelNodeTSRestType | BabelNodeTSNamedTupleMember | BabelNodeTSUnionType | BabelNodeTSIntersectionType | BabelNodeTSConditionalType | BabelNodeTSInferType | BabelNodeTSParenthesizedType | BabelNodeTSTypeOperator | BabelNodeTSIndexedAccessType | BabelNodeTSMappedType | BabelNodeTSTemplateLiteralType | BabelNodeTSLiteralType | BabelNodeTSExpressionWithTypeArguments | BabelNodeTSInterfaceDeclaration | BabelNodeTSInterfaceBody | BabelNodeTSTypeAliasDeclaration | BabelNodeTSInstantiationExpression | BabelNodeTSAsExpression | BabelNodeTSSatisfiesExpression | BabelNodeTSTypeAssertion | BabelNodeTSEnumBody | BabelNodeTSEnumDeclaration | BabelNodeTSEnumMember | BabelNodeTSModuleDeclaration | BabelNodeTSModuleBlock | BabelNodeTSImportType | BabelNodeTSImportEqualsDeclaration | BabelNodeTSExternalModuleReference | BabelNodeTSNonNullExpression | BabelNodeTSExportAssignment | BabelNodeTSNamespaceExportDeclaration | BabelNodeTSTypeAnnotation | BabelNodeTSTypeParameterInstantiation | BabelNodeTSTypeParameterDeclaration | BabelNodeTSTypeParameter; + declare type BabelNodeStandardized = BabelNodeArrayExpression | BabelNodeAssignmentExpression | BabelNodeBinaryExpression | BabelNodeInterpreterDirective | BabelNodeDirective | BabelNodeDirectiveLiteral | BabelNodeBlockStatement | BabelNodeBreakStatement | BabelNodeCallExpression | BabelNodeCatchClause | BabelNodeConditionalExpression | BabelNodeContinueStatement | BabelNodeDebuggerStatement | BabelNodeDoWhileStatement | BabelNodeEmptyStatement | BabelNodeExpressionStatement | BabelNodeFile | BabelNodeForInStatement | BabelNodeForStatement | BabelNodeFunctionDeclaration | BabelNodeFunctionExpression | BabelNodeIdentifier | BabelNodeIfStatement | BabelNodeLabeledStatement | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeNullLiteral | BabelNodeBooleanLiteral | BabelNodeRegExpLiteral | BabelNodeLogicalExpression | BabelNodeMemberExpression | BabelNodeNewExpression | BabelNodeProgram | BabelNodeObjectExpression | BabelNodeObjectMethod | BabelNodeObjectProperty | BabelNodeRestElement | BabelNodeReturnStatement | BabelNodeSequenceExpression | BabelNodeParenthesizedExpression | BabelNodeSwitchCase | BabelNodeSwitchStatement | BabelNodeThisExpression | BabelNodeThrowStatement | BabelNodeTryStatement | BabelNodeUnaryExpression | BabelNodeUpdateExpression | BabelNodeVariableDeclaration | BabelNodeVariableDeclarator | BabelNodeWhileStatement | BabelNodeWithStatement | BabelNodeAssignmentPattern | BabelNodeArrayPattern | BabelNodeArrowFunctionExpression | BabelNodeClassBody | BabelNodeClassExpression | BabelNodeClassDeclaration | BabelNodeExportAllDeclaration | BabelNodeExportDefaultDeclaration | BabelNodeExportNamedDeclaration | BabelNodeExportSpecifier | BabelNodeForOfStatement | BabelNodeImportDeclaration | BabelNodeImportDefaultSpecifier | BabelNodeImportNamespaceSpecifier | BabelNodeImportSpecifier | BabelNodeImportExpression | BabelNodeMetaProperty | BabelNodeClassMethod | BabelNodeObjectPattern | BabelNodeSpreadElement | BabelNodeSuper | BabelNodeTaggedTemplateExpression | BabelNodeTemplateElement | BabelNodeTemplateLiteral | BabelNodeYieldExpression | BabelNodeAwaitExpression | BabelNodeImport | BabelNodeBigIntLiteral | BabelNodeExportNamespaceSpecifier | BabelNodeOptionalMemberExpression | BabelNodeOptionalCallExpression | BabelNodeClassProperty | BabelNodeClassAccessorProperty | BabelNodeClassPrivateProperty | BabelNodeClassPrivateMethod | BabelNodePrivateName | BabelNodeStaticBlock | BabelNodeImportAttribute; + declare type BabelNodeExpression = BabelNodeArrayExpression | BabelNodeAssignmentExpression | BabelNodeBinaryExpression | BabelNodeCallExpression | BabelNodeConditionalExpression | BabelNodeFunctionExpression | BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeNullLiteral | BabelNodeBooleanLiteral | BabelNodeRegExpLiteral | BabelNodeLogicalExpression | BabelNodeMemberExpression | BabelNodeNewExpression | BabelNodeObjectExpression | BabelNodeSequenceExpression | BabelNodeParenthesizedExpression | BabelNodeThisExpression | BabelNodeUnaryExpression | BabelNodeUpdateExpression | BabelNodeArrowFunctionExpression | BabelNodeClassExpression | BabelNodeImportExpression | BabelNodeMetaProperty | BabelNodeSuper | BabelNodeTaggedTemplateExpression | BabelNodeTemplateLiteral | BabelNodeYieldExpression | BabelNodeAwaitExpression | BabelNodeImport | BabelNodeBigIntLiteral | BabelNodeOptionalMemberExpression | BabelNodeOptionalCallExpression | BabelNodeTypeCastExpression | BabelNodeJSXElement | BabelNodeJSXFragment | BabelNodeBindExpression | BabelNodeDoExpression | BabelNodeRecordExpression | BabelNodeTupleExpression | BabelNodeDecimalLiteral | BabelNodeModuleExpression | BabelNodeTopicReference | BabelNodePipelineTopicExpression | BabelNodePipelineBareFunction | BabelNodePipelinePrimaryTopicReference | BabelNodeTSInstantiationExpression | BabelNodeTSAsExpression | BabelNodeTSSatisfiesExpression | BabelNodeTSTypeAssertion | BabelNodeTSNonNullExpression; + declare type BabelNodeBinary = BabelNodeBinaryExpression | BabelNodeLogicalExpression; + declare type BabelNodeScopable = BabelNodeBlockStatement | BabelNodeCatchClause | BabelNodeDoWhileStatement | BabelNodeForInStatement | BabelNodeForStatement | BabelNodeFunctionDeclaration | BabelNodeFunctionExpression | BabelNodeProgram | BabelNodeObjectMethod | BabelNodeSwitchStatement | BabelNodeWhileStatement | BabelNodeArrowFunctionExpression | BabelNodeClassExpression | BabelNodeClassDeclaration | BabelNodeForOfStatement | BabelNodeClassMethod | BabelNodeClassPrivateMethod | BabelNodeStaticBlock | BabelNodeTSModuleBlock; + declare type BabelNodeBlockParent = BabelNodeBlockStatement | BabelNodeCatchClause | BabelNodeDoWhileStatement | BabelNodeForInStatement | BabelNodeForStatement | BabelNodeFunctionDeclaration | BabelNodeFunctionExpression | BabelNodeProgram | BabelNodeObjectMethod | BabelNodeSwitchStatement | BabelNodeWhileStatement | BabelNodeArrowFunctionExpression | BabelNodeForOfStatement | BabelNodeClassMethod | BabelNodeClassPrivateMethod | BabelNodeStaticBlock | BabelNodeTSModuleBlock; + declare type BabelNodeBlock = BabelNodeBlockStatement | BabelNodeProgram | BabelNodeTSModuleBlock; + declare type BabelNodeStatement = BabelNodeBlockStatement | BabelNodeBreakStatement | BabelNodeContinueStatement | BabelNodeDebuggerStatement | BabelNodeDoWhileStatement | BabelNodeEmptyStatement | BabelNodeExpressionStatement | BabelNodeForInStatement | BabelNodeForStatement | BabelNodeFunctionDeclaration | BabelNodeIfStatement | BabelNodeLabeledStatement | BabelNodeReturnStatement | BabelNodeSwitchStatement | BabelNodeThrowStatement | BabelNodeTryStatement | BabelNodeVariableDeclaration | BabelNodeWhileStatement | BabelNodeWithStatement | BabelNodeClassDeclaration | BabelNodeExportAllDeclaration | BabelNodeExportDefaultDeclaration | BabelNodeExportNamedDeclaration | BabelNodeForOfStatement | BabelNodeImportDeclaration | BabelNodeDeclareClass | BabelNodeDeclareFunction | BabelNodeDeclareInterface | BabelNodeDeclareModule | BabelNodeDeclareModuleExports | BabelNodeDeclareTypeAlias | BabelNodeDeclareOpaqueType | BabelNodeDeclareVariable | BabelNodeDeclareExportDeclaration | BabelNodeDeclareExportAllDeclaration | BabelNodeInterfaceDeclaration | BabelNodeOpaqueType | BabelNodeTypeAlias | BabelNodeEnumDeclaration | BabelNodeTSDeclareFunction | BabelNodeTSInterfaceDeclaration | BabelNodeTSTypeAliasDeclaration | BabelNodeTSEnumDeclaration | BabelNodeTSModuleDeclaration | BabelNodeTSImportEqualsDeclaration | BabelNodeTSExportAssignment | BabelNodeTSNamespaceExportDeclaration; + declare type BabelNodeTerminatorless = BabelNodeBreakStatement | BabelNodeContinueStatement | BabelNodeReturnStatement | BabelNodeThrowStatement | BabelNodeYieldExpression | BabelNodeAwaitExpression; + declare type BabelNodeCompletionStatement = BabelNodeBreakStatement | BabelNodeContinueStatement | BabelNodeReturnStatement | BabelNodeThrowStatement; + declare type BabelNodeConditional = BabelNodeConditionalExpression | BabelNodeIfStatement; + declare type BabelNodeLoop = BabelNodeDoWhileStatement | BabelNodeForInStatement | BabelNodeForStatement | BabelNodeWhileStatement | BabelNodeForOfStatement; + declare type BabelNodeWhile = BabelNodeDoWhileStatement | BabelNodeWhileStatement; + declare type BabelNodeExpressionWrapper = BabelNodeExpressionStatement | BabelNodeParenthesizedExpression | BabelNodeTypeCastExpression; + declare type BabelNodeFor = BabelNodeForInStatement | BabelNodeForStatement | BabelNodeForOfStatement; + declare type BabelNodeForXStatement = BabelNodeForInStatement | BabelNodeForOfStatement; + declare type BabelNodeFunction = BabelNodeFunctionDeclaration | BabelNodeFunctionExpression | BabelNodeObjectMethod | BabelNodeArrowFunctionExpression | BabelNodeClassMethod | BabelNodeClassPrivateMethod; + declare type BabelNodeFunctionParent = BabelNodeFunctionDeclaration | BabelNodeFunctionExpression | BabelNodeObjectMethod | BabelNodeArrowFunctionExpression | BabelNodeClassMethod | BabelNodeClassPrivateMethod | BabelNodeStaticBlock | BabelNodeTSModuleBlock; + declare type BabelNodePureish = BabelNodeFunctionDeclaration | BabelNodeFunctionExpression | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeNullLiteral | BabelNodeBooleanLiteral | BabelNodeRegExpLiteral | BabelNodeArrowFunctionExpression | BabelNodeBigIntLiteral | BabelNodeDecimalLiteral; + declare type BabelNodeDeclaration = BabelNodeFunctionDeclaration | BabelNodeVariableDeclaration | BabelNodeClassDeclaration | BabelNodeExportAllDeclaration | BabelNodeExportDefaultDeclaration | BabelNodeExportNamedDeclaration | BabelNodeImportDeclaration | BabelNodeDeclareClass | BabelNodeDeclareFunction | BabelNodeDeclareInterface | BabelNodeDeclareModule | BabelNodeDeclareModuleExports | BabelNodeDeclareTypeAlias | BabelNodeDeclareOpaqueType | BabelNodeDeclareVariable | BabelNodeDeclareExportDeclaration | BabelNodeDeclareExportAllDeclaration | BabelNodeInterfaceDeclaration | BabelNodeOpaqueType | BabelNodeTypeAlias | BabelNodeEnumDeclaration | BabelNodeTSDeclareFunction | BabelNodeTSInterfaceDeclaration | BabelNodeTSTypeAliasDeclaration | BabelNodeTSEnumDeclaration | BabelNodeTSModuleDeclaration | BabelNodeTSImportEqualsDeclaration; + declare type BabelNodeFunctionParameter = BabelNodeIdentifier | BabelNodeRestElement | BabelNodeAssignmentPattern | BabelNodeArrayPattern | BabelNodeObjectPattern | BabelNodeVoidPattern; + declare type BabelNodePatternLike = BabelNodeIdentifier | BabelNodeMemberExpression | BabelNodeRestElement | BabelNodeAssignmentPattern | BabelNodeArrayPattern | BabelNodeObjectPattern | BabelNodeVoidPattern | BabelNodeTSAsExpression | BabelNodeTSSatisfiesExpression | BabelNodeTSTypeAssertion | BabelNodeTSNonNullExpression; + declare type BabelNodeLVal = BabelNodeIdentifier | BabelNodeMemberExpression | BabelNodeRestElement | BabelNodeAssignmentPattern | BabelNodeArrayPattern | BabelNodeObjectPattern | BabelNodeTSParameterProperty | BabelNodeTSAsExpression | BabelNodeTSSatisfiesExpression | BabelNodeTSTypeAssertion | BabelNodeTSNonNullExpression; + declare type BabelNodeTSEntityName = BabelNodeIdentifier | BabelNodeTSQualifiedName; + declare type BabelNodeLiteral = BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeNullLiteral | BabelNodeBooleanLiteral | BabelNodeRegExpLiteral | BabelNodeTemplateLiteral | BabelNodeBigIntLiteral | BabelNodeDecimalLiteral; + declare type BabelNodeImmutable = BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeNullLiteral | BabelNodeBooleanLiteral | BabelNodeBigIntLiteral | BabelNodeJSXAttribute | BabelNodeJSXClosingElement | BabelNodeJSXElement | BabelNodeJSXExpressionContainer | BabelNodeJSXSpreadChild | BabelNodeJSXOpeningElement | BabelNodeJSXText | BabelNodeJSXFragment | BabelNodeJSXOpeningFragment | BabelNodeJSXClosingFragment | BabelNodeDecimalLiteral; + declare type BabelNodeUserWhitespacable = BabelNodeObjectMethod | BabelNodeObjectProperty | BabelNodeObjectTypeInternalSlot | BabelNodeObjectTypeCallProperty | BabelNodeObjectTypeIndexer | BabelNodeObjectTypeProperty | BabelNodeObjectTypeSpreadProperty; + declare type BabelNodeMethod = BabelNodeObjectMethod | BabelNodeClassMethod | BabelNodeClassPrivateMethod; + declare type BabelNodeObjectMember = BabelNodeObjectMethod | BabelNodeObjectProperty; + declare type BabelNodeProperty = BabelNodeObjectProperty | BabelNodeClassProperty | BabelNodeClassAccessorProperty | BabelNodeClassPrivateProperty; + declare type BabelNodeUnaryLike = BabelNodeUnaryExpression | BabelNodeSpreadElement; + declare type BabelNodePattern = BabelNodeAssignmentPattern | BabelNodeArrayPattern | BabelNodeObjectPattern | BabelNodeVoidPattern; + declare type BabelNodeClass = BabelNodeClassExpression | BabelNodeClassDeclaration; + declare type BabelNodeImportOrExportDeclaration = BabelNodeExportAllDeclaration | BabelNodeExportDefaultDeclaration | BabelNodeExportNamedDeclaration | BabelNodeImportDeclaration; + declare type BabelNodeExportDeclaration = BabelNodeExportAllDeclaration | BabelNodeExportDefaultDeclaration | BabelNodeExportNamedDeclaration; + declare type BabelNodeModuleSpecifier = BabelNodeExportSpecifier | BabelNodeImportDefaultSpecifier | BabelNodeImportNamespaceSpecifier | BabelNodeImportSpecifier | BabelNodeExportNamespaceSpecifier | BabelNodeExportDefaultSpecifier; + declare type BabelNodeAccessor = BabelNodeClassAccessorProperty; + declare type BabelNodePrivate = BabelNodeClassPrivateProperty | BabelNodeClassPrivateMethod | BabelNodePrivateName; + declare type BabelNodeFlow = BabelNodeAnyTypeAnnotation | BabelNodeArrayTypeAnnotation | BabelNodeBooleanTypeAnnotation | BabelNodeBooleanLiteralTypeAnnotation | BabelNodeNullLiteralTypeAnnotation | BabelNodeClassImplements | BabelNodeDeclareClass | BabelNodeDeclareFunction | BabelNodeDeclareInterface | BabelNodeDeclareModule | BabelNodeDeclareModuleExports | BabelNodeDeclareTypeAlias | BabelNodeDeclareOpaqueType | BabelNodeDeclareVariable | BabelNodeDeclareExportDeclaration | BabelNodeDeclareExportAllDeclaration | BabelNodeDeclaredPredicate | BabelNodeExistsTypeAnnotation | BabelNodeFunctionTypeAnnotation | BabelNodeFunctionTypeParam | BabelNodeGenericTypeAnnotation | BabelNodeInferredPredicate | BabelNodeInterfaceExtends | BabelNodeInterfaceDeclaration | BabelNodeInterfaceTypeAnnotation | BabelNodeIntersectionTypeAnnotation | BabelNodeMixedTypeAnnotation | BabelNodeEmptyTypeAnnotation | BabelNodeNullableTypeAnnotation | BabelNodeNumberLiteralTypeAnnotation | BabelNodeNumberTypeAnnotation | BabelNodeObjectTypeAnnotation | BabelNodeObjectTypeInternalSlot | BabelNodeObjectTypeCallProperty | BabelNodeObjectTypeIndexer | BabelNodeObjectTypeProperty | BabelNodeObjectTypeSpreadProperty | BabelNodeOpaqueType | BabelNodeQualifiedTypeIdentifier | BabelNodeStringLiteralTypeAnnotation | BabelNodeStringTypeAnnotation | BabelNodeSymbolTypeAnnotation | BabelNodeThisTypeAnnotation | BabelNodeTupleTypeAnnotation | BabelNodeTypeofTypeAnnotation | BabelNodeTypeAlias | BabelNodeTypeAnnotation | BabelNodeTypeCastExpression | BabelNodeTypeParameter | BabelNodeTypeParameterDeclaration | BabelNodeTypeParameterInstantiation | BabelNodeUnionTypeAnnotation | BabelNodeVariance | BabelNodeVoidTypeAnnotation | BabelNodeEnumDeclaration | BabelNodeEnumBooleanBody | BabelNodeEnumNumberBody | BabelNodeEnumStringBody | BabelNodeEnumSymbolBody | BabelNodeEnumBooleanMember | BabelNodeEnumNumberMember | BabelNodeEnumStringMember | BabelNodeEnumDefaultedMember | BabelNodeIndexedAccessType | BabelNodeOptionalIndexedAccessType; + declare type BabelNodeFlowType = BabelNodeAnyTypeAnnotation | BabelNodeArrayTypeAnnotation | BabelNodeBooleanTypeAnnotation | BabelNodeBooleanLiteralTypeAnnotation | BabelNodeNullLiteralTypeAnnotation | BabelNodeExistsTypeAnnotation | BabelNodeFunctionTypeAnnotation | BabelNodeGenericTypeAnnotation | BabelNodeInterfaceTypeAnnotation | BabelNodeIntersectionTypeAnnotation | BabelNodeMixedTypeAnnotation | BabelNodeEmptyTypeAnnotation | BabelNodeNullableTypeAnnotation | BabelNodeNumberLiteralTypeAnnotation | BabelNodeNumberTypeAnnotation | BabelNodeObjectTypeAnnotation | BabelNodeStringLiteralTypeAnnotation | BabelNodeStringTypeAnnotation | BabelNodeSymbolTypeAnnotation | BabelNodeThisTypeAnnotation | BabelNodeTupleTypeAnnotation | BabelNodeTypeofTypeAnnotation | BabelNodeUnionTypeAnnotation | BabelNodeVoidTypeAnnotation | BabelNodeIndexedAccessType | BabelNodeOptionalIndexedAccessType; + declare type BabelNodeFlowBaseAnnotation = BabelNodeAnyTypeAnnotation | BabelNodeBooleanTypeAnnotation | BabelNodeNullLiteralTypeAnnotation | BabelNodeMixedTypeAnnotation | BabelNodeEmptyTypeAnnotation | BabelNodeNumberTypeAnnotation | BabelNodeStringTypeAnnotation | BabelNodeSymbolTypeAnnotation | BabelNodeThisTypeAnnotation | BabelNodeVoidTypeAnnotation; + declare type BabelNodeFlowDeclaration = BabelNodeDeclareClass | BabelNodeDeclareFunction | BabelNodeDeclareInterface | BabelNodeDeclareModule | BabelNodeDeclareModuleExports | BabelNodeDeclareTypeAlias | BabelNodeDeclareOpaqueType | BabelNodeDeclareVariable | BabelNodeDeclareExportDeclaration | BabelNodeDeclareExportAllDeclaration | BabelNodeInterfaceDeclaration | BabelNodeOpaqueType | BabelNodeTypeAlias; + declare type BabelNodeFlowPredicate = BabelNodeDeclaredPredicate | BabelNodeInferredPredicate; + declare type BabelNodeEnumBody = BabelNodeEnumBooleanBody | BabelNodeEnumNumberBody | BabelNodeEnumStringBody | BabelNodeEnumSymbolBody; + declare type BabelNodeEnumMember = BabelNodeEnumBooleanMember | BabelNodeEnumNumberMember | BabelNodeEnumStringMember | BabelNodeEnumDefaultedMember; + declare type BabelNodeJSX = BabelNodeJSXAttribute | BabelNodeJSXClosingElement | BabelNodeJSXElement | BabelNodeJSXEmptyExpression | BabelNodeJSXExpressionContainer | BabelNodeJSXSpreadChild | BabelNodeJSXIdentifier | BabelNodeJSXMemberExpression | BabelNodeJSXNamespacedName | BabelNodeJSXOpeningElement | BabelNodeJSXSpreadAttribute | BabelNodeJSXText | BabelNodeJSXFragment | BabelNodeJSXOpeningFragment | BabelNodeJSXClosingFragment; + declare type BabelNodeMiscellaneous = BabelNodeNoop | BabelNodePlaceholder | BabelNodeV8IntrinsicIdentifier; + declare type BabelNodeTypeScript = BabelNodeTSParameterProperty | BabelNodeTSDeclareFunction | BabelNodeTSDeclareMethod | BabelNodeTSQualifiedName | BabelNodeTSCallSignatureDeclaration | BabelNodeTSConstructSignatureDeclaration | BabelNodeTSPropertySignature | BabelNodeTSMethodSignature | BabelNodeTSIndexSignature | BabelNodeTSAnyKeyword | BabelNodeTSBooleanKeyword | BabelNodeTSBigIntKeyword | BabelNodeTSIntrinsicKeyword | BabelNodeTSNeverKeyword | BabelNodeTSNullKeyword | BabelNodeTSNumberKeyword | BabelNodeTSObjectKeyword | BabelNodeTSStringKeyword | BabelNodeTSSymbolKeyword | BabelNodeTSUndefinedKeyword | BabelNodeTSUnknownKeyword | BabelNodeTSVoidKeyword | BabelNodeTSThisType | BabelNodeTSFunctionType | BabelNodeTSConstructorType | BabelNodeTSTypeReference | BabelNodeTSTypePredicate | BabelNodeTSTypeQuery | BabelNodeTSTypeLiteral | BabelNodeTSArrayType | BabelNodeTSTupleType | BabelNodeTSOptionalType | BabelNodeTSRestType | BabelNodeTSNamedTupleMember | BabelNodeTSUnionType | BabelNodeTSIntersectionType | BabelNodeTSConditionalType | BabelNodeTSInferType | BabelNodeTSParenthesizedType | BabelNodeTSTypeOperator | BabelNodeTSIndexedAccessType | BabelNodeTSMappedType | BabelNodeTSTemplateLiteralType | BabelNodeTSLiteralType | BabelNodeTSExpressionWithTypeArguments | BabelNodeTSInterfaceDeclaration | BabelNodeTSInterfaceBody | BabelNodeTSTypeAliasDeclaration | BabelNodeTSInstantiationExpression | BabelNodeTSAsExpression | BabelNodeTSSatisfiesExpression | BabelNodeTSTypeAssertion | BabelNodeTSEnumBody | BabelNodeTSEnumDeclaration | BabelNodeTSEnumMember | BabelNodeTSModuleDeclaration | BabelNodeTSModuleBlock | BabelNodeTSImportType | BabelNodeTSImportEqualsDeclaration | BabelNodeTSExternalModuleReference | BabelNodeTSNonNullExpression | BabelNodeTSExportAssignment | BabelNodeTSNamespaceExportDeclaration | BabelNodeTSTypeAnnotation | BabelNodeTSTypeParameterInstantiation | BabelNodeTSTypeParameterDeclaration | BabelNodeTSTypeParameter; + declare type BabelNodeTSTypeElement = BabelNodeTSCallSignatureDeclaration | BabelNodeTSConstructSignatureDeclaration | BabelNodeTSPropertySignature | BabelNodeTSMethodSignature | BabelNodeTSIndexSignature; + declare type BabelNodeTSType = BabelNodeTSAnyKeyword | BabelNodeTSBooleanKeyword | BabelNodeTSBigIntKeyword | BabelNodeTSIntrinsicKeyword | BabelNodeTSNeverKeyword | BabelNodeTSNullKeyword | BabelNodeTSNumberKeyword | BabelNodeTSObjectKeyword | BabelNodeTSStringKeyword | BabelNodeTSSymbolKeyword | BabelNodeTSUndefinedKeyword | BabelNodeTSUnknownKeyword | BabelNodeTSVoidKeyword | BabelNodeTSThisType | BabelNodeTSFunctionType | BabelNodeTSConstructorType | BabelNodeTSTypeReference | BabelNodeTSTypePredicate | BabelNodeTSTypeQuery | BabelNodeTSTypeLiteral | BabelNodeTSArrayType | BabelNodeTSTupleType | BabelNodeTSOptionalType | BabelNodeTSRestType | BabelNodeTSUnionType | BabelNodeTSIntersectionType | BabelNodeTSConditionalType | BabelNodeTSInferType | BabelNodeTSParenthesizedType | BabelNodeTSTypeOperator | BabelNodeTSIndexedAccessType | BabelNodeTSMappedType | BabelNodeTSTemplateLiteralType | BabelNodeTSLiteralType | BabelNodeTSExpressionWithTypeArguments | BabelNodeTSImportType; + declare type BabelNodeTSBaseType = BabelNodeTSAnyKeyword | BabelNodeTSBooleanKeyword | BabelNodeTSBigIntKeyword | BabelNodeTSIntrinsicKeyword | BabelNodeTSNeverKeyword | BabelNodeTSNullKeyword | BabelNodeTSNumberKeyword | BabelNodeTSObjectKeyword | BabelNodeTSStringKeyword | BabelNodeTSSymbolKeyword | BabelNodeTSUndefinedKeyword | BabelNodeTSUnknownKeyword | BabelNodeTSVoidKeyword | BabelNodeTSThisType | BabelNodeTSTemplateLiteralType | BabelNodeTSLiteralType; + declare type BabelNodeModuleDeclaration = BabelNodeExportAllDeclaration | BabelNodeExportDefaultDeclaration | BabelNodeExportNamedDeclaration | BabelNodeImportDeclaration; -declare module "@babel/types" { declare export function arrayExpression(elements?: Array): BabelNodeArrayExpression; declare export function assignmentExpression(operator: string, left: BabelNodeLVal | BabelNodeOptionalMemberExpression, right: BabelNodeExpression): BabelNodeAssignmentExpression; declare export function binaryExpression(operator: "+" | "-" | "/" | "%" | "*" | "**" | "&" | "|" | ">>" | ">>>" | "<<" | "^" | "==" | "===" | "!=" | "!==" | "in" | "instanceof" | ">" | "<" | ">=" | "<=" | "|>", left: BabelNodeExpression | BabelNodePrivateName, right: BabelNodeExpression): BabelNodeBinaryExpression; @@ -3848,8 +3848,8 @@ declare module "@babel/types" { declare export function prependToMemberExpression(member: BabelNodeMemberExpression, prepend: BabelNodeExpression): BabelNodeMemberExpression declare export function removeProperties(n: T, opts: ?{}): void; declare export function removePropertiesDeep(n: T, opts: ?{}): T; - declare export function getBindingIdentifiers(node: BabelNode, duplicates: boolean, outerOnly?: boolean): { [key: string]: BabelNodeIdentifier | Array } - declare export function getOuterBindingIdentifiers(node: Node, duplicates: boolean): { [key: string]: BabelNodeIdentifier | Array } + declare export function getBindingIdentifiers(node: BabelNode, duplicates?: boolean, outerOnly?: boolean): { [key: string]: BabelNodeIdentifier | Array } + declare export function getOuterBindingIdentifiers(node: Node, duplicates?: boolean): { [key: string]: BabelNodeIdentifier | Array } declare export type TraversalAncestors = Array<{ node: BabelNode, key: string, diff --git a/flow-typed/npm/babel_v7.x.x.js b/flow-typed/npm/babel_v7.x.x.js index 4da72d6b7d54..fa78c6124859 100644 --- a/flow-typed/npm/babel_v7.x.x.js +++ b/flow-typed/npm/babel_v7.x.x.js @@ -28,12 +28,35 @@ type _BabelSourceMapSegment = { ... }; +// A "decoded" source map (as produced by `@jridgewell/gen-mapping`), grouped by +// generated line. Segment fields are all 0-based: generated column, source +// index, source line, source column, name index. +type _BabelDecodedSourceMapSegment = + | [number] + | [number, number, number, number] + | [number, number, number, number, number]; + +type _BabelDecodedSourceMap = Readonly<{ + file?: string, + mappings: Array>, + names: Array, + sourceRoot?: string, + sources: Array, + sourcesContent?: Array, + version: number, +}>; + export type BabelSourceLocation = Readonly<{ start: Readonly<{line: number, column: number}>, end: Readonly<{line: number, column: number}>, }>; declare module '@babel/parser' { + import type { + Expression as BabelNodeExpression, + File as BabelNodeFile, + } from '@babel/types'; + // See https://github.com/babel/babel/blob/master/packages/babel-parser/typings/babel-parser.d.ts declare export type ParserPlugin = | 'asyncGenerators' @@ -242,6 +265,14 @@ declare module '@babel/core' { import typeof Template from '@babel/template'; import typeof Traverse from '@babel/traverse'; import typeof * as Types from '@babel/types'; + import type { + ArrayExpression as BabelNodeArrayExpression, + File as BabelNodeFile, + Identifier as BabelNodeIdentifier, + Node as BabelNode, + Program as BabelNodeProgram, + SourceLocation as BabelNodeSourceLocation, + } from '@babel/types'; declare export var version: string; declare export var tokTypes: TokTypes; @@ -423,13 +454,13 @@ declare module '@babel/core' { }; declare export class ConfigItem { - +value: PluginObj | (() => PluginObj); - +options: EntryOptions; - +dirname: string; - +name: string | void; - +file: { - +request: string, - +resolved: string, + readonly value: PluginObj | (() => PluginObj); + readonly options: EntryOptions; + readonly dirname: string; + readonly name: string | void; + readonly file: { + readonly request: string, + readonly resolved: string, } | void; constructor(descriptor: UnloadedDescriptor): ConfigItem; @@ -1079,12 +1110,12 @@ declare module '@babel/core' { declare type ValidatedOptions = BabelCoreOptions; declare class PartialConfig { - +options: Readonly; - +babelrc: string | void; - +babelignore: string | void; - +config: string | void; - +files: ReadonlySet; - +fileHandling: 'ignored' | 'transpile' | 'unsupported'; + readonly options: Readonly; + readonly babelrc: string | void; + readonly babelignore: string | void; + readonly config: string | void; + readonly files: ReadonlySet; + readonly fileHandling: 'ignored' | 'transpile' | 'unsupported'; constructor(options: ValidatedOptions): PartialConfig; @@ -1106,11 +1137,14 @@ declare module '@babel/core' { } declare module '@babel/generator' { + import type {Node as BabelNode} from '@babel/types'; + declare export type BabelSourceMapSegment = _BabelSourceMapSegment; declare export type GeneratorResult = { code: string, map: ?_BabelSourceMap, + decodedMap: ?_BabelDecodedSourceMap, rawMappings: ?Array, }; @@ -1273,9 +1307,7 @@ declare module '@babel/template' { syntacticPlaceholders?: ?boolean, }; - declare export type PublicReplacements = - | {[string]: ?BabelNode} - | Array; + declare export type PublicReplacements = {[string]: ?Node} | Array; declare export type TemplateBuilder = { // Build a new builder, merging the given options with the previous ones. diff --git a/flow-typed/npm/chrome-launcher_v0.15.x.js b/flow-typed/npm/chrome-launcher_v0.15.x.js deleted file mode 100644 index 4f7a3fef11a2..000000000000 --- a/flow-typed/npm/chrome-launcher_v0.15.x.js +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow strict - * @format - */ - -declare module 'chrome-launcher' { - import typeof fs from 'fs'; - import typeof childProcess from 'child_process'; - import type {ChildProcess} from 'child_process'; - - declare export type Options = { - startingUrl?: string, - chromeFlags?: Array, - prefs?: unknown, - port?: number, - handleSIGINT?: boolean, - chromePath?: string, - userDataDir?: string | boolean, - logLevel?: 'verbose' | 'info' | 'error' | 'warn' | 'silent', - ignoreDefaultFlags?: boolean, - connectionPollInterval?: number, - maxConnectionRetries?: number, - envVars?: {[key: string]: ?string}, - }; - - declare export type LaunchedChrome = { - pid: number, - port: number, - process: ChildProcess, - kill: () => void, - }; - - declare export type ModuleOverrides = { - fs?: fs, - spawn?: childProcess['spawn'], - }; - - declare class Launcher { - getChromePath(): string; - launch(options: Options): Promise; - Launcher: { - defaultFlags(): Array, - }; - } - - declare module.exports: Launcher; -} diff --git a/flow-typed/npm/chromium-edge-launcher_v0.2.x.js b/flow-typed/npm/chromium-edge-launcher_v0.2.x.js deleted file mode 100644 index 0b74594465da..000000000000 --- a/flow-typed/npm/chromium-edge-launcher_v0.2.x.js +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow strict - * @format - */ - -declare module 'chromium-edge-launcher' { - import typeof fs from 'fs'; - import typeof childProcess from 'child_process'; - import type {ChildProcess} from 'child_process'; - - declare export type Options = { - startingUrl?: string, - edgeFlags?: Array, - prefs?: unknown, - port?: number, - handleSIGINT?: boolean, - edgePath?: string, - userDataDir?: string | boolean, - logLevel?: 'verbose' | 'info' | 'error' | 'warn' | 'silent', - ignoreDefaultFlags?: boolean, - connectionPollInterval?: number, - maxConnectionRetries?: number, - envVars?: {[key: string]: ?string}, - }; - - declare export type LaunchedEdge = { - pid: number, - port: number, - process: ChildProcess, - kill: () => void, - }; - - declare export type ModuleOverrides = { - fs?: fs, - spawn?: childProcess['spawn'], - }; - - declare class Launcher { - getFirstInstallation(): string; - launch(options: Options): Promise; - } - - declare module.exports: { - default: Launcher, - Launcher: Launcher, - }; -} diff --git a/flow-typed/npm/commander_v12.x.x.js b/flow-typed/npm/commander_v12.x.x.js index 1f18ac9da056..d98bd1ed5335 100644 --- a/flow-typed/npm/commander_v12.x.x.js +++ b/flow-typed/npm/commander_v12.x.x.js @@ -15,8 +15,7 @@ declare module 'commander' { declare type LiteralUnion = - | LiteralType - | {...BaseType, ...{[key: empty]: empty, ...}}; + LiteralType | {...BaseType, ...{[key: empty]: empty, ...}}; declare export class CommanderError mixins Error { code: string; @@ -335,10 +334,7 @@ declare module 'commander' { outputError?: (str: string, write: (str: string) => void) => void; } export type AddHelpTextPosition = - | 'beforeAll' - | 'before' - | 'after' - | 'afterAll'; + 'beforeAll' | 'before' | 'after' | 'afterAll'; export type HookEvent = 'preSubcommand' | 'preAction' | 'postAction'; export type OptionValueSource = LiteralUnion< 'default' | 'config' | 'env' | 'cli' | 'implied', diff --git a/flow-typed/npm/electron-packager_v18.x.x.js b/flow-typed/npm/electron-packager_v20.x.x.js similarity index 84% rename from flow-typed/npm/electron-packager_v18.x.x.js rename to flow-typed/npm/electron-packager_v20.x.x.js index 4ac8b158eb5c..86e3cfc25f1d 100644 --- a/flow-typed/npm/electron-packager_v18.x.x.js +++ b/flow-typed/npm/electron-packager_v20.x.x.js @@ -11,29 +11,25 @@ declare module '@electron/packager' { declare export type AsarOptions = $FlowFixMe; - declare export type ElectronDownloadRequestOptions = $FlowFixMe; - declare export type TargetDefinition = { arch: TargetArch, platform: TargetPlatform, }; - declare export type FinalizePackageTargetsHookFunction = ( - targets: TargetDefinition[], - callback: HookFunctionErrorCallback, - ) => void; - - declare export type HookFunction = ( + declare export type HookFunctionArgs = { buildPath: string, electronVersion: string, platform: TargetPlatform, arch: TargetArch, - callback: HookFunctionErrorCallback, - ) => void; + }; - declare export type IgnoreFunction = (path: string) => boolean; + declare export type HookFunction = (args: HookFunctionArgs) => Promise; + + declare export type FinalizePackageTargetsHookFunction = (args: { + targets: TargetDefinition[], + }) => Promise; - declare export type HookFunctionErrorCallback = (err?: Error | null) => void; + declare export type IgnoreFunction = (path: string) => boolean; declare export interface MacOSProtocol { name: string; @@ -53,21 +49,14 @@ declare module '@electron/packager' { ProductName?: string, InternalName?: string, 'requested-execution-level'?: - | 'asInvoker' - | 'highestAvailable' - | 'requireAdministrator', + 'asInvoker' | 'highestAvailable' | 'requireAdministrator', 'application-manifest'?: string, }>; declare export type WindowsSignOptions = $FlowFixMe; declare export type OfficialArch = - | 'ia32' - | 'x64' - | 'armv7l' - | 'arm64' - | 'mips64el' - | 'universal'; + 'ia32' | 'x64' | 'armv7l' | 'arm64' | 'mips64el' | 'universal'; declare export type OfficialPlatform = 'linux' | 'win32' | 'darwin' | 'mas'; @@ -102,7 +91,6 @@ declare module '@electron/packager' { buildVersion?: string; darwinDarkModeSupport?: boolean; derefSymlinks?: boolean; - download?: ElectronDownloadRequestOptions; electronVersion?: string; electronZipDir?: string; executableName?: string; @@ -118,7 +106,7 @@ declare module '@electron/packager' { }; extraResource?: string | string[]; helperBundleId?: string; - icon?: string; + icon?: string | string[]; ignore?: RegExp | (string | RegExp)[] | IgnoreFunction; junk?: boolean; name?: string; @@ -132,7 +120,7 @@ declare module '@electron/packager' { protocols?: MacOSProtocol[]; prune?: boolean; quiet?: boolean; - tmpdir?: string | false; + tmpdir?: string; usageDescription?: { [property: string]: string, }; diff --git a/flow-typed/npm/execa_v5.x.x.js b/flow-typed/npm/execa_v5.x.x.js index c54a07291e94..a3a8dae8b4c3 100644 --- a/flow-typed/npm/execa_v5.x.x.js +++ b/flow-typed/npm/execa_v5.x.x.js @@ -13,12 +13,7 @@ declare module 'execa' { declare type StdIoOption = - | 'pipe' - | 'ipc' - | 'ignore' - | 'inherit' - | stream$Stream - | number; + 'pipe' | 'ipc' | 'ignore' | 'inherit' | stream$Stream | number; declare type CommonOptions = { argv0?: string, @@ -74,8 +69,7 @@ declare module 'execa' { }; declare interface ExecaPromise - extends Promise, - child_process$ChildProcess {} + extends Promise, child_process$ChildProcess {} declare interface ExecaError extends ErrnoError { stdout: string; diff --git a/flow-typed/npm/jest.js b/flow-typed/npm/jest.js index 00767deaa1c8..70597548c96c 100644 --- a/flow-typed/npm/jest.js +++ b/flow-typed/npm/jest.js @@ -214,10 +214,7 @@ type FakeTimersConfig = { */ type JestStyledComponentsMatcherValue = - | string - | JestAsymmetricEqualityType - | RegExp - | void; + string | JestAsymmetricEqualityType | RegExp | void; type JestStyledComponentsMatcherOptions = { media?: string, diff --git a/flow-typed/npm/jsonc-parser_v2.2.x.js b/flow-typed/npm/jsonc-parser_v2.2.x.js index 51eadf91b48a..c8b47b6404ef 100644 --- a/flow-typed/npm/jsonc-parser_v2.2.x.js +++ b/flow-typed/npm/jsonc-parser_v2.2.x.js @@ -155,13 +155,7 @@ declare module 'jsonc-parser' { | 'InvalidCharacter' | ''; export type NodeType = - | 'object' - | 'array' - | 'property' - | 'string' - | 'number' - | 'boolean' - | 'null'; + 'object' | 'array' | 'property' | 'string' | 'number' | 'boolean' | 'null'; export type Node = { type: NodeType, value?: any, diff --git a/flow-typed/npm/node-fetch_v2.x.x.js b/flow-typed/npm/node-fetch_v2.x.x.js index 5b6b9cc51b46..22108efa6b74 100644 --- a/flow-typed/npm/node-fetch_v2.x.x.js +++ b/flow-typed/npm/node-fetch_v2.x.x.js @@ -157,12 +157,7 @@ declare module 'node-fetch' { } declare type ResponseType = - | 'basic' - | 'cors' - | 'default' - | 'error' - | 'opaque' - | 'opaqueredirect'; + 'basic' | 'cors' | 'default' | 'error' | 'opaque' | 'opaqueredirect'; declare interface ResponseInit { headers?: HeaderInit; @@ -172,12 +167,7 @@ declare module 'node-fetch' { declare type HeaderInit = Headers | Array; declare type BodyInit = - | string - | null - | Buffer - | Blob - | Readable - | URLSearchParams; + string | null | Buffer | Blob | Readable | URLSearchParams; declare function fetch( url: string | URL | Request, diff --git a/flow-typed/npm/open_v7.x.x.js b/flow-typed/npm/open_v7.x.x.js deleted file mode 100644 index 25f62fae2179..000000000000 --- a/flow-typed/npm/open_v7.x.x.js +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow strict - * @format - */ - -declare module 'open' { - import type {ChildProcess} from 'child_process'; - - declare export type Options = Readonly<{ - wait?: boolean, - background?: boolean, - newInstance?: boolean, - allowNonzeroExitCode?: boolean, - ... - }>; - - declare type open = ( - target: string, - options?: Options, - ) => Promise; - - declare module.exports: open; -} diff --git a/flow-typed/npm/open_v8.x.x.js b/flow-typed/npm/open_v8.x.x.js new file mode 100644 index 000000000000..0c77a236170d --- /dev/null +++ b/flow-typed/npm/open_v8.x.x.js @@ -0,0 +1,50 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict + * @format + */ + +declare module 'open' { + import type {ChildProcess} from 'child_process'; + + declare export type AppName = 'chrome' | 'firefox' | 'edge'; + + declare export type App = Readonly<{ + name: string | ReadonlyArray, + arguments?: ReadonlyArray, + }>; + + declare export type Options = Readonly<{ + wait?: boolean, + background?: boolean, + newInstance?: boolean, + allowNonzeroExitCode?: boolean, + app?: App | ReadonlyArray, + ... + }>; + + declare export type OpenAppOptions = Readonly<{ + wait?: boolean, + background?: boolean, + newInstance?: boolean, + allowNonzeroExitCode?: boolean, + arguments?: ReadonlyArray, + ... + }>; + + declare module.exports: (( + target: string, + options?: Options, + ) => Promise) & { + apps: Record>, + openApp: ( + name: string | ReadonlyArray, + options?: OpenAppOptions, + ) => Promise, + ... + }; +} diff --git a/flow-typed/npm/pretty-format_v29.x.x.js b/flow-typed/npm/pretty-format_v29.x.x.js index a13951717f0f..fbcdfda1f5e2 100644 --- a/flow-typed/npm/pretty-format_v29.x.x.js +++ b/flow-typed/npm/pretty-format_v29.x.x.js @@ -37,9 +37,7 @@ declare type PrettyFormatPlugin = declare module 'pretty-format' { declare export type CompareKeys = - | ((a: string, b: string) => number) - | null - | void; + ((a: string, b: string) => number) | null | void; declare export function format( value: unknown, options?: ?{ diff --git a/flow-typed/npm/rxjs_v6.x.x.js b/flow-typed/npm/rxjs_v6.x.x.js index a4326724e3ee..dfb0557cd726 100644 --- a/flow-typed/npm/rxjs_v6.x.x.js +++ b/flow-typed/npm/rxjs_v6.x.x.js @@ -9,11 +9,14 @@ declare interface rxjs$UnaryFunction { (source: T): R; } -declare interface rxjs$OperatorFunction - extends rxjs$UnaryFunction, rxjs$Observable> {} +declare interface rxjs$OperatorFunction extends rxjs$UnaryFunction< + rxjs$Observable, + rxjs$Observable, +> {} declare type rxjs$FactoryOrValue = T | (() => T); -declare interface rxjs$MonoTypeOperatorFunction - extends rxjs$OperatorFunction {} +declare interface rxjs$MonoTypeOperatorFunction< + T, +> extends rxjs$OperatorFunction {} declare interface rxjs$Timestamp { value: T; timestamp: number; @@ -47,9 +50,7 @@ declare interface rxjs$Subscribable { ): rxjs$Unsubscribable; } declare type rxjs$ObservableInput = - | rxjs$SubscribableOrPromise - | Array - | Iterable; + rxjs$SubscribableOrPromise | Array | Iterable; declare type rxjs$InteropObservable = { [string | unknown]: () => rxjs$Subscribable, @@ -588,8 +589,7 @@ declare module 'rxjs' { ((...sources: rxjs$ObservableInput[]) => rxjs$Observable), from( input: - | rxjs$ObservableInput - | rxjs$ObservableInput>, + rxjs$ObservableInput | rxjs$ObservableInput>, scheduler?: rxjs$SchedulerLike, ): rxjs$Observable, ArgumentOutOfRangeError: ArgumentOutOfRangeError, @@ -630,9 +630,7 @@ declare module 'rxjs' { ) => rxjs$Observable) & (( ...observables: ( - | rxjs$ObservableInput - | rxjs$SchedulerLike - | number + rxjs$ObservableInput | rxjs$SchedulerLike | number )[] ) => rxjs$Observable) & (( @@ -3349,9 +3347,7 @@ declare module 'rxjs/webSocket' { _output: rxjs$Subject; constructor( urlConfigOrSource: - | string - | WebSocketSubjectConfig - | rxjs$Observable, + string | WebSocketSubjectConfig | rxjs$Observable, destination?: rxjs$Observer, ): void; lift(operator: rxjs$Operator): WebSocketSubject; diff --git a/flow-typed/npm/shelljs_v0.x.x.js b/flow-typed/npm/shelljs_v0.x.x.js index c5ffdee80618..22eb29608ca5 100644 --- a/flow-typed/npm/shelljs_v0.x.x.js +++ b/flow-typed/npm/shelljs_v0.x.x.js @@ -48,14 +48,7 @@ declare type $npm$shelljs$GrepOpts = $npm$shelljs$OptionsPoly<'-l' | '-v'>; declare type $npm$shelljs$SedOpts = $npm$shelljs$OptionsPoly<'-i'>; declare type $npm$shelljs$SortOpts = $npm$shelljs$OptionsPoly<'-n' | '-r'>; declare type $npm$shelljs$TestOpts = - | '-b' - | '-c' - | '-d' - | '-e' - | '-f' - | '-L' - | '-p' - | '-S'; + '-b' | '-c' | '-d' | '-e' | '-f' | '-L' | '-p' | '-S'; declare type $npm$shelljs$TouchOpts = { [key: '-a' | '-c' | '-m']: boolean, '-d'?: string, diff --git a/flow-typed/npm/tinybench_v4.1.x.js b/flow-typed/npm/tinybench_v4.1.x.js index 2b6bbba9bafa..821e79e0a969 100644 --- a/flow-typed/npm/tinybench_v4.1.x.js +++ b/flow-typed/npm/tinybench_v4.1.x.js @@ -101,9 +101,7 @@ declare module 'tinybench' { // but we type it this way to avoid mistakes (we can make breaking changes // in our definition that they can't). export type Fn = () => - | Promise - | void - | FnReturnedObject; + Promise | void | FnReturnedObject; declare export class Bench extends EventTarget { concurrency: null | 'task' | 'bench'; diff --git a/jest.config.js b/jest.config.js index 240abcbfeae2..6e98ae747ea4 100644 --- a/jest.config.js +++ b/jest.config.js @@ -26,6 +26,13 @@ module.exports = { '.*': './jest/preprocessor.js', }, resolver: './packages/jest-preset/jest/resolver.js', + moduleNameMapper: { + // `resolver.js` strips `exports`, so alias these subpaths to their `src/` impl. + '^react-native/react-private-interface$': + '/packages/react-native/src/react-private-interface.js', + '^react-native/setup-env$': + '/packages/react-native/src/setup-env.js', + }, setupFiles: ['./packages/jest-preset/jest/local-setup.js'], fakeTimers: { enableGlobally: true, diff --git a/package.json b/package.json index 274c4e3f32b6..b9e9c8c3f42d 100644 --- a/package.json +++ b/package.json @@ -9,11 +9,11 @@ "build-android": "./gradlew :packages:react-native:ReactAndroid:build", "build": "node ./scripts/build/build.js", "build-types": "node ./scripts/js-api/build-types", - "clang-format": "clang-format -i --glob=*/**/*.{h,cpp,m,mm}", + "clang-format": "node ./scripts/clang-format.js", "clean": "node ./scripts/build/clean.js", "cxx-api-build": "python -m scripts.cxx-api.parser", "cxx-api-validate": "python -m scripts.cxx-api.parser --validate", - "flow-check": "flow check", + "flow-check": "flow full-check", "flow": "flow", "format-check": "prettier --list-different \"./**/*.{js,md,yml,ts,tsx}\"", "format": "npm run prettier && npm run clang-format", @@ -33,15 +33,17 @@ "test-release-local-clean": "node ./scripts/release-testing/test-release-local-clean.js", "test-release-local": "node ./scripts/release-testing/test-release-local.js", "test-ios": "./scripts/objc-test.sh test", - "test-typescript": "tsc -p packages/react-native/types/tsconfig.json", - "test-generated-typescript": "tsc -p packages/react-native/types_generated/tsconfig.test.json", + "test-typescript-legacy": "tsc -p packages/react-native/__typetests__/tsconfig.legacy.json", + "test-generated-typescript": "tsc -p packages/react-native/__typetests__/tsconfig.json", "test": "jest", "fantom": "./scripts/fantom.sh", + "fantom-cli": "./scripts/fantom-cli.sh", "trigger-react-native-release": "node ./scripts/releases-local/trigger-react-native-release.js", "update-lock": "npx yarn-deduplicate" }, "workspaces": [ "packages/*", + "packages/react-native-test-library/*", "private/*", "!private/helloworld" ], @@ -53,7 +55,7 @@ "@babel/plugin-transform-regenerator": "^7.24.7", "@babel/preset-env": "^7.25.3", "@babel/preset-flow": "^7.24.7", - "@electron/packager": "^18.3.6", + "@electron/packager": "^20.0.0", "@expo/spawn-async": "^1.7.2", "@jest/create-cache-key-function": "^29.7.0", "@microsoft/api-extractor": "^7.52.2", @@ -66,10 +68,8 @@ "ansi-regex": "^5.0.0", "ansi-styles": "^4.2.1", "babel-plugin-minify-dead-code-elimination": "^0.5.2", - "babel-plugin-syntax-hermes-parser": "0.36.1", "babel-plugin-transform-define": "^2.1.4", "babel-plugin-transform-flow-enums": "^0.0.2", - "clang-format": "^1.8.0", "connect": "^3.6.5", "debug": "^4.4.0", "deep-equal": "1.1.1", @@ -78,6 +78,7 @@ "eslint-plugin-babel": "^5.3.1", "eslint-plugin-eslint-comments": "^3.2.0", "eslint-plugin-ft-flow": "^2.0.1", + "eslint-plugin-import": "^2.32.0", "eslint-plugin-jest": "^29.0.1", "eslint-plugin-jsx-a11y": "^6.6.0", "eslint-plugin-react": "^7.37.5", @@ -85,10 +86,11 @@ "eslint-plugin-redundant-undefined": "^0.4.0", "eslint-plugin-relay": "^1.8.3", "fb-dotslash": "0.5.8", - "flow-api-translator": "0.36.1", - "flow-bin": "^0.318.0", - "hermes-eslint": "0.36.1", - "hermes-transform": "0.36.1", + "flow-api-translator": "0.327.0", + "flow-bin": "^0.327.0", + "flow-eslint": "0.327.0", + "flow-parser": "0.327.0", + "flow-transform": "0.327.0", "ini": "^5.0.0", "inquirer": "^7.1.0", "jest": "^29.7.0", @@ -100,13 +102,12 @@ "markdownlint-cli2": "^0.17.2", "markdownlint-rule-relative-links": "^3.0.0", "memfs": "^4.38.2", - "metro-babel-register": "^0.84.3", - "metro-transform-plugins": "^0.84.3", + "metro-babel-register": "^0.87.0", + "metro-transform-plugins": "^0.87.0", "micromatch": "^4.0.4", "node-fetch": "^2.2.0", "nullthrows": "^1.1.1", - "prettier": "3.6.2", - "prettier-plugin-hermes-parser": "0.36.0", + "prettier": "3.9.4", "react": "19.2.3", "react-test-renderer": "19.2.3", "rimraf": "^3.0.2", @@ -124,7 +125,6 @@ "on-headers": "1.1.0", "compression": "1.8.1", "@microsoft/api-extractor/minimatch": "3.1.4", - "metro-babel-register/babel-plugin-syntax-hermes-parser": "0.36.1", "lodash": "4.18.1", "@xmldom/xmldom": "^0.8.13", "fast-xml-parser": "^4.5.6", diff --git a/packages/asset-utils/README.md b/packages/asset-utils/README.md new file mode 100644 index 000000000000..ebcd7e938e64 --- /dev/null +++ b/packages/asset-utils/README.md @@ -0,0 +1,23 @@ +# @react-native/asset-utils + +[![npm]](https://www.npmjs.com/package/@react-native/asset-utils) [![npm downloads]](https://www.npmjs.com/package/@react-native/asset-utils) + +[npm]: https://img.shields.io/npm/v/@react-native/asset-utils.svg?color=blue +[npm downloads]: https://img.shields.io/npm/dm/@react-native/asset-utils.svg + +Android resource-path helpers used when copying React Native assets into `drawable-*` / `raw` folders. Consumed by bundling and build tooling; most apps never import this directly. + +## API + +```js +import { + getAndroidResourceFolderName, + getAndroidResourceIdentifier, +} from '@react-native/asset-utils'; +``` + +| Export | Signature | Notes | +|---|---|---| +| `getAndroidResourceFolderName` | `(asset: PackagerAsset, scale: number) => string` | e.g. `drawable-xhdpi`; non-drawable types resolve to `raw` | +| `getAndroidResourceIdentifier` | `(asset: PackagerAsset) => string` | Sanitised resource name | +| `drawableFileTypes` | `Set` | Asset types that map to a `drawable-*` folder | diff --git a/packages/asset-utils/package.json b/packages/asset-utils/package.json new file mode 100644 index 000000000000..bec6ea4d6931 --- /dev/null +++ b/packages/asset-utils/package.json @@ -0,0 +1,31 @@ +{ + "name": "@react-native/asset-utils", + "version": "0.87.0-main", + "description": "Asset path utilities for React Native.", + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/react/react-native.git", + "directory": "packages/asset-utils" + }, + "homepage": "https://github.com/react/react-native/tree/HEAD/packages/asset-utils#readme", + "keywords": [ + "react-native" + ], + "bugs": "https://github.com/react/react-native/issues", + "engines": { + "node": "^22.13.0 || ^24.3.0 || >= 26.0.0" + }, + "exports": { + ".": "./src/index.js", + "./package.json": "./package.json" + }, + "files": [ + "src", + "README.md", + "!**/__docs__/**", + "!**/__fixtures__/**", + "!**/__mocks__/**", + "!**/__tests__/**" + ] +} diff --git a/packages/asset-utils/src/AndroidPathUtils.d.ts b/packages/asset-utils/src/AndroidPathUtils.d.ts new file mode 100644 index 000000000000..854eecc3338f --- /dev/null +++ b/packages/asset-utils/src/AndroidPathUtils.d.ts @@ -0,0 +1,23 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +export type PackagerAsset = Readonly<{ + httpServerLocation: string; + name: string; + type: string; +}>; + +export function getAndroidResourceFolderName( + asset: PackagerAsset, + scale: number, +): string; + +export function getAndroidResourceIdentifier(asset: PackagerAsset): string; + +export const drawableFileTypes: Set; diff --git a/packages/asset-utils/src/AndroidPathUtils.js b/packages/asset-utils/src/AndroidPathUtils.js new file mode 100644 index 000000000000..3b76e82aab02 --- /dev/null +++ b/packages/asset-utils/src/AndroidPathUtils.js @@ -0,0 +1,93 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict + * @format + */ + +'use strict'; + +/*:: +// Conforms to the `PackagerAsset` type from `react-native`. +export type PackagerAsset = Readonly<{ + httpServerLocation: string, + name: string, + type: string, + ... +}>; +*/ + +const androidScaleSuffix /*: {[string]: string} */ = { + '0.75': 'ldpi', + '1': 'mdpi', + '1.5': 'hdpi', + '2': 'xhdpi', + '3': 'xxhdpi', + '4': 'xxxhdpi', +}; + +const ANDROID_BASE_DENSITY = 160; + +// FIXME: Using number to represent discrete scale numbers is fragile in +// essence because of floating point number imprecision. +function getAndroidAssetSuffix(scale /*: number */) /*: string */ { + if (scale.toString() in androidScaleSuffix) { + return androidScaleSuffix[scale.toString()]; + } + + // NOTE: Android Gradle Plugin does not fully support the nnndpi format. + // See https://issuetracker.google.com/issues/72884435 + if (Number.isFinite(scale) && scale > 0) { + return Math.round(scale * ANDROID_BASE_DENSITY) + 'dpi'; + } + + throw new Error('no such scale ' + scale.toString()); +} + +// See https://developer.android.com/guide/topics/resources/drawable-resource.html +const drawableFileTypes /*: Set */ = new Set([ + 'gif', + 'heic', + 'heif', + 'jpeg', + 'jpg', + 'ktx', + 'png', + 'webp', + 'xml', +]); + +function getAndroidResourceFolderName( + asset /*: PackagerAsset */, + scale /*: number */, +) /*: string */ { + if (!drawableFileTypes.has(asset.type)) { + return 'raw'; + } + + return 'drawable-' + getAndroidAssetSuffix(scale); +} + +function getAndroidResourceIdentifier( + asset /*: PackagerAsset */, +) /*: string */ { + return (getBasePath(asset) + '/' + asset.name) + .toLowerCase() + .replace(/\//g, '_') // Encode folder structure in file name + .replace(/([^a-z0-9_])/g, '') // Remove illegal chars + .replace(/^(?:assets|assetsunstable_path)_/, ''); // Remove "assets_" or "assetsunstable_path_" prefix +} + +function getBasePath(asset /*: PackagerAsset */) /*: string */ { + const basePath = asset.httpServerLocation; + return basePath.startsWith('/') ? basePath.slice(1) : basePath; +} + +module.exports = { + drawableFileTypes, + getAndroidResourceFolderName, + getAndroidResourceIdentifier, +}; diff --git a/packages/asset-utils/src/__tests__/AndroidPathUtils-test.js b/packages/asset-utils/src/__tests__/AndroidPathUtils-test.js new file mode 100644 index 000000000000..2496c1d9ee01 --- /dev/null +++ b/packages/asset-utils/src/__tests__/AndroidPathUtils-test.js @@ -0,0 +1,72 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + */ + +import {getAndroidResourceFolderName} from '../AndroidPathUtils'; + +const DRAWABLE_ASSET = { + httpServerLocation: '/assets/', + name: 'foo', + type: 'png', +}; + +const NON_DRAWABLE_ASSET = { + httpServerLocation: '/assets/', + name: 'foo', + type: 'txt', +}; + +describe('getAndroidResourceFolderName', () => { + test('supports the six primary density buckets', () => { + expect(getAndroidResourceFolderName(DRAWABLE_ASSET, 0.75)).toBe( + 'drawable-ldpi', + ); + expect(getAndroidResourceFolderName(DRAWABLE_ASSET, 1)).toBe( + 'drawable-mdpi', + ); + expect(getAndroidResourceFolderName(DRAWABLE_ASSET, 1.5)).toBe( + 'drawable-hdpi', + ); + expect(getAndroidResourceFolderName(DRAWABLE_ASSET, 2)).toBe( + 'drawable-xhdpi', + ); + expect(getAndroidResourceFolderName(DRAWABLE_ASSET, 3)).toBe( + 'drawable-xxhdpi', + ); + expect(getAndroidResourceFolderName(DRAWABLE_ASSET, 4)).toBe( + 'drawable-xxxhdpi', + ); + }); + + test('supports nonstandard densities', () => { + expect(getAndroidResourceFolderName(DRAWABLE_ASSET, 1.25)).toBe( + 'drawable-200dpi', + ); + expect(getAndroidResourceFolderName(DRAWABLE_ASSET, 1.66)).toBe( + 'drawable-266dpi', + ); + expect(getAndroidResourceFolderName(DRAWABLE_ASSET, 1.33)).toBe( + 'drawable-213dpi', + ); // ~tvdpi + }); + + test('throws if the density cannot be processed', () => { + expect(() => getAndroidResourceFolderName(DRAWABLE_ASSET, -1)).toThrow(); + expect(() => getAndroidResourceFolderName(DRAWABLE_ASSET, 0)).toThrow(); + expect(() => + getAndroidResourceFolderName(DRAWABLE_ASSET, Infinity), + ).toThrow(); + }); + + test('returns "raw" for non-drawables', () => { + expect(getAndroidResourceFolderName(NON_DRAWABLE_ASSET, 0.75)).toBe('raw'); + expect(getAndroidResourceFolderName(NON_DRAWABLE_ASSET, 1)).toBe('raw'); + expect(getAndroidResourceFolderName(NON_DRAWABLE_ASSET, 1.25)).toBe('raw'); + }); +}); diff --git a/packages/react-native/Libraries/Image/AssetRegistry.js b/packages/asset-utils/src/index.d.ts similarity index 65% rename from packages/react-native/Libraries/Image/AssetRegistry.js rename to packages/asset-utils/src/index.d.ts index 3e1785346ff3..c67af666a8a3 100644 --- a/packages/react-native/Libraries/Image/AssetRegistry.js +++ b/packages/asset-utils/src/index.d.ts @@ -4,11 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict * @format */ -export { - registerAsset, - getAssetByID, -} from '@react-native/assets-registry/registry'; +export * from './AndroidPathUtils'; diff --git a/packages/react-native/Libraries/Modal/NativeModalManager.js b/packages/asset-utils/src/index.js similarity index 51% rename from packages/react-native/Libraries/Modal/NativeModalManager.js rename to packages/asset-utils/src/index.js index 0d6b730aaaac..4fdff4702d04 100644 --- a/packages/react-native/Libraries/Modal/NativeModalManager.js +++ b/packages/asset-utils/src/index.js @@ -8,7 +8,10 @@ * @format */ -export * from '../../src/private/specs_DEPRECATED/modules/NativeModalManager'; -import NativeModalManager from '../../src/private/specs_DEPRECATED/modules/NativeModalManager'; +'use strict'; -export default NativeModalManager; +/*:: +export type {PackagerAsset} from './AndroidPathUtils'; +*/ + +module.exports = require('./AndroidPathUtils'); diff --git a/packages/assets-registry/README.md b/packages/assets-registry/README.md index 51f229af163b..1dd81110155e 100644 --- a/packages/assets-registry/README.md +++ b/packages/assets-registry/README.md @@ -1,21 +1,39 @@ # @react-native/assets-registry -[![Version][version-badge]][package] +![npm package](https://img.shields.io/npm/v/@react-native/assets-registry?color=brightgreen&label=npm%20package) -## Installation +> [!Warning] +> **This package is deprecated (since 0.87)** and will be removed in a future release. Use [`AssetRegistry`](https://reactnative.dev/docs/assetregistry) from `react-native` (or the `react-native/asset-registry` build entry point) instead of `@react-native/assets-registry/registry`, and [`@react-native/asset-utils`](https://www.npmjs.com/package/@react-native/asset-utils) instead of `@react-native/assets-registry/path-support`. -``` -yarn add --dev @react-native/assets-registry -``` +Runtime registry that maps asset IDs generated in a Metro bundle to asset metadata. It backs ``, `Image.resolveAssetSource()`, and any code that resolves `require('./img.png')` on native. -*Note: We're using `yarn` to install deps. Feel free to change commands to use `npm` 3+ and `npx` if you like* +Most apps never import this directly โ€” assets are handled through ``. -[version-badge]: https://img.shields.io/npm/v/@react-native/assets-registry?style=flat-square -[package]: https://www.npmjs.com/package/@react-native/assets-registry +## API -## Testing +### `@react-native/assets-registry/registry` (DEPRECATED) -To run the tests in this package, run the following commands from the React Native root folder: +> [!Warning] +> **Deprecated**: Aliases to [`AssetRegistry`](https://reactnative.dev/docs/assetregistry) (since 0.87). +> +> Please use: +> - `import { AssetRegistry } from 'react-native';` (apps/library code) +> - `'react-native/asset-registry'` (entrypoint for Metro/build configs) -1. `yarn` to install the dependencies. You just need to run this once -2. `yarn jest packages/assets-registry`. +| Export | Signature | Notes | +|---|---|---| +| `registerAsset` | `(asset: PackagerAsset) => number` | Stores the asset; returns a numeric ID | +| `getAssetByID` | `(assetId: number) => PackagerAsset` | Looks an asset back up by ID | + +### `@react-native/assets-registry/path-support` (DEPRECATED) + +> [!Warning] +> **Deprecated**: Use [`@react-native/asset-utils`](https://www.npmjs.com/package/@react-native/asset-utils) (since 0.87). + +Android resource-path helpers, used when copying assets into `drawable-*` folders. + +| Export | Signature | Notes | +|---|---|---| +| `getAndroidResourceFolderName` | `(asset: PackagerAsset, scale: number) => string` | e.g. `drawable-xhdpi`; non-drawable types resolve to `raw` | +| `getAndroidResourceIdentifier` | `(asset: PackagerAsset) => string` | Sanitised resource name | +| `getBasePath` | `(asset: PackagerAsset) => string` | `httpServerLocation` without the leading slash | diff --git a/packages/assets-registry/package.json b/packages/assets-registry/package.json index e7208814e309..645604cc9846 100644 --- a/packages/assets-registry/package.json +++ b/packages/assets-registry/package.json @@ -5,27 +5,29 @@ "license": "MIT", "repository": { "type": "git", - "url": "git+https://github.com/facebook/react-native.git", + "url": "git+https://github.com/react/react-native.git", "directory": "packages/assets-registry" }, - "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/assets-registry#readme", + "homepage": "https://github.com/react/react-native/tree/HEAD/packages/assets-registry#readme", "keywords": [ - "assets", - "registry", - "react-native", - "support" + "react-native" ], - "bugs": "https://github.com/facebook/react-native/issues", + "bugs": "https://github.com/react/react-native/issues", "engines": { "node": "^22.13.0 || ^24.3.0 || >= 26.0.0" }, "files": [ "path-support.js", + "path-support.d.ts", "registry.js", + "registry.d.ts", "README.md", "!**/__docs__/**", "!**/__fixtures__/**", "!**/__mocks__/**", "!**/__tests__/**" - ] + ], + "peerDependencies": { + "react-native": "*" + } } diff --git a/packages/assets-registry/path-support.d.ts b/packages/assets-registry/path-support.d.ts new file mode 100644 index 000000000000..cddc55f69bac --- /dev/null +++ b/packages/assets-registry/path-support.d.ts @@ -0,0 +1,28 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +import type {PackagerAsset} from './registry'; + +/** + * @deprecated Use `getAndroidResourceFolderName` from `@react-native/asset-utils` instead. + */ +export function getAndroidResourceFolderName( + asset: PackagerAsset, + scale: number, +): string; + +/** + * @deprecated Use `getAndroidResourceIdentifier` from `@react-native/asset-utils` instead. + */ +export function getAndroidResourceIdentifier(asset: PackagerAsset): string; + +/** + * @deprecated Use `@react-native/asset-utils` instead. + */ +export function getBasePath(asset: PackagerAsset): string; diff --git a/packages/assets-registry/path-support.js b/packages/assets-registry/path-support.js index c73a2e2bbf2e..f7e51a9e6ecd 100644 --- a/packages/assets-registry/path-support.js +++ b/packages/assets-registry/path-support.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict + * @flow strict-local * @format */ diff --git a/packages/assets-registry/registry.d.ts b/packages/assets-registry/registry.d.ts new file mode 100644 index 000000000000..fb8bfcc2a156 --- /dev/null +++ b/packages/assets-registry/registry.d.ts @@ -0,0 +1,39 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +/** + * @deprecated Use `import type {AssetDestPathResolver} from 'react-native'` instead. + */ +export type AssetDestPathResolver = 'android' | 'generic'; + +/** + * @deprecated Use `import type {PackagerAsset} from 'react-native'` instead. + */ +export type PackagerAsset = { + readonly __packager_asset: boolean; + readonly fileSystemLocation: string; + readonly httpServerLocation: string; + readonly width: number | null | undefined; + readonly height: number | null | undefined; + readonly scales: Array; + readonly hash: string; + readonly name: string; + readonly type: string; + readonly resolver?: AssetDestPathResolver | undefined; +}; + +/** + * @deprecated Use `import {AssetRegistry} from 'react-native'` instead. + */ +export function registerAsset(asset: PackagerAsset): number; + +/** + * @deprecated Use `import {AssetRegistry} from 'react-native'` instead. + */ +export function getAssetByID(assetId: number): PackagerAsset; diff --git a/packages/assets-registry/registry.js b/packages/assets-registry/registry.js index d193d3af1c87..08a0ef59fb35 100644 --- a/packages/assets-registry/registry.js +++ b/packages/assets-registry/registry.js @@ -4,41 +4,20 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict + * @flow strict-local * @format */ 'use strict'; -/*:: -export type AssetDestPathResolver = 'android' | 'generic'; +import {AssetRegistry} from 'react-native'; -export type PackagerAsset = { - readonly __packager_asset: boolean, - readonly fileSystemLocation: string, - readonly httpServerLocation: string, - readonly width: ?number, - readonly height: ?number, - readonly scales: Array, - readonly hash: string, - readonly name: string, - readonly type: string, - readonly resolver?: AssetDestPathResolver, - ... -}; +/*:: +export type {AssetDestPathResolver, PackagerAsset} from 'react-native'; */ -const assets /*: Array */ = []; - -function registerAsset(asset /*: PackagerAsset */) /*: number */ { - // `push` returns new array length, so the first asset will - // get id 1 (not 0) to make the value truthy - return assets.push(asset); -} - -function getAssetByID(assetId /*: number */) /*: PackagerAsset */ { - return assets[assetId - 1]; -} - // eslint-disable-next-line @react-native/monorepo/no-commonjs-exports -module.exports = {registerAsset, getAssetByID}; +module.exports = { + registerAsset: AssetRegistry.registerAsset, + getAssetByID: AssetRegistry.getAssetByID, +}; diff --git a/packages/babel-plugin-codegen/README.md b/packages/babel-plugin-codegen/README.md index 34194810ab2b..430d36ac3b8e 100644 --- a/packages/babel-plugin-codegen/README.md +++ b/packages/babel-plugin-codegen/README.md @@ -1,21 +1,8 @@ # @react-native/babel-plugin-codegen -[![Version][version-badge]][package] +[![npm]](https://www.npmjs.com/package/@react-native/babel-plugin-codegen) [![npm downloads]](https://www.npmjs.com/package/@react-native/babel-plugin-codegen) -## Installation +[npm]: https://img.shields.io/npm/v/@react-native/babel-plugin-codegen.svg?color=blue +[npm downloads]: https://img.shields.io/npm/dm/@react-native/babel-plugin-codegen.svg -``` -yarn add --dev @babel/core @react-native/babel-plugin-codegen -``` - -*Note: We're using `yarn` to install deps. Feel free to change commands to use `npm` 3+ and `npx` if you like* - -[version-badge]: https://img.shields.io/npm/v/@react-native/babel-plugin-codegen?style=flat-square -[package]: https://www.npmjs.com/package/@react-native/babel-plugin-codegen - -## Testing - -To run the tests in this package, run the following commands from the React Native root folder: - -1. `yarn` to install the dependencies. You just need to run this once -2. `yarn jest packages/babel-plugin-codegen`. +Babel plugin that generates native module and view manager binding code for React Native, powered by [`@react-native/codegen`](https://www.npmjs.com/package/@react-native/codegen). diff --git a/packages/babel-plugin-codegen/index.js b/packages/babel-plugin-codegen/index.js index 06a4939ad225..2b6dbac1840e 100644 --- a/packages/babel-plugin-codegen/index.js +++ b/packages/babel-plugin-codegen/index.js @@ -13,7 +13,7 @@ let FlowParser, TypeScriptParser, RNCodegen; const {cheap: traverseCheap} = require('@babel/traverse').default; -const {basename} = require('path'); +const {basename} = require('node:path'); try { FlowParser = diff --git a/packages/babel-plugin-codegen/package.json b/packages/babel-plugin-codegen/package.json index 3ae6ff190eab..d58d065315b8 100644 --- a/packages/babel-plugin-codegen/package.json +++ b/packages/babel-plugin-codegen/package.json @@ -5,10 +5,10 @@ "license": "MIT", "repository": { "type": "git", - "url": "git+https://github.com/facebook/react-native.git", + "url": "git+https://github.com/react/react-native.git", "directory": "packages/babel-plugin-codegen" }, - "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/babel-plugin-codegen#readme", + "homepage": "https://github.com/react/react-native/tree/HEAD/packages/babel-plugin-codegen#readme", "keywords": [ "babel", "plugin", @@ -17,7 +17,7 @@ "native-modules", "view-manager" ], - "bugs": "https://github.com/facebook/react-native/issues", + "bugs": "https://github.com/react/react-native/issues", "engines": { "node": "^22.13.0 || ^24.3.0 || >= 26.0.0" }, diff --git a/packages/community-cli-plugin/README.md b/packages/community-cli-plugin/README.md index dc4c687208c3..109193ff9c81 100644 --- a/packages/community-cli-plugin/README.md +++ b/packages/community-cli-plugin/README.md @@ -1,5 +1,10 @@ # @react-native/community-cli-plugin +[![npm]](https://www.npmjs.com/package/@react-native/community-cli-plugin) [![npm downloads]](https://www.npmjs.com/package/@react-native/community-cli-plugin) + +[npm]: https://img.shields.io/npm/v/@react-native/community-cli-plugin.svg?color=blue +[npm downloads]: https://img.shields.io/npm/dm/@react-native/community-cli-plugin.svg + > This is an internal dependency of React Native. **Please don't depend on it directly.** CLI entry points supporting core React Native development features. @@ -70,6 +75,48 @@ npx @react-native-community/cli bundle --entry-file [options] | `--read-global-cache` | Attempt to fetch transformed JS code from the global cache, if configured. Defaults to `false`. | | `--config ` | Path to the CLI configuration file. | +### `codegen` + +Run the React Native codegen, generating native boilerplate from JS spec files. + +#### Usage + +```sh +npx @react-native-community/cli codegen [options] +``` + +#### Options + +| Option | Description | +| - | - | +| `--path ` | Path to the React Native project root. Defaults to the current working directory. | +| `--platform ` | Target platform. Supported values: `"android"`, `"ios"`, `"all"`. Defaults to `"all"`. | +| `--outputPath ` | Path where generated artifacts will be output to. | +| `--source ` | Whether the script is invoked from an `app` or a `library`. Defaults to `"app"`. | + +### `spm [action]` + +Set up or maintain Swift Package Manager support for the iOS/macOS app. Actions: `add`, `update`, `deinit`, `scaffold`. With no action: `add` (or `update` if SPM is already set up). + +#### Usage + +```sh +npx @react-native-community/cli spm [action] [options] +``` + +#### Options + +| Option | Description | +| - | - | +| `--version ` | React Native version (e.g. `0.80.0`). Defaults to the version in `node_modules/react-native/package.json`. | +| `--yes` | Skip the dirty-pbxproj confirmation prompt. | +| `--xcodeproj ` | **[add]** Path to the `.xcodeproj` to inject SPM packages into (disambiguates when several exist). | +| `--productName ` | **[add]** App target to inject into (disambiguates when several exist). | +| `--deintegrate` | **[add]** Run `pod deintegrate` and strip React Native from the Podfile before injecting (CocoaPods โ†’ SwiftPM migration). | +| `--artifacts ` | **[advanced]** Local artifact root containing complete `debug/` and `release/` slots. | +| `--download ` | **[advanced]** Artifact download policy: `auto` (default), `skip`, or `force`. | +| `--skipCodegen` | **[advanced]** Skip the react-native codegen step. | + ## Contributing Changes to this package can be made locally and tested against the `rn-tester` app, per the [Contributing guide](https://reactnative.dev/contributing/overview#contributing-code). During development, this package is automatically run from source with no build step. diff --git a/packages/community-cli-plugin/package.json b/packages/community-cli-plugin/package.json index be7c4d710596..c780f698a964 100644 --- a/packages/community-cli-plugin/package.json +++ b/packages/community-cli-plugin/package.json @@ -6,11 +6,11 @@ "react-native", "tools" ], - "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/community-cli-plugin#readme", - "bugs": "https://github.com/facebook/react-native/issues", + "homepage": "https://github.com/react/react-native/tree/HEAD/packages/community-cli-plugin#readme", + "bugs": "https://github.com/react/react-native/issues", "repository": { "type": "git", - "url": "git+https://github.com/facebook/react-native.git", + "url": "git+https://github.com/react/react-native.git", "directory": "packages/community-cli-plugin" }, "license": "MIT", @@ -31,16 +31,16 @@ "prepack": "node ../../scripts/build/prepack.js" }, "dependencies": { + "@react-native/asset-utils": "0.87.0-main", "@react-native/dev-middleware": "0.87.0-main", + "commander": "^12.0.0", "debug": "^4.4.0", "invariant": "^2.2.4", - "metro": "^0.84.3", - "metro-config": "^0.84.3", - "metro-core": "^0.84.3", + "metro": "^0.87.0", "semver": "^7.1.3" }, "devDependencies": { - "metro-resolver": "^0.84.3" + "metro-resolver": "^0.87.0" }, "peerDependencies": { "@react-native-community/cli": "*", diff --git a/packages/community-cli-plugin/src/commands/bundle/__tests__/filterPlatformAssetScales-test.js b/packages/community-cli-plugin/src/commands/bundle/__tests__/filterPlatformAssetScales-test.js index 5973fdceb678..d5ff14434f13 100644 --- a/packages/community-cli-plugin/src/commands/bundle/__tests__/filterPlatformAssetScales-test.js +++ b/packages/community-cli-plugin/src/commands/bundle/__tests__/filterPlatformAssetScales-test.js @@ -10,7 +10,7 @@ import filterPlatformAssetScales from '../filterPlatformAssetScales'; -jest.dontMock('../filterPlatformAssetScales').dontMock('../assetPathUtils'); +jest.dontMock('../filterPlatformAssetScales'); describe('filterPlatformAssetScales', () => { test('removes everything but 2x and 3x for iOS', () => { diff --git a/packages/community-cli-plugin/src/commands/bundle/__tests__/getAssetDestPathAndroid-test.js b/packages/community-cli-plugin/src/commands/bundle/__tests__/getAssetDestPathAndroid-test.js index c2198025d691..781c427d5c18 100644 --- a/packages/community-cli-plugin/src/commands/bundle/__tests__/getAssetDestPathAndroid-test.js +++ b/packages/community-cli-plugin/src/commands/bundle/__tests__/getAssetDestPathAndroid-test.js @@ -10,9 +10,11 @@ import getAssetDestPathAndroid from '../getAssetDestPathAndroid'; -const path = require('path'); +const path = require('node:path'); -jest.dontMock('../getAssetDestPathAndroid').dontMock('../assetPathUtils'); +jest + .dontMock('../getAssetDestPathAndroid') + .dontMock('@react-native/asset-utils'); describe('getAssetDestPathAndroid', () => { test('should use the right destination folder', () => { diff --git a/packages/community-cli-plugin/src/commands/bundle/__tests__/getAssetDestPathIOS-test.js b/packages/community-cli-plugin/src/commands/bundle/__tests__/getAssetDestPathIOS-test.js index 482dacede640..46f331295b57 100644 --- a/packages/community-cli-plugin/src/commands/bundle/__tests__/getAssetDestPathIOS-test.js +++ b/packages/community-cli-plugin/src/commands/bundle/__tests__/getAssetDestPathIOS-test.js @@ -10,7 +10,7 @@ import getAssetDestPathIOS from '../getAssetDestPathIOS'; -const path = require('path'); +const path = require('node:path'); jest.dontMock('../getAssetDestPathIOS'); diff --git a/packages/community-cli-plugin/src/commands/bundle/assetCatalogIOS.js b/packages/community-cli-plugin/src/commands/bundle/assetCatalogIOS.js index eefc3c6d5ad9..7ecf219a5372 100644 --- a/packages/community-cli-plugin/src/commands/bundle/assetCatalogIOS.js +++ b/packages/community-cli-plugin/src/commands/bundle/assetCatalogIOS.js @@ -10,9 +10,9 @@ import type {AssetData} from 'metro'; -import assetPathUtils from './assetPathUtils'; -import fs from 'fs'; -import path from 'path'; +import {getAndroidResourceIdentifier} from '@react-native/asset-utils'; +import fs from 'node:fs'; +import path from 'node:path'; export function cleanAssetCatalog(catalogDir: string): void { const files = fs @@ -33,7 +33,7 @@ export function getImageSet( asset: AssetData, scales: ReadonlyArray, ): ImageSet { - const fileName = assetPathUtils.getResourceIdentifier(asset); + const fileName = getAndroidResourceIdentifier(asset); return { basePath: path.join(catalogDir, `${fileName}.imageset`), files: scales.map((scale, idx) => { diff --git a/packages/community-cli-plugin/src/commands/bundle/assetPathUtils.js b/packages/community-cli-plugin/src/commands/bundle/assetPathUtils.js deleted file mode 100644 index 1ac88c6c01ec..000000000000 --- a/packages/community-cli-plugin/src/commands/bundle/assetPathUtils.js +++ /dev/null @@ -1,95 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow strict-local - * @format - */ - -export type PackagerAsset = Readonly<{ - httpServerLocation: string, - name: string, - type: string, - ... -}>; - -/** - * FIXME: using number to represent discrete scale numbers is fragile in essence because of - * floating point numbers imprecision. - */ -function getAndroidAssetSuffix(scale: number): string { - switch (scale) { - case 0.75: - return 'ldpi'; - case 1: - return 'mdpi'; - case 1.5: - return 'hdpi'; - case 2: - return 'xhdpi'; - case 3: - return 'xxhdpi'; - case 4: - return 'xxxhdpi'; - default: - return ''; - } -} - -// See https://developer.android.com/guide/topics/resources/drawable-resource.html -const drawableFileTypes: Set = new Set([ - 'gif', - 'heic', - 'heif', - 'jpeg', - 'jpg', - 'png', - 'webp', - 'xml', -]); - -function getAndroidResourceFolderName( - asset: PackagerAsset, - scale: number, -): string { - if (!drawableFileTypes.has(asset.type)) { - return 'raw'; - } - const suffix = getAndroidAssetSuffix(scale); - if (!suffix) { - throw new Error( - `Don't know which android drawable suffix to use for asset: ${JSON.stringify( - asset, - )}`, - ); - } - const androidFolder = `drawable-${suffix}`; - return androidFolder; -} - -function getResourceIdentifier(asset: PackagerAsset): string { - const folderPath = getBasePath(asset); - return `${folderPath}/${asset.name}` - .toLowerCase() - .replace(/\//g, '_') // Encode folder structure in file name - .replace(/([^a-z0-9_])/g, '') // Remove illegal chars - .replace(/^(?:assets|assetsunstable_path)_/, ''); // Remove "assets_" or "assetsunstable_path_" prefix -} - -function getBasePath(asset: PackagerAsset): string { - let basePath = asset.httpServerLocation; - if (basePath[0] === '/') { - basePath = basePath.substr(1); - } - return basePath; -} - -export default { - drawableFileTypes, - getAndroidAssetSuffix, - getAndroidResourceFolderName, - getResourceIdentifier, - getBasePath, -}; diff --git a/packages/community-cli-plugin/src/commands/bundle/buildBundle.js b/packages/community-cli-plugin/src/commands/bundle/buildBundle.js index 2b02160e8ac7..c6e38af5e2c2 100644 --- a/packages/community-cli-plugin/src/commands/bundle/buildBundle.js +++ b/packages/community-cli-plugin/src/commands/bundle/buildBundle.js @@ -10,15 +10,16 @@ import type {Config} from '@react-native-community/cli-types'; import type {RunBuildOptions} from 'metro'; -import type {ConfigT} from 'metro-config'; import loadMetroConfig from '../../utils/loadMetroConfig'; import parseKeyValueParamArray from '../../utils/parseKeyValueParamArray'; import saveAssets from './saveAssets'; -import {promises as fs} from 'fs'; import {runBuild} from 'metro'; -import path from 'path'; -import {styleText} from 'util'; +import {promises as fs} from 'node:fs'; +import path from 'node:path'; +import {styleText} from 'node:util'; + +type HydratedMetroConfig = Awaited>; export type BundleCommandArgs = { assetsDest?: string, @@ -60,7 +61,7 @@ async function buildBundle( async function buildBundleWithConfig( args: BundleCommandArgs, - config: ConfigT, + config: HydratedMetroConfig, bundleImpl?: RunBuildOptions['output'], ): Promise { const customResolverOptions = parseKeyValueParamArray( diff --git a/packages/community-cli-plugin/src/commands/bundle/createKeepFileAsync.js b/packages/community-cli-plugin/src/commands/bundle/createKeepFileAsync.js index 479c1bdf0143..10970dcaea21 100644 --- a/packages/community-cli-plugin/src/commands/bundle/createKeepFileAsync.js +++ b/packages/community-cli-plugin/src/commands/bundle/createKeepFileAsync.js @@ -10,9 +10,12 @@ import type {AssetData} from 'metro'; -import assetPathUtils from './assetPathUtils'; -import fs from 'fs'; -import path from 'path'; +import { + drawableFileTypes, + getAndroidResourceIdentifier, +} from '@react-native/asset-utils'; +import fs from 'node:fs'; +import path from 'node:path'; async function createKeepFileAsync( assets: ReadonlyArray, @@ -23,12 +26,8 @@ async function createKeepFileAsync( } const assetsList = []; for (const asset of assets) { - const prefix = assetPathUtils.drawableFileTypes.has(asset.type) - ? 'drawable' - : 'raw'; - assetsList.push( - `@${prefix}/${assetPathUtils.getResourceIdentifier(asset)}`, - ); + const prefix = drawableFileTypes.has(asset.type) ? 'drawable' : 'raw'; + assetsList.push(`@${prefix}/${getAndroidResourceIdentifier(asset)}`); } const keepPath = path.join(outputDirectory, 'raw/keep.xml'); const content = `\n`; diff --git a/packages/community-cli-plugin/src/commands/bundle/getAssetDestPathAndroid.js b/packages/community-cli-plugin/src/commands/bundle/getAssetDestPathAndroid.js index 6a8c913ce844..22167768702f 100644 --- a/packages/community-cli-plugin/src/commands/bundle/getAssetDestPathAndroid.js +++ b/packages/community-cli-plugin/src/commands/bundle/getAssetDestPathAndroid.js @@ -8,17 +8,17 @@ * @format */ -import type {PackagerAsset} from './assetPathUtils'; +import type {PackagerAsset} from '@react-native/asset-utils'; -import assetPathUtils from './assetPathUtils'; -import path from 'path'; +import { + getAndroidResourceFolderName, + getAndroidResourceIdentifier, +} from '@react-native/asset-utils'; +import path from 'node:path'; function getAssetDestPathAndroid(asset: PackagerAsset, scale: number): string { - const androidFolder = assetPathUtils.getAndroidResourceFolderName( - asset, - scale, - ); - const fileName = assetPathUtils.getResourceIdentifier(asset); + const androidFolder = getAndroidResourceFolderName(asset, scale); + const fileName = getAndroidResourceIdentifier(asset); return path.join(androidFolder, `${fileName}.${asset.type}`); } diff --git a/packages/community-cli-plugin/src/commands/bundle/getAssetDestPathIOS.js b/packages/community-cli-plugin/src/commands/bundle/getAssetDestPathIOS.js index 8f4cb0926a28..79bc573288ef 100644 --- a/packages/community-cli-plugin/src/commands/bundle/getAssetDestPathIOS.js +++ b/packages/community-cli-plugin/src/commands/bundle/getAssetDestPathIOS.js @@ -8,9 +8,9 @@ * @format */ -import type {PackagerAsset} from './assetPathUtils'; +import type {PackagerAsset} from '@react-native/asset-utils'; -import path from 'path'; +import path from 'node:path'; function getAssetDestPathIOS(asset: PackagerAsset, scale: number): string { const suffix = scale === 1 ? '' : `@${scale}x`; diff --git a/packages/community-cli-plugin/src/commands/bundle/index.js b/packages/community-cli-plugin/src/commands/bundle/index.js index d47a7b4a8524..7f82ef81d672 100644 --- a/packages/community-cli-plugin/src/commands/bundle/index.js +++ b/packages/community-cli-plugin/src/commands/bundle/index.js @@ -8,14 +8,22 @@ * @format */ -import type {Command} from '@react-native-community/cli-types'; +import type {Command as CommunityCommand} from '@react-native-community/cli-types'; import buildBundle from './buildBundle'; -import path from 'path'; +import {Command} from 'commander'; +import path from 'node:path'; export type {BundleCommandArgs} from './buildBundle'; -const bundleCommand: Command = { +type CommandOption = Readonly[number]>; + +type BundleCommandParser = { + parser: Command, + baseHelpInformation: string, +}; + +const bundleCommand: CommunityCommand = { name: 'bundle', description: 'Build the bundle for the provided JavaScript entry file.', func: buildBundle, @@ -123,4 +131,43 @@ const bundleCommand: Command = { ], }; +function addOptions( + command: Command, + options: ReadonlyArray, +): void { + for (const option of options) { + const description = option.description ?? ''; + const defaultValue = + typeof option.default === 'function' ? undefined : option.default; + + if (option.parse != null) { + command.option(option.name, description, option.parse, defaultValue); + } else if ( + typeof defaultValue === 'string' || + typeof defaultValue === 'boolean' || + Array.isArray(defaultValue) + ) { + command.option(option.name, description, defaultValue); + } else { + command.option(option.name, description); + } + } +} + +export function unstable_createBundleCommandParser( + additionalOptions: ReadonlyArray = [], +): BundleCommandParser { + const parser = new Command() + .name(bundleCommand.name) + .description(bundleCommand.description ?? '') + .helpOption('--help', 'Display help for command') + .allowUnknownOption(); + + addOptions(parser, bundleCommand.options ?? []); + const baseHelpInformation = parser.helpInformation(); + addOptions(parser, additionalOptions); + + return {parser, baseHelpInformation}; +} + export default bundleCommand; diff --git a/packages/community-cli-plugin/src/commands/bundle/saveAssets.js b/packages/community-cli-plugin/src/commands/bundle/saveAssets.js index 83a8e139cb2a..666b7671e974 100644 --- a/packages/community-cli-plugin/src/commands/bundle/saveAssets.js +++ b/packages/community-cli-plugin/src/commands/bundle/saveAssets.js @@ -20,9 +20,9 @@ import createKeepFileAsync from './createKeepFileAsync'; import filterPlatformAssetScales from './filterPlatformAssetScales'; import getAssetDestPathAndroid from './getAssetDestPathAndroid'; import getAssetDestPathIOS from './getAssetDestPathIOS'; -import fs from 'fs'; -import path from 'path'; -import {styleText} from 'util'; +import fs from 'node:fs'; +import path from 'node:path'; +import {styleText} from 'node:util'; type CopiedFiles = { [src: string]: string, diff --git a/packages/community-cli-plugin/src/commands/codegen.js b/packages/community-cli-plugin/src/commands/codegen.js new file mode 100644 index 000000000000..20e7e021c32f --- /dev/null +++ b/packages/community-cli-plugin/src/commands/codegen.js @@ -0,0 +1,63 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + */ + +import type {Command, Config} from '@react-native-community/cli-types'; + +export type CodegenCommandArgs = { + path: string, + platform: string, + outputPath?: string, + source: string, +}; + +const codegenCommand: Command = { + name: 'codegen', + options: [ + { + name: '--path ', + description: 'Path to the React Native project root.', + default: process.cwd(), + }, + { + name: '--platform ', + description: + 'Target platform. Supported values: "android", "ios", "all".', + default: 'all', + }, + { + name: '--outputPath ', + description: 'Path where generated artifacts will be output to.', + }, + { + name: '--source ', + description: 'Whether the script is invoked from an `app` or a `library`', + default: 'app', + }, + ], + func: ( + argv: Array, + config: Config, + args: CodegenCommandArgs, + ): void => { + const generateArtifactsExecutor = require.resolve( + 'react-native/scripts/codegen/generate-artifacts-executor/index', + {paths: [config.root]}, + ); + // $FlowFixMe[unsupported-syntax] dynamic require of a resolved path + require(generateArtifactsExecutor).execute( + args.path, + args.platform, + args.outputPath, + args.source, + ); + }, +}; + +export default codegenCommand; diff --git a/packages/community-cli-plugin/src/commands/spm.js b/packages/community-cli-plugin/src/commands/spm.js new file mode 100644 index 000000000000..181ad4ff812e --- /dev/null +++ b/packages/community-cli-plugin/src/commands/spm.js @@ -0,0 +1,118 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + */ + +import type {Command, Config} from '@react-native-community/cli-types'; + +export type SpmCommandArgs = { + version?: string, + yes?: boolean, + xcodeproj?: string, + productName?: string, + deintegrate?: boolean, + artifacts?: string, + download?: string, + skipCodegen?: boolean, +}; + +const spmCommand: Command = { + name: 'spm [action]', + description: + 'Set up or maintain Swift Package Manager support for the iOS/macOS app. ' + + 'Actions: add, update, deinit, scaffold. With no action: add (or update ' + + 'if SPM is already set up).', + options: [ + { + name: '--version ', + description: + 'React Native version (e.g. 0.80.0). Defaults to the version in node_modules/react-native/package.json.', + }, + { + name: '--yes', + description: 'Skip the dirty-pbxproj confirmation prompt.', + }, + { + name: '--xcodeproj ', + description: + '[add] Path to the .xcodeproj to inject SPM packages into ' + + '(disambiguates when several exist).', + }, + { + name: '--productName ', + description: + '[add] App target to inject into (disambiguates when several exist).', + }, + { + name: '--deintegrate', + description: + '[add] Run `pod deintegrate` and strip React Native from the Podfile ' + + 'before injecting (CocoaPods โ†’ SwiftPM migration).', + }, + { + name: '--artifacts ', + description: + '[advanced] Local artifact root containing complete debug/ and release/ slots.', + }, + { + name: '--download ', + description: + '[advanced] Artifact download policy: auto (default), skip, or force.', + }, + { + name: '--skipCodegen', + description: '[advanced] Skip the react-native codegen step.', + }, + ], + func: async ( + argv: Array, + config: Config, + args: SpmCommandArgs, + ): Promise => { + const passthrough: Array = []; + if (argv[0] != null) { + passthrough.push(argv[0]); + } + const stringOpts: Array< + [ + 'version' | 'productName' | 'xcodeproj' | 'artifacts' | 'download', + string, + ], + > = [ + ['version', '--version'], + ['productName', '--product-name'], + ['xcodeproj', '--xcodeproj'], + ['artifacts', '--artifacts'], + ['download', '--download'], + ]; + for (const [key, flag] of stringOpts) { + const value = args[key]; + if (value != null) { + passthrough.push(flag, String(value)); + } + } + const boolOpts: Array<['skipCodegen' | 'deintegrate' | 'yes', string]> = [ + ['skipCodegen', '--skip-codegen'], + ['deintegrate', '--deintegrate'], + ['yes', '--yes'], + ]; + for (const [key, flag] of boolOpts) { + if (args[key] === true) { + passthrough.push(flag); + } + } + const setupAppleSpm = require.resolve( + 'react-native/scripts/setup-apple-spm', + {paths: [config.root]}, + ); + // $FlowFixMe[unsupported-syntax] dynamic require of a resolved path + await require(setupAppleSpm).main(passthrough); + }, +}; + +export default spmCommand; diff --git a/packages/community-cli-plugin/src/commands/start/index.js b/packages/community-cli-plugin/src/commands/start.js similarity index 95% rename from packages/community-cli-plugin/src/commands/start/index.js rename to packages/community-cli-plugin/src/commands/start.js index 427d8ef82f50..ab9c1e7a67cf 100644 --- a/packages/community-cli-plugin/src/commands/start/index.js +++ b/packages/community-cli-plugin/src/commands/start.js @@ -10,14 +10,12 @@ import type {Command} from '@react-native-community/cli-types'; -import runServer from './runServer'; -import path from 'path'; - -export type {StartCommandArgs} from './runServer'; +import runDevServer from '../dev-server/runDevServer'; +import path from 'node:path'; const startCommand: Command = { name: 'start', - func: runServer, + func: runDevServer, description: 'Start the React Native development server.', options: [ { diff --git a/packages/community-cli-plugin/src/commands/start/middleware.js b/packages/community-cli-plugin/src/commands/start/middleware.js deleted file mode 100644 index 806d8c393537..000000000000 --- a/packages/community-cli-plugin/src/commands/start/middleware.js +++ /dev/null @@ -1,96 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow strict-local - * @format - */ - -import type {Server} from 'connect'; -import type {TerminalReportableEvent} from 'metro'; - -import {typeof createDevServerMiddleware as CreateDevServerMiddleware} from '@react-native-community/cli-server-api'; - -const debug = require('debug')('ReactNative:CommunityCliPlugin'); - -type MiddlewareReturn = { - middleware: Server, - websocketEndpoints: { - [path: string]: ws$WebSocketServer, - }, - messageSocketEndpoint: { - server: ws$WebSocketServer, - broadcast: ( - method: string, - params?: Record | null, - ) => void, - }, - eventsSocketEndpoint: { - server: ws$WebSocketServer, - reportEvent: (event: TerminalReportableEvent) => void, - }, - ... -}; - -// $FlowFixMe[incompatible-type] -const unusedStubWSServer: ws$WebSocketServer = {}; -// $FlowFixMe[incompatible-type] -const unusedMiddlewareStub: Server = {}; - -const communityMiddlewareFallback = { - createDevServerMiddleware: (params: { - host?: string, - port: number, - watchFolders: ReadonlyArray, - }): MiddlewareReturn => ({ - // FIXME: Several features will break without community middleware and - // should be migrated into core. - // e.g. used by Libraries/Core/Devtools: - // - /open-stack-frame - // - /open-url - // - /symbolicate - middleware: unusedMiddlewareStub, - websocketEndpoints: {}, - messageSocketEndpoint: { - server: unusedStubWSServer, - broadcast: ( - method: string, - _params?: Record | null, - ): void => {}, - }, - eventsSocketEndpoint: { - server: unusedStubWSServer, - reportEvent: (event: TerminalReportableEvent) => {}, - }, - }), -}; - -// Attempt to use the community middleware if it exists, but fallback to -// the stubs if it doesn't. -try { - // `@react-native-community/cli` is an optional peer dependency of this - // package, and should be a dev dependency of the host project (via the - // community template's package.json). - const communityCliPath = require.resolve('@react-native-community/cli'); - - // Until https://github.com/react-native-community/cli/pull/2605 lands, - // we need to find `@react-native-community/cli-server-api` via - // `@react-native-community/cli`. Once that lands, we can simply - // require('@react-native-community/cli'). - const communityCliServerApiPath = require.resolve( - '@react-native-community/cli-server-api', - {paths: [communityCliPath]}, - ); - // $FlowFixMe[unsupported-syntax] dynamic import - communityMiddlewareFallback.createDevServerMiddleware = require( - communityCliServerApiPath, - ).createDevServerMiddleware as CreateDevServerMiddleware; -} catch { - debug(`โš ๏ธ Unable to find @react-native-community/cli-server-api -Starting the server without the community middleware.`); -} - -export const createDevServerMiddleware = - communityMiddlewareFallback.createDevServerMiddleware; diff --git a/packages/community-cli-plugin/src/commands/start/OpenDebuggerKeyboardHandler.js b/packages/community-cli-plugin/src/dev-server/OpenDebuggerKeyboardHandler.js similarity index 99% rename from packages/community-cli-plugin/src/commands/start/OpenDebuggerKeyboardHandler.js rename to packages/community-cli-plugin/src/dev-server/OpenDebuggerKeyboardHandler.js index 75afc25ce13f..f7314812e0ef 100644 --- a/packages/community-cli-plugin/src/commands/start/OpenDebuggerKeyboardHandler.js +++ b/packages/community-cli-plugin/src/dev-server/OpenDebuggerKeyboardHandler.js @@ -10,7 +10,7 @@ import type {TerminalReporter} from 'metro'; -import {styleText} from 'util'; +import {styleText} from 'node:util'; type PageDescription = Readonly<{ id: string, diff --git a/packages/community-cli-plugin/src/commands/start/attachKeyHandlers.js b/packages/community-cli-plugin/src/dev-server/attachKeyHandlers.js similarity index 96% rename from packages/community-cli-plugin/src/commands/start/attachKeyHandlers.js rename to packages/community-cli-plugin/src/dev-server/attachKeyHandlers.js index fd43a0e8e011..6679274f7a88 100644 --- a/packages/community-cli-plugin/src/commands/start/attachKeyHandlers.js +++ b/packages/community-cli-plugin/src/dev-server/attachKeyHandlers.js @@ -12,9 +12,9 @@ import type {TerminalReporter} from 'metro'; import OpenDebuggerKeyboardHandler from './OpenDebuggerKeyboardHandler'; import invariant from 'invariant'; -import readline from 'readline'; -import {ReadStream} from 'tty'; -import {styleText} from 'util'; +import readline from 'node:readline'; +import {ReadStream} from 'node:tty'; +import {styleText} from 'node:util'; const CTRL_C = '\u0003'; const CTRL_D = '\u0004'; diff --git a/packages/community-cli-plugin/src/utils/createDevMiddlewareLogger.js b/packages/community-cli-plugin/src/dev-server/createDevMiddlewareLogger.js similarity index 100% rename from packages/community-cli-plugin/src/utils/createDevMiddlewareLogger.js rename to packages/community-cli-plugin/src/dev-server/createDevMiddlewareLogger.js diff --git a/packages/community-cli-plugin/src/utils/isDevServerRunning.js b/packages/community-cli-plugin/src/dev-server/isDevServerRunning.js similarity index 95% rename from packages/community-cli-plugin/src/utils/isDevServerRunning.js rename to packages/community-cli-plugin/src/dev-server/isDevServerRunning.js index c6da9937e182..5cf83ebda690 100644 --- a/packages/community-cli-plugin/src/utils/isDevServerRunning.js +++ b/packages/community-cli-plugin/src/dev-server/isDevServerRunning.js @@ -8,7 +8,7 @@ * @format */ -import net from 'net'; +import net from 'node:net'; /** * Determine whether we can run the dev server. @@ -33,6 +33,7 @@ export default async function isDevServerRunning( return 'not_running'; } + // FIXME: Depends on @react-native-community/cli-server-api const statusResponse = await fetch(`${devServerUrl}/status`); const body = await statusResponse.text(); diff --git a/packages/community-cli-plugin/src/dev-server/loadCommunityMiddleware.js b/packages/community-cli-plugin/src/dev-server/loadCommunityMiddleware.js new file mode 100644 index 000000000000..bd4f314bc77e --- /dev/null +++ b/packages/community-cli-plugin/src/dev-server/loadCommunityMiddleware.js @@ -0,0 +1,82 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + */ + +import type {Server} from 'connect'; +import type {TerminalReportableEvent} from 'metro'; + +type DevServerMiddlewareFactory = (params: { + host?: string, + port: number, + watchFolders: ReadonlyArray, +}) => { + middleware: Server, + websocketEndpoints: {[path: string]: ws$WebSocketServer}, + messageSocketEndpoint: { + server: ws$WebSocketServer, + broadcast: ( + method: string, + params?: Record | null, + ) => void, + }, + eventsSocketEndpoint: { + server: ws$WebSocketServer, + reportEvent: (event: TerminalReportableEvent) => void, + }, + ... +}; + +// $FlowFixMe[incompatible-type] +const unusedStubWSServer: ws$WebSocketServer = {}; +// $FlowFixMe[incompatible-type] +const unusedMiddlewareStub: Server = {}; + +// FIXME: Several features will break without community middleware +// (@react-native-community/cli-server-api) and should be migrated into core. +// e.g. used by packages/react-native/Libraries/Core/Devtools/: +// - /open-stack-frame +// - /open-url +// - /symbolicate +// e.g. used by ./isDevServerRunning.js: +// - /status +const communityMiddlewareFallback: DevServerMiddlewareFactory = () => ({ + middleware: unusedMiddlewareStub, + websocketEndpoints: {}, + messageSocketEndpoint: { + server: unusedStubWSServer, + broadcast: ( + method: string, + _params?: Record | null, + ): void => {}, + }, + eventsSocketEndpoint: { + server: unusedStubWSServer, + reportEvent: (event: TerminalReportableEvent) => {}, + }, +}); + +/** + * Attempt to load the `createDevServerMiddleware` factory from + * `@react-native-community/cli` (an optional peer dependency). If it cannot be + * found, return a factory that produces stub middleware instead. + */ +export default function loadCommunityMiddleware(): DevServerMiddlewareFactory { + try { + // `@react-native-community/cli` is an optional peer dependency of this + // package, and should be a dev dependency of the host project (via the + // community template's package.json). + // $FlowFixMe[prop-missing] + // $FlowFixMe[untyped-import] + return require('@react-native-community/cli').createDevServerMiddleware; + } catch { + console.warn(`โš ๏ธ Unable to find @react-native-community/cli. +Starting dev server without community middleware endpoints - some functionality may be broken.`); + return communityMiddlewareFallback; + } +} diff --git a/packages/community-cli-plugin/src/commands/start/runServer.js b/packages/community-cli-plugin/src/dev-server/runDevServer.js similarity index 88% rename from packages/community-cli-plugin/src/commands/start/runServer.js rename to packages/community-cli-plugin/src/dev-server/runDevServer.js index 22962457a2bf..fe120f4e9537 100644 --- a/packages/community-cli-plugin/src/commands/start/runServer.js +++ b/packages/community-cli-plugin/src/dev-server/runDevServer.js @@ -11,20 +11,19 @@ import type {Config} from '@react-native-community/cli-types'; import type {Reporter, TerminalReportableEvent, TerminalReporter} from 'metro'; -import createDevMiddlewareLogger from '../../utils/createDevMiddlewareLogger'; -import isDevServerRunning from '../../utils/isDevServerRunning'; -import loadMetroConfig from '../../utils/loadMetroConfig'; -import * as version from '../../utils/version'; +import loadMetroConfig from '../utils/loadMetroConfig'; import attachKeyHandlers from './attachKeyHandlers'; -import {createDevServerMiddleware} from './middleware'; +import createDevMiddlewareLogger from './createDevMiddlewareLogger'; +import isDevServerRunning from './isDevServerRunning'; +import loadCommunityMiddleware from './loadCommunityMiddleware'; +import * as version from './version'; import {createDevMiddleware} from '@react-native/dev-middleware'; -import Metro from 'metro'; -import {Terminal} from 'metro-core'; -import path from 'path'; -import url from 'url'; -import {styleText} from 'util'; +import * as Metro from 'metro'; +import path from 'node:path'; +import url from 'node:url'; +import {styleText} from 'node:util'; -export type StartCommandArgs = { +export type DevServerOptions = { assetPlugins?: string[], cert?: string, customLogReporterPath?: string, @@ -44,10 +43,10 @@ export type StartCommandArgs = { clientLogs: boolean, }; -async function runServer( +async function runDevServer( _argv: Array, cliConfig: Config, - args: StartCommandArgs, + args: DevServerOptions, ) { const metroConfig = await loadMetroConfig(cliConfig, { config: args.config, @@ -104,16 +103,17 @@ async function runServer( } let reportEvent: (event: TerminalReportableEvent) => void; - const terminal = new Terminal(process.stdout); + const terminal = new Metro.Terminal(process.stdout); const ReporterImpl = getReporterImpl(args.customLogReporterPath); const terminalReporter = new ReporterImpl(terminal); + const createCommunityMiddleware = loadCommunityMiddleware(); const { middleware: communityMiddleware, websocketEndpoints: communityWebsocketEndpoints, messageSocketEndpoint, eventsSocketEndpoint, - } = createDevServerMiddleware({ + } = createCommunityMiddleware({ host: hostname, port, watchFolders, @@ -187,4 +187,4 @@ function getReporterImpl( } } -export default runServer; +export default runDevServer; diff --git a/packages/community-cli-plugin/src/utils/version.js b/packages/community-cli-plugin/src/dev-server/version.js similarity index 98% rename from packages/community-cli-plugin/src/utils/version.js rename to packages/community-cli-plugin/src/dev-server/version.js index 27f455a8aaee..8d86c1bdcd89 100644 --- a/packages/community-cli-plugin/src/utils/version.js +++ b/packages/community-cli-plugin/src/dev-server/version.js @@ -11,8 +11,8 @@ import type {Config} from '@react-native-community/cli-types'; import type {TerminalReporter} from 'metro'; +import {styleText} from 'node:util'; import semver from 'semver'; -import {styleText} from 'util'; const debug = require('debug')('ReactNative:CommunityCliPlugin'); @@ -88,6 +88,7 @@ Diff: ${styleText(['dim', 'underline'], newVersion?.diffUrl ?? 'none')} } } +// $FlowFixMe[incompatible-type-guard] function isDiffPurgeEntry(data: Partial): data is DiffPurge { return ( // $FlowFixMe[incompatible-type-guard] diff --git a/packages/community-cli-plugin/src/index.flow.js b/packages/community-cli-plugin/src/index.flow.js index 1f8177f03313..7b0fa97aceba 100644 --- a/packages/community-cli-plugin/src/index.flow.js +++ b/packages/community-cli-plugin/src/index.flow.js @@ -8,7 +8,12 @@ * @format */ -export {default as bundleCommand} from './commands/bundle'; +export { + default as bundleCommand, + unstable_createBundleCommandParser, +} from './commands/bundle'; +export {default as codegenCommand} from './commands/codegen'; +export {default as spmCommand} from './commands/spm'; export {default as startCommand} from './commands/start'; export {unstable_buildBundleWithConfig} from './commands/bundle/buildBundle'; diff --git a/packages/community-cli-plugin/src/utils/loadMetroConfig.js b/packages/community-cli-plugin/src/utils/loadMetroConfig.js index 8b5883a3148a..3a9f7df94f6c 100644 --- a/packages/community-cli-plugin/src/utils/loadMetroConfig.js +++ b/packages/community-cli-plugin/src/utils/loadMetroConfig.js @@ -9,20 +9,21 @@ */ import type {Config} from '@react-native-community/cli-types'; -import type {ConfigT, InputConfigT, YargArguments} from 'metro-config'; +import type {MetroConfig} from 'metro'; import {CLIError} from './errors'; import {reactNativePlatformResolver} from './metroPlatformResolver'; -import {loadConfig, resolveConfig} from 'metro-config'; -import path from 'path'; +import {loadConfig, resolveConfig} from 'metro'; const debug = require('debug')('ReactNative:CommunityCliPlugin'); +type HydratedMetroConfig = Awaited>; +type ArgvInput = Parameters[0]; + export type {Config}; export type ConfigLoadingContext = Readonly<{ root: Config['root'], - reactNativePath: Config['reactNativePath'], platforms: Config['platforms'], ... }>; @@ -32,12 +33,12 @@ export type ConfigLoadingContext = Readonly<{ */ function getCommunityCliDefaultConfig( ctx: ConfigLoadingContext, - config: ConfigT, -): InputConfigT { + config: HydratedMetroConfig, +): MetroConfig { const outOfTreePlatforms = Object.keys(ctx.platforms).filter( platform => ctx.platforms[platform].npmPackageName, ); - const resolver: Partial<{...ConfigT['resolver']}> = { + const resolver: Partial<{...HydratedMetroConfig['resolver']}> = { platforms: [...Object.keys(ctx.platforms), 'native'], }; @@ -57,16 +58,15 @@ function getCommunityCliDefaultConfig( return { resolver, serializer: { - // We can include multiple copies of InitializeCore here because metro will + // We can include multiple copies of setup-env here because Metro will // only add ones that are already part of the bundle getModulesRunBeforeMainModule: () => [ - require.resolve( - path.join(ctx.reactNativePath, 'Libraries/Core/InitializeCore'), - {paths: [ctx.root]}, - ), + require.resolve('react-native/setup-env', { + paths: [ctx.root], + }), ...outOfTreePlatforms.map(platform => require.resolve( - `${ctx.platforms[platform].npmPackageName}/Libraries/Core/InitializeCore`, + `${ctx.platforms[platform].npmPackageName}/setup-env`, {paths: [ctx.root]}, ), ), @@ -83,8 +83,8 @@ function getCommunityCliDefaultConfig( */ export default async function loadMetroConfig( ctx: ConfigLoadingContext, - options: YargArguments = {}, -): Promise { + options: NonNullable = {}, +): Promise { let RNMetroConfig = null; try { RNMetroConfig = require('@react-native/metro-config'); @@ -96,8 +96,6 @@ export default async function loadMetroConfig( // Get the RN defaults before our customisations const defaultConfig = RNMetroConfig.getDefaultConfig(ctx.root); - // Unflag the config as being loaded - it must be loaded again in userland. - global.__REACT_NATIVE_METRO_CONFIG_LOADED = false; // Add our defaults to `@react-native/metro-config` before the user config // loads them. @@ -119,20 +117,6 @@ export default async function loadMetroConfig( debug(`Reading Metro config from ${projectConfig.filepath}`); - if (!global.__REACT_NATIVE_METRO_CONFIG_LOADED) { - const warning = ` -================================================================================================= -From React Native 0.73, your project's Metro config should extend '@react-native/metro-config' -or it will fail to build. Please copy the template at: -https://github.com/react-native-community/template/blob/main/template/metro.config.js -This warning will be removed in future (https://github.com/facebook/metro/issues/1018). -================================================================================================= - `; - - for (const line of warning.trim().split('\n')) { - console.warn(line); - } - } return loadConfig({ cwd, ...options, diff --git a/packages/debugger-frontend/BUILD_INFO b/packages/debugger-frontend/BUILD_INFO index 966fb68e2465..bd9c2b9b5446 100644 --- a/packages/debugger-frontend/BUILD_INFO +++ b/packages/debugger-frontend/BUILD_INFO @@ -1,8 +1,8 @@ -@generated SignedSource<<06b58bc7c9ba92605c093ab30f1bcad6>> -Git revision: 571dc30a5de05c09d6734fd38f6a6c279d5d7ec2 +@generated SignedSource<> +Git revision: dbc1c525fbe78bf415ff5441ea05d5b2475b2c24 Built with --nohooks: false Is local checkout: false -Remote URL: https://github.com/facebook/react-native-devtools-frontend +Remote URL: https://github.com/react/react-native-devtools-frontend Remote branch: main GN build args (overrides only): is_official_build = true diff --git a/packages/debugger-frontend/README.md b/packages/debugger-frontend/README.md index fc563eee9ab9..d5515409f9e7 100644 --- a/packages/debugger-frontend/README.md +++ b/packages/debugger-frontend/README.md @@ -1,10 +1,11 @@ # @react-native/debugger-frontend -![npm package](https://img.shields.io/npm/v/@react-native/debugger-frontend?color=brightgreen&label=npm%20package) +[![npm]](https://www.npmjs.com/package/@react-native/debugger-frontend) [![npm downloads]](https://www.npmjs.com/package/@react-native/debugger-frontend) -Debugger frontend for React Native based on Chrome DevTools. +[npm]: https://img.shields.io/npm/v/@react-native/debugger-frontend.svg?color=blue +[npm downloads]: https://img.shields.io/npm/dm/@react-native/debugger-frontend.svg -This package is internal to React Native and is intended to be used via [`@react-native/dev-middleware`](https://www.npmjs.com/package/@react-native/dev-middleware). +Debugger frontend for React Native based on Chrome DevTools. It is intended to be used via [`@react-native/dev-middleware`](https://www.npmjs.com/package/@react-native/dev-middleware). ## Usage @@ -35,3 +36,5 @@ node scripts/debugger-frontend/sync-and-build --branch 0.73-stable ``` By default, this will clone and build from [react/react-native-devtools-frontend](https://github.com/react/react-native-devtools-frontend). + +The updated files are committed on completion, with a generated summary and changelog of the synced revisions. diff --git a/packages/debugger-frontend/dist/third-party/front_end/core/common/common.js b/packages/debugger-frontend/dist/third-party/front_end/core/common/common.js index e279864ef0dc..8690d2f89742 100644 --- a/packages/debugger-frontend/dist/third-party/front_end/core/common/common.js +++ b/packages/debugger-frontend/dist/third-party/front_end/core/common/common.js @@ -1 +1 @@ -import*as t from"../root/root.js";import*as e from"../platform/platform.js";export{UIString}from"../platform/platform.js";import*as r from"../i18n/i18n.js";var s=Object.freeze({__proto__:null});const n=[];var i=Object.freeze({__proto__:null,getRegisteredAppProviders:function(){return n.filter((e=>t.Runtime.Runtime.isDescriptorEnabled({experiment:void 0,condition:e.condition}))).sort(((t,e)=>(t.order||0)-(e.order||0)))},registerAppProvider:function(t){n.push(t)}});const a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=new Uint8Array(123);for(let t=0;t<64;++t)o[a.charCodeAt(t)]=t;var l=Object.freeze({__proto__:null,BASE64_CHARS:a,BASE64_CODES:o,decode:function(t){let e=3*t.length/4>>>0;61===t.charCodeAt(t.length-2)?e-=2:61===t.charCodeAt(t.length-1)&&(e-=1);const r=new Uint8Array(e);for(let e=0,s=0;e>4,r[s++]=(15&i)<<4|a>>2,r[s++]=(3&a)<<6|63&l}return r.buffer},encode:function(t){return new Promise(((e,r)=>{const s=new FileReader;s.onerror=()=>r(new Error("failed to convert to base64")),s.onload=()=>{const t=s.result,[,r]=t.split(",",2);e(r)},s.readAsDataURL(new Blob([t]))}))}});var h=Object.freeze({__proto__:null,CharacterIdMap:class{#t=new Map;#e=new Map;#r=33;toChar(t){let e=this.#t.get(t);if(!e){if(this.#r>=65535)throw new Error("CharacterIdMap ran out of capacity!");e=String.fromCharCode(this.#r++),this.#t.set(t,e),this.#e.set(e,t)}return e}fromChar(t){const e=this.#e.get(t);return void 0===e?null:e}}});const c=.9642,u=.8251;class g{values=[0,0,0];constructor(t){t&&(this.values=t)}}class d{values=[[0,0,0],[0,0,0],[0,0,0]];constructor(t){t&&(this.values=t)}multiply(t){const e=new g;for(let r=0;r<3;++r)e.values[r]=this.values[r][0]*t.values[0]+this.values[r][1]*t.values[1]+this.values[r][2]*t.values[2];return e}}class p{g;a;b;c;d;e;f;constructor(t,e,r=0,s=0,n=0,i=0,a=0){this.g=t,this.a=e,this.b=r,this.c=s,this.d=n,this.e=i,this.f=a}eval(t){const e=t<0?-1:1,r=t*e;return r.022?t:t+Math.pow(.022-t,1.414)}function W(t,e){if(t=M(t),e=M(e),Math.abs(t-e)<5e-4)return 0;let r=0;return e>t?(r=1.14*(Math.pow(e,.56)-Math.pow(t,.57)),r=r<.1?0:r-V):(r=1.14*(Math.pow(e,.65)-Math.pow(t,.62)),r=r>-.1?0:r+V),100*r}function X(t,e,r){function s(){return r?Math.pow(Math.abs(Math.pow(t,.65)-(-e-V)/1.14),1/.62):Math.pow(Math.abs(Math.pow(t,.56)-(e+V)/1.14),1/.57)}t=M(t),e/=100;let n=s();return(n<0||n>1)&&(r=!r,n=s()),n}const D=[[12,-1,-1,-1,-1,100,90,80,-1,-1],[14,-1,-1,-1,100,90,80,60,60,-1],[16,-1,-1,100,90,80,60,55,50,50],[18,-1,-1,90,80,60,55,50,40,40],[24,-1,100,80,60,55,50,40,38,35],[30,-1,90,70,55,50,40,38,35,40],[36,-1,80,60,50,40,38,35,30,25],[48,100,70,55,40,38,35,30,25,20],[60,90,60,50,38,35,30,25,20,20],[72,80,55,40,35,30,25,20,20,20],[96,70,50,35,30,25,20,20,20,20],[120,60,40,30,25,20,20,20,20,20]];function F(t,e){const r=72*parseFloat(t.replace("px",""))/96;return(isNaN(Number(e))?["bold","bolder"].includes(e):Number(e)>=600)?r>=14:r>=18}D.reverse();const j={aa:3,aaa:4.5},U={aa:4.5,aaa:7};var $=Object.freeze({__proto__:null,blendColors:E,contrastRatio:function(t,e){const r=O(E(t,e)),s=O(e);return(Math.max(r,s)+.05)/(Math.min(r,s)+.05)},contrastRatioAPCA:G,contrastRatioByLuminanceAPCA:W,desiredLuminanceAPCA:X,getAPCAThreshold:function(t,e){const r=parseFloat(t.replace("px","")),s=parseFloat(e);for(const[t,...e]of D)if(r>=t)for(const[t,r]of[900,800,700,600,500,400,300,200,100].entries())if(s>=r){const r=e[e.length-1-t];return-1===r?null:r}return null},getContrastThreshold:function(t,e){return F(t,e)?j:U},isLargeFont:F,luminance:O,luminanceAPCA:B,rgbToHsl:L,rgbToHwb:_,rgbaToHsla:C,rgbaToHwba:N});function H(t){return(t%360+360)%360}function q(t){const e=t.replace(/(deg|g?rad|turn)$/,"");if(isNaN(e)||t.match(/\s+(deg|g?rad|turn)/))return null;const r=parseFloat(e);return t.includes("turn")?360*r:t.includes("grad")?9*r/10:t.includes("rad")?180*r/Math.PI:r}function Y(t){switch(t){case"srgb":return"srgb";case"srgb-linear":return"srgb-linear";case"display-p3":return"display-p3";case"a98-rgb":return"a98-rgb";case"prophoto-rgb":return"prophoto-rgb";case"rec2020":return"rec2020";case"xyz":return"xyz";case"xyz-d50":return"xyz-d50";case"xyz-d65":return"xyz-d65"}return null}function Z(t,e){const r=Math.sign(t),s=Math.abs(t),[n,i]=e;return r*(s*(i-n)/100+n)}function K(t,{min:e,max:r}){return null===t||(void 0!==e&&(t=Math.max(t,e)),void 0!==r&&(t=Math.min(t,r))),t}function J(t,e){if(!t.endsWith("%"))return null;const r=parseFloat(t.substr(0,t.length-1));return isNaN(r)?null:Z(r,e)}function Q(t){const e=parseFloat(t);return isNaN(e)?null:e}function tt(t){return void 0===t?null:K(J(t,[0,1])??Q(t),{min:0,max:1})}function et(t,e=[0,1]){if(isNaN(t.replace("%","")))return null;const r=parseFloat(t);return-1!==t.indexOf("%")?t.indexOf("%")!==t.length-1?null:Z(r,e):r}function rt(t){const e=et(t);return null===e?null:-1!==t.indexOf("%")?e:e/255}function st(t){const e=t.replace(/(deg|g?rad|turn)$/,"");if(isNaN(e)||t.match(/\s+(deg|g?rad|turn)/))return null;const r=parseFloat(e);return-1!==t.indexOf("turn")?r%1:-1!==t.indexOf("grad")?r/400%1:-1!==t.indexOf("rad")?r/(2*Math.PI)%1:r/360%1}function nt(t){if(t.indexOf("%")!==t.length-1||isNaN(t.replace("%","")))return null;return parseFloat(t)/100}function it(t){const e=t[0];let r=t[1];const s=t[2];function n(t,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?t+(e-t)*r*6:2*r<1?e:3*r<2?t+(e-t)*(2/3-r)*6:t}let i;r<0&&(r=0),i=s<=.5?s*(1+r):s+r-s*r;const a=2*s-i,o=e,l=e-1/3;return[n(a,i,e+1/3),n(a,i,o),n(a,i,l),t[3]]}function at(t){return it(function(t){const e=t[0];let r=t[1];const s=t[2],n=(2-r)*s;return 0===s||0===r?r=0:r*=s/(n<1?n:2-n),[e,r,n/2,t[3]]}(t))}function ot(t,e,r){function s(){return r?(t+.05)*e-.05:(t+.05)/e-.05}let n=s();return(n<0||n>1)&&(r=!r,n=s()),n}function lt(t,e,r,s,n){let i=t[r],a=1,o=n(t)-s,l=Math.sign(o);for(let e=100;e;e--){if(Math.abs(o)<2e-4)return t[r]=i,i;const e=Math.sign(o);if(e!==l)a/=2,l=e;else if(i<0||i>1)return null;i+=a*(2===r?-o:o),t[r]=i,o=n(t)-s}return null}function ht(t,e,r=.01){if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return!1;for(const r in t)if(!ht(t[r],e[r]))return!1;return!0}return!Array.isArray(t)&&!Array.isArray(e)&&(null===t||null===e?t===e:Math.abs(t-e)new vt(t.#a(!1),"hex"),hexa:t=>new vt(t.#a(!0),"hexa"),rgb:t=>new vt(t.#a(!1),"rgb"),rgba:t=>new vt(t.#a(!0),"rgba"),hsl:t=>new yt(...L(t.#a(!1)),t.alpha),hsla:t=>new yt(...L(t.#a(!1)),t.alpha),hwb:t=>new bt(..._(t.#a(!1)),t.alpha),hwba:t=>new bt(..._(t.#a(!1)),t.alpha),lch:t=>new gt(...A.labToLch(t.l,t.a,t.b),t.alpha),oklch:t=>new pt(...A.xyzd50ToOklch(...t.#o()),t.alpha),lab:t=>t,oklab:t=>new dt(...A.xyzd65ToOklab(...A.xyzd50ToD65(...t.#o())),t.alpha),srgb:t=>new mt("srgb",...A.xyzd50ToSrgb(...t.#o()),t.alpha),"srgb-linear":t=>new mt("srgb-linear",...A.xyzd50TosRGBLinear(...t.#o()),t.alpha),"display-p3":t=>new mt("display-p3",...A.xyzd50ToDisplayP3(...t.#o()),t.alpha),"a98-rgb":t=>new mt("a98-rgb",...A.xyzd50ToAdobeRGB(...t.#o()),t.alpha),"prophoto-rgb":t=>new mt("prophoto-rgb",...A.xyzd50ToProPhoto(...t.#o()),t.alpha),rec2020:t=>new mt("rec2020",...A.xyzd50ToRec2020(...t.#o()),t.alpha),xyz:t=>new mt("xyz",...A.xyzd50ToD65(...t.#o()),t.alpha),"xyz-d50":t=>new mt("xyz-d50",...t.#o(),t.alpha),"xyz-d65":t=>new mt("xyz-d65",...A.xyzd50ToD65(...t.#o()),t.alpha)};#o(){return A.labToXyzd50(this.l,this.a,this.b)}#a(t=!0){const e=A.xyzd50ToSrgb(...this.#o());return t?[...e,this.alpha??void 0]:e}constructor(t,e,r,s,n){this.#n=[t,e,r],this.l=K(t,{min:0,max:100}),(ht(this.l,0,1)||ht(this.l,100,1))&&(e=r=0),this.a=e,this.b=r,this.alpha=K(s,{min:0,max:1}),this.#s=n}is(t){return t===this.format()}as(t){return ut.#i[t](this)}asLegacyColor(){return this.as("rgba")}equal(t){const e=t.as("lab");return ht(e.l,this.l,1)&&ht(e.a,this.a)&&ht(e.b,this.b)&&ht(e.alpha,this.alpha)}format(){return"lab"}setAlpha(t){return new ut(this.l,this.a,this.b,t,void 0)}asString(t){return t?this.as(t).asString():this.#l(this.l,this.a,this.b)}#l(t,r,s){const n=null===this.alpha||ht(this.alpha,1)?"":` / ${e.StringUtilities.stringifyWithPrecision(this.alpha)}`;return`lab(${e.StringUtilities.stringifyWithPrecision(t,0)} ${e.StringUtilities.stringifyWithPrecision(r)} ${e.StringUtilities.stringifyWithPrecision(s)}${n})`}getAuthoredText(){return this.#s??null}getRawParameters(){return[...this.#n]}getAsRawString(t){return t?this.as(t).getAsRawString():this.#l(...this.#n)}isGamutClipped(){return!1}static fromSpec(t,e){const r=J(t[0],[0,100])??Q(t[0]);if(null===r)return null;const s=J(t[1],[0,125])??Q(t[1]);if(null===s)return null;const n=J(t[2],[0,125])??Q(t[2]);if(null===n)return null;const i=tt(t[3]);return new ut(r,s,n,i,e)}}class gt{#n;l;c;h;alpha;#s;static#i={hex:t=>new vt(t.#a(!1),"hex"),hexa:t=>new vt(t.#a(!0),"hexa"),rgb:t=>new vt(t.#a(!1),"rgb"),rgba:t=>new vt(t.#a(!0),"rgba"),hsl:t=>new yt(...L(t.#a(!1)),t.alpha),hsla:t=>new yt(...L(t.#a(!1)),t.alpha),hwb:t=>new bt(..._(t.#a(!1)),t.alpha),hwba:t=>new bt(..._(t.#a(!1)),t.alpha),lch:t=>t,oklch:t=>new pt(...A.xyzd50ToOklch(...t.#o()),t.alpha),lab:t=>new ut(...A.lchToLab(t.l,t.c,t.h),t.alpha),oklab:t=>new dt(...A.xyzd65ToOklab(...A.xyzd50ToD65(...t.#o())),t.alpha),srgb:t=>new mt("srgb",...A.xyzd50ToSrgb(...t.#o()),t.alpha),"srgb-linear":t=>new mt("srgb-linear",...A.xyzd50TosRGBLinear(...t.#o()),t.alpha),"display-p3":t=>new mt("display-p3",...A.xyzd50ToDisplayP3(...t.#o()),t.alpha),"a98-rgb":t=>new mt("a98-rgb",...A.xyzd50ToAdobeRGB(...t.#o()),t.alpha),"prophoto-rgb":t=>new mt("prophoto-rgb",...A.xyzd50ToProPhoto(...t.#o()),t.alpha),rec2020:t=>new mt("rec2020",...A.xyzd50ToRec2020(...t.#o()),t.alpha),xyz:t=>new mt("xyz",...A.xyzd50ToD65(...t.#o()),t.alpha),"xyz-d50":t=>new mt("xyz-d50",...t.#o(),t.alpha),"xyz-d65":t=>new mt("xyz-d65",...A.xyzd50ToD65(...t.#o()),t.alpha)};#o(){return A.labToXyzd50(...A.lchToLab(this.l,this.c,this.h))}#a(t=!0){const e=A.xyzd50ToSrgb(...this.#o());return t?[...e,this.alpha??void 0]:e}constructor(t,e,r,s,n){this.#n=[t,e,r],this.l=K(t,{min:0,max:100}),e=ht(this.l,0,1)||ht(this.l,100,1)?0:e,this.c=K(e,{min:0}),r=ht(e,0)?0:r,this.h=H(r),this.alpha=K(s,{min:0,max:1}),this.#s=n}asLegacyColor(){return this.as("rgba")}is(t){return t===this.format()}as(t){return gt.#i[t](this)}equal(t){const e=t.as("lch");return ht(e.l,this.l,1)&&ht(e.c,this.c)&&ht(e.h,this.h)&&ht(e.alpha,this.alpha)}format(){return"lch"}setAlpha(t){return new gt(this.l,this.c,this.h,t)}asString(t){return t?this.as(t).asString():this.#l(this.l,this.c,this.h)}#l(t,r,s){const n=null===this.alpha||ht(this.alpha,1)?"":` / ${e.StringUtilities.stringifyWithPrecision(this.alpha)}`;return`lch(${e.StringUtilities.stringifyWithPrecision(t,0)} ${e.StringUtilities.stringifyWithPrecision(r)} ${e.StringUtilities.stringifyWithPrecision(s)}${n})`}getAuthoredText(){return this.#s??null}getRawParameters(){return[...this.#n]}getAsRawString(t){return t?this.as(t).getAsRawString():this.#l(...this.#n)}isGamutClipped(){return!1}isHuePowerless(){return ht(this.c,0)}static fromSpec(t,e){const r=J(t[0],[0,100])??Q(t[0]);if(null===r)return null;const s=J(t[1],[0,150])??Q(t[1]);if(null===s)return null;const n=q(t[2]);if(null===n)return null;const i=tt(t[3]);return new gt(r,s,n,i,e)}}class dt{#n;l;a;b;alpha;#s;static#i={hex:t=>new vt(t.#a(!1),"hex"),hexa:t=>new vt(t.#a(!0),"hexa"),rgb:t=>new vt(t.#a(!1),"rgb"),rgba:t=>new vt(t.#a(!0),"rgba"),hsl:t=>new yt(...L(t.#a(!1)),t.alpha),hsla:t=>new yt(...L(t.#a(!1)),t.alpha),hwb:t=>new bt(..._(t.#a(!1)),t.alpha),hwba:t=>new bt(..._(t.#a(!1)),t.alpha),lch:t=>new gt(...A.labToLch(...A.xyzd50ToLab(...t.#o())),t.alpha),oklch:t=>new pt(...A.xyzd50ToOklch(...t.#o()),t.alpha),lab:t=>new ut(...A.xyzd50ToLab(...t.#o()),t.alpha),oklab:t=>t,srgb:t=>new mt("srgb",...A.xyzd50ToSrgb(...t.#o()),t.alpha),"srgb-linear":t=>new mt("srgb-linear",...A.xyzd50TosRGBLinear(...t.#o()),t.alpha),"display-p3":t=>new mt("display-p3",...A.xyzd50ToDisplayP3(...t.#o()),t.alpha),"a98-rgb":t=>new mt("a98-rgb",...A.xyzd50ToAdobeRGB(...t.#o()),t.alpha),"prophoto-rgb":t=>new mt("prophoto-rgb",...A.xyzd50ToProPhoto(...t.#o()),t.alpha),rec2020:t=>new mt("rec2020",...A.xyzd50ToRec2020(...t.#o()),t.alpha),xyz:t=>new mt("xyz",...A.xyzd50ToD65(...t.#o()),t.alpha),"xyz-d50":t=>new mt("xyz-d50",...t.#o(),t.alpha),"xyz-d65":t=>new mt("xyz-d65",...A.xyzd50ToD65(...t.#o()),t.alpha)};#o(){return A.xyzd65ToD50(...A.oklabToXyzd65(this.l,this.a,this.b))}#a(t=!0){const e=A.xyzd50ToSrgb(...this.#o());return t?[...e,this.alpha??void 0]:e}constructor(t,e,r,s,n){this.#n=[t,e,r],this.l=K(t,{min:0,max:1}),(ht(this.l,0)||ht(this.l,1))&&(e=r=0),this.a=e,this.b=r,this.alpha=K(s,{min:0,max:1}),this.#s=n}asLegacyColor(){return this.as("rgba")}is(t){return t===this.format()}as(t){return dt.#i[t](this)}equal(t){const e=t.as("oklab");return ht(e.l,this.l)&&ht(e.a,this.a)&&ht(e.b,this.b)&&ht(e.alpha,this.alpha)}format(){return"oklab"}setAlpha(t){return new dt(this.l,this.a,this.b,t)}asString(t){return t?this.as(t).asString():this.#l(this.l,this.a,this.b)}#l(t,r,s){const n=null===this.alpha||ht(this.alpha,1)?"":` / ${e.StringUtilities.stringifyWithPrecision(this.alpha)}`;return`oklab(${e.StringUtilities.stringifyWithPrecision(t)} ${e.StringUtilities.stringifyWithPrecision(r)} ${e.StringUtilities.stringifyWithPrecision(s)}${n})`}getAuthoredText(){return this.#s??null}getRawParameters(){return[...this.#n]}getAsRawString(t){return t?this.as(t).getAsRawString():this.#l(...this.#n)}isGamutClipped(){return!1}static fromSpec(t,e){const r=J(t[0],[0,1])??Q(t[0]);if(null===r)return null;const s=J(t[1],[0,.4])??Q(t[1]);if(null===s)return null;const n=J(t[2],[0,.4])??Q(t[2]);if(null===n)return null;const i=tt(t[3]);return new dt(r,s,n,i,e)}}class pt{#n;l;c;h;alpha;#s;static#i={hex:t=>new vt(t.#a(!1),"hex"),hexa:t=>new vt(t.#a(!0),"hexa"),rgb:t=>new vt(t.#a(!1),"rgb"),rgba:t=>new vt(t.#a(!0),"rgba"),hsl:t=>new yt(...L(t.#a(!1)),t.alpha),hsla:t=>new yt(...L(t.#a(!1)),t.alpha),hwb:t=>new bt(..._(t.#a(!1)),t.alpha),hwba:t=>new bt(..._(t.#a(!1)),t.alpha),lch:t=>new gt(...A.labToLch(...A.xyzd50ToLab(...t.#o())),t.alpha),oklch:t=>t,lab:t=>new ut(...A.xyzd50ToLab(...t.#o()),t.alpha),oklab:t=>new dt(...A.xyzd65ToOklab(...A.xyzd50ToD65(...t.#o())),t.alpha),srgb:t=>new mt("srgb",...A.xyzd50ToSrgb(...t.#o()),t.alpha),"srgb-linear":t=>new mt("srgb-linear",...A.xyzd50TosRGBLinear(...t.#o()),t.alpha),"display-p3":t=>new mt("display-p3",...A.xyzd50ToDisplayP3(...t.#o()),t.alpha),"a98-rgb":t=>new mt("a98-rgb",...A.xyzd50ToAdobeRGB(...t.#o()),t.alpha),"prophoto-rgb":t=>new mt("prophoto-rgb",...A.xyzd50ToProPhoto(...t.#o()),t.alpha),rec2020:t=>new mt("rec2020",...A.xyzd50ToRec2020(...t.#o()),t.alpha),xyz:t=>new mt("xyz",...A.xyzd50ToD65(...t.#o()),t.alpha),"xyz-d50":t=>new mt("xyz-d50",...t.#o(),t.alpha),"xyz-d65":t=>new mt("xyz-d65",...A.xyzd50ToD65(...t.#o()),t.alpha)};#o(){return A.oklchToXyzd50(this.l,this.c,this.h)}#a(t=!0){const e=A.xyzd50ToSrgb(...this.#o());return t?[...e,this.alpha??void 0]:e}constructor(t,e,r,s,n){this.#n=[t,e,r],this.l=K(t,{min:0,max:1}),e=ht(this.l,0)||ht(this.l,1)?0:e,this.c=K(e,{min:0}),r=ht(e,0)?0:r,this.h=H(r),this.alpha=K(s,{min:0,max:1}),this.#s=n}asLegacyColor(){return this.as("rgba")}is(t){return t===this.format()}as(t){return pt.#i[t](this)}equal(t){const e=t.as("oklch");return ht(e.l,this.l)&&ht(e.c,this.c)&&ht(e.h,this.h)&&ht(e.alpha,this.alpha)}format(){return"oklch"}setAlpha(t){return new pt(this.l,this.c,this.h,t)}asString(t){return t?this.as(t).asString():this.#l(this.l,this.c,this.h)}#l(t,r,s){const n=null===this.alpha||ht(this.alpha,1)?"":` / ${e.StringUtilities.stringifyWithPrecision(this.alpha)}`;return`oklch(${e.StringUtilities.stringifyWithPrecision(t)} ${e.StringUtilities.stringifyWithPrecision(r)} ${e.StringUtilities.stringifyWithPrecision(s)}${n})`}getAuthoredText(){return this.#s??null}getRawParameters(){return[...this.#n]}getAsRawString(t){return t?this.as(t).getAsRawString():this.#l(...this.#n)}isGamutClipped(){return!1}static fromSpec(t,e){const r=J(t[0],[0,1])??Q(t[0]);if(null===r)return null;const s=J(t[1],[0,.4])??Q(t[1]);if(null===s)return null;const n=q(t[2]);if(null===n)return null;const i=tt(t[3]);return new pt(r,s,n,i,e)}}class mt{#n;p0;p1;p2;alpha;colorSpace;#s;static#i={hex:t=>new vt(t.#a(!1),"hex"),hexa:t=>new vt(t.#a(!0),"hexa"),rgb:t=>new vt(t.#a(!1),"rgb"),rgba:t=>new vt(t.#a(!0),"rgba"),hsl:t=>new yt(...L(t.#a(!1)),t.alpha),hsla:t=>new yt(...L(t.#a(!1)),t.alpha),hwb:t=>new bt(..._(t.#a(!1)),t.alpha),hwba:t=>new bt(..._(t.#a(!1)),t.alpha),lch:t=>new gt(...A.labToLch(...A.xyzd50ToLab(...t.#o())),t.alpha),oklch:t=>new pt(...A.xyzd50ToOklch(...t.#o()),t.alpha),lab:t=>new ut(...A.xyzd50ToLab(...t.#o()),t.alpha),oklab:t=>new dt(...A.xyzd65ToOklab(...A.xyzd50ToD65(...t.#o())),t.alpha),srgb:t=>new mt("srgb",...A.xyzd50ToSrgb(...t.#o()),t.alpha),"srgb-linear":t=>new mt("srgb-linear",...A.xyzd50TosRGBLinear(...t.#o()),t.alpha),"display-p3":t=>new mt("display-p3",...A.xyzd50ToDisplayP3(...t.#o()),t.alpha),"a98-rgb":t=>new mt("a98-rgb",...A.xyzd50ToAdobeRGB(...t.#o()),t.alpha),"prophoto-rgb":t=>new mt("prophoto-rgb",...A.xyzd50ToProPhoto(...t.#o()),t.alpha),rec2020:t=>new mt("rec2020",...A.xyzd50ToRec2020(...t.#o()),t.alpha),xyz:t=>new mt("xyz",...A.xyzd50ToD65(...t.#o()),t.alpha),"xyz-d50":t=>new mt("xyz-d50",...t.#o(),t.alpha),"xyz-d65":t=>new mt("xyz-d65",...A.xyzd50ToD65(...t.#o()),t.alpha)};#o(){const[t,e,r]=this.#n;switch(this.colorSpace){case"srgb":return A.srgbToXyzd50(t,e,r);case"srgb-linear":return A.srgbLinearToXyzd50(t,e,r);case"display-p3":return A.displayP3ToXyzd50(t,e,r);case"a98-rgb":return A.adobeRGBToXyzd50(t,e,r);case"prophoto-rgb":return A.proPhotoToXyzd50(t,e,r);case"rec2020":return A.rec2020ToXyzd50(t,e,r);case"xyz-d50":return[t,e,r];case"xyz":case"xyz-d65":return A.xyzd65ToD50(t,e,r)}throw new Error("Invalid color space")}#a(t=!0){const[e,r,s]=this.#n,n="srgb"===this.colorSpace?[e,r,s]:[...A.xyzd50ToSrgb(...this.#o())];return t?[...n,this.alpha??void 0]:n}constructor(t,e,r,s,n,i){this.#n=[e,r,s],this.colorSpace=t,this.#s=i,"xyz-d50"!==this.colorSpace&&"xyz-d65"!==this.colorSpace&&"xyz"!==this.colorSpace&&(e=K(e,{min:0,max:1}),r=K(r,{min:0,max:1}),s=K(s,{min:0,max:1})),this.p0=e,this.p1=r,this.p2=s,this.alpha=K(n,{min:0,max:1})}asLegacyColor(){return this.as("rgba")}is(t){return t===this.format()}as(t){return this.colorSpace===t?this:mt.#i[t](this)}equal(t){const e=t.as(this.colorSpace);return ht(this.p0,e.p0)&&ht(this.p1,e.p1)&&ht(this.p2,e.p2)&&ht(this.alpha,e.alpha)}format(){return this.colorSpace}setAlpha(t){return new mt(this.colorSpace,this.p0,this.p1,this.p2,t)}asString(t){return t?this.as(t).asString():this.#l(this.p0,this.p1,this.p2)}#l(t,r,s){const n=null===this.alpha||ht(this.alpha,1)?"":` / ${e.StringUtilities.stringifyWithPrecision(this.alpha)}`;return`color(${this.colorSpace} ${e.StringUtilities.stringifyWithPrecision(t)} ${e.StringUtilities.stringifyWithPrecision(r)} ${e.StringUtilities.stringifyWithPrecision(s)}${n})`}getAuthoredText(){return this.#s??null}getRawParameters(){return[...this.#n]}getAsRawString(t){return t?this.as(t).getAsRawString():this.#l(...this.#n)}isGamutClipped(){return"xyz-d50"!==this.colorSpace&&"xyz-d65"!==this.colorSpace&&"xyz"!==this.colorSpace&&!ht(this.#n,[this.p0,this.p1,this.p2])}static fromSpec(t,e){const[r,s]=e.split("/",2),n=r.trim().split(/\s+/),[i,...a]=n,o=Y(i);if(!o)return null;if(0===a.length&&void 0===s)return new mt(o,0,0,0,null,t);if(0===a.length&&void 0!==s&&s.trim().split(/\s+/).length>1)return null;if(a.length>3)return null;const l=a.map((t=>"none"===t?"0":t)).map((t=>et(t,[0,1])));if(l.includes(null))return null;const h=s?et(s,[0,1])??1:1,c=[l[0]??0,l[1]??0,l[2]??0,h];return new mt(o,...c,t)}}class yt{h;s;l;alpha;#n;#s;static#i={hex:t=>new vt(t.#a(!1),"hex"),hexa:t=>new vt(t.#a(!0),"hexa"),rgb:t=>new vt(t.#a(!1),"rgb"),rgba:t=>new vt(t.#a(!0),"rgba"),hsl:t=>t,hsla:t=>t,hwb:t=>new bt(..._(t.#a(!1)),t.alpha),hwba:t=>new bt(..._(t.#a(!1)),t.alpha),lch:t=>new gt(...A.labToLch(...A.xyzd50ToLab(...t.#o())),t.alpha),oklch:t=>new pt(...A.xyzd50ToOklch(...t.#o()),t.alpha),lab:t=>new ut(...A.xyzd50ToLab(...t.#o()),t.alpha),oklab:t=>new dt(...A.xyzd65ToOklab(...A.xyzd50ToD65(...t.#o())),t.alpha),srgb:t=>new mt("srgb",...A.xyzd50ToSrgb(...t.#o()),t.alpha),"srgb-linear":t=>new mt("srgb-linear",...A.xyzd50TosRGBLinear(...t.#o()),t.alpha),"display-p3":t=>new mt("display-p3",...A.xyzd50ToDisplayP3(...t.#o()),t.alpha),"a98-rgb":t=>new mt("a98-rgb",...A.xyzd50ToAdobeRGB(...t.#o()),t.alpha),"prophoto-rgb":t=>new mt("prophoto-rgb",...A.xyzd50ToProPhoto(...t.#o()),t.alpha),rec2020:t=>new mt("rec2020",...A.xyzd50ToRec2020(...t.#o()),t.alpha),xyz:t=>new mt("xyz",...A.xyzd50ToD65(...t.#o()),t.alpha),"xyz-d50":t=>new mt("xyz-d50",...t.#o(),t.alpha),"xyz-d65":t=>new mt("xyz-d65",...A.xyzd50ToD65(...t.#o()),t.alpha)};#a(t=!0){const e=it([this.h,this.s,this.l,0]);return t?[e[0],e[1],e[2],this.alpha??void 0]:[e[0],e[1],e[2]]}#o(){const t=this.#a(!1);return A.srgbToXyzd50(t[0],t[1],t[2])}constructor(t,e,r,s,n){this.#n=[t,e,r],this.l=K(r,{min:0,max:1}),e=ht(this.l,0)||ht(this.l,1)?0:e,this.s=K(e,{min:0,max:1}),t=ht(this.s,0)?0:t,this.h=H(360*t)/360,this.alpha=K(s??null,{min:0,max:1}),this.#s=n}equal(t){const e=t.as("hsl");return ht(this.h,e.h)&&ht(this.s,e.s)&&ht(this.l,e.l)&&ht(this.alpha,e.alpha)}asString(t){return t?this.as(t).asString():this.#l(this.h,this.s,this.l)}#l(t,r,s){const n=e.StringUtilities.sprintf("hsl(%sdeg %s% %s%",e.StringUtilities.stringifyWithPrecision(360*t),e.StringUtilities.stringifyWithPrecision(100*r),e.StringUtilities.stringifyWithPrecision(100*s));return null!==this.alpha&&1!==this.alpha?n+e.StringUtilities.sprintf(" / %s%)",e.StringUtilities.stringifyWithPrecision(100*this.alpha)):n+")"}setAlpha(t){return new yt(this.h,this.s,this.l,t)}format(){return null===this.alpha||1===this.alpha?"hsl":"hsla"}is(t){return t===this.format()}as(t){return t===this.format()?this:yt.#i[t](this)}asLegacyColor(){return this.as("rgba")}getAuthoredText(){return this.#s??null}getRawParameters(){return[...this.#n]}getAsRawString(t){return t?this.as(t).getAsRawString():this.#l(...this.#n)}isGamutClipped(){return!ct(this.#n[1],1)||!ct(0,this.#n[1])}static fromSpec(t,e){const r=st(t[0]);if(null===r)return null;const s=nt(t[1]);if(null===s)return null;const n=nt(t[2]);if(null===n)return null;const i=tt(t[3]);return new yt(r,s,n,i,e)}hsva(){const t=this.s*(this.l<.5?this.l:1-this.l);return[this.h,0!==t?2*t/(this.l+t):0,this.l+t,this.alpha??1]}canonicalHSLA(){return[Math.round(360*this.h),Math.round(100*this.s),Math.round(100*this.l),this.alpha??1]}}class bt{h;w;b;alpha;#n;#s;static#i={hex:t=>new vt(t.#a(!1),"hex"),hexa:t=>new vt(t.#a(!0),"hexa"),rgb:t=>new vt(t.#a(!1),"rgb"),rgba:t=>new vt(t.#a(!0),"rgba"),hsl:t=>new yt(...L(t.#a(!1)),t.alpha),hsla:t=>new yt(...L(t.#a(!1)),t.alpha),hwb:t=>t,hwba:t=>t,lch:t=>new gt(...A.labToLch(...A.xyzd50ToLab(...t.#o())),t.alpha),oklch:t=>new pt(...A.xyzd50ToOklch(...t.#o()),t.alpha),lab:t=>new ut(...A.xyzd50ToLab(...t.#o()),t.alpha),oklab:t=>new dt(...A.xyzd65ToOklab(...A.xyzd50ToD65(...t.#o())),t.alpha),srgb:t=>new mt("srgb",...A.xyzd50ToSrgb(...t.#o()),t.alpha),"srgb-linear":t=>new mt("srgb-linear",...A.xyzd50TosRGBLinear(...t.#o()),t.alpha),"display-p3":t=>new mt("display-p3",...A.xyzd50ToDisplayP3(...t.#o()),t.alpha),"a98-rgb":t=>new mt("a98-rgb",...A.xyzd50ToAdobeRGB(...t.#o()),t.alpha),"prophoto-rgb":t=>new mt("prophoto-rgb",...A.xyzd50ToProPhoto(...t.#o()),t.alpha),rec2020:t=>new mt("rec2020",...A.xyzd50ToRec2020(...t.#o()),t.alpha),xyz:t=>new mt("xyz",...A.xyzd50ToD65(...t.#o()),t.alpha),"xyz-d50":t=>new mt("xyz-d50",...t.#o(),t.alpha),"xyz-d65":t=>new mt("xyz-d65",...A.xyzd50ToD65(...t.#o()),t.alpha)};#a(t=!0){const e=function(t){const e=t[0],r=t[1],s=t[2],n=r/(r+s);let i=[n,n,n,t[3]];if(r+s<1){i=it([e,1,.5,t[3]]);for(let t=0;t<3;++t)i[t]+=r-(r+s)*i[t]}return i}([this.h,this.w,this.b,0]);return t?[e[0],e[1],e[2],this.alpha??void 0]:[e[0],e[1],e[2]]}#o(){const t=this.#a(!1);return A.srgbToXyzd50(t[0],t[1],t[2])}constructor(t,e,r,s,n){if(this.#n=[t,e,r],this.w=K(e,{min:0,max:1}),this.b=K(r,{min:0,max:1}),t=ct(1,this.w+this.b)?0:t,this.h=H(360*t)/360,this.alpha=K(s,{min:0,max:1}),ct(1,this.w+this.b)){const t=this.w/this.b;this.b=1/(1+t),this.w=1-this.b}this.#s=n}equal(t){const e=t.as("hwb");return ht(this.h,e.h)&&ht(this.w,e.w)&&ht(this.b,e.b)&&ht(this.alpha,e.alpha)}asString(t){return t?this.as(t).asString():this.#l(this.h,this.w,this.b)}#l(t,r,s){const n=e.StringUtilities.sprintf("hwb(%sdeg %s% %s%",e.StringUtilities.stringifyWithPrecision(360*t),e.StringUtilities.stringifyWithPrecision(100*r),e.StringUtilities.stringifyWithPrecision(100*s));return null!==this.alpha&&1!==this.alpha?n+e.StringUtilities.sprintf(" / %s%)",e.StringUtilities.stringifyWithPrecision(100*this.alpha)):n+")"}setAlpha(t){return new bt(this.h,this.w,this.b,t,this.#s)}format(){return null===this.alpha||ht(this.alpha,1)?"hwb":"hwba"}is(t){return t===this.format()}as(t){return t===this.format()?this:bt.#i[t](this)}asLegacyColor(){return this.as("rgba")}getAuthoredText(){return this.#s??null}canonicalHWBA(){return[Math.round(360*this.h),Math.round(100*this.w),Math.round(100*this.b),this.alpha??1]}getRawParameters(){return[...this.#n]}getAsRawString(t){return t?this.as(t).getAsRawString():this.#l(...this.#n)}isGamutClipped(){return!(ct(this.#n[1],1)&&ct(0,this.#n[1])&&ct(this.#n[2],1)&&ct(0,this.#n[2]))}static fromSpec(t,e){const r=st(t[0]);if(null===r)return null;const s=nt(t[1]);if(null===s)return null;const n=nt(t[2]);if(null===n)return null;const i=tt(t[3]);return new bt(r,s,n,i,e)}}function ft(t){return Math.round(255*t)}class wt{color;constructor(t){this.color=t}get alpha(){return this.color.alpha}rgba(){return this.color.rgba()}equal(t){return this.color.equal(t)}setAlpha(t){return this.color.setAlpha(t)}format(){return 1!==(this.alpha??1)?"hexa":"hex"}as(t){return this.color.as(t)}is(t){return this.color.is(t)}asLegacyColor(){return this.color.asLegacyColor()}getAuthoredText(){return this.color.getAuthoredText()}getRawParameters(){return this.color.getRawParameters()}isGamutClipped(){return this.color.isGamutClipped()}asString(t){if(t)return this.as(t).asString();const[e,r,s]=this.color.rgba();return this.stringify(e,r,s)}getAsRawString(t){if(t)return this.as(t).getAsRawString();const[e,r,s]=this.getRawParameters();return this.stringify(e,r,s)}}class St extends wt{setAlpha(t){return new St(this.color.setAlpha(t))}asString(t){return t&&t!==this.format()?super.as(t).asString():super.asString()}stringify(t,r,s){function n(t){return(Math.round(255*t)/17).toString(16)}return this.color.hasAlpha()?e.StringUtilities.sprintf("#%s%s%s%s",n(t),n(r),n(s),n(this.alpha??1)).toLowerCase():e.StringUtilities.sprintf("#%s%s%s",n(t),n(r),n(s)).toLowerCase()}}class xt extends wt{nickname;constructor(t,e){super(e),this.nickname=t}static fromName(t,e){const r=t.toLowerCase(),s=Rt.get(r);return void 0!==s?new xt(r,vt.fromRGBA(s,e)):null}stringify(){return this.nickname}getAsRawString(t){return this.color.getAsRawString(t)}}class vt{#n;#h;#s;#c;static#i={hex:t=>new vt(t.#h,"hex"),hexa:t=>new vt(t.#h,"hexa"),rgb:t=>new vt(t.#h,"rgb"),rgba:t=>new vt(t.#h,"rgba"),hsl:t=>new yt(...L([t.#h[0],t.#h[1],t.#h[2]]),t.alpha),hsla:t=>new yt(...L([t.#h[0],t.#h[1],t.#h[2]]),t.alpha),hwb:t=>new bt(..._([t.#h[0],t.#h[1],t.#h[2]]),t.alpha),hwba:t=>new bt(..._([t.#h[0],t.#h[1],t.#h[2]]),t.alpha),lch:t=>new gt(...A.labToLch(...A.xyzd50ToLab(...t.#o())),t.alpha),oklch:t=>new pt(...A.xyzd50ToOklch(...t.#o()),t.alpha),lab:t=>new ut(...A.xyzd50ToLab(...t.#o()),t.alpha),oklab:t=>new dt(...A.xyzd65ToOklab(...A.xyzd50ToD65(...t.#o())),t.alpha),srgb:t=>new mt("srgb",...A.xyzd50ToSrgb(...t.#o()),t.alpha),"srgb-linear":t=>new mt("srgb-linear",...A.xyzd50TosRGBLinear(...t.#o()),t.alpha),"display-p3":t=>new mt("display-p3",...A.xyzd50ToDisplayP3(...t.#o()),t.alpha),"a98-rgb":t=>new mt("a98-rgb",...A.xyzd50ToAdobeRGB(...t.#o()),t.alpha),"prophoto-rgb":t=>new mt("prophoto-rgb",...A.xyzd50ToProPhoto(...t.#o()),t.alpha),rec2020:t=>new mt("rec2020",...A.xyzd50ToRec2020(...t.#o()),t.alpha),xyz:t=>new mt("xyz",...A.xyzd50ToD65(...t.#o()),t.alpha),"xyz-d50":t=>new mt("xyz-d50",...t.#o(),t.alpha),"xyz-d65":t=>new mt("xyz-d65",...A.xyzd50ToD65(...t.#o()),t.alpha)};#o(){const[t,e,r]=this.#h;return A.srgbToXyzd50(t,e,r)}get alpha(){switch(this.format()){case"hexa":case"rgba":return this.#h[3];default:return null}}asLegacyColor(){return this}nickname(){const t=zt.get(String(this.canonicalRGBA()));return t?new xt(t,this):null}shortHex(){for(let t=0;t<4;++t){if(Math.round(255*this.#h[t])%17)return null}return new St(this)}constructor(t,e,r){this.#s=r||null,this.#c=e,this.#n=[t[0],t[1],t[2]],this.#h=[K(t[0],{min:0,max:1}),K(t[1],{min:0,max:1}),K(t[2],{min:0,max:1}),K(t[3]??1,{min:0,max:1})]}static fromHex(t,e){const r=4===(t=t.toLowerCase()).length||8===t.length?"hexa":"hex",s=t.length<=4;s&&(t=t.charAt(0)+t.charAt(0)+t.charAt(1)+t.charAt(1)+t.charAt(2)+t.charAt(2)+t.charAt(3)+t.charAt(3));const n=parseInt(t.substring(0,2),16),i=parseInt(t.substring(2,4),16),a=parseInt(t.substring(4,6),16);let o=1;8===t.length&&(o=parseInt(t.substring(6,8),16)/255);const l=new vt([n/255,i/255,a/255,o],r,e);return s?new St(l):l}static fromRGBAFunction(t,r,s,n,i){const a=[rt(t),rt(r),rt(s),n?(o=n,et(o)):1];var o;return e.ArrayUtilities.arrayDoesNotContainNullOrUndefined(a)?new vt(a,n?"rgba":"rgb",i):null}static fromRGBA(t,e){return new vt([t[0]/255,t[1]/255,t[2]/255,t[3]],"rgba",e)}static fromHSVA(t){const e=at(t);return new vt(e,"rgba")}is(t){return t===this.format()}as(t){return t===this.format()?this:vt.#i[t](this)}format(){return this.#c}hasAlpha(){return 1!==this.#h[3]}detectHEXFormat(){return this.hasAlpha()?"hexa":"hex"}asString(t){return t?this.as(t).asString():this.#l(t,this.#h[0],this.#h[1],this.#h[2])}#l(t,r,s,n){function i(t){const e=Math.round(255*t).toString(16);return 1===e.length?"0"+e:e}switch(t||(t=this.#c),t){case"rgb":case"rgba":{const t=e.StringUtilities.sprintf("rgb(%d %d %d",ft(r),ft(s),ft(n));return this.hasAlpha()?t+e.StringUtilities.sprintf(" / %d%)",Math.round(100*this.#h[3])):t+")"}case"hex":case"hexa":return this.hasAlpha()?e.StringUtilities.sprintf("#%s%s%s%s",i(r),i(s),i(n),i(this.#h[3])).toLowerCase():e.StringUtilities.sprintf("#%s%s%s",i(r),i(s),i(n)).toLowerCase()}}getAuthoredText(){return this.#s??null}getRawParameters(){return[...this.#n]}getAsRawString(t){return t?this.as(t).getAsRawString():this.#l(t,...this.#n)}isGamutClipped(){return!ht(this.#n.map(ft),[this.#h[0],this.#h[1],this.#h[2]].map(ft),1)}rgba(){return[...this.#h]}canonicalRGBA(){const t=new Array(4);for(let e=0;e<3;++e)t[e]=Math.round(255*this.#h[e]);return t[3]=this.#h[3],t}toProtocolRGBA(){const t=this.canonicalRGBA(),e={r:t[0],g:t[1],b:t[2],a:void 0};return 1!==t[3]&&(e.a=t[3]),e}invert(){const t=[0,0,0,0];return t[0]=1-this.#h[0],t[1]=1-this.#h[1],t[2]=1-this.#h[2],t[3]=this.#h[3],new vt(t,"rgba")}grayscale(){const[t,e,r]=this.#h,s=.299*t+.587*e+.114*r;return new vt([s,s,s,.5],"rgba")}setAlpha(t){const e=[...this.#h];return e[3]=t,new vt(e,"rgba")}blendWith(t){const e=E(t.#h,this.#h);return new vt(e,"rgba")}blendWithAlpha(t){const e=[...this.#h];return e[3]*=t,new vt(e,"rgba")}setFormat(t){this.#c=t}equal(t){const e=t.as(this.#c);return ht(ft(this.#h[0]),ft(e.#h[0]),1)&&ht(ft(this.#h[1]),ft(e.#h[1]),1)&&ht(ft(this.#h[2]),ft(e.#h[2]),1)&&ht(this.#h[3],e.#h[3])}}const Tt=[["aliceblue",[240,248,255]],["antiquewhite",[250,235,215]],["aqua",[0,255,255]],["aquamarine",[127,255,212]],["azure",[240,255,255]],["beige",[245,245,220]],["bisque",[255,228,196]],["black",[0,0,0]],["blanchedalmond",[255,235,205]],["blue",[0,0,255]],["blueviolet",[138,43,226]],["brown",[165,42,42]],["burlywood",[222,184,135]],["cadetblue",[95,158,160]],["chartreuse",[127,255,0]],["chocolate",[210,105,30]],["coral",[255,127,80]],["cornflowerblue",[100,149,237]],["cornsilk",[255,248,220]],["crimson",[237,20,61]],["cyan",[0,255,255]],["darkblue",[0,0,139]],["darkcyan",[0,139,139]],["darkgoldenrod",[184,134,11]],["darkgray",[169,169,169]],["darkgrey",[169,169,169]],["darkgreen",[0,100,0]],["darkkhaki",[189,183,107]],["darkmagenta",[139,0,139]],["darkolivegreen",[85,107,47]],["darkorange",[255,140,0]],["darkorchid",[153,50,204]],["darkred",[139,0,0]],["darksalmon",[233,150,122]],["darkseagreen",[143,188,143]],["darkslateblue",[72,61,139]],["darkslategray",[47,79,79]],["darkslategrey",[47,79,79]],["darkturquoise",[0,206,209]],["darkviolet",[148,0,211]],["deeppink",[255,20,147]],["deepskyblue",[0,191,255]],["dimgray",[105,105,105]],["dimgrey",[105,105,105]],["dodgerblue",[30,144,255]],["firebrick",[178,34,34]],["floralwhite",[255,250,240]],["forestgreen",[34,139,34]],["fuchsia",[255,0,255]],["gainsboro",[220,220,220]],["ghostwhite",[248,248,255]],["gold",[255,215,0]],["goldenrod",[218,165,32]],["gray",[128,128,128]],["grey",[128,128,128]],["green",[0,128,0]],["greenyellow",[173,255,47]],["honeydew",[240,255,240]],["hotpink",[255,105,180]],["indianred",[205,92,92]],["indigo",[75,0,130]],["ivory",[255,255,240]],["khaki",[240,230,140]],["lavender",[230,230,250]],["lavenderblush",[255,240,245]],["lawngreen",[124,252,0]],["lemonchiffon",[255,250,205]],["lightblue",[173,216,230]],["lightcoral",[240,128,128]],["lightcyan",[224,255,255]],["lightgoldenrodyellow",[250,250,210]],["lightgreen",[144,238,144]],["lightgray",[211,211,211]],["lightgrey",[211,211,211]],["lightpink",[255,182,193]],["lightsalmon",[255,160,122]],["lightseagreen",[32,178,170]],["lightskyblue",[135,206,250]],["lightslategray",[119,136,153]],["lightslategrey",[119,136,153]],["lightsteelblue",[176,196,222]],["lightyellow",[255,255,224]],["lime",[0,255,0]],["limegreen",[50,205,50]],["linen",[250,240,230]],["magenta",[255,0,255]],["maroon",[128,0,0]],["mediumaquamarine",[102,205,170]],["mediumblue",[0,0,205]],["mediumorchid",[186,85,211]],["mediumpurple",[147,112,219]],["mediumseagreen",[60,179,113]],["mediumslateblue",[123,104,238]],["mediumspringgreen",[0,250,154]],["mediumturquoise",[72,209,204]],["mediumvioletred",[199,21,133]],["midnightblue",[25,25,112]],["mintcream",[245,255,250]],["mistyrose",[255,228,225]],["moccasin",[255,228,181]],["navajowhite",[255,222,173]],["navy",[0,0,128]],["oldlace",[253,245,230]],["olive",[128,128,0]],["olivedrab",[107,142,35]],["orange",[255,165,0]],["orangered",[255,69,0]],["orchid",[218,112,214]],["palegoldenrod",[238,232,170]],["palegreen",[152,251,152]],["paleturquoise",[175,238,238]],["palevioletred",[219,112,147]],["papayawhip",[255,239,213]],["peachpuff",[255,218,185]],["peru",[205,133,63]],["pink",[255,192,203]],["plum",[221,160,221]],["powderblue",[176,224,230]],["purple",[128,0,128]],["rebeccapurple",[102,51,153]],["red",[255,0,0]],["rosybrown",[188,143,143]],["royalblue",[65,105,225]],["saddlebrown",[139,69,19]],["salmon",[250,128,114]],["sandybrown",[244,164,96]],["seagreen",[46,139,87]],["seashell",[255,245,238]],["sienna",[160,82,45]],["silver",[192,192,192]],["skyblue",[135,206,235]],["slateblue",[106,90,205]],["slategray",[112,128,144]],["slategrey",[112,128,144]],["snow",[255,250,250]],["springgreen",[0,255,127]],["steelblue",[70,130,180]],["tan",[210,180,140]],["teal",[0,128,128]],["thistle",[216,191,216]],["tomato",[255,99,71]],["turquoise",[64,224,208]],["violet",[238,130,238]],["wheat",[245,222,179]],["white",[255,255,255]],["whitesmoke",[245,245,245]],["yellow",[255,255,0]],["yellowgreen",[154,205,50]],["transparent",[0,0,0,0]]];console.assert(Tt.every((([t])=>t.toLowerCase()===t)),"All color nicknames must be lowercase.");const Rt=new Map(Tt),zt=new Map(Tt.map((([t,[e,r,s,n=1]])=>[String([e,r,s,n]),t]))),It=[127,32,210],At={Content:vt.fromRGBA([111,168,220,.66]),ContentLight:vt.fromRGBA([111,168,220,.5]),ContentOutline:vt.fromRGBA([9,83,148]),Padding:vt.fromRGBA([147,196,125,.55]),PaddingLight:vt.fromRGBA([147,196,125,.4]),Border:vt.fromRGBA([255,229,153,.66]),BorderLight:vt.fromRGBA([255,229,153,.5]),Margin:vt.fromRGBA([246,178,107,.66]),MarginLight:vt.fromRGBA([246,178,107,.5]),EventTarget:vt.fromRGBA([255,196,196,.66]),Shape:vt.fromRGBA([96,82,177,.8]),ShapeMargin:vt.fromRGBA([96,82,127,.6]),CssGrid:vt.fromRGBA([75,0,130,1]),LayoutLine:vt.fromRGBA([...It,1]),GridBorder:vt.fromRGBA([...It,1]),GapBackground:vt.fromRGBA([...It,.3]),GapHatch:vt.fromRGBA([...It,.8]),GridAreaBorder:vt.fromRGBA([26,115,232,1])},Pt={ParentOutline:vt.fromRGBA([224,90,183,1]),ChildOutline:vt.fromRGBA([0,120,212,1])},Et={Resizer:vt.fromRGBA([222,225,230,1]),ResizerHandle:vt.fromRGBA([166,166,166,1]),Mask:vt.fromRGBA([248,249,249,1])};var kt=Object.freeze({__proto__:null,ColorFunction:mt,ColorMixRegex:/color-mix\(.*,\s*(?.+)\s*,\s*(?.+)\s*\)/g,Generator:class{#u;#g;#d;#p;#m=new Map;constructor(t,e,r,s){this.#u=t||{min:0,max:360,count:void 0},this.#g=e||67,this.#d=r||80,this.#p=s||1}setColorForID(t,e){this.#m.set(t,e)}colorForID(t){let e=this.#m.get(t);return e||(e=this.generateColorForID(t),this.#m.set(t,e)),e}generateColorForID(t){const r=e.StringUtilities.hashCode(t),s=this.indexToValueInSpace(r,this.#u),n=this.indexToValueInSpace(r>>8,this.#g),i=this.indexToValueInSpace(r>>16,this.#d),a=this.indexToValueInSpace(r>>24,this.#p),o=`hsl(${s}deg ${n}% ${i}%`;return 1!==a?`${o} / ${Math.floor(100*a)}%)`:`${o})`}indexToValueInSpace(t,e){if("number"==typeof e)return e;const r=e.count||e.max-e.min;return t%=r,e.min+Math.floor(t/(r-1)*(e.max-e.min))}},HSL:yt,HWB:bt,IsolationModeHighlight:Et,LCH:gt,Lab:ut,Legacy:vt,Nickname:xt,Nicknames:Rt,Oklab:dt,Oklch:pt,PageHighlight:At,Regex:/((?:rgba?|hsla?|hwba?|lab|lch|oklab|oklch|color)\([^)]+\)|#[0-9a-fA-F]{8}|#[0-9a-fA-F]{6}|#[0-9a-fA-F]{3,4}|\b[a-zA-Z]+\b(?!-))/g,ShortHex:St,SourceOrderHighlight:Pt,approachColorValue:lt,desiredLuminance:ot,findFgColorForContrast:function(t,e,r){const s=t.as("hsl").hsva(),n=e.rgba(),i=t=>O(E(vt.fromHSVA(t).rgba(),n)),a=O(e.rgba()),o=ot(a,r,i(s)>a);return lt(s,0,2,o,i)?vt.fromHSVA(s):(s[2]=1,lt(s,0,1,o,i)?vt.fromHSVA(s):null)},findFgColorForContrastAPCA:function(t,e,r){const s=t.as("hsl").hsva(),n=(e.rgba(),t=>B(vt.fromHSVA(t).rgba())),i=B(e.rgba()),a=X(i,r,n(s)>=i);if(lt(s,0,2,a,n)){const t=vt.fromHSVA(s);if(Math.abs(G(e.rgba(),t.rgba()))>=r)return t}if(s[2]=1,lt(s,0,1,a,n)){const t=vt.fromHSVA(s);if(Math.abs(G(e.rgba(),t.rgba()))>=r)return t}return null},getFormat:function(t){switch(t){case"hex":return"hex";case"hexa":return"hexa";case"rgb":return"rgb";case"rgba":return"rgba";case"hsl":return"hsl";case"hsla":return"hsla";case"hwb":return"hwb";case"hwba":return"hwba";case"lch":return"lch";case"oklch":return"oklch";case"lab":return"lab";case"oklab":return"oklab"}return Y(t)},hsl2rgb:it,hsva2rgba:at,parse:function(t){if(!t.match(/\s/)){const e=t.toLowerCase().match(/^(?:#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})|(\w+))$/i);if(e)return e[1]?vt.fromHex(e[1],t):e[2]?xt.fromName(e[2],t):null}const e=t.toLowerCase().match(/^\s*(?:(rgba?)|(hsla?)|(hwba?)|(lch)|(oklch)|(lab)|(oklab)|(color))\((.*)\)\s*$/);if(e){const r=Boolean(e[1]),s=Boolean(e[2]),n=Boolean(e[3]),i=Boolean(e[4]),a=Boolean(e[5]),o=Boolean(e[6]),l=Boolean(e[7]),h=Boolean(e[8]),c=e[9];if(h)return mt.fromSpec(t,c);const u=function(t,{allowCommas:e,convertNoneToZero:r}){const s=t.trim();let n=[];e&&(n=s.split(/\s*,\s*/));if(!e||1===n.length)if(n=s.split(/\s+/),"/"===n[3]){if(n.splice(3,1),4!==n.length)return null}else if(n.length>2&&-1!==n[2].indexOf("/")||n.length>3&&-1!==n[3].indexOf("/")){const t=n.slice(2,4).join("");n=n.slice(0,2).concat(t.split(/\//)).concat(n.slice(4))}else if(n.length>=4)return null;if(3!==n.length&&4!==n.length||n.indexOf("")>-1)return null;if(r)return n.map((t=>"none"===t?"0":t));return n}(c,{allowCommas:r||s,convertNoneToZero:!(r||s||n)});if(!u)return null;const g=[u[0],u[1],u[2],u[3]];if(r)return vt.fromRGBAFunction(u[0],u[1],u[2],u[3],t);if(s)return yt.fromSpec(g,t);if(n)return bt.fromSpec(g,t);if(i)return gt.fromSpec(g,t);if(a)return pt.fromSpec(g,t);if(o)return ut.fromSpec(g,t);if(l)return dt.fromSpec(g,t)}return null},parseHueNumeric:st,rgb2hsv:function(t){const e=L(t),r=e[0];let s=e[1];const n=e[2];return s*=n<.5?n:1-n,[r,0!==s?2*s/(n+s):0,n+s]}});class Lt{listeners;addEventListener(t,e,r){this.listeners||(this.listeners=new Map);let s=this.listeners.get(t);return s||(s=new Set,this.listeners.set(t,s)),s.add({thisObject:r,listener:e}),{eventTarget:this,eventType:t,thisObject:r,listener:e}}once(t){return new Promise((e=>{const r=this.addEventListener(t,(s=>{this.removeEventListener(t,r.listener),e(s.data)}))}))}removeEventListener(t,e,r){const s=this.listeners?.get(t);if(s){for(const t of s)t.listener===e&&t.thisObject===r&&(t.disposed=!0,s.delete(t));s.size||this.listeners?.delete(t)}}hasEventListeners(t){return Boolean(this.listeners?.has(t))}dispatchEventToListeners(t,...[e]){const r=this.listeners?.get(t);if(!r)return;const s={data:e,source:this};for(const t of[...r])t.disposed||t.listener.call(t.thisObject,s)}}var Ct=Object.freeze({__proto__:null,ObjectWrapper:Lt,eventMixin:function(t){return console.assert(t!==HTMLElement),class extends t{#y=new Lt;addEventListener(t,e,r){return this.#y.addEventListener(t,e,r)}once(t){return this.#y.once(t)}removeEventListener(t,e,r){this.#y.removeEventListener(t,e,r)}hasEventListeners(t){return this.#y.hasEventListeners(t)}dispatchEventToListeners(t,...e){this.#y.dispatchEventToListeners(t,...e)}}}});const _t={elementsPanel:"Elements panel",stylesSidebar:"styles sidebar",changesDrawer:"Changes drawer",issuesView:"Issues view",networkPanel:"Network panel",applicationPanel:"Application panel",securityPanel:"Security panel",sourcesPanel:"Sources panel",timelinePanel:"Performance panel",memoryInspectorPanel:"Memory inspector panel",developerResourcesPanel:"Developer Resources panel",animationsPanel:"Animations panel"},Nt=r.i18n.registerUIStrings("core/common/Revealer.ts",_t),Ot=r.i18n.getLazilyComputedLocalizedString.bind(void 0,Nt);let Vt;class Bt{registeredRevealers=[];static instance(){return void 0===Vt&&(Vt=new Bt),Vt}static removeInstance(){Vt=void 0}register(t){this.registeredRevealers.push(t)}async reveal(t,e){const r=await Promise.all(this.getApplicableRegisteredRevealers(t).map((t=>t.loadRevealer())));if(r.length<1)throw new Error(`No revealers found for ${t}`);if(r.length>1)throw new Error(`Conflicting reveals found for ${t}`);return await r[0].reveal(t,e)}getApplicableRegisteredRevealers(t){return this.registeredRevealers.filter((e=>{for(const r of e.contextTypes())if(t instanceof r)return!0;return!1}))}}async function Gt(t,e=!1){await Bt.instance().reveal(t,e)}const Mt={DEVELOPER_RESOURCES_PANEL:Ot(_t.developerResourcesPanel),ELEMENTS_PANEL:Ot(_t.elementsPanel),STYLES_SIDEBAR:Ot(_t.stylesSidebar),CHANGES_DRAWER:Ot(_t.changesDrawer),ISSUES_VIEW:Ot(_t.issuesView),NETWORK_PANEL:Ot(_t.networkPanel),TIMELINE_PANEL:Ot(_t.timelinePanel),APPLICATION_PANEL:Ot(_t.applicationPanel),SOURCES_PANEL:Ot(_t.sourcesPanel),SECURITY_PANEL:Ot(_t.securityPanel),MEMORY_INSPECTOR_PANEL:Ot(_t.memoryInspectorPanel),ANIMATIONS_PANEL:Ot(_t.animationsPanel)};var Wt=Object.freeze({__proto__:null,RevealerDestination:Mt,RevealerRegistry:Bt,registerRevealer:function(t){Bt.instance().register(t)},reveal:Gt,revealDestination:function(t){const e=Bt.instance().getApplicableRegisteredRevealers(t);for(const{destination:t}of e)if(t)return t();return null}});let Xt;class Dt extends Lt{#b;constructor(){super(),this.#b=[]}static instance(t){return Xt&&!t?.forceNew||(Xt=new Dt),Xt}static removeInstance(){Xt=void 0}addMessage(t,e="info",r=!1,s){const n=new jt(t,e,Date.now(),r,s);this.#b.push(n),this.dispatchEventToListeners("messageAdded",n)}log(t){this.addMessage(t,"info")}warn(t,e){this.addMessage(t,"warning",void 0,e)}error(t,e=!0){this.addMessage(t,"error",e)}messages(){return this.#b}show(){this.showPromise()}showPromise(){return Gt(this)}}var Ft;!function(t){t.CSS="css",t.ConsoleAPI="console-api",t.ISSUE_PANEL="issue-panel",t.SELF_XSS="self-xss"}(Ft||(Ft={}));class jt{text;level;timestamp;show;source;constructor(t,e,r,s,n){this.text=t,this.level=e,this.timestamp="number"==typeof r?r:Date.now(),this.show=s,n&&(this.source=n)}}var Ut=Object.freeze({__proto__:null,Console:Dt,get FrontendMessageSource(){return Ft},Message:jt});var $t=Object.freeze({__proto__:null,debounce:function(t,e){let r=0;return()=>{clearTimeout(r),r=window.setTimeout((()=>t()),e)}}});var Ht=Object.freeze({__proto__:null,fireEvent:function(t,e={},r=window){const s=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e});r.dispatchEvent(s)},removeEventListeners:function(t){for(const e of t)e.eventTarget.removeEventListener(e.eventType,e.listener,e.thisObject);t.splice(0)}}),qt=Object.freeze({__proto__:null});const Yt=Symbol("uninitialized"),Zt=Symbol("error");var Kt=Object.freeze({__proto__:null,lazy:function(t){let e=Yt,r=new Error("Initial");return()=>{if(e===Zt)throw r;if(e!==Yt)return e;try{return e=t(),e}catch(t){throw r=t instanceof Error?t:new Error(t),e=Zt,r}}}});const Jt=[];function Qt(t){return Jt.filter((function(e){if(!e.contextTypes)return!0;for(const r of e.contextTypes())if(t instanceof r)return!0;return!1}))}var te=Object.freeze({__proto__:null,Linkifier:class{static async linkify(t,e){if(!t)throw new Error("Can't linkify "+t);const r=Qt(t)[0];if(!r)throw new Error("No linkifiers registered for object "+t);return(await r.loadLinkifier()).linkify(t,e)}},getApplicableRegisteredlinkifiers:Qt,registerLinkifier:function(t){Jt.push(t)}});class ee extends Map{getOrInsert(t,e){return this.has(t)||this.set(t,e),this.get(t)}getOrInsertComputed(t,e){return this.has(t)||this.set(t,e(t)),this.get(t)}}var re=Object.freeze({__proto__:null,MapWithDefault:ee});var se=Object.freeze({__proto__:null,Mutex:class{#f=!1;#w=[];acquire(){const t={resolved:!1};return this.#f?new Promise((e=>{this.#w.push((()=>e(this.#S.bind(this,t))))})):(this.#f=!0,Promise.resolve(this.#S.bind(this,t)))}#S(t){if(t.resolved)throw new Error("Cannot release more than once.");t.resolved=!0;const e=this.#w.shift();e?e():this.#f=!1}async run(t){const e=await this.acquire();try{return await t()}finally{e()}}}});function ne(t){if(-1===t.indexOf("..")&&-1===t.indexOf("."))return t;const e=("/"===t[0]?t.substring(1):t).split("/"),r=[];for(const t of e)"."!==t&&(".."===t?r.pop():r.push(t));let s=r.join("/");return"/"===t[0]&&s&&(s="/"+s),"/"===s[s.length-1]||"/"!==t[t.length-1]&&"."!==e[e.length-1]&&".."!==e[e.length-1]||(s+="/"),s}class ie{isValid;url;scheme;user;host;port;path;queryParams;fragment;folderPathComponents;lastPathComponent;blobInnerScheme;#x;#v;constructor(t){this.isValid=!1,this.url=t,this.scheme="",this.user="",this.host="",this.port="",this.path="",this.queryParams="",this.fragment="",this.folderPathComponents="",this.lastPathComponent="";const e=this.url.startsWith("blob:"),r=(e?t.substring(5):t).match(ie.urlRegex());if(r)this.isValid=!0,e?(this.blobInnerScheme=r[2].toLowerCase(),this.scheme="blob"):this.scheme=r[2].toLowerCase(),this.user=r[3]??"",this.host=r[4]??"",this.port=r[5]??"",this.path=r[6]??"/",this.queryParams=r[7]??"",this.fragment=r[8]??"";else{if(this.url.startsWith("data:"))return void(this.scheme="data");if(this.url.startsWith("blob:"))return void(this.scheme="blob");if("about:blank"===this.url)return void(this.scheme="about");this.path=this.url}const s=this.path.lastIndexOf("/",this.path.length-2);this.lastPathComponent=-1!==s?this.path.substring(s+1):this.path;const n=this.path.lastIndexOf("/");-1!==n&&(this.folderPathComponents=this.path.substring(0,n))}static fromString(t){const e=new ie(t.toString());return e.isValid?e:null}static preEncodeSpecialCharactersInPath(t){for(const e of["%",";","#","?"," "])t=t.replaceAll(e,encodeURIComponent(e));return t}static rawPathToEncodedPathString(t){const e=ie.preEncodeSpecialCharactersInPath(t);return t.startsWith("/")?new URL(e,"file:///").pathname:new URL("/"+e,"file:///").pathname.substr(1)}static encodedFromParentPathAndName(t,e){return ie.concatenate(t,"/",ie.preEncodeSpecialCharactersInPath(e))}static urlFromParentUrlAndName(t,e){return ie.concatenate(t,"/",ie.preEncodeSpecialCharactersInPath(e))}static encodedPathToRawPathString(t){return decodeURIComponent(t)}static rawPathToUrlString(t){let e=ie.preEncodeSpecialCharactersInPath(t.replace(/\\/g,"/"));return e=e.replace(/\\/g,"/"),e.startsWith("file://")||(e=e.startsWith("/")?"file://"+e:"file:///"+e),new URL(e).toString()}static relativePathToUrlString(t,e){const r=ie.preEncodeSpecialCharactersInPath(t.replace(/\\/g,"/"));return new URL(r,e).toString()}static urlToRawPathString(t,e){console.assert(t.startsWith("file://"),"This must be a file URL.");const r=decodeURIComponent(t);return e?r.substr(8).replace(/\//g,"\\"):r.substr(7)}static sliceUrlToEncodedPathString(t,e){return t.substring(e)}static substr(t,e,r){return t.substr(e,r)}static substring(t,e,r){return t.substring(e,r)}static prepend(t,e){return t+e}static concatenate(t,...e){return t.concat(...e)}static trim(t){return t.trim()}static slice(t,e,r){return t.slice(e,r)}static join(t,e){return t.join(e)}static split(t,e,r){return t.split(e,r)}static toLowerCase(t){return t.toLowerCase()}static isValidUrlString(t){return new ie(t).isValid}static urlWithoutHash(t){const e=t.indexOf("#");return-1!==e?t.substr(0,e):t}static urlRegex(){if(ie.urlRegexInstance)return ie.urlRegexInstance;return ie.urlRegexInstance=new RegExp("^("+/([A-Za-z][A-Za-z0-9+.-]*):\/\//.source+/(?:([A-Za-z0-9\-._~%!$&'()*+,;=:]*)@)?/.source+/((?:\[::\d?\])|(?:[^\s\/:]*))/.source+/(?::([\d]+))?/.source+")"+/(\/[^#?]*)?/.source+/(?:\?([^#]*))?/.source+/(?:#(.*))?/.source+"$"),ie.urlRegexInstance}static extractPath(t){const e=this.fromString(t);return e?e.path:""}static extractOrigin(t){const r=this.fromString(t);return r?r.securityOrigin():e.DevToolsPath.EmptyUrlString}static extractExtension(t){const e=(t=ie.urlWithoutHash(t)).indexOf("?");-1!==e&&(t=t.substr(0,e));const r=t.lastIndexOf("/");-1!==r&&(t=t.substr(r+1));const s=t.lastIndexOf(".");if(-1!==s){const e=(t=t.substr(s+1)).indexOf("%");return-1!==e?t.substr(0,e):t}return""}static extractName(t){let e=t.lastIndexOf("/");const r=-1!==e?t.substr(e+1):t;return e=r.indexOf("?"),e<0?r:r.substr(0,e)}static completeURL(t,e){if(e.startsWith("data:")||e.startsWith("blob:")||e.startsWith("javascript:")||e.startsWith("mailto:"))return e;const r=e.trim(),s=this.fromString(r);if(s?.scheme){return s.securityOrigin()+ne(s.path)+(s.queryParams&&`?${s.queryParams}`)+(s.fragment&&`#${s.fragment}`)}const n=this.fromString(t);if(!n)return null;if(n.isDataURL())return e;if(e.length>1&&"/"===e.charAt(0)&&"/"===e.charAt(1))return n.scheme+":"+e;const i=n.securityOrigin(),a=n.path,o=n.queryParams?"?"+n.queryParams:"";if(!e.length)return i+a+o;if("#"===e.charAt(0))return i+a+o+e;if("?"===e.charAt(0))return i+a+e;const l=e.match(/^[^#?]*/);if(!l||!e.length)throw new Error("Invalid href");let h=l[0];const c=e.substring(h.length);return"/"!==h.charAt(0)&&(h=n.folderPathComponents+"/"+h),i+ne(h)+c}static splitLineAndColumn(t){const e=t.match(ie.urlRegex());let r="",s=t;e&&(r=e[1],s=t.substring(e[1].length));const n=/(?::(\d+))?(?::(\d+))?$/.exec(s);let i,a;if(console.assert(Boolean(n)),!n)return{url:t,lineNumber:0,columnNumber:0};"string"==typeof n[1]&&(i=parseInt(n[1],10),i=isNaN(i)?void 0:i-1),"string"==typeof n[2]&&(a=parseInt(n[2],10),a=isNaN(a)?void 0:a-1);let o=r+s.substring(0,s.length-n[0].length);if(void 0===n[1]&&void 0===n[2]){const t=/wasm-function\[\d+\]:0x([a-z0-9]+)$/g.exec(s);t&&"string"==typeof t[1]&&(o=ie.removeWasmFunctionInfoFromURL(o),a=parseInt(t[1],16),a=isNaN(a)?void 0:a)}return{url:o,lineNumber:i,columnNumber:a}}static removeWasmFunctionInfoFromURL(t){const e=t.search(/:wasm-function\[\d+\]/);return-1===e?t:ie.substring(t,0,e)}static beginsWithWindowsDriveLetter(t){return/^[A-Za-z]:/.test(t)}static beginsWithScheme(t){return/^[A-Za-z][A-Za-z0-9+.-]*:/.test(t)}static isRelativeURL(t){return!this.beginsWithScheme(t)||this.beginsWithWindowsDriveLetter(t)}get displayName(){return this.#x?this.#x:this.isDataURL()?this.dataURLDisplayName():this.isBlobURL()||this.isAboutBlank()?this.url:(this.#x=this.lastPathComponent,this.#x||(this.#x=(this.host||"")+"/"),"/"===this.#x&&(this.#x=this.url),this.#x)}dataURLDisplayName(){return this.#v?this.#v:this.isDataURL()?(this.#v=e.StringUtilities.trimEndWithMaxLength(this.url,20),this.#v):""}isAboutBlank(){return"about:blank"===this.url}isDataURL(){return"data"===this.scheme}extractDataUrlMimeType(){const t=this.url.match(/^data:((?\w+)\/(?\w+))?(;base64)?,/);return{type:t?.groups?.type,subtype:t?.groups?.subtype}}isBlobURL(){return this.url.startsWith("blob:")}lastPathComponentWithFragment(){return this.lastPathComponent+(this.fragment?"#"+this.fragment:"")}domain(){return this.isDataURL()?"data:":this.host+(this.port?":"+this.port:"")}securityOrigin(){if(this.isDataURL())return"data:";return(this.isBlobURL()?this.blobInnerScheme:this.scheme)+"://"+this.domain()}urlWithoutScheme(){return this.scheme&&this.url.startsWith(this.scheme+"://")?this.url.substring(this.scheme.length+3):this.url}static urlRegexInstance=null}var ae=Object.freeze({__proto__:null,ParsedURL:ie,normalizePath:ne,schemeIs:function(t,e){try{return new URL(t).protocol===e}catch{return!1}}});class oe{#T;#R;#z;#I;constructor(t,e){this.#T=t,this.#R=e||1,this.#z=0,this.#I=0}isCanceled(){return this.#T.parent.isCanceled()}setTitle(t){this.#T.parent.setTitle(t)}done(){this.setWorked(this.#I),this.#T.childDone()}setTotalWork(t){this.#I=t,this.#T.update()}setWorked(t,e){this.#z=t,void 0!==e&&this.setTitle(e),this.#T.update()}incrementWorked(t){this.setWorked(this.#z+(t||1))}getWeight(){return this.#R}getWorked(){return this.#z}getTotalWork(){return this.#I}}var le=Object.freeze({__proto__:null,CompositeProgress:class{parent;#A;#P;constructor(t){this.parent=t,this.#A=[],this.#P=0,this.parent.setTotalWork(1),this.parent.setWorked(0)}childDone(){++this.#P===this.#A.length&&this.parent.done()}createSubProgress(t){const e=new oe(this,t);return this.#A.push(e),e}update(){let t=0,e=0;for(let r=0;r{};return this.getOrCreatePromise(t).catch(r).then((t=>{t&&e(t)})),null}return r}clear(){this.stopListening();for(const[t,{reject:e}]of this.#L.entries())e(new Error(`Object with ${t} never resolved.`));this.#L.clear()}getOrCreatePromise(t){const e=this.#L.get(t);if(e)return e.promise;const{resolve:r,reject:s,promise:n}=Promise.withResolvers();return this.#L.set(t,{promise:n,resolve:r,reject:s}),this.startListening(),n}onResolve(t,e){const r=this.#L.get(t);this.#L.delete(t),0===this.#L.size&&this.stopListening(),r?.resolve(e)}}});const ue={fetchAndXHR:"`Fetch` and `XHR`",javascript:"JavaScript",js:"JS",css:"CSS",img:"Img",media:"Media",font:"Font",doc:"Doc",socketShort:"Socket",webassembly:"WebAssembly",wasm:"Wasm",manifest:"Manifest",other:"Other",document:"Document",stylesheet:"Stylesheet",image:"Image",script:"Script",texttrack:"TextTrack",fetch:"Fetch",eventsource:"EventSource",websocket:"WebSocket",webtransport:"WebTransport",directsocket:"DirectSocket",signedexchange:"SignedExchange",ping:"Ping",cspviolationreport:"CSPViolationReport",preflight:"Preflight",webbundle:"WebBundle"},ge=r.i18n.registerUIStrings("core/common/ResourceType.ts",ue),de=r.i18n.getLazilyComputedLocalizedString.bind(void 0,ge);class pe{#C;#_;#N;#O;constructor(t,e,r,s){this.#C=t,this.#_=e,this.#N=r,this.#O=s}static fromMimeType(t){return t?t.startsWith("text/html")?fe.Document:t.startsWith("text/css")?fe.Stylesheet:t.startsWith("image/")?fe.Image:t.startsWith("text/")?fe.Script:t.includes("font")?fe.Font:t.includes("script")?fe.Script:t.includes("octet")?fe.Other:t.includes("application")?fe.Script:fe.Other:fe.Other}static fromMimeTypeOverride(t){return"application/manifest+json"===t?fe.Manifest:"application/wasm"===t?fe.Wasm:"application/webbundle"===t?fe.WebBundle:null}static fromURL(t){return Se.get(ie.extractExtension(t))||null}static fromName(t){for(const e in fe){const r=fe[e];if(r.name()===t)return r}return null}static mimeFromURL(t){if(t.startsWith("snippet://")||t.startsWith("debugger://"))return"text/javascript";const e=ie.extractName(t);if(we.has(e))return we.get(e);let r=ie.extractExtension(t).toLowerCase();return"html"===r&&e.endsWith(".component.html")&&(r="component.html"),xe.get(r)}static mimeFromExtension(t){return xe.get(t)}static simplifyContentType(t){return new RegExp("^application(.*json$|/json+.*)").test(t)?"application/json":t}static mediaTypeForMetrics(t,e,r,s,n){return"text/javascript"!==t?t:e?"text/javascript+sourcemapped":r?"text/javascript+minified":s?"text/javascript+snippet":n?"text/javascript+eval":"text/javascript+plain"}name(){return this.#C}title(){return this.#_()}category(){return this.#N}isTextType(){return this.#O}isScript(){return"script"===this.#C||"sm-script"===this.#C}hasScripts(){return this.isScript()||this.isDocument()}isStyleSheet(){return"stylesheet"===this.#C||"sm-stylesheet"===this.#C}hasStyleSheets(){return this.isStyleSheet()||this.isDocument()}isDocument(){return"document"===this.#C}isDocumentOrScriptOrStyleSheet(){return this.isDocument()||this.isScript()||this.isStyleSheet()}isFont(){return"font"===this.#C}isImage(){return"image"===this.#C}isFromSourceMap(){return this.#C.startsWith("sm-")}isWebbundle(){return"webbundle"===this.#C}toString(){return this.#C}canonicalMimeType(){return this.isDocument()?"text/html":this.isScript()?"text/javascript":this.isStyleSheet()?"text/css":""}}class me{name;title;shortTitle;constructor(t,e,r){this.name=t,this.title=e,this.shortTitle=r}}const ye={XHR:new me("Fetch and XHR",de(ue.fetchAndXHR),r.i18n.lockedLazyString("Fetch/XHR")),Document:new me(ue.document,de(ue.document),de(ue.doc)),Stylesheet:new me(ue.css,de(ue.css),de(ue.css)),Script:new me(ue.javascript,de(ue.javascript),de(ue.js)),Font:new me(ue.font,de(ue.font),de(ue.font)),Image:new me(ue.image,de(ue.image),de(ue.img)),Media:new me(ue.media,de(ue.media),de(ue.media)),Manifest:new me(ue.manifest,de(ue.manifest),de(ue.manifest)),Socket:new me("Socket",r.i18n.lockedLazyString("WebSocket | WebTransport | DirectSocket"),de(ue.socketShort)),Wasm:new me(ue.webassembly,de(ue.webassembly),de(ue.wasm)),Other:new me(ue.other,de(ue.other),de(ue.other))},be={XHR:new me("Fetch and XHR",de(ue.fetchAndXHR),r.i18n.lockedLazyString("Fetch/XHR")),Script:new me(ue.javascript,de(ue.javascript),de(ue.js)),Image:new me(ue.image,de(ue.image),de(ue.img)),Media:new me(ue.media,de(ue.media),de(ue.media)),Other:new me(ue.other,de(ue.other),de(ue.other))},fe={Document:new pe("document",de(ue.document),ye.Document,!0),Stylesheet:new pe("stylesheet",de(ue.stylesheet),ye.Stylesheet,!0),Image:new pe("image",de(ue.image),ye.Image,!1),Media:new pe("media",de(ue.media),ye.Media,!1),Font:new pe("font",de(ue.font),ye.Font,!1),Script:new pe("script",de(ue.script),ye.Script,!0),TextTrack:new pe("texttrack",de(ue.texttrack),ye.Other,!0),XHR:new pe("xhr",r.i18n.lockedLazyString("XHR"),ye.XHR,!0),Fetch:new pe("fetch",de(ue.fetch),ye.XHR,!0),Prefetch:new pe("prefetch",r.i18n.lockedLazyString("Prefetch"),ye.Document,!0),EventSource:new pe("eventsource",de(ue.eventsource),ye.XHR,!0),WebSocket:new pe("websocket",de(ue.websocket),ye.Socket,!1),WebTransport:new pe("webtransport",de(ue.webtransport),ye.Socket,!1),DirectSocket:new pe("directsocket",de(ue.directsocket),ye.Socket,!1),Wasm:new pe("wasm",de(ue.wasm),ye.Wasm,!1),Manifest:new pe("manifest",de(ue.manifest),ye.Manifest,!0),SignedExchange:new pe("signed-exchange",de(ue.signedexchange),ye.Other,!1),Ping:new pe("ping",de(ue.ping),ye.Other,!1),CSPViolationReport:new pe("csp-violation-report",de(ue.cspviolationreport),ye.Other,!1),Other:new pe("other",de(ue.other),ye.Other,!1),Preflight:new pe("preflight",de(ue.preflight),ye.Other,!0),SourceMapScript:new pe("sm-script",de(ue.script),ye.Script,!0),SourceMapStyleSheet:new pe("sm-stylesheet",de(ue.stylesheet),ye.Stylesheet,!0),WebBundle:new pe("webbundle",de(ue.webbundle),ye.Other,!1)},we=new Map([["Cakefile","text/x-coffeescript"]]),Se=new Map([["js",fe.Script],["mjs",fe.Script],["css",fe.Stylesheet],["xsl",fe.Stylesheet],["avif",fe.Image],["bmp",fe.Image],["gif",fe.Image],["ico",fe.Image],["jpeg",fe.Image],["jpg",fe.Image],["jxl",fe.Image],["png",fe.Image],["svg",fe.Image],["tif",fe.Image],["tiff",fe.Image],["vue",fe.Document],["webmanifest",fe.Manifest],["webp",fe.Media],["otf",fe.Font],["ttc",fe.Font],["ttf",fe.Font],["woff",fe.Font],["woff2",fe.Font],["wasm",fe.Wasm]]),xe=new Map([["js","text/javascript"],["mjs","text/javascript"],["css","text/css"],["html","text/html"],["htm","text/html"],["xml","application/xml"],["xsl","application/xml"],["wasm","application/wasm"],["webmanifest","application/manifest+json"],["asp","application/x-aspx"],["aspx","application/x-aspx"],["jsp","application/x-jsp"],["c","text/x-c++src"],["cc","text/x-c++src"],["cpp","text/x-c++src"],["h","text/x-c++src"],["m","text/x-c++src"],["mm","text/x-c++src"],["coffee","text/x-coffeescript"],["dart","application/vnd.dart"],["ts","text/typescript"],["tsx","text/typescript-jsx"],["json","application/json"],["gyp","application/json"],["gypi","application/json"],["map","application/json"],["cs","text/x-csharp"],["go","text/x-go"],["java","text/x-java"],["kt","text/x-kotlin"],["scala","text/x-scala"],["less","text/x-less"],["php","application/x-httpd-php"],["phtml","application/x-httpd-php"],["py","text/x-python"],["sh","text/x-sh"],["gss","text/x-gss"],["sass","text/x-sass"],["scss","text/x-scss"],["vtt","text/vtt"],["ls","text/x-livescript"],["md","text/markdown"],["cljs","text/x-clojure"],["cljc","text/x-clojure"],["cljx","text/x-clojure"],["styl","text/x-styl"],["jsx","text/jsx"],["avif","image/avif"],["bmp","image/bmp"],["gif","image/gif"],["ico","image/ico"],["jpeg","image/jpeg"],["jpg","image/jpeg"],["jxl","image/jxl"],["png","image/png"],["svg","image/svg+xml"],["tif","image/tif"],["tiff","image/tiff"],["webp","image/webp"],["otf","font/otf"],["ttc","font/collection"],["ttf","font/ttf"],["woff","font/woff"],["woff2","font/woff2"],["component.html","text/x.angular"],["svelte","text/x.svelte"],["vue","text/x.vue"]]);var ve=Object.freeze({__proto__:null,ResourceCategory:me,ResourceType:pe,mimeTypeByExtension:xe,resourceCategories:ye,resourceCategoriesReactNative:be,resourceTypeByExtension:Se,resourceTypes:fe});const Te=new Map;const Re=[];var ze=Object.freeze({__proto__:null,earlyInitializationRunnables:function(){return Re},lateInitializationRunnables:function(){return[...Te.values()]},maybeRemoveLateInitializationRunnable:function(t){return Te.delete(t)},registerEarlyInitializationRunnable:function(t){Re.push(t)},registerLateInitializationRunnable:function(t){const{id:e,loadRunnable:r}=t;if(Te.has(e))throw new Error(`Duplicate late Initializable runnable id '${e}'`);Te.set(e,r)}});class Ie{begin;end;data;constructor(t,e,r){if(t>e)throw new Error("Invalid segment");this.begin=t,this.end=e,this.data=r}intersects(t){return this.begint.begin-e.begin)),s=r,n=null;if(r>0){const e=this.#V[r-1];n=this.tryMerge(e,t),n?(--r,t=n):this.#V[r-1].end>=t.begin&&(t.endt.Runtime.Runtime.isDescriptorEnabled(e)))}function Oe(t,e=!1){if(0===Le.length||e){Le=t,Ce.clear();for(const e of t){const t=e.settingName;if(Ce.has(t))throw new Error(`Duplicate setting name '${t}'`);Ce.add(t)}}}function Ve(){Le=[],Ce.clear()}function Be(t){const e=Le.findIndex((e=>e.settingName===t));return!(e<0||!Ce.delete(t))&&(Le.splice(e,1),!0)}function Ge(t){switch(t){case"ELEMENTS":return ke(Pe.elements);case"AI":return ke(Pe.ai);case"APPEARANCE":return ke(Pe.appearance);case"SOURCES":return ke(Pe.sources);case"NETWORK":return ke(Pe.network);case"PERFORMANCE":return ke(Pe.performance);case"CONSOLE":case"EMULATION":return ke(Pe.console);case"PERSISTENCE":return ke(Pe.persistence);case"DEBUGGER":return ke(Pe.debugger);case"GLOBAL":return ke(Pe.global);case"RENDERING":return ke(Pe.rendering);case"GRID":return ke(Pe.grid);case"MOBILE":return ke(Pe.mobile);case"MEMORY":return ke(Pe.memory);case"EXTENSIONS":return ke(Pe.extension);case"ADORNER":return ke(Pe.adorner);case"":return r.i18n.lockedString("");case"SYNC":return ke(Pe.sync);case"PRIVACY":return ke(Pe.privacy)}}var Me=Object.freeze({__proto__:null,getLocalizedSettingsCategory:Ge,getRegisteredSettings:Ne,maybeRemoveSettingExtension:Be,registerSettingExtension:_e,registerSettingsForTest:Oe,resetSettings:Ve});let We;class Xe{syncedStorage;globalStorage;localStorage;#G=new Fe({});settingNameSet=new Set;orderValuesBySettingCategory=new Map;#M=new Lt;#W=new Map;moduleSettings=new Map;#X;constructor(e,r,s,n){this.syncedStorage=e,this.globalStorage=r,this.localStorage=s,this.#X=n;for(const e of this.getRegisteredSettings()){const{settingName:r,defaultValue:s,storageType:n}=e,i="regex"===e.settingType,a="function"==typeof s?s(t.Runtime.hostConfig):s,o=i&&"string"==typeof a?this.createRegExpSetting(r,a,void 0,n):this.createSetting(r,a,n);o.setTitleFunction(e.title),e.userActionCondition&&o.setRequiresUserAction(Boolean(t.Runtime.Runtime.queryParam(e.userActionCondition))),o.setRegistration(e),this.registerModuleSetting(o)}}getRegisteredSettings(){return Ne()}static hasInstance(){return void 0!==We}static instance(t={forceNew:null,syncedStorage:null,globalStorage:null,localStorage:null}){const{forceNew:e,syncedStorage:r,globalStorage:s,localStorage:n,logSettingAccess:i}=t;if(!We||e){if(!r||!s||!n)throw new Error(`Unable to create settings: global and local storage must be provided: ${(new Error).stack}`);We=new Xe(r,s,n,i)}return We}static removeInstance(){We=void 0}registerModuleSetting(t){const e=t.name,r=t.category(),s=t.order();if(this.settingNameSet.has(e))throw new Error(`Duplicate Setting name '${e}'`);if(r&&s){const t=this.orderValuesBySettingCategory.get(r)||new Set;if(t.has(s))throw new Error(`Duplicate order value '${s}' for settings category '${r}'`);t.add(s),this.orderValuesBySettingCategory.set(r,t)}this.settingNameSet.add(e),this.moduleSettings.set(t.name,t)}static normalizeSettingName(t){return[qe.GLOBAL_VERSION_SETTING_NAME,qe.SYNCED_VERSION_SETTING_NAME,qe.LOCAL_VERSION_SETTING_NAME,"currentDockState","isUnderTest"].includes(t)?t:e.StringUtilities.toKebabCase(t)}moduleSetting(t){const e=this.moduleSettings.get(t);if(!e)throw new Error("No setting registered: "+t);return e}settingForTest(t){const e=this.#W.get(t);if(!e)throw new Error("No setting registered: "+t);return e}createSetting(t,e,r){const s=this.storageFromType(r);let n=this.#W.get(t);return n||(n=new $e(t,e,this.#M,s,this.#X),this.#W.set(t,n)),n}createLocalSetting(t,e){return this.createSetting(t,e,"Local")}createRegExpSetting(t,e,r,s){return this.#W.get(t)||this.#W.set(t,new He(t,e,this.#M,this.storageFromType(s),r,this.#X)),this.#W.get(t)}clearAll(){this.globalStorage.removeAll(),this.syncedStorage.removeAll(),this.localStorage.removeAll(),(new qe).resetToCurrent()}storageFromType(t){switch(t){case"Local":return this.localStorage;case"Session":return this.#G;case"Global":return this.globalStorage;case"Synced":return this.syncedStorage}return this.globalStorage}getRegistry(){return this.#W}}const De={register:()=>{},set:()=>{},get:()=>Promise.resolve(""),remove:()=>{},clear:()=>{}};class Fe{object;backingStore;storagePrefix;constructor(t,e=De,r=""){this.object=t,this.backingStore=e,this.storagePrefix=r}register(t){t=this.storagePrefix+t,this.backingStore.register(t)}set(t,e){t=this.storagePrefix+t,this.object[t]=e,this.backingStore.set(t,e)}has(t){return(t=this.storagePrefix+t)in this.object}get(t){return t=this.storagePrefix+t,this.object[t]}async forceGet(t){const e=this.storagePrefix+t,r=await this.backingStore.get(e);return r&&r!==this.object[e]?this.set(t,r):r||this.remove(t),r}remove(t){t=this.storagePrefix+t,delete this.object[t],this.backingStore.remove(t)}removeAll(){this.object={},this.backingStore.clear()}keys(){return Object.keys(this.object)}dumpSizes(){Dt.instance().log("Ten largest settings: ");const t={__proto__:null};for(const e in this.object)t[e]=this.object[e].length;const e=Object.keys(t);e.sort((function(e,r){return t[r]-t[e]}));for(let r=0;r<10&&rt.name===e.experiment)):void 0}}class $e{name;defaultValue;eventSupport;storage;#D;#_;#F=null;#j;#U;#$=JSON;#H;#q;#Y=null;#Z=!1;#X;constructor(t,e,r,s,n){this.name=t,this.defaultValue=e,this.eventSupport=r,this.storage=s,s.register(this.name),this.#X=n}setSerializer(t){this.#$=t}addChangeListener(t,e){return this.eventSupport.addEventListener(this.name,t,e)}removeChangeListener(t,e){this.eventSupport.removeEventListener(this.name,t,e)}title(){return this.#_?this.#_:this.#D?this.#D():""}setTitleFunction(t){t&&(this.#D=t)}setTitle(t){this.#_=t}setRequiresUserAction(t){this.#j=t}disabled(){if(this.#F?.disabledCondition){const{disabled:e}=this.#F.disabledCondition(t.Runtime.hostConfig);if(e)return!0}return this.#q||!1}disabledReasons(){if(this.#F?.disabledCondition){const e=this.#F.disabledCondition(t.Runtime.hostConfig);if(e.disabled)return e.reasons}return[]}setDisabled(t){this.#q=t,this.eventSupport.dispatchEventToListeners(this.name)}#K(t){const e="string"==typeof t||"number"==typeof t||"boolean"==typeof t?t:this.#$?.stringify(t);void 0!==e&&this.#X&&this.#X(this.name,e)}#J(t){this.#Z||(this.#K(t),this.#Z=!0)}get(){if(this.#j&&!this.#H)return this.#J(this.defaultValue),this.defaultValue;if(void 0!==this.#U)return this.#J(this.#U),this.#U;if(this.#U=this.defaultValue,this.storage.has(this.name))try{this.#U=this.#$.parse(this.storage.get(this.name))}catch{this.storage.remove(this.name)}return this.#J(this.#U),this.#U}getIfNotDisabled(){if(!this.disabled())return this.get()}async forceGet(){const t=this.name,e=this.storage.get(t),r=await this.storage.forceGet(t);if(this.#U=this.defaultValue,r)try{this.#U=this.#$.parse(r)}catch{this.storage.remove(this.name)}return e!==r&&this.eventSupport.dispatchEventToListeners(this.name,this.#U),this.#J(this.#U),this.#U}set(t){this.#K(t),this.#H=!0,this.#U=t;try{const e=this.#$.stringify(t);try{this.storage.set(this.name,e)}catch(t){this.printSettingsSavingError(t.message,this.name,e)}}catch(t){Dt.instance().error("Cannot stringify setting with name: "+this.name+", error: "+t.message)}this.eventSupport.dispatchEventToListeners(this.name,t)}setRegistration(e){this.#F=e;const{deprecationNotice:r}=e;if(r?.disabled){const e=r.experiment?t.Runtime.experiments.allConfigurableExperiments().find((t=>t.name===r.experiment)):void 0;e&&!e.isEnabled()||(this.set(this.defaultValue),this.setDisabled(!0))}}type(){return this.#F?this.#F.settingType:null}options(){return this.#F&&this.#F.options?this.#F.options.map((t=>{const{value:e,title:r,text:s,raw:n}=t;return{value:e,title:r(),text:"function"==typeof s?s():s,raw:n}})):[]}reloadRequired(){return this.#F&&this.#F.reloadRequired||null}category(){return this.#F&&this.#F.category||null}tags(){return this.#F&&this.#F.tags?this.#F.tags.map((t=>t())).join("\0"):null}order(){return this.#F&&this.#F.order||null}learnMore(){return this.#F?.learnMore??null}get deprecation(){return this.#F&&this.#F.deprecationNotice?(this.#Y||(this.#Y=new Ue(this.#F)),this.#Y):null}printSettingsSavingError(t,e,r){const s="Error saving setting with name: "+this.name+", value length: "+r.length+". Error: "+t;console.error(s),Dt.instance().error(s),this.storage.dumpSizes()}}class He extends $e{#Q;#tt;constructor(t,e,r,s,n,i){super(t,e?[{pattern:e}]:[],r,s,i),this.#Q=n}get(){const t=[],e=this.getAsArray();for(let r=0;r`-url:${t}`)).join(" ");if(e){const t=Xe.instance().createSetting("console.textFilter",""),r=t.get()?` ${t.get()}`:"";t.set(`${e}${r}`)}je(t)}updateVersionFrom26To27(){function t(t,e,r){const s=Xe.instance().createSetting(t,{}),n=s.get();e in n&&(n[r]=n[e],delete n[e],s.set(n))}t("panel-tabOrder","audits2","audits"),t("panel-closeableTabs","audits2","audits"),function(t,e,r){const s=Xe.instance().createSetting(t,"");s.get()===e&&s.set(r)}("panel-selectedTab","audits2","audits")}updateVersionFrom27To28(){const t=Xe.instance().createSetting("uiTheme","systemPreferred");"default"===t.get()&&t.set("systemPreferred")}updateVersionFrom28To29(){function t(t,e,r){const s=Xe.instance().createSetting(t,{}),n=s.get();e in n&&(n[r]=n[e],delete n[e],s.set(n))}t("panel-tabOrder","audits","lighthouse"),t("panel-closeableTabs","audits","lighthouse"),function(t,e,r){const s=Xe.instance().createSetting(t,"");s.get()===e&&s.set(r)}("panel-selectedTab","audits","lighthouse")}updateVersionFrom29To30(){const t=Xe.instance().createSetting("closeableTabs",{}),e=Xe.instance().createSetting("panel-closeableTabs",{}),r=Xe.instance().createSetting("drawer-view-closeableTabs",{}),s=e.get(),n=e.get(),i=Object.assign(n,s);t.set(i),je(e),je(r)}updateVersionFrom30To31(){je(Xe.instance().createSetting("recorder_recordings",[]))}updateVersionFrom31To32(){const t=Xe.instance().createLocalSetting("breakpoints",[]),e=t.get();for(const t of e)t.resourceTypeName="script";t.set(e)}updateVersionFrom32To33(){const t=Xe.instance().createLocalSetting("previouslyViewedFiles",[]);let e=t.get();e=e.filter((t=>"url"in t));for(const t of e)t.resourceTypeName="script";t.set(e)}updateVersionFrom33To34(){const t=Xe.instance().createLocalSetting("breakpoints",[]),e=t.get();for(const t of e){const e=t.condition.startsWith("/** DEVTOOLS_LOGPOINT */ console.log(")&&t.condition.endsWith(")");t.isLogpoint=e}t.set(e)}updateVersionFrom34To35(){const t=Xe.instance().createLocalSetting("breakpoints",[]),e=t.get();for(const t of e){const{condition:e,isLogpoint:r}=t;r&&(t.condition=e.slice(37,e.length-1))}t.set(e)}updateVersionFrom35To36(){Xe.instance().createSetting("showThirdPartyIssues",!0).set(!0)}updateVersionFrom36To37(){const t=t=>{for(const e of t.keys()){const r=Xe.normalizeSettingName(e);if(r!==e){const s=t.get(e);je({name:e,storage:t}),t.set(r,s)}}};t(Xe.instance().globalStorage),t(Xe.instance().syncedStorage),t(Xe.instance().localStorage);for(const t of Xe.instance().globalStorage.keys()){if(t.startsWith("data-grid-")&&t.endsWith("-column-weights")||t.endsWith("-tab-order")||"views-location-override"===t||"closeable-tabs"===t){const r=Xe.instance().createSetting(t,{});r.set(e.StringUtilities.toKebabCaseKeys(r.get()))}if(t.endsWith("-selected-tab")){const r=Xe.instance().createSetting(t,"");r.set(e.StringUtilities.toKebabCase(r.get()))}}}updateVersionFrom37To38(){const t=(()=>{try{return Ye("console-insights-enabled")}catch{return}})(),e=Xe.instance().createLocalSetting("console-insights-onboarding-finished",!1);t&&!0===t.get()&&!1===e.get()&&t.set(!1),t&&!1===t.get()&&e.set(!1)}migrateSettingsFromLocalStorage(){const t=new Set(["advancedSearchConfig","breakpoints","consoleHistory","domBreakpoints","eventListenerBreakpoints","fileSystemMapping","lastSelectedSourcesSidebarPaneTab","previouslyViewedFiles","savedURLs","watchExpressions","workspaceExcludedFolders","xhrBreakpoints"]);if(window.localStorage)for(const e in window.localStorage){if(t.has(e))continue;const r=window.localStorage[e];window.localStorage.removeItem(e),Xe.instance().globalStorage.set(e,r)}}clearBreakpointsWhenTooMany(t,e){t.get().length>e&&t.set([])}}function Ye(t){return Xe.instance().moduleSetting(t)}var Ze=Object.freeze({__proto__:null,Deprecation:Ue,NOOP_STORAGE:De,RegExpSetting:He,Setting:$e,Settings:Xe,SettingsStorage:Fe,VersionController:qe,getLocalizedSettingsCategory:Ge,maybeRemoveSettingExtension:Be,moduleSetting:Ye,registerSettingExtension:_e,registerSettingsForTest:Oe,resetSettings:Ve,settingForTest:function(t){return Xe.instance().settingForTest(t)}});var Ke=Object.freeze({__proto__:null,SimpleHistoryManager:class{#nt;#it;#at;#ot;constructor(t){this.#nt=[],this.#it=-1,this.#at=0,this.#ot=t}readOnlyLock(){++this.#at}releaseReadOnlyLock(){--this.#at}getPreviousValidIndex(){if(this.empty())return-1;let t=this.#it-1;for(;t>=0&&!this.#nt[t].valid();)--t;return t<0?-1:t}getNextValidIndex(){let t=this.#it+1;for(;t=this.#nt.length?-1:t}readOnly(){return Boolean(this.#at)}filterOut(t){if(this.readOnly())return;const e=[];let r=0;for(let s=0;sthis.#ot&&this.#nt.shift(),this.#it=this.#nt.length-1)}canRollback(){return this.getPreviousValidIndex()>=0}canRollover(){return this.getNextValidIndex()>=0}rollback(){const t=this.getPreviousValidIndex();return-1!==t&&(this.readOnlyLock(),this.#it=t,this.#nt[t].reveal(),this.releaseReadOnlyLock(),!0)}rollover(){const t=this.getNextValidIndex();return-1!==t&&(this.readOnlyLock(),this.#it=t,this.#nt[t].reveal(),this.releaseReadOnlyLock(),!0)}}});var Je=Object.freeze({__proto__:null,StringOutputStream:class{#lt;constructor(){this.#lt=""}async write(t){this.#lt+=t}async close(){}data(){return this.#lt}}});class Qe{#ht;#ct;#ut;#gt;#dt;#pt;#mt;constructor(t){this.#ct=0,this.#mt=t,this.clear()}static newStringTrie(){return new Qe({empty:()=>"",append:(t,e)=>t+e,slice:(t,e,r)=>t.slice(e,r)})}static newArrayTrie(){return new Qe({empty:()=>[],append:(t,e)=>t.concat([e]),slice:(t,e,r)=>t.slice(e,r)})}add(t){let e=this.#ct;++this.#dt[this.#ct];for(let r=0;rthis.#yt,n="AsSoonAsPossible"===e||"Default"===e&&!r&&s,i=n&&!this.#ft;this.#ft=this.#ft||n,this.#zt(i),await this.#xt.promise}#zt(t){if(this.#bt)return;if(this.#vt&&!t)return;clearTimeout(this.#vt);const e=this.#ft?0:this.#yt;this.#vt=window.setTimeout(this.#It.bind(this),e)}#Rt(){return window.performance.now()}}});class sr{#At;#Pt;constructor(t){this.#At=new Promise((e=>{const r=new Worker(t,{type:"module"});r.onmessage=t=>{console.assert("workerReady"===t.data),r.onmessage=null,e(r)}}))}static fromURL(t){return new sr(t)}postMessage(t,e){this.#At.then((r=>{this.#Pt||r.postMessage(t,e??[])}))}dispose(){this.#Pt=!0,this.#At.then((t=>t.terminate()))}terminate(){this.dispose()}set onmessage(t){this.#At.then((e=>{e.onmessage=t}))}set onerror(t){this.#At.then((e=>{e.onerror=t}))}}var nr=Object.freeze({__proto__:null,WorkerWrapper:sr});export{s as App,i as AppProvider,l as Base64,h as CharacterIdMap,kt as Color,P as ColorConverter,$ as ColorUtils,Ut as Console,$t as Debouncer,Ht as EventTarget,qt as JavaScriptMetaData,Kt as Lazy,te as Linkifier,re as MapWithDefault,se as Mutex,Ct as ObjectWrapper,ae as ParsedURL,le as Progress,he as QueryParamHandler,ce as ResolverBase,ve as ResourceType,Wt as Revealer,ze as Runnable,Ae as SegmentedRange,Me as SettingRegistration,Ze as Settings,Ke as SimpleHistoryManager,Je as StringOutputStream,er as TextDictionary,rr as Throttler,tr as Trie,nr as Worker}; +import*as t from"../root/root.js";import*as e from"../platform/platform.js";export{UIString}from"../platform/platform.js";import*as r from"../i18n/i18n.js";var s=Object.freeze({__proto__:null});const n=[];var i=Object.freeze({__proto__:null,getRegisteredAppProviders:function(){return n.filter((e=>t.Runtime.Runtime.isDescriptorEnabled({experiment:void 0,condition:e.condition}))).sort(((t,e)=>(t.order||0)-(e.order||0)))},registerAppProvider:function(t){n.push(t)}});const a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=new Uint8Array(123);for(let t=0;t<64;++t)o[a.charCodeAt(t)]=t;var l=Object.freeze({__proto__:null,BASE64_CHARS:a,BASE64_CODES:o,decode:function(t){let e=3*t.length/4>>>0;61===t.charCodeAt(t.length-2)?e-=2:61===t.charCodeAt(t.length-1)&&(e-=1);const r=new Uint8Array(e);for(let e=0,s=0;e>4,r[s++]=(15&i)<<4|a>>2,r[s++]=(3&a)<<6|63&l}return r.buffer},encode:function(t){return new Promise(((e,r)=>{const s=new FileReader;s.onerror=()=>r(new Error("failed to convert to base64")),s.onload=()=>{const t=s.result,[,r]=t.split(",",2);e(r)},s.readAsDataURL(new Blob([t]))}))}});var h=Object.freeze({__proto__:null,CharacterIdMap:class{#t=new Map;#e=new Map;#r=33;toChar(t){let e=this.#t.get(t);if(!e){if(this.#r>=65535)throw new Error("CharacterIdMap ran out of capacity!");e=String.fromCharCode(this.#r++),this.#t.set(t,e),this.#e.set(e,t)}return e}fromChar(t){const e=this.#e.get(t);return void 0===e?null:e}}});const c=.9642,u=.8251;class g{values=[0,0,0];constructor(t){t&&(this.values=t)}}class d{values=[[0,0,0],[0,0,0],[0,0,0]];constructor(t){t&&(this.values=t)}multiply(t){const e=new g;for(let r=0;r<3;++r)e.values[r]=this.values[r][0]*t.values[0]+this.values[r][1]*t.values[1]+this.values[r][2]*t.values[2];return e}}class p{g;a;b;c;d;e;f;constructor(t,e,r=0,s=0,n=0,i=0,a=0){this.g=t,this.a=e,this.b=r,this.c=s,this.d=n,this.e=i,this.f=a}eval(t){const e=t<0?-1:1,r=t*e;return r.022?t:t+Math.pow(.022-t,1.414)}function W(t,e){if(t=M(t),e=M(e),Math.abs(t-e)<5e-4)return 0;let r=0;return e>t?(r=1.14*(Math.pow(e,.56)-Math.pow(t,.57)),r=r<.1?0:r-V):(r=1.14*(Math.pow(e,.65)-Math.pow(t,.62)),r=r>-.1?0:r+V),100*r}function X(t,e,r){function s(){return r?Math.pow(Math.abs(Math.pow(t,.65)-(-e-V)/1.14),1/.62):Math.pow(Math.abs(Math.pow(t,.56)-(e+V)/1.14),1/.57)}t=M(t),e/=100;let n=s();return(n<0||n>1)&&(r=!r,n=s()),n}const D=[[12,-1,-1,-1,-1,100,90,80,-1,-1],[14,-1,-1,-1,100,90,80,60,60,-1],[16,-1,-1,100,90,80,60,55,50,50],[18,-1,-1,90,80,60,55,50,40,40],[24,-1,100,80,60,55,50,40,38,35],[30,-1,90,70,55,50,40,38,35,40],[36,-1,80,60,50,40,38,35,30,25],[48,100,70,55,40,38,35,30,25,20],[60,90,60,50,38,35,30,25,20,20],[72,80,55,40,35,30,25,20,20,20],[96,70,50,35,30,25,20,20,20,20],[120,60,40,30,25,20,20,20,20,20]];function F(t,e){const r=72*parseFloat(t.replace("px",""))/96;return(isNaN(Number(e))?["bold","bolder"].includes(e):Number(e)>=600)?r>=14:r>=18}D.reverse();const j={aa:3,aaa:4.5},U={aa:4.5,aaa:7};var $=Object.freeze({__proto__:null,blendColors:E,contrastRatio:function(t,e){const r=O(E(t,e)),s=O(e);return(Math.max(r,s)+.05)/(Math.min(r,s)+.05)},contrastRatioAPCA:G,contrastRatioByLuminanceAPCA:W,desiredLuminanceAPCA:X,getAPCAThreshold:function(t,e){const r=parseFloat(t.replace("px","")),s=parseFloat(e);for(const[t,...e]of D)if(r>=t)for(const[t,r]of[900,800,700,600,500,400,300,200,100].entries())if(s>=r){const r=e[e.length-1-t];return-1===r?null:r}return null},getContrastThreshold:function(t,e){return F(t,e)?j:U},isLargeFont:F,luminance:O,luminanceAPCA:B,rgbToHsl:L,rgbToHwb:_,rgbaToHsla:C,rgbaToHwba:N});function H(t){return(t%360+360)%360}function q(t){const e=t.replace(/(deg|g?rad|turn)$/,"");if(isNaN(e)||t.match(/\s+(deg|g?rad|turn)/))return null;const r=parseFloat(e);return t.includes("turn")?360*r:t.includes("grad")?9*r/10:t.includes("rad")?180*r/Math.PI:r}function Y(t){switch(t){case"srgb":return"srgb";case"srgb-linear":return"srgb-linear";case"display-p3":return"display-p3";case"a98-rgb":return"a98-rgb";case"prophoto-rgb":return"prophoto-rgb";case"rec2020":return"rec2020";case"xyz":return"xyz";case"xyz-d50":return"xyz-d50";case"xyz-d65":return"xyz-d65"}return null}function Z(t,e){const r=Math.sign(t),s=Math.abs(t),[n,i]=e;return r*(s*(i-n)/100+n)}function K(t,{min:e,max:r}){return null===t||(void 0!==e&&(t=Math.max(t,e)),void 0!==r&&(t=Math.min(t,r))),t}function J(t,e){if(!t.endsWith("%"))return null;const r=parseFloat(t.substr(0,t.length-1));return isNaN(r)?null:Z(r,e)}function Q(t){const e=parseFloat(t);return isNaN(e)?null:e}function tt(t){return void 0===t?null:K(J(t,[0,1])??Q(t),{min:0,max:1})}function et(t,e=[0,1]){if(isNaN(t.replace("%","")))return null;const r=parseFloat(t);return-1!==t.indexOf("%")?t.indexOf("%")!==t.length-1?null:Z(r,e):r}function rt(t){const e=et(t);return null===e?null:-1!==t.indexOf("%")?e:e/255}function st(t){const e=t.replace(/(deg|g?rad|turn)$/,"");if(isNaN(e)||t.match(/\s+(deg|g?rad|turn)/))return null;const r=parseFloat(e);return-1!==t.indexOf("turn")?r%1:-1!==t.indexOf("grad")?r/400%1:-1!==t.indexOf("rad")?r/(2*Math.PI)%1:r/360%1}function nt(t){if(t.indexOf("%")!==t.length-1||isNaN(t.replace("%","")))return null;return parseFloat(t)/100}function it(t){const e=t[0];let r=t[1];const s=t[2];function n(t,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?t+(e-t)*r*6:2*r<1?e:3*r<2?t+(e-t)*(2/3-r)*6:t}let i;r<0&&(r=0),i=s<=.5?s*(1+r):s+r-s*r;const a=2*s-i,o=e,l=e-1/3;return[n(a,i,e+1/3),n(a,i,o),n(a,i,l),t[3]]}function at(t){return it(function(t){const e=t[0];let r=t[1];const s=t[2],n=(2-r)*s;return 0===s||0===r?r=0:r*=s/(n<1?n:2-n),[e,r,n/2,t[3]]}(t))}function ot(t,e,r){function s(){return r?(t+.05)*e-.05:(t+.05)/e-.05}let n=s();return(n<0||n>1)&&(r=!r,n=s()),n}function lt(t,e,r,s,n){let i=t[r],a=1,o=n(t)-s,l=Math.sign(o);for(let e=100;e;e--){if(Math.abs(o)<2e-4)return t[r]=i,i;const e=Math.sign(o);if(e!==l)a/=2,l=e;else if(i<0||i>1)return null;i+=a*(2===r?-o:o),t[r]=i,o=n(t)-s}return null}function ht(t,e,r=.01){if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return!1;for(const r in t)if(!ht(t[r],e[r]))return!1;return!0}return!Array.isArray(t)&&!Array.isArray(e)&&(null===t||null===e?t===e:Math.abs(t-e)new vt(t.#a(!1),"hex"),hexa:t=>new vt(t.#a(!0),"hexa"),rgb:t=>new vt(t.#a(!1),"rgb"),rgba:t=>new vt(t.#a(!0),"rgba"),hsl:t=>new yt(...L(t.#a(!1)),t.alpha),hsla:t=>new yt(...L(t.#a(!1)),t.alpha),hwb:t=>new bt(..._(t.#a(!1)),t.alpha),hwba:t=>new bt(..._(t.#a(!1)),t.alpha),lch:t=>new gt(...A.labToLch(t.l,t.a,t.b),t.alpha),oklch:t=>new pt(...A.xyzd50ToOklch(...t.#o()),t.alpha),lab:t=>t,oklab:t=>new dt(...A.xyzd65ToOklab(...A.xyzd50ToD65(...t.#o())),t.alpha),srgb:t=>new mt("srgb",...A.xyzd50ToSrgb(...t.#o()),t.alpha),"srgb-linear":t=>new mt("srgb-linear",...A.xyzd50TosRGBLinear(...t.#o()),t.alpha),"display-p3":t=>new mt("display-p3",...A.xyzd50ToDisplayP3(...t.#o()),t.alpha),"a98-rgb":t=>new mt("a98-rgb",...A.xyzd50ToAdobeRGB(...t.#o()),t.alpha),"prophoto-rgb":t=>new mt("prophoto-rgb",...A.xyzd50ToProPhoto(...t.#o()),t.alpha),rec2020:t=>new mt("rec2020",...A.xyzd50ToRec2020(...t.#o()),t.alpha),xyz:t=>new mt("xyz",...A.xyzd50ToD65(...t.#o()),t.alpha),"xyz-d50":t=>new mt("xyz-d50",...t.#o(),t.alpha),"xyz-d65":t=>new mt("xyz-d65",...A.xyzd50ToD65(...t.#o()),t.alpha)};#o(){return A.labToXyzd50(this.l,this.a,this.b)}#a(t=!0){const e=A.xyzd50ToSrgb(...this.#o());return t?[...e,this.alpha??void 0]:e}constructor(t,e,r,s,n){this.#n=[t,e,r],this.l=K(t,{min:0,max:100}),(ht(this.l,0,1)||ht(this.l,100,1))&&(e=r=0),this.a=e,this.b=r,this.alpha=K(s,{min:0,max:1}),this.#s=n}is(t){return t===this.format()}as(t){return ut.#i[t](this)}asLegacyColor(){return this.as("rgba")}equal(t){const e=t.as("lab");return ht(e.l,this.l,1)&&ht(e.a,this.a)&&ht(e.b,this.b)&&ht(e.alpha,this.alpha)}format(){return"lab"}setAlpha(t){return new ut(this.l,this.a,this.b,t,void 0)}asString(t){return t?this.as(t).asString():this.#l(this.l,this.a,this.b)}#l(t,r,s){const n=null===this.alpha||ht(this.alpha,1)?"":` / ${e.StringUtilities.stringifyWithPrecision(this.alpha)}`;return`lab(${e.StringUtilities.stringifyWithPrecision(t,0)} ${e.StringUtilities.stringifyWithPrecision(r)} ${e.StringUtilities.stringifyWithPrecision(s)}${n})`}getAuthoredText(){return this.#s??null}getRawParameters(){return[...this.#n]}getAsRawString(t){return t?this.as(t).getAsRawString():this.#l(...this.#n)}isGamutClipped(){return!1}static fromSpec(t,e){const r=J(t[0],[0,100])??Q(t[0]);if(null===r)return null;const s=J(t[1],[0,125])??Q(t[1]);if(null===s)return null;const n=J(t[2],[0,125])??Q(t[2]);if(null===n)return null;const i=tt(t[3]);return new ut(r,s,n,i,e)}}class gt{#n;l;c;h;alpha;#s;static#i={hex:t=>new vt(t.#a(!1),"hex"),hexa:t=>new vt(t.#a(!0),"hexa"),rgb:t=>new vt(t.#a(!1),"rgb"),rgba:t=>new vt(t.#a(!0),"rgba"),hsl:t=>new yt(...L(t.#a(!1)),t.alpha),hsla:t=>new yt(...L(t.#a(!1)),t.alpha),hwb:t=>new bt(..._(t.#a(!1)),t.alpha),hwba:t=>new bt(..._(t.#a(!1)),t.alpha),lch:t=>t,oklch:t=>new pt(...A.xyzd50ToOklch(...t.#o()),t.alpha),lab:t=>new ut(...A.lchToLab(t.l,t.c,t.h),t.alpha),oklab:t=>new dt(...A.xyzd65ToOklab(...A.xyzd50ToD65(...t.#o())),t.alpha),srgb:t=>new mt("srgb",...A.xyzd50ToSrgb(...t.#o()),t.alpha),"srgb-linear":t=>new mt("srgb-linear",...A.xyzd50TosRGBLinear(...t.#o()),t.alpha),"display-p3":t=>new mt("display-p3",...A.xyzd50ToDisplayP3(...t.#o()),t.alpha),"a98-rgb":t=>new mt("a98-rgb",...A.xyzd50ToAdobeRGB(...t.#o()),t.alpha),"prophoto-rgb":t=>new mt("prophoto-rgb",...A.xyzd50ToProPhoto(...t.#o()),t.alpha),rec2020:t=>new mt("rec2020",...A.xyzd50ToRec2020(...t.#o()),t.alpha),xyz:t=>new mt("xyz",...A.xyzd50ToD65(...t.#o()),t.alpha),"xyz-d50":t=>new mt("xyz-d50",...t.#o(),t.alpha),"xyz-d65":t=>new mt("xyz-d65",...A.xyzd50ToD65(...t.#o()),t.alpha)};#o(){return A.labToXyzd50(...A.lchToLab(this.l,this.c,this.h))}#a(t=!0){const e=A.xyzd50ToSrgb(...this.#o());return t?[...e,this.alpha??void 0]:e}constructor(t,e,r,s,n){this.#n=[t,e,r],this.l=K(t,{min:0,max:100}),e=ht(this.l,0,1)||ht(this.l,100,1)?0:e,this.c=K(e,{min:0}),r=ht(e,0)?0:r,this.h=H(r),this.alpha=K(s,{min:0,max:1}),this.#s=n}asLegacyColor(){return this.as("rgba")}is(t){return t===this.format()}as(t){return gt.#i[t](this)}equal(t){const e=t.as("lch");return ht(e.l,this.l,1)&&ht(e.c,this.c)&&ht(e.h,this.h)&&ht(e.alpha,this.alpha)}format(){return"lch"}setAlpha(t){return new gt(this.l,this.c,this.h,t)}asString(t){return t?this.as(t).asString():this.#l(this.l,this.c,this.h)}#l(t,r,s){const n=null===this.alpha||ht(this.alpha,1)?"":` / ${e.StringUtilities.stringifyWithPrecision(this.alpha)}`;return`lch(${e.StringUtilities.stringifyWithPrecision(t,0)} ${e.StringUtilities.stringifyWithPrecision(r)} ${e.StringUtilities.stringifyWithPrecision(s)}${n})`}getAuthoredText(){return this.#s??null}getRawParameters(){return[...this.#n]}getAsRawString(t){return t?this.as(t).getAsRawString():this.#l(...this.#n)}isGamutClipped(){return!1}isHuePowerless(){return ht(this.c,0)}static fromSpec(t,e){const r=J(t[0],[0,100])??Q(t[0]);if(null===r)return null;const s=J(t[1],[0,150])??Q(t[1]);if(null===s)return null;const n=q(t[2]);if(null===n)return null;const i=tt(t[3]);return new gt(r,s,n,i,e)}}class dt{#n;l;a;b;alpha;#s;static#i={hex:t=>new vt(t.#a(!1),"hex"),hexa:t=>new vt(t.#a(!0),"hexa"),rgb:t=>new vt(t.#a(!1),"rgb"),rgba:t=>new vt(t.#a(!0),"rgba"),hsl:t=>new yt(...L(t.#a(!1)),t.alpha),hsla:t=>new yt(...L(t.#a(!1)),t.alpha),hwb:t=>new bt(..._(t.#a(!1)),t.alpha),hwba:t=>new bt(..._(t.#a(!1)),t.alpha),lch:t=>new gt(...A.labToLch(...A.xyzd50ToLab(...t.#o())),t.alpha),oklch:t=>new pt(...A.xyzd50ToOklch(...t.#o()),t.alpha),lab:t=>new ut(...A.xyzd50ToLab(...t.#o()),t.alpha),oklab:t=>t,srgb:t=>new mt("srgb",...A.xyzd50ToSrgb(...t.#o()),t.alpha),"srgb-linear":t=>new mt("srgb-linear",...A.xyzd50TosRGBLinear(...t.#o()),t.alpha),"display-p3":t=>new mt("display-p3",...A.xyzd50ToDisplayP3(...t.#o()),t.alpha),"a98-rgb":t=>new mt("a98-rgb",...A.xyzd50ToAdobeRGB(...t.#o()),t.alpha),"prophoto-rgb":t=>new mt("prophoto-rgb",...A.xyzd50ToProPhoto(...t.#o()),t.alpha),rec2020:t=>new mt("rec2020",...A.xyzd50ToRec2020(...t.#o()),t.alpha),xyz:t=>new mt("xyz",...A.xyzd50ToD65(...t.#o()),t.alpha),"xyz-d50":t=>new mt("xyz-d50",...t.#o(),t.alpha),"xyz-d65":t=>new mt("xyz-d65",...A.xyzd50ToD65(...t.#o()),t.alpha)};#o(){return A.xyzd65ToD50(...A.oklabToXyzd65(this.l,this.a,this.b))}#a(t=!0){const e=A.xyzd50ToSrgb(...this.#o());return t?[...e,this.alpha??void 0]:e}constructor(t,e,r,s,n){this.#n=[t,e,r],this.l=K(t,{min:0,max:1}),(ht(this.l,0)||ht(this.l,1))&&(e=r=0),this.a=e,this.b=r,this.alpha=K(s,{min:0,max:1}),this.#s=n}asLegacyColor(){return this.as("rgba")}is(t){return t===this.format()}as(t){return dt.#i[t](this)}equal(t){const e=t.as("oklab");return ht(e.l,this.l)&&ht(e.a,this.a)&&ht(e.b,this.b)&&ht(e.alpha,this.alpha)}format(){return"oklab"}setAlpha(t){return new dt(this.l,this.a,this.b,t)}asString(t){return t?this.as(t).asString():this.#l(this.l,this.a,this.b)}#l(t,r,s){const n=null===this.alpha||ht(this.alpha,1)?"":` / ${e.StringUtilities.stringifyWithPrecision(this.alpha)}`;return`oklab(${e.StringUtilities.stringifyWithPrecision(t)} ${e.StringUtilities.stringifyWithPrecision(r)} ${e.StringUtilities.stringifyWithPrecision(s)}${n})`}getAuthoredText(){return this.#s??null}getRawParameters(){return[...this.#n]}getAsRawString(t){return t?this.as(t).getAsRawString():this.#l(...this.#n)}isGamutClipped(){return!1}static fromSpec(t,e){const r=J(t[0],[0,1])??Q(t[0]);if(null===r)return null;const s=J(t[1],[0,.4])??Q(t[1]);if(null===s)return null;const n=J(t[2],[0,.4])??Q(t[2]);if(null===n)return null;const i=tt(t[3]);return new dt(r,s,n,i,e)}}class pt{#n;l;c;h;alpha;#s;static#i={hex:t=>new vt(t.#a(!1),"hex"),hexa:t=>new vt(t.#a(!0),"hexa"),rgb:t=>new vt(t.#a(!1),"rgb"),rgba:t=>new vt(t.#a(!0),"rgba"),hsl:t=>new yt(...L(t.#a(!1)),t.alpha),hsla:t=>new yt(...L(t.#a(!1)),t.alpha),hwb:t=>new bt(..._(t.#a(!1)),t.alpha),hwba:t=>new bt(..._(t.#a(!1)),t.alpha),lch:t=>new gt(...A.labToLch(...A.xyzd50ToLab(...t.#o())),t.alpha),oklch:t=>t,lab:t=>new ut(...A.xyzd50ToLab(...t.#o()),t.alpha),oklab:t=>new dt(...A.xyzd65ToOklab(...A.xyzd50ToD65(...t.#o())),t.alpha),srgb:t=>new mt("srgb",...A.xyzd50ToSrgb(...t.#o()),t.alpha),"srgb-linear":t=>new mt("srgb-linear",...A.xyzd50TosRGBLinear(...t.#o()),t.alpha),"display-p3":t=>new mt("display-p3",...A.xyzd50ToDisplayP3(...t.#o()),t.alpha),"a98-rgb":t=>new mt("a98-rgb",...A.xyzd50ToAdobeRGB(...t.#o()),t.alpha),"prophoto-rgb":t=>new mt("prophoto-rgb",...A.xyzd50ToProPhoto(...t.#o()),t.alpha),rec2020:t=>new mt("rec2020",...A.xyzd50ToRec2020(...t.#o()),t.alpha),xyz:t=>new mt("xyz",...A.xyzd50ToD65(...t.#o()),t.alpha),"xyz-d50":t=>new mt("xyz-d50",...t.#o(),t.alpha),"xyz-d65":t=>new mt("xyz-d65",...A.xyzd50ToD65(...t.#o()),t.alpha)};#o(){return A.oklchToXyzd50(this.l,this.c,this.h)}#a(t=!0){const e=A.xyzd50ToSrgb(...this.#o());return t?[...e,this.alpha??void 0]:e}constructor(t,e,r,s,n){this.#n=[t,e,r],this.l=K(t,{min:0,max:1}),e=ht(this.l,0)||ht(this.l,1)?0:e,this.c=K(e,{min:0}),r=ht(e,0)?0:r,this.h=H(r),this.alpha=K(s,{min:0,max:1}),this.#s=n}asLegacyColor(){return this.as("rgba")}is(t){return t===this.format()}as(t){return pt.#i[t](this)}equal(t){const e=t.as("oklch");return ht(e.l,this.l)&&ht(e.c,this.c)&&ht(e.h,this.h)&&ht(e.alpha,this.alpha)}format(){return"oklch"}setAlpha(t){return new pt(this.l,this.c,this.h,t)}asString(t){return t?this.as(t).asString():this.#l(this.l,this.c,this.h)}#l(t,r,s){const n=null===this.alpha||ht(this.alpha,1)?"":` / ${e.StringUtilities.stringifyWithPrecision(this.alpha)}`;return`oklch(${e.StringUtilities.stringifyWithPrecision(t)} ${e.StringUtilities.stringifyWithPrecision(r)} ${e.StringUtilities.stringifyWithPrecision(s)}${n})`}getAuthoredText(){return this.#s??null}getRawParameters(){return[...this.#n]}getAsRawString(t){return t?this.as(t).getAsRawString():this.#l(...this.#n)}isGamutClipped(){return!1}static fromSpec(t,e){const r=J(t[0],[0,1])??Q(t[0]);if(null===r)return null;const s=J(t[1],[0,.4])??Q(t[1]);if(null===s)return null;const n=q(t[2]);if(null===n)return null;const i=tt(t[3]);return new pt(r,s,n,i,e)}}class mt{#n;p0;p1;p2;alpha;colorSpace;#s;static#i={hex:t=>new vt(t.#a(!1),"hex"),hexa:t=>new vt(t.#a(!0),"hexa"),rgb:t=>new vt(t.#a(!1),"rgb"),rgba:t=>new vt(t.#a(!0),"rgba"),hsl:t=>new yt(...L(t.#a(!1)),t.alpha),hsla:t=>new yt(...L(t.#a(!1)),t.alpha),hwb:t=>new bt(..._(t.#a(!1)),t.alpha),hwba:t=>new bt(..._(t.#a(!1)),t.alpha),lch:t=>new gt(...A.labToLch(...A.xyzd50ToLab(...t.#o())),t.alpha),oklch:t=>new pt(...A.xyzd50ToOklch(...t.#o()),t.alpha),lab:t=>new ut(...A.xyzd50ToLab(...t.#o()),t.alpha),oklab:t=>new dt(...A.xyzd65ToOklab(...A.xyzd50ToD65(...t.#o())),t.alpha),srgb:t=>new mt("srgb",...A.xyzd50ToSrgb(...t.#o()),t.alpha),"srgb-linear":t=>new mt("srgb-linear",...A.xyzd50TosRGBLinear(...t.#o()),t.alpha),"display-p3":t=>new mt("display-p3",...A.xyzd50ToDisplayP3(...t.#o()),t.alpha),"a98-rgb":t=>new mt("a98-rgb",...A.xyzd50ToAdobeRGB(...t.#o()),t.alpha),"prophoto-rgb":t=>new mt("prophoto-rgb",...A.xyzd50ToProPhoto(...t.#o()),t.alpha),rec2020:t=>new mt("rec2020",...A.xyzd50ToRec2020(...t.#o()),t.alpha),xyz:t=>new mt("xyz",...A.xyzd50ToD65(...t.#o()),t.alpha),"xyz-d50":t=>new mt("xyz-d50",...t.#o(),t.alpha),"xyz-d65":t=>new mt("xyz-d65",...A.xyzd50ToD65(...t.#o()),t.alpha)};#o(){const[t,e,r]=this.#n;switch(this.colorSpace){case"srgb":return A.srgbToXyzd50(t,e,r);case"srgb-linear":return A.srgbLinearToXyzd50(t,e,r);case"display-p3":return A.displayP3ToXyzd50(t,e,r);case"a98-rgb":return A.adobeRGBToXyzd50(t,e,r);case"prophoto-rgb":return A.proPhotoToXyzd50(t,e,r);case"rec2020":return A.rec2020ToXyzd50(t,e,r);case"xyz-d50":return[t,e,r];case"xyz":case"xyz-d65":return A.xyzd65ToD50(t,e,r)}throw new Error("Invalid color space")}#a(t=!0){const[e,r,s]=this.#n,n="srgb"===this.colorSpace?[e,r,s]:[...A.xyzd50ToSrgb(...this.#o())];return t?[...n,this.alpha??void 0]:n}constructor(t,e,r,s,n,i){this.#n=[e,r,s],this.colorSpace=t,this.#s=i,"xyz-d50"!==this.colorSpace&&"xyz-d65"!==this.colorSpace&&"xyz"!==this.colorSpace&&(e=K(e,{min:0,max:1}),r=K(r,{min:0,max:1}),s=K(s,{min:0,max:1})),this.p0=e,this.p1=r,this.p2=s,this.alpha=K(n,{min:0,max:1})}asLegacyColor(){return this.as("rgba")}is(t){return t===this.format()}as(t){return this.colorSpace===t?this:mt.#i[t](this)}equal(t){const e=t.as(this.colorSpace);return ht(this.p0,e.p0)&&ht(this.p1,e.p1)&&ht(this.p2,e.p2)&&ht(this.alpha,e.alpha)}format(){return this.colorSpace}setAlpha(t){return new mt(this.colorSpace,this.p0,this.p1,this.p2,t)}asString(t){return t?this.as(t).asString():this.#l(this.p0,this.p1,this.p2)}#l(t,r,s){const n=null===this.alpha||ht(this.alpha,1)?"":` / ${e.StringUtilities.stringifyWithPrecision(this.alpha)}`;return`color(${this.colorSpace} ${e.StringUtilities.stringifyWithPrecision(t)} ${e.StringUtilities.stringifyWithPrecision(r)} ${e.StringUtilities.stringifyWithPrecision(s)}${n})`}getAuthoredText(){return this.#s??null}getRawParameters(){return[...this.#n]}getAsRawString(t){return t?this.as(t).getAsRawString():this.#l(...this.#n)}isGamutClipped(){return"xyz-d50"!==this.colorSpace&&"xyz-d65"!==this.colorSpace&&"xyz"!==this.colorSpace&&!ht(this.#n,[this.p0,this.p1,this.p2])}static fromSpec(t,e){const[r,s]=e.split("/",2),n=r.trim().split(/\s+/),[i,...a]=n,o=Y(i);if(!o)return null;if(0===a.length&&void 0===s)return new mt(o,0,0,0,null,t);if(0===a.length&&void 0!==s&&s.trim().split(/\s+/).length>1)return null;if(a.length>3)return null;const l=a.map((t=>"none"===t?"0":t)).map((t=>et(t,[0,1])));if(l.includes(null))return null;const h=s?et(s,[0,1])??1:1,c=[l[0]??0,l[1]??0,l[2]??0,h];return new mt(o,...c,t)}}class yt{h;s;l;alpha;#n;#s;static#i={hex:t=>new vt(t.#a(!1),"hex"),hexa:t=>new vt(t.#a(!0),"hexa"),rgb:t=>new vt(t.#a(!1),"rgb"),rgba:t=>new vt(t.#a(!0),"rgba"),hsl:t=>t,hsla:t=>t,hwb:t=>new bt(..._(t.#a(!1)),t.alpha),hwba:t=>new bt(..._(t.#a(!1)),t.alpha),lch:t=>new gt(...A.labToLch(...A.xyzd50ToLab(...t.#o())),t.alpha),oklch:t=>new pt(...A.xyzd50ToOklch(...t.#o()),t.alpha),lab:t=>new ut(...A.xyzd50ToLab(...t.#o()),t.alpha),oklab:t=>new dt(...A.xyzd65ToOklab(...A.xyzd50ToD65(...t.#o())),t.alpha),srgb:t=>new mt("srgb",...A.xyzd50ToSrgb(...t.#o()),t.alpha),"srgb-linear":t=>new mt("srgb-linear",...A.xyzd50TosRGBLinear(...t.#o()),t.alpha),"display-p3":t=>new mt("display-p3",...A.xyzd50ToDisplayP3(...t.#o()),t.alpha),"a98-rgb":t=>new mt("a98-rgb",...A.xyzd50ToAdobeRGB(...t.#o()),t.alpha),"prophoto-rgb":t=>new mt("prophoto-rgb",...A.xyzd50ToProPhoto(...t.#o()),t.alpha),rec2020:t=>new mt("rec2020",...A.xyzd50ToRec2020(...t.#o()),t.alpha),xyz:t=>new mt("xyz",...A.xyzd50ToD65(...t.#o()),t.alpha),"xyz-d50":t=>new mt("xyz-d50",...t.#o(),t.alpha),"xyz-d65":t=>new mt("xyz-d65",...A.xyzd50ToD65(...t.#o()),t.alpha)};#a(t=!0){const e=it([this.h,this.s,this.l,0]);return t?[e[0],e[1],e[2],this.alpha??void 0]:[e[0],e[1],e[2]]}#o(){const t=this.#a(!1);return A.srgbToXyzd50(t[0],t[1],t[2])}constructor(t,e,r,s,n){this.#n=[t,e,r],this.l=K(r,{min:0,max:1}),e=ht(this.l,0)||ht(this.l,1)?0:e,this.s=K(e,{min:0,max:1}),t=ht(this.s,0)?0:t,this.h=H(360*t)/360,this.alpha=K(s??null,{min:0,max:1}),this.#s=n}equal(t){const e=t.as("hsl");return ht(this.h,e.h)&&ht(this.s,e.s)&&ht(this.l,e.l)&&ht(this.alpha,e.alpha)}asString(t){return t?this.as(t).asString():this.#l(this.h,this.s,this.l)}#l(t,r,s){const n=e.StringUtilities.sprintf("hsl(%sdeg %s% %s%",e.StringUtilities.stringifyWithPrecision(360*t),e.StringUtilities.stringifyWithPrecision(100*r),e.StringUtilities.stringifyWithPrecision(100*s));return null!==this.alpha&&1!==this.alpha?n+e.StringUtilities.sprintf(" / %s%)",e.StringUtilities.stringifyWithPrecision(100*this.alpha)):n+")"}setAlpha(t){return new yt(this.h,this.s,this.l,t)}format(){return null===this.alpha||1===this.alpha?"hsl":"hsla"}is(t){return t===this.format()}as(t){return t===this.format()?this:yt.#i[t](this)}asLegacyColor(){return this.as("rgba")}getAuthoredText(){return this.#s??null}getRawParameters(){return[...this.#n]}getAsRawString(t){return t?this.as(t).getAsRawString():this.#l(...this.#n)}isGamutClipped(){return!ct(this.#n[1],1)||!ct(0,this.#n[1])}static fromSpec(t,e){const r=st(t[0]);if(null===r)return null;const s=nt(t[1]);if(null===s)return null;const n=nt(t[2]);if(null===n)return null;const i=tt(t[3]);return new yt(r,s,n,i,e)}hsva(){const t=this.s*(this.l<.5?this.l:1-this.l);return[this.h,0!==t?2*t/(this.l+t):0,this.l+t,this.alpha??1]}canonicalHSLA(){return[Math.round(360*this.h),Math.round(100*this.s),Math.round(100*this.l),this.alpha??1]}}class bt{h;w;b;alpha;#n;#s;static#i={hex:t=>new vt(t.#a(!1),"hex"),hexa:t=>new vt(t.#a(!0),"hexa"),rgb:t=>new vt(t.#a(!1),"rgb"),rgba:t=>new vt(t.#a(!0),"rgba"),hsl:t=>new yt(...L(t.#a(!1)),t.alpha),hsla:t=>new yt(...L(t.#a(!1)),t.alpha),hwb:t=>t,hwba:t=>t,lch:t=>new gt(...A.labToLch(...A.xyzd50ToLab(...t.#o())),t.alpha),oklch:t=>new pt(...A.xyzd50ToOklch(...t.#o()),t.alpha),lab:t=>new ut(...A.xyzd50ToLab(...t.#o()),t.alpha),oklab:t=>new dt(...A.xyzd65ToOklab(...A.xyzd50ToD65(...t.#o())),t.alpha),srgb:t=>new mt("srgb",...A.xyzd50ToSrgb(...t.#o()),t.alpha),"srgb-linear":t=>new mt("srgb-linear",...A.xyzd50TosRGBLinear(...t.#o()),t.alpha),"display-p3":t=>new mt("display-p3",...A.xyzd50ToDisplayP3(...t.#o()),t.alpha),"a98-rgb":t=>new mt("a98-rgb",...A.xyzd50ToAdobeRGB(...t.#o()),t.alpha),"prophoto-rgb":t=>new mt("prophoto-rgb",...A.xyzd50ToProPhoto(...t.#o()),t.alpha),rec2020:t=>new mt("rec2020",...A.xyzd50ToRec2020(...t.#o()),t.alpha),xyz:t=>new mt("xyz",...A.xyzd50ToD65(...t.#o()),t.alpha),"xyz-d50":t=>new mt("xyz-d50",...t.#o(),t.alpha),"xyz-d65":t=>new mt("xyz-d65",...A.xyzd50ToD65(...t.#o()),t.alpha)};#a(t=!0){const e=function(t){const e=t[0],r=t[1],s=t[2],n=r/(r+s);let i=[n,n,n,t[3]];if(r+s<1){i=it([e,1,.5,t[3]]);for(let t=0;t<3;++t)i[t]+=r-(r+s)*i[t]}return i}([this.h,this.w,this.b,0]);return t?[e[0],e[1],e[2],this.alpha??void 0]:[e[0],e[1],e[2]]}#o(){const t=this.#a(!1);return A.srgbToXyzd50(t[0],t[1],t[2])}constructor(t,e,r,s,n){if(this.#n=[t,e,r],this.w=K(e,{min:0,max:1}),this.b=K(r,{min:0,max:1}),t=ct(1,this.w+this.b)?0:t,this.h=H(360*t)/360,this.alpha=K(s,{min:0,max:1}),ct(1,this.w+this.b)){const t=this.w/this.b;this.b=1/(1+t),this.w=1-this.b}this.#s=n}equal(t){const e=t.as("hwb");return ht(this.h,e.h)&&ht(this.w,e.w)&&ht(this.b,e.b)&&ht(this.alpha,e.alpha)}asString(t){return t?this.as(t).asString():this.#l(this.h,this.w,this.b)}#l(t,r,s){const n=e.StringUtilities.sprintf("hwb(%sdeg %s% %s%",e.StringUtilities.stringifyWithPrecision(360*t),e.StringUtilities.stringifyWithPrecision(100*r),e.StringUtilities.stringifyWithPrecision(100*s));return null!==this.alpha&&1!==this.alpha?n+e.StringUtilities.sprintf(" / %s%)",e.StringUtilities.stringifyWithPrecision(100*this.alpha)):n+")"}setAlpha(t){return new bt(this.h,this.w,this.b,t,this.#s)}format(){return null===this.alpha||ht(this.alpha,1)?"hwb":"hwba"}is(t){return t===this.format()}as(t){return t===this.format()?this:bt.#i[t](this)}asLegacyColor(){return this.as("rgba")}getAuthoredText(){return this.#s??null}canonicalHWBA(){return[Math.round(360*this.h),Math.round(100*this.w),Math.round(100*this.b),this.alpha??1]}getRawParameters(){return[...this.#n]}getAsRawString(t){return t?this.as(t).getAsRawString():this.#l(...this.#n)}isGamutClipped(){return!(ct(this.#n[1],1)&&ct(0,this.#n[1])&&ct(this.#n[2],1)&&ct(0,this.#n[2]))}static fromSpec(t,e){const r=st(t[0]);if(null===r)return null;const s=nt(t[1]);if(null===s)return null;const n=nt(t[2]);if(null===n)return null;const i=tt(t[3]);return new bt(r,s,n,i,e)}}function ft(t){return Math.round(255*t)}class wt{color;constructor(t){this.color=t}get alpha(){return this.color.alpha}rgba(){return this.color.rgba()}equal(t){return this.color.equal(t)}setAlpha(t){return this.color.setAlpha(t)}format(){return 1!==(this.alpha??1)?"hexa":"hex"}as(t){return this.color.as(t)}is(t){return this.color.is(t)}asLegacyColor(){return this.color.asLegacyColor()}getAuthoredText(){return this.color.getAuthoredText()}getRawParameters(){return this.color.getRawParameters()}isGamutClipped(){return this.color.isGamutClipped()}asString(t){if(t)return this.as(t).asString();const[e,r,s]=this.color.rgba();return this.stringify(e,r,s)}getAsRawString(t){if(t)return this.as(t).getAsRawString();const[e,r,s]=this.getRawParameters();return this.stringify(e,r,s)}}class St extends wt{setAlpha(t){return new St(this.color.setAlpha(t))}asString(t){return t&&t!==this.format()?super.as(t).asString():super.asString()}stringify(t,r,s){function n(t){return(Math.round(255*t)/17).toString(16)}return this.color.hasAlpha()?e.StringUtilities.sprintf("#%s%s%s%s",n(t),n(r),n(s),n(this.alpha??1)).toLowerCase():e.StringUtilities.sprintf("#%s%s%s",n(t),n(r),n(s)).toLowerCase()}}class xt extends wt{nickname;constructor(t,e){super(e),this.nickname=t}static fromName(t,e){const r=t.toLowerCase(),s=Rt.get(r);return void 0!==s?new xt(r,vt.fromRGBA(s,e)):null}stringify(){return this.nickname}getAsRawString(t){return this.color.getAsRawString(t)}}class vt{#n;#h;#s;#c;static#i={hex:t=>new vt(t.#h,"hex"),hexa:t=>new vt(t.#h,"hexa"),rgb:t=>new vt(t.#h,"rgb"),rgba:t=>new vt(t.#h,"rgba"),hsl:t=>new yt(...L([t.#h[0],t.#h[1],t.#h[2]]),t.alpha),hsla:t=>new yt(...L([t.#h[0],t.#h[1],t.#h[2]]),t.alpha),hwb:t=>new bt(..._([t.#h[0],t.#h[1],t.#h[2]]),t.alpha),hwba:t=>new bt(..._([t.#h[0],t.#h[1],t.#h[2]]),t.alpha),lch:t=>new gt(...A.labToLch(...A.xyzd50ToLab(...t.#o())),t.alpha),oklch:t=>new pt(...A.xyzd50ToOklch(...t.#o()),t.alpha),lab:t=>new ut(...A.xyzd50ToLab(...t.#o()),t.alpha),oklab:t=>new dt(...A.xyzd65ToOklab(...A.xyzd50ToD65(...t.#o())),t.alpha),srgb:t=>new mt("srgb",...A.xyzd50ToSrgb(...t.#o()),t.alpha),"srgb-linear":t=>new mt("srgb-linear",...A.xyzd50TosRGBLinear(...t.#o()),t.alpha),"display-p3":t=>new mt("display-p3",...A.xyzd50ToDisplayP3(...t.#o()),t.alpha),"a98-rgb":t=>new mt("a98-rgb",...A.xyzd50ToAdobeRGB(...t.#o()),t.alpha),"prophoto-rgb":t=>new mt("prophoto-rgb",...A.xyzd50ToProPhoto(...t.#o()),t.alpha),rec2020:t=>new mt("rec2020",...A.xyzd50ToRec2020(...t.#o()),t.alpha),xyz:t=>new mt("xyz",...A.xyzd50ToD65(...t.#o()),t.alpha),"xyz-d50":t=>new mt("xyz-d50",...t.#o(),t.alpha),"xyz-d65":t=>new mt("xyz-d65",...A.xyzd50ToD65(...t.#o()),t.alpha)};#o(){const[t,e,r]=this.#h;return A.srgbToXyzd50(t,e,r)}get alpha(){switch(this.format()){case"hexa":case"rgba":return this.#h[3];default:return null}}asLegacyColor(){return this}nickname(){const t=zt.get(String(this.canonicalRGBA()));return t?new xt(t,this):null}shortHex(){for(let t=0;t<4;++t){if(Math.round(255*this.#h[t])%17)return null}return new St(this)}constructor(t,e,r){this.#s=r||null,this.#c=e,this.#n=[t[0],t[1],t[2]],this.#h=[K(t[0],{min:0,max:1}),K(t[1],{min:0,max:1}),K(t[2],{min:0,max:1}),K(t[3]??1,{min:0,max:1})]}static fromHex(t,e){const r=4===(t=t.toLowerCase()).length||8===t.length?"hexa":"hex",s=t.length<=4;s&&(t=t.charAt(0)+t.charAt(0)+t.charAt(1)+t.charAt(1)+t.charAt(2)+t.charAt(2)+t.charAt(3)+t.charAt(3));const n=parseInt(t.substring(0,2),16),i=parseInt(t.substring(2,4),16),a=parseInt(t.substring(4,6),16);let o=1;8===t.length&&(o=parseInt(t.substring(6,8),16)/255);const l=new vt([n/255,i/255,a/255,o],r,e);return s?new St(l):l}static fromRGBAFunction(t,r,s,n,i){const a=[rt(t),rt(r),rt(s),n?(o=n,et(o)):1];var o;return e.ArrayUtilities.arrayDoesNotContainNullOrUndefined(a)?new vt(a,n?"rgba":"rgb",i):null}static fromRGBA(t,e){return new vt([t[0]/255,t[1]/255,t[2]/255,t[3]],"rgba",e)}static fromHSVA(t){const e=at(t);return new vt(e,"rgba")}is(t){return t===this.format()}as(t){return t===this.format()?this:vt.#i[t](this)}format(){return this.#c}hasAlpha(){return 1!==this.#h[3]}detectHEXFormat(){return this.hasAlpha()?"hexa":"hex"}asString(t){return t?this.as(t).asString():this.#l(t,this.#h[0],this.#h[1],this.#h[2])}#l(t,r,s,n){function i(t){const e=Math.round(255*t).toString(16);return 1===e.length?"0"+e:e}switch(t||(t=this.#c),t){case"rgb":case"rgba":{const t=e.StringUtilities.sprintf("rgb(%d %d %d",ft(r),ft(s),ft(n));return this.hasAlpha()?t+e.StringUtilities.sprintf(" / %d%)",Math.round(100*this.#h[3])):t+")"}case"hex":case"hexa":return this.hasAlpha()?e.StringUtilities.sprintf("#%s%s%s%s",i(r),i(s),i(n),i(this.#h[3])).toLowerCase():e.StringUtilities.sprintf("#%s%s%s",i(r),i(s),i(n)).toLowerCase()}}getAuthoredText(){return this.#s??null}getRawParameters(){return[...this.#n]}getAsRawString(t){return t?this.as(t).getAsRawString():this.#l(t,...this.#n)}isGamutClipped(){return!ht(this.#n.map(ft),[this.#h[0],this.#h[1],this.#h[2]].map(ft),1)}rgba(){return[...this.#h]}canonicalRGBA(){const t=new Array(4);for(let e=0;e<3;++e)t[e]=Math.round(255*this.#h[e]);return t[3]=this.#h[3],t}toProtocolRGBA(){const t=this.canonicalRGBA(),e={r:t[0],g:t[1],b:t[2],a:void 0};return 1!==t[3]&&(e.a=t[3]),e}invert(){const t=[0,0,0,0];return t[0]=1-this.#h[0],t[1]=1-this.#h[1],t[2]=1-this.#h[2],t[3]=this.#h[3],new vt(t,"rgba")}grayscale(){const[t,e,r]=this.#h,s=.299*t+.587*e+.114*r;return new vt([s,s,s,.5],"rgba")}setAlpha(t){const e=[...this.#h];return e[3]=t,new vt(e,"rgba")}blendWith(t){const e=E(t.#h,this.#h);return new vt(e,"rgba")}blendWithAlpha(t){const e=[...this.#h];return e[3]*=t,new vt(e,"rgba")}setFormat(t){this.#c=t}equal(t){const e=t.as(this.#c);return ht(ft(this.#h[0]),ft(e.#h[0]),1)&&ht(ft(this.#h[1]),ft(e.#h[1]),1)&&ht(ft(this.#h[2]),ft(e.#h[2]),1)&&ht(this.#h[3],e.#h[3])}}const Tt=[["aliceblue",[240,248,255]],["antiquewhite",[250,235,215]],["aqua",[0,255,255]],["aquamarine",[127,255,212]],["azure",[240,255,255]],["beige",[245,245,220]],["bisque",[255,228,196]],["black",[0,0,0]],["blanchedalmond",[255,235,205]],["blue",[0,0,255]],["blueviolet",[138,43,226]],["brown",[165,42,42]],["burlywood",[222,184,135]],["cadetblue",[95,158,160]],["chartreuse",[127,255,0]],["chocolate",[210,105,30]],["coral",[255,127,80]],["cornflowerblue",[100,149,237]],["cornsilk",[255,248,220]],["crimson",[237,20,61]],["cyan",[0,255,255]],["darkblue",[0,0,139]],["darkcyan",[0,139,139]],["darkgoldenrod",[184,134,11]],["darkgray",[169,169,169]],["darkgrey",[169,169,169]],["darkgreen",[0,100,0]],["darkkhaki",[189,183,107]],["darkmagenta",[139,0,139]],["darkolivegreen",[85,107,47]],["darkorange",[255,140,0]],["darkorchid",[153,50,204]],["darkred",[139,0,0]],["darksalmon",[233,150,122]],["darkseagreen",[143,188,143]],["darkslateblue",[72,61,139]],["darkslategray",[47,79,79]],["darkslategrey",[47,79,79]],["darkturquoise",[0,206,209]],["darkviolet",[148,0,211]],["deeppink",[255,20,147]],["deepskyblue",[0,191,255]],["dimgray",[105,105,105]],["dimgrey",[105,105,105]],["dodgerblue",[30,144,255]],["firebrick",[178,34,34]],["floralwhite",[255,250,240]],["forestgreen",[34,139,34]],["fuchsia",[255,0,255]],["gainsboro",[220,220,220]],["ghostwhite",[248,248,255]],["gold",[255,215,0]],["goldenrod",[218,165,32]],["gray",[128,128,128]],["grey",[128,128,128]],["green",[0,128,0]],["greenyellow",[173,255,47]],["honeydew",[240,255,240]],["hotpink",[255,105,180]],["indianred",[205,92,92]],["indigo",[75,0,130]],["ivory",[255,255,240]],["khaki",[240,230,140]],["lavender",[230,230,250]],["lavenderblush",[255,240,245]],["lawngreen",[124,252,0]],["lemonchiffon",[255,250,205]],["lightblue",[173,216,230]],["lightcoral",[240,128,128]],["lightcyan",[224,255,255]],["lightgoldenrodyellow",[250,250,210]],["lightgreen",[144,238,144]],["lightgray",[211,211,211]],["lightgrey",[211,211,211]],["lightpink",[255,182,193]],["lightsalmon",[255,160,122]],["lightseagreen",[32,178,170]],["lightskyblue",[135,206,250]],["lightslategray",[119,136,153]],["lightslategrey",[119,136,153]],["lightsteelblue",[176,196,222]],["lightyellow",[255,255,224]],["lime",[0,255,0]],["limegreen",[50,205,50]],["linen",[250,240,230]],["magenta",[255,0,255]],["maroon",[128,0,0]],["mediumaquamarine",[102,205,170]],["mediumblue",[0,0,205]],["mediumorchid",[186,85,211]],["mediumpurple",[147,112,219]],["mediumseagreen",[60,179,113]],["mediumslateblue",[123,104,238]],["mediumspringgreen",[0,250,154]],["mediumturquoise",[72,209,204]],["mediumvioletred",[199,21,133]],["midnightblue",[25,25,112]],["mintcream",[245,255,250]],["mistyrose",[255,228,225]],["moccasin",[255,228,181]],["navajowhite",[255,222,173]],["navy",[0,0,128]],["oldlace",[253,245,230]],["olive",[128,128,0]],["olivedrab",[107,142,35]],["orange",[255,165,0]],["orangered",[255,69,0]],["orchid",[218,112,214]],["palegoldenrod",[238,232,170]],["palegreen",[152,251,152]],["paleturquoise",[175,238,238]],["palevioletred",[219,112,147]],["papayawhip",[255,239,213]],["peachpuff",[255,218,185]],["peru",[205,133,63]],["pink",[255,192,203]],["plum",[221,160,221]],["powderblue",[176,224,230]],["purple",[128,0,128]],["rebeccapurple",[102,51,153]],["red",[255,0,0]],["rosybrown",[188,143,143]],["royalblue",[65,105,225]],["saddlebrown",[139,69,19]],["salmon",[250,128,114]],["sandybrown",[244,164,96]],["seagreen",[46,139,87]],["seashell",[255,245,238]],["sienna",[160,82,45]],["silver",[192,192,192]],["skyblue",[135,206,235]],["slateblue",[106,90,205]],["slategray",[112,128,144]],["slategrey",[112,128,144]],["snow",[255,250,250]],["springgreen",[0,255,127]],["steelblue",[70,130,180]],["tan",[210,180,140]],["teal",[0,128,128]],["thistle",[216,191,216]],["tomato",[255,99,71]],["turquoise",[64,224,208]],["violet",[238,130,238]],["wheat",[245,222,179]],["white",[255,255,255]],["whitesmoke",[245,245,245]],["yellow",[255,255,0]],["yellowgreen",[154,205,50]],["transparent",[0,0,0,0]]];console.assert(Tt.every((([t])=>t.toLowerCase()===t)),"All color nicknames must be lowercase.");const Rt=new Map(Tt),zt=new Map(Tt.map((([t,[e,r,s,n=1]])=>[String([e,r,s,n]),t]))),It=[127,32,210],At={Content:vt.fromRGBA([111,168,220,.66]),ContentLight:vt.fromRGBA([111,168,220,.5]),ContentOutline:vt.fromRGBA([9,83,148]),Padding:vt.fromRGBA([147,196,125,.55]),PaddingLight:vt.fromRGBA([147,196,125,.4]),Border:vt.fromRGBA([255,229,153,.66]),BorderLight:vt.fromRGBA([255,229,153,.5]),Margin:vt.fromRGBA([246,178,107,.66]),MarginLight:vt.fromRGBA([246,178,107,.5]),EventTarget:vt.fromRGBA([255,196,196,.66]),Shape:vt.fromRGBA([96,82,177,.8]),ShapeMargin:vt.fromRGBA([96,82,127,.6]),CssGrid:vt.fromRGBA([75,0,130,1]),LayoutLine:vt.fromRGBA([...It,1]),GridBorder:vt.fromRGBA([...It,1]),GapBackground:vt.fromRGBA([...It,.3]),GapHatch:vt.fromRGBA([...It,.8]),GridAreaBorder:vt.fromRGBA([26,115,232,1])},Pt={ParentOutline:vt.fromRGBA([224,90,183,1]),ChildOutline:vt.fromRGBA([0,120,212,1])},Et={Resizer:vt.fromRGBA([222,225,230,1]),ResizerHandle:vt.fromRGBA([166,166,166,1]),Mask:vt.fromRGBA([248,249,249,1])};var kt=Object.freeze({__proto__:null,ColorFunction:mt,ColorMixRegex:/color-mix\(.*,\s*(?.+)\s*,\s*(?.+)\s*\)/g,Generator:class{#u;#g;#d;#p;#m=new Map;constructor(t,e,r,s){this.#u=t||{min:0,max:360,count:void 0},this.#g=e||67,this.#d=r||80,this.#p=s||1}setColorForID(t,e){this.#m.set(t,e)}colorForID(t){let e=this.#m.get(t);return e||(e=this.generateColorForID(t),this.#m.set(t,e)),e}generateColorForID(t){const r=e.StringUtilities.hashCode(t),s=this.indexToValueInSpace(r,this.#u),n=this.indexToValueInSpace(r>>8,this.#g),i=this.indexToValueInSpace(r>>16,this.#d),a=this.indexToValueInSpace(r>>24,this.#p),o=`hsl(${s}deg ${n}% ${i}%`;return 1!==a?`${o} / ${Math.floor(100*a)}%)`:`${o})`}indexToValueInSpace(t,e){if("number"==typeof e)return e;const r=e.count||e.max-e.min;return t%=r,e.min+Math.floor(t/(r-1)*(e.max-e.min))}},HSL:yt,HWB:bt,IsolationModeHighlight:Et,LCH:gt,Lab:ut,Legacy:vt,Nickname:xt,Nicknames:Rt,Oklab:dt,Oklch:pt,PageHighlight:At,Regex:/((?:rgba?|hsla?|hwba?|lab|lch|oklab|oklch|color)\([^)]+\)|#[0-9a-fA-F]{8}|#[0-9a-fA-F]{6}|#[0-9a-fA-F]{3,4}|\b[a-zA-Z]+\b(?!-))/g,ShortHex:St,SourceOrderHighlight:Pt,approachColorValue:lt,desiredLuminance:ot,findFgColorForContrast:function(t,e,r){const s=t.as("hsl").hsva(),n=e.rgba(),i=t=>O(E(vt.fromHSVA(t).rgba(),n)),a=O(e.rgba()),o=ot(a,r,i(s)>a);return lt(s,0,2,o,i)?vt.fromHSVA(s):(s[2]=1,lt(s,0,1,o,i)?vt.fromHSVA(s):null)},findFgColorForContrastAPCA:function(t,e,r){const s=t.as("hsl").hsva(),n=(e.rgba(),t=>B(vt.fromHSVA(t).rgba())),i=B(e.rgba()),a=X(i,r,n(s)>=i);if(lt(s,0,2,a,n)){const t=vt.fromHSVA(s);if(Math.abs(G(e.rgba(),t.rgba()))>=r)return t}if(s[2]=1,lt(s,0,1,a,n)){const t=vt.fromHSVA(s);if(Math.abs(G(e.rgba(),t.rgba()))>=r)return t}return null},getFormat:function(t){switch(t){case"hex":return"hex";case"hexa":return"hexa";case"rgb":return"rgb";case"rgba":return"rgba";case"hsl":return"hsl";case"hsla":return"hsla";case"hwb":return"hwb";case"hwba":return"hwba";case"lch":return"lch";case"oklch":return"oklch";case"lab":return"lab";case"oklab":return"oklab"}return Y(t)},hsl2rgb:it,hsva2rgba:at,parse:function(t){if(!t.match(/\s/)){const e=t.toLowerCase().match(/^(?:#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})|(\w+))$/i);if(e)return e[1]?vt.fromHex(e[1],t):e[2]?xt.fromName(e[2],t):null}const e=t.toLowerCase().match(/^\s*(?:(rgba?)|(hsla?)|(hwba?)|(lch)|(oklch)|(lab)|(oklab)|(color))\((.*)\)\s*$/);if(e){const r=Boolean(e[1]),s=Boolean(e[2]),n=Boolean(e[3]),i=Boolean(e[4]),a=Boolean(e[5]),o=Boolean(e[6]),l=Boolean(e[7]),h=Boolean(e[8]),c=e[9];if(h)return mt.fromSpec(t,c);const u=function(t,{allowCommas:e,convertNoneToZero:r}){const s=t.trim();let n=[];e&&(n=s.split(/\s*,\s*/));if(!e||1===n.length)if(n=s.split(/\s+/),"/"===n[3]){if(n.splice(3,1),4!==n.length)return null}else if(n.length>2&&-1!==n[2].indexOf("/")||n.length>3&&-1!==n[3].indexOf("/")){const t=n.slice(2,4).join("");n=n.slice(0,2).concat(t.split(/\//)).concat(n.slice(4))}else if(n.length>=4)return null;if(3!==n.length&&4!==n.length||n.indexOf("")>-1)return null;if(r)return n.map((t=>"none"===t?"0":t));return n}(c,{allowCommas:r||s,convertNoneToZero:!(r||s||n)});if(!u)return null;const g=[u[0],u[1],u[2],u[3]];if(r)return vt.fromRGBAFunction(u[0],u[1],u[2],u[3],t);if(s)return yt.fromSpec(g,t);if(n)return bt.fromSpec(g,t);if(i)return gt.fromSpec(g,t);if(a)return pt.fromSpec(g,t);if(o)return ut.fromSpec(g,t);if(l)return dt.fromSpec(g,t)}return null},parseHueNumeric:st,rgb2hsv:function(t){const e=L(t),r=e[0];let s=e[1];const n=e[2];return s*=n<.5?n:1-n,[r,0!==s?2*s/(n+s):0,n+s]}});class Lt{listeners;addEventListener(t,e,r){this.listeners||(this.listeners=new Map);let s=this.listeners.get(t);return s||(s=new Set,this.listeners.set(t,s)),s.add({thisObject:r,listener:e}),{eventTarget:this,eventType:t,thisObject:r,listener:e}}once(t){return new Promise((e=>{const r=this.addEventListener(t,(s=>{this.removeEventListener(t,r.listener),e(s.data)}))}))}removeEventListener(t,e,r){const s=this.listeners?.get(t);if(s){for(const t of s)t.listener===e&&t.thisObject===r&&(t.disposed=!0,s.delete(t));s.size||this.listeners?.delete(t)}}hasEventListeners(t){return Boolean(this.listeners?.has(t))}dispatchEventToListeners(t,...[e]){const r=this.listeners?.get(t);if(!r)return;const s={data:e,source:this};for(const t of[...r])t.disposed||t.listener.call(t.thisObject,s)}}var Ct=Object.freeze({__proto__:null,ObjectWrapper:Lt,eventMixin:function(t){return console.assert(t!==HTMLElement),class extends t{#y=new Lt;addEventListener(t,e,r){return this.#y.addEventListener(t,e,r)}once(t){return this.#y.once(t)}removeEventListener(t,e,r){this.#y.removeEventListener(t,e,r)}hasEventListeners(t){return this.#y.hasEventListeners(t)}dispatchEventToListeners(t,...e){this.#y.dispatchEventToListeners(t,...e)}}}});const _t={elementsPanel:"Elements panel",stylesSidebar:"styles sidebar",changesDrawer:"Changes drawer",issuesView:"Issues view",networkPanel:"Network panel",applicationPanel:"Application panel",securityPanel:"Security panel",sourcesPanel:"Sources panel",timelinePanel:"Performance panel",memoryInspectorPanel:"Memory inspector panel",developerResourcesPanel:"Developer Resources panel",animationsPanel:"Animations panel"},Nt=r.i18n.registerUIStrings("core/common/Revealer.ts",_t),Ot=r.i18n.getLazilyComputedLocalizedString.bind(void 0,Nt);let Vt;class Bt{registeredRevealers=[];static instance(){return void 0===Vt&&(Vt=new Bt),Vt}static removeInstance(){Vt=void 0}register(t){this.registeredRevealers.push(t)}async reveal(t,e){const r=await Promise.all(this.getApplicableRegisteredRevealers(t).map((t=>t.loadRevealer())));if(r.length<1)throw new Error(`No revealers found for ${t}`);if(r.length>1)throw new Error(`Conflicting reveals found for ${t}`);return await r[0].reveal(t,e)}getApplicableRegisteredRevealers(t){return this.registeredRevealers.filter((e=>{for(const r of e.contextTypes())if(t instanceof r)return!0;return!1}))}}async function Gt(t,e=!1){await Bt.instance().reveal(t,e)}const Mt={DEVELOPER_RESOURCES_PANEL:Ot(_t.developerResourcesPanel),ELEMENTS_PANEL:Ot(_t.elementsPanel),STYLES_SIDEBAR:Ot(_t.stylesSidebar),CHANGES_DRAWER:Ot(_t.changesDrawer),ISSUES_VIEW:Ot(_t.issuesView),NETWORK_PANEL:Ot(_t.networkPanel),TIMELINE_PANEL:Ot(_t.timelinePanel),APPLICATION_PANEL:Ot(_t.applicationPanel),SOURCES_PANEL:Ot(_t.sourcesPanel),SECURITY_PANEL:Ot(_t.securityPanel),MEMORY_INSPECTOR_PANEL:Ot(_t.memoryInspectorPanel),ANIMATIONS_PANEL:Ot(_t.animationsPanel)};var Wt=Object.freeze({__proto__:null,RevealerDestination:Mt,RevealerRegistry:Bt,registerRevealer:function(t){Bt.instance().register(t)},reveal:Gt,revealDestination:function(t){const e=Bt.instance().getApplicableRegisteredRevealers(t);for(const{destination:t}of e)if(t)return t();return null}});let Xt;class Dt extends Lt{#b;constructor(){super(),this.#b=[]}static instance(t){return Xt&&!t?.forceNew||(Xt=new Dt),Xt}static removeInstance(){Xt=void 0}addMessage(t,e="info",r=!1,s){const n=new jt(t,e,Date.now(),r,s);this.#b.push(n),this.dispatchEventToListeners("messageAdded",n)}log(t){this.addMessage(t,"info")}warn(t,e){this.addMessage(t,"warning",void 0,e)}error(t,e=!0){this.addMessage(t,"error",e)}messages(){return this.#b}show(){this.showPromise()}showPromise(){return Gt(this)}}var Ft;!function(t){t.CSS="css",t.ConsoleAPI="console-api",t.ISSUE_PANEL="issue-panel",t.SELF_XSS="self-xss"}(Ft||(Ft={}));class jt{text;level;timestamp;show;source;constructor(t,e,r,s,n){this.text=t,this.level=e,this.timestamp="number"==typeof r?r:Date.now(),this.show=s,n&&(this.source=n)}}var Ut=Object.freeze({__proto__:null,Console:Dt,get FrontendMessageSource(){return Ft},Message:jt});var $t=Object.freeze({__proto__:null,debounce:function(t,e){let r=0;return()=>{clearTimeout(r),r=window.setTimeout((()=>t()),e)}}});var Ht=Object.freeze({__proto__:null,fireEvent:function(t,e={},r=window){const s=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e});r.dispatchEvent(s)},removeEventListeners:function(t){for(const e of t)e.eventTarget.removeEventListener(e.eventType,e.listener,e.thisObject);t.splice(0)}}),qt=Object.freeze({__proto__:null});const Yt=Symbol("uninitialized"),Zt=Symbol("error");var Kt=Object.freeze({__proto__:null,lazy:function(t){let e=Yt,r=new Error("Initial");return()=>{if(e===Zt)throw r;if(e!==Yt)return e;try{return e=t(),e}catch(t){throw r=t instanceof Error?t:new Error(t),e=Zt,r}}}});const Jt=[];function Qt(t){return Jt.filter((function(e){if(!e.contextTypes)return!0;for(const r of e.contextTypes())if(t instanceof r)return!0;return!1}))}var te=Object.freeze({__proto__:null,Linkifier:class{static async linkify(t,e){if(!t)throw new Error("Can't linkify "+t);const r=Qt(t)[0];if(!r)throw new Error("No linkifiers registered for object "+t);return(await r.loadLinkifier()).linkify(t,e)}},getApplicableRegisteredlinkifiers:Qt,registerLinkifier:function(t){Jt.push(t)}});class ee extends Map{getOrInsert(t,e){return this.has(t)||this.set(t,e),this.get(t)}getOrInsertComputed(t,e){return this.has(t)||this.set(t,e(t)),this.get(t)}}var re=Object.freeze({__proto__:null,MapWithDefault:ee});var se=Object.freeze({__proto__:null,Mutex:class{#f=!1;#w=[];acquire(){const t={resolved:!1};return this.#f?new Promise((e=>{this.#w.push((()=>e(this.#S.bind(this,t))))})):(this.#f=!0,Promise.resolve(this.#S.bind(this,t)))}#S(t){if(t.resolved)throw new Error("Cannot release more than once.");t.resolved=!0;const e=this.#w.shift();e?e():this.#f=!1}async run(t){const e=await this.acquire();try{return await t()}finally{e()}}}});function ne(t){if(-1===t.indexOf("..")&&-1===t.indexOf("."))return t;const e=("/"===t[0]?t.substring(1):t).split("/"),r=[];for(const t of e)"."!==t&&(".."===t?r.pop():r.push(t));let s=r.join("/");return"/"===t[0]&&s&&(s="/"+s),"/"===s[s.length-1]||"/"!==t[t.length-1]&&"."!==e[e.length-1]&&".."!==e[e.length-1]||(s+="/"),s}class ie{isValid;url;scheme;user;host;port;path;queryParams;fragment;folderPathComponents;lastPathComponent;blobInnerScheme;#x;#v;constructor(t){this.isValid=!1,this.url=t,this.scheme="",this.user="",this.host="",this.port="",this.path="",this.queryParams="",this.fragment="",this.folderPathComponents="",this.lastPathComponent="";const e=this.url.startsWith("blob:"),r=(e?t.substring(5):t).match(ie.urlRegex());if(r)this.isValid=!0,e?(this.blobInnerScheme=r[2].toLowerCase(),this.scheme="blob"):this.scheme=r[2].toLowerCase(),this.user=r[3]??"",this.host=r[4]??"",this.port=r[5]??"",this.path=r[6]??"/",this.queryParams=r[7]??"",this.fragment=r[8]??"";else{if(this.url.startsWith("data:"))return void(this.scheme="data");if(this.url.startsWith("blob:"))return void(this.scheme="blob");if("about:blank"===this.url)return void(this.scheme="about");this.path=this.url}const s=this.path.lastIndexOf("/",this.path.length-2);this.lastPathComponent=-1!==s?this.path.substring(s+1):this.path;const n=this.path.lastIndexOf("/");-1!==n&&(this.folderPathComponents=this.path.substring(0,n))}static fromString(t){const e=new ie(t.toString());return e.isValid?e:null}static preEncodeSpecialCharactersInPath(t){for(const e of["%",";","#","?"," "])t=t.replaceAll(e,encodeURIComponent(e));return t}static rawPathToEncodedPathString(t){const e=ie.preEncodeSpecialCharactersInPath(t);return t.startsWith("/")?new URL(e,"file:///").pathname:new URL("/"+e,"file:///").pathname.substr(1)}static encodedFromParentPathAndName(t,e){return ie.concatenate(t,"/",ie.preEncodeSpecialCharactersInPath(e))}static urlFromParentUrlAndName(t,e){return ie.concatenate(t,"/",ie.preEncodeSpecialCharactersInPath(e))}static encodedPathToRawPathString(t){return decodeURIComponent(t)}static rawPathToUrlString(t){let e=ie.preEncodeSpecialCharactersInPath(t.replace(/\\/g,"/"));return e=e.replace(/\\/g,"/"),e.startsWith("file://")||(e=e.startsWith("/")?"file://"+e:"file:///"+e),new URL(e).toString()}static relativePathToUrlString(t,e){const r=ie.preEncodeSpecialCharactersInPath(t.replace(/\\/g,"/"));return new URL(r,e).toString()}static urlToRawPathString(t,e){console.assert(t.startsWith("file://"),"This must be a file URL.");const r=decodeURIComponent(t);return e?r.substr(8).replace(/\//g,"\\"):r.substr(7)}static sliceUrlToEncodedPathString(t,e){return t.substring(e)}static substr(t,e,r){return t.substr(e,r)}static substring(t,e,r){return t.substring(e,r)}static prepend(t,e){return t+e}static concatenate(t,...e){return t.concat(...e)}static trim(t){return t.trim()}static slice(t,e,r){return t.slice(e,r)}static join(t,e){return t.join(e)}static split(t,e,r){return t.split(e,r)}static toLowerCase(t){return t.toLowerCase()}static isValidUrlString(t){return new ie(t).isValid}static urlWithoutHash(t){const e=t.indexOf("#");return-1!==e?t.substr(0,e):t}static urlRegex(){if(ie.urlRegexInstance)return ie.urlRegexInstance;return ie.urlRegexInstance=new RegExp("^("+/([A-Za-z][A-Za-z0-9+.-]*):\/\//.source+/(?:([A-Za-z0-9\-._~%!$&'()*+,;=:]*)@)?/.source+/((?:\[::\d?\])|(?:[^\s\/:]*))/.source+/(?::([\d]+))?/.source+")"+/(\/[^#?]*)?/.source+/(?:\?([^#]*))?/.source+/(?:#(.*))?/.source+"$"),ie.urlRegexInstance}static extractPath(t){const e=this.fromString(t);return e?e.path:""}static extractOrigin(t){const r=this.fromString(t);return r?r.securityOrigin():e.DevToolsPath.EmptyUrlString}static extractExtension(t){const e=(t=ie.urlWithoutHash(t)).indexOf("?");-1!==e&&(t=t.substr(0,e));const r=t.lastIndexOf("/");-1!==r&&(t=t.substr(r+1));const s=t.lastIndexOf(".");if(-1!==s){const e=(t=t.substr(s+1)).indexOf("%");return-1!==e?t.substr(0,e):t}return""}static extractName(t){let e=t.lastIndexOf("/");const r=-1!==e?t.substr(e+1):t;return e=r.indexOf("?"),e<0?r:r.substr(0,e)}static completeURL(t,e){if(e.startsWith("data:")||e.startsWith("blob:")||e.startsWith("javascript:")||e.startsWith("mailto:"))return e;const r=e.trim(),s=this.fromString(r);if(s?.scheme){return s.securityOrigin()+ne(s.path)+(s.queryParams&&`?${s.queryParams}`)+(s.fragment&&`#${s.fragment}`)}const n=this.fromString(t);if(!n)return null;if(n.isDataURL())return e;if(e.length>1&&"/"===e.charAt(0)&&"/"===e.charAt(1))return n.scheme+":"+e;const i=n.securityOrigin(),a=n.path,o=n.queryParams?"?"+n.queryParams:"";if(!e.length)return i+a+o;if("#"===e.charAt(0))return i+a+o+e;if("?"===e.charAt(0))return i+a+e;const l=e.match(/^[^#?]*/);if(!l||!e.length)throw new Error("Invalid href");let h=l[0];const c=e.substring(h.length);return"/"!==h.charAt(0)&&(h=n.folderPathComponents+"/"+h),i+ne(h)+c}static splitLineAndColumn(t){const e=t.match(ie.urlRegex());let r="",s=t;e&&(r=e[1],s=t.substring(e[1].length));const n=/(?::(\d+))?(?::(\d+))?$/.exec(s);let i,a;if(console.assert(Boolean(n)),!n)return{url:t,lineNumber:0,columnNumber:0};"string"==typeof n[1]&&(i=parseInt(n[1],10),i=isNaN(i)?void 0:i-1),"string"==typeof n[2]&&(a=parseInt(n[2],10),a=isNaN(a)?void 0:a-1);let o=r+s.substring(0,s.length-n[0].length);if(void 0===n[1]&&void 0===n[2]){const t=/wasm-function\[\d+\]:0x([a-z0-9]+)$/g.exec(s);t&&"string"==typeof t[1]&&(o=ie.removeWasmFunctionInfoFromURL(o),a=parseInt(t[1],16),a=isNaN(a)?void 0:a)}return{url:o,lineNumber:i,columnNumber:a}}static removeWasmFunctionInfoFromURL(t){const e=t.search(/:wasm-function\[\d+\]/);return-1===e?t:ie.substring(t,0,e)}static beginsWithWindowsDriveLetter(t){return/^[A-Za-z]:/.test(t)}static beginsWithScheme(t){return/^[A-Za-z][A-Za-z0-9+.-]*:/.test(t)}static isRelativeURL(t){return!this.beginsWithScheme(t)||this.beginsWithWindowsDriveLetter(t)}get displayName(){return this.#x?this.#x:this.isDataURL()?this.dataURLDisplayName():this.isBlobURL()||this.isAboutBlank()?this.url:(this.#x=this.lastPathComponent,this.#x||(this.#x=(this.host||"")+"/"),"/"===this.#x&&(this.#x=this.url),this.#x)}dataURLDisplayName(){return this.#v?this.#v:this.isDataURL()?(this.#v=e.StringUtilities.trimEndWithMaxLength(this.url,20),this.#v):""}isAboutBlank(){return"about:blank"===this.url}isDataURL(){return"data"===this.scheme}extractDataUrlMimeType(){const t=this.url.match(/^data:((?\w+)\/(?\w+))?(;base64)?,/);return{type:t?.groups?.type,subtype:t?.groups?.subtype}}isBlobURL(){return this.url.startsWith("blob:")}lastPathComponentWithFragment(){return this.lastPathComponent+(this.fragment?"#"+this.fragment:"")}domain(){return this.isDataURL()?"data:":this.host+(this.port?":"+this.port:"")}securityOrigin(){if(this.isDataURL())return"data:";return(this.isBlobURL()?this.blobInnerScheme:this.scheme)+"://"+this.domain()}urlWithoutScheme(){return this.scheme&&this.url.startsWith(this.scheme+"://")?this.url.substring(this.scheme.length+3):this.url}static urlRegexInstance=null}var ae=Object.freeze({__proto__:null,ParsedURL:ie,normalizePath:ne,schemeIs:function(t,e){try{return new URL(t).protocol===e}catch{return!1}}});class oe{#T;#R;#z;#I;constructor(t,e){this.#T=t,this.#R=e||1,this.#z=0,this.#I=0}isCanceled(){return this.#T.parent.isCanceled()}setTitle(t){this.#T.parent.setTitle(t)}done(){this.setWorked(this.#I),this.#T.childDone()}setTotalWork(t){this.#I=t,this.#T.update()}setWorked(t,e){this.#z=t,void 0!==e&&this.setTitle(e),this.#T.update()}incrementWorked(t){this.setWorked(this.#z+(t||1))}getWeight(){return this.#R}getWorked(){return this.#z}getTotalWork(){return this.#I}}var le=Object.freeze({__proto__:null,CompositeProgress:class{parent;#A;#P;constructor(t){this.parent=t,this.#A=[],this.#P=0,this.parent.setTotalWork(1),this.parent.setWorked(0)}childDone(){++this.#P===this.#A.length&&this.parent.done()}createSubProgress(t){const e=new oe(this,t);return this.#A.push(e),e}update(){let t=0,e=0;for(let r=0;r{};return this.getOrCreatePromise(t).catch(r).then((t=>{t&&e(t)})),null}return r}clear(){this.stopListening();for(const[t,{reject:e}]of this.#L.entries())e(new Error(`Object with ${t} never resolved.`));this.#L.clear()}getOrCreatePromise(t){const e=this.#L.get(t);if(e)return e.promise;const{resolve:r,reject:s,promise:n}=Promise.withResolvers();return this.#L.set(t,{promise:n,resolve:r,reject:s}),this.startListening(),n}onResolve(t,e){const r=this.#L.get(t);this.#L.delete(t),0===this.#L.size&&this.stopListening(),r?.resolve(e)}}});const ue={fetchAndXHR:"`Fetch` and `XHR`",javascript:"JavaScript",js:"JS",css:"CSS",img:"Img",media:"Media",font:"Font",doc:"Doc",socketShort:"Socket",webassembly:"WebAssembly",wasm:"Wasm",manifest:"Manifest",other:"Other",document:"Document",stylesheet:"Stylesheet",image:"Image",script:"Script",texttrack:"TextTrack",fetch:"Fetch",eventsource:"EventSource",websocket:"WebSocket",webtransport:"WebTransport",directsocket:"DirectSocket",signedexchange:"SignedExchange",ping:"Ping",cspviolationreport:"CSPViolationReport",preflight:"Preflight",webbundle:"WebBundle"},ge=r.i18n.registerUIStrings("core/common/ResourceType.ts",ue),de=r.i18n.getLazilyComputedLocalizedString.bind(void 0,ge);class pe{#C;#_;#N;#O;constructor(t,e,r,s){this.#C=t,this.#_=e,this.#N=r,this.#O=s}static fromMimeType(t){return t?t.startsWith("text/html")?fe.Document:t.startsWith("text/css")?fe.Stylesheet:t.startsWith("image/")?fe.Image:t.startsWith("text/")?fe.Script:t.includes("font")?fe.Font:t.includes("script")?fe.Script:t.includes("octet")?fe.Other:t.includes("application")?fe.Script:fe.Other:fe.Other}static fromMimeTypeOverride(t){return"application/manifest+json"===t?fe.Manifest:"application/wasm"===t?fe.Wasm:"application/webbundle"===t?fe.WebBundle:null}static fromURL(t){return Se.get(ie.extractExtension(t))||null}static fromName(t){for(const e in fe){const r=fe[e];if(r.name()===t)return r}return null}static mimeFromURL(t){if(t.startsWith("snippet://")||t.startsWith("debugger://"))return"text/javascript";const e=ie.extractName(t);if(we.has(e))return we.get(e);let r=ie.extractExtension(t).toLowerCase();return"html"===r&&e.endsWith(".component.html")&&(r="component.html"),xe.get(r)}static mimeFromExtension(t){return xe.get(t)}static simplifyContentType(t){return new RegExp("^application(.*json$|/json+.*)").test(t)?"application/json":t}static mediaTypeForMetrics(t,e,r,s,n){return"text/javascript"!==t?t:e?"text/javascript+sourcemapped":r?"text/javascript+minified":s?"text/javascript+snippet":n?"text/javascript+eval":"text/javascript+plain"}name(){return this.#C}title(){return this.#_()}category(){return this.#N}isTextType(){return this.#O}isScript(){return"script"===this.#C||"sm-script"===this.#C}hasScripts(){return this.isScript()||this.isDocument()}isStyleSheet(){return"stylesheet"===this.#C||"sm-stylesheet"===this.#C}hasStyleSheets(){return this.isStyleSheet()||this.isDocument()}isDocument(){return"document"===this.#C}isDocumentOrScriptOrStyleSheet(){return this.isDocument()||this.isScript()||this.isStyleSheet()}isFont(){return"font"===this.#C}isImage(){return"image"===this.#C}isFromSourceMap(){return this.#C.startsWith("sm-")}isWebbundle(){return"webbundle"===this.#C}toString(){return this.#C}canonicalMimeType(){return this.isDocument()?"text/html":this.isScript()?"text/javascript":this.isStyleSheet()?"text/css":""}}class me{name;title;shortTitle;constructor(t,e,r){this.name=t,this.title=e,this.shortTitle=r}}const ye={XHR:new me("Fetch and XHR",de(ue.fetchAndXHR),r.i18n.lockedLazyString("Fetch/XHR")),Document:new me(ue.document,de(ue.document),de(ue.doc)),Stylesheet:new me(ue.css,de(ue.css),de(ue.css)),Script:new me(ue.javascript,de(ue.javascript),de(ue.js)),Font:new me(ue.font,de(ue.font),de(ue.font)),Image:new me(ue.image,de(ue.image),de(ue.img)),Media:new me(ue.media,de(ue.media),de(ue.media)),Manifest:new me(ue.manifest,de(ue.manifest),de(ue.manifest)),Socket:new me("Socket",r.i18n.lockedLazyString("WebSocket | WebTransport | DirectSocket"),de(ue.socketShort)),Wasm:new me(ue.webassembly,de(ue.webassembly),de(ue.wasm)),Other:new me(ue.other,de(ue.other),de(ue.other))},be={XHR:new me("Fetch and XHR",de(ue.fetchAndXHR),r.i18n.lockedLazyString("Fetch/XHR")),Script:new me(ue.javascript,de(ue.javascript),de(ue.js)),Image:new me(ue.image,de(ue.image),de(ue.img)),Media:new me(ue.media,de(ue.media),de(ue.media)),Other:new me(ue.other,de(ue.other),de(ue.other))},fe={Document:new pe("document",de(ue.document),ye.Document,!0),Stylesheet:new pe("stylesheet",de(ue.stylesheet),ye.Stylesheet,!0),Image:new pe("image",de(ue.image),ye.Image,!1),Media:new pe("media",de(ue.media),ye.Media,!1),Font:new pe("font",de(ue.font),ye.Font,!1),Script:new pe("script",de(ue.script),ye.Script,!0),TextTrack:new pe("texttrack",de(ue.texttrack),ye.Other,!0),XHR:new pe("xhr",r.i18n.lockedLazyString("XHR"),ye.XHR,!0),Fetch:new pe("fetch",de(ue.fetch),ye.XHR,!0),Prefetch:new pe("prefetch",r.i18n.lockedLazyString("Prefetch"),ye.Document,!0),EventSource:new pe("eventsource",de(ue.eventsource),ye.XHR,!0),WebSocket:new pe("websocket",de(ue.websocket),ye.Socket,!1),WebTransport:new pe("webtransport",de(ue.webtransport),ye.Socket,!1),DirectSocket:new pe("directsocket",de(ue.directsocket),ye.Socket,!1),Wasm:new pe("wasm",de(ue.wasm),ye.Wasm,!1),Manifest:new pe("manifest",de(ue.manifest),ye.Manifest,!0),SignedExchange:new pe("signed-exchange",de(ue.signedexchange),ye.Other,!1),Ping:new pe("ping",de(ue.ping),ye.Other,!1),CSPViolationReport:new pe("csp-violation-report",de(ue.cspviolationreport),ye.Other,!1),Other:new pe("other",de(ue.other),ye.Other,!1),Preflight:new pe("preflight",de(ue.preflight),ye.Other,!0),SourceMapScript:new pe("sm-script",de(ue.script),ye.Script,!0),SourceMapStyleSheet:new pe("sm-stylesheet",de(ue.stylesheet),ye.Stylesheet,!0),WebBundle:new pe("webbundle",de(ue.webbundle),ye.Other,!1)},we=new Map([["Cakefile","text/x-coffeescript"]]),Se=new Map([["js",fe.Script],["mjs",fe.Script],["css",fe.Stylesheet],["xsl",fe.Stylesheet],["avif",fe.Image],["bmp",fe.Image],["gif",fe.Image],["ico",fe.Image],["jpeg",fe.Image],["jpg",fe.Image],["jxl",fe.Image],["png",fe.Image],["svg",fe.Image],["tif",fe.Image],["tiff",fe.Image],["vue",fe.Document],["webmanifest",fe.Manifest],["webp",fe.Media],["otf",fe.Font],["ttc",fe.Font],["ttf",fe.Font],["woff",fe.Font],["woff2",fe.Font],["wasm",fe.Wasm]]),xe=new Map([["js","text/javascript"],["mjs","text/javascript"],["css","text/css"],["html","text/html"],["htm","text/html"],["xml","application/xml"],["xsl","application/xml"],["wasm","application/wasm"],["webmanifest","application/manifest+json"],["asp","application/x-aspx"],["aspx","application/x-aspx"],["jsp","application/x-jsp"],["c","text/x-c++src"],["cc","text/x-c++src"],["cpp","text/x-c++src"],["h","text/x-c++src"],["m","text/x-c++src"],["mm","text/x-c++src"],["coffee","text/x-coffeescript"],["dart","application/vnd.dart"],["ts","text/typescript"],["tsx","text/typescript-jsx"],["json","application/json"],["gyp","application/json"],["gypi","application/json"],["map","application/json"],["cs","text/x-csharp"],["go","text/x-go"],["java","text/x-java"],["kt","text/x-kotlin"],["scala","text/x-scala"],["less","text/x-less"],["php","application/x-httpd-php"],["phtml","application/x-httpd-php"],["py","text/x-python"],["sh","text/x-sh"],["gss","text/x-gss"],["sass","text/x-sass"],["scss","text/x-scss"],["vtt","text/vtt"],["ls","text/x-livescript"],["md","text/markdown"],["cljs","text/x-clojure"],["cljc","text/x-clojure"],["cljx","text/x-clojure"],["styl","text/x-styl"],["jsx","text/jsx"],["avif","image/avif"],["bmp","image/bmp"],["gif","image/gif"],["ico","image/ico"],["jpeg","image/jpeg"],["jpg","image/jpeg"],["jxl","image/jxl"],["png","image/png"],["svg","image/svg+xml"],["tif","image/tif"],["tiff","image/tiff"],["webp","image/webp"],["otf","font/otf"],["ttc","font/collection"],["ttf","font/ttf"],["woff","font/woff"],["woff2","font/woff2"],["component.html","text/x.angular"],["svelte","text/x.svelte"],["vue","text/x.vue"]]);var ve=Object.freeze({__proto__:null,ResourceCategory:me,ResourceType:pe,mimeTypeByExtension:xe,resourceCategories:ye,resourceCategoriesReactNative:be,resourceTypeByExtension:Se,resourceTypes:fe});const Te=new Map;const Re=[];var ze=Object.freeze({__proto__:null,earlyInitializationRunnables:function(){return Re},lateInitializationRunnables:function(){return[...Te.values()]},maybeRemoveLateInitializationRunnable:function(t){return Te.delete(t)},registerEarlyInitializationRunnable:function(t){Re.push(t)},registerLateInitializationRunnable:function(t){const{id:e,loadRunnable:r}=t;if(Te.has(e))throw new Error(`Duplicate late Initializable runnable id '${e}'`);Te.set(e,r)}});class Ie{begin;end;data;constructor(t,e,r){if(t>e)throw new Error("Invalid segment");this.begin=t,this.end=e,this.data=r}intersects(t){return this.begint.begin-e.begin)),s=r,n=null;if(r>0){const e=this.#V[r-1];n=this.tryMerge(e,t),n?(--r,t=n):this.#V[r-1].end>=t.begin&&(t.endt.Runtime.Runtime.isDescriptorEnabled(e)))}function Oe(){return Le}function Ve(t,e=!1){if(0===Le.length||e){Le=t,Ce.clear();for(const e of t){const t=e.settingName;if(Ce.has(t))throw new Error(`Duplicate setting name '${t}'`);Ce.add(t)}}}function Be(){Le=[],Ce.clear()}function Ge(t){const e=Le.findIndex((e=>e.settingName===t));return!(e<0||!Ce.delete(t))&&(Le.splice(e,1),!0)}function Me(t){switch(t){case"ELEMENTS":return ke(Pe.elements);case"AI":return ke(Pe.ai);case"APPEARANCE":return ke(Pe.appearance);case"SOURCES":return ke(Pe.sources);case"NETWORK":return ke(Pe.network);case"PERFORMANCE":return ke(Pe.performance);case"CONSOLE":case"EMULATION":return ke(Pe.console);case"PERSISTENCE":return ke(Pe.persistence);case"DEBUGGER":return ke(Pe.debugger);case"GLOBAL":return ke(Pe.global);case"RENDERING":return ke(Pe.rendering);case"GRID":return ke(Pe.grid);case"MOBILE":return ke(Pe.mobile);case"MEMORY":return ke(Pe.memory);case"EXTENSIONS":return ke(Pe.extension);case"ADORNER":return ke(Pe.adorner);case"":return r.i18n.lockedString("");case"SYNC":return ke(Pe.sync);case"PRIVACY":return ke(Pe.privacy)}}var We=Object.freeze({__proto__:null,getAllRegisteredSettings:Oe,getLocalizedSettingsCategory:Me,getRegisteredSettings:Ne,maybeRemoveSettingExtension:Ge,registerSettingExtension:_e,registerSettingsForTest:Ve,resetSettings:Be});let Xe;class De{syncedStorage;globalStorage;localStorage;#G=new je({});settingNameSet=new Set;orderValuesBySettingCategory=new Map;#M=new Lt;#W=new Map;moduleSettings=new Map;#X;constructor(e,r,s,n){this.syncedStorage=e,this.globalStorage=r,this.localStorage=s,this.#X=n;for(const e of Oe()){const{settingName:r,defaultValue:s,storageType:n}=e,i="regex"===e.settingType,a="function"==typeof s?s(t.Runtime.hostConfig):s,o=i&&"string"==typeof a?this.createRegExpSetting(r,a,void 0,n):this.createSetting(r,a,n);o.setTitleFunction(e.title),e.userActionCondition&&o.setRequiresUserAction(Boolean(t.Runtime.Runtime.queryParam(e.userActionCondition))),o.setRegistration(e),this.registerModuleSetting(o)}}getRegisteredSettings(){return Ne()}static hasInstance(){return void 0!==Xe}static instance(t={forceNew:null,syncedStorage:null,globalStorage:null,localStorage:null}){const{forceNew:e,syncedStorage:r,globalStorage:s,localStorage:n,logSettingAccess:i}=t;if(!Xe||e){if(!r||!s||!n)throw new Error(`Unable to create settings: global and local storage must be provided: ${(new Error).stack}`);Xe=new De(r,s,n,i)}return Xe}static removeInstance(){Xe=void 0}registerModuleSetting(t){const e=t.name,r=t.category(),s=t.order();if(this.settingNameSet.has(e))throw new Error(`Duplicate Setting name '${e}'`);if(r&&s){const t=this.orderValuesBySettingCategory.get(r)||new Set;if(t.has(s))throw new Error(`Duplicate order value '${s}' for settings category '${r}'`);t.add(s),this.orderValuesBySettingCategory.set(r,t)}this.settingNameSet.add(e),this.moduleSettings.set(t.name,t)}static normalizeSettingName(t){return[Ye.GLOBAL_VERSION_SETTING_NAME,Ye.SYNCED_VERSION_SETTING_NAME,Ye.LOCAL_VERSION_SETTING_NAME,"currentDockState","isUnderTest"].includes(t)?t:e.StringUtilities.toKebabCase(t)}moduleSetting(t){const e=this.moduleSettings.get(t);if(!e)throw new Error("No setting registered: "+t);return e}settingForTest(t){const e=this.#W.get(t);if(!e)throw new Error("No setting registered: "+t);return e}createSetting(t,e,r){const s=this.storageFromType(r);let n=this.#W.get(t);return n||(n=new He(t,e,this.#M,s,this.#X),this.#W.set(t,n)),n}createLocalSetting(t,e){return this.createSetting(t,e,"Local")}createRegExpSetting(t,e,r,s){return this.#W.get(t)||this.#W.set(t,new qe(t,e,this.#M,this.storageFromType(s),r,this.#X)),this.#W.get(t)}clearAll(){this.globalStorage.removeAll(),this.syncedStorage.removeAll(),this.localStorage.removeAll(),(new Ye).resetToCurrent()}storageFromType(t){switch(t){case"Local":return this.localStorage;case"Session":return this.#G;case"Global":return this.globalStorage;case"Synced":return this.syncedStorage}return this.globalStorage}getRegistry(){return this.#W}}const Fe={register:()=>{},set:()=>{},get:()=>Promise.resolve(""),remove:()=>{},clear:()=>{}};class je{object;backingStore;storagePrefix;constructor(t,e=Fe,r=""){this.object=t,this.backingStore=e,this.storagePrefix=r}register(t){t=this.storagePrefix+t,this.backingStore.register(t)}set(t,e){t=this.storagePrefix+t,this.object[t]=e,this.backingStore.set(t,e)}has(t){return(t=this.storagePrefix+t)in this.object}get(t){return t=this.storagePrefix+t,this.object[t]}async forceGet(t){const e=this.storagePrefix+t,r=await this.backingStore.get(e);return r&&r!==this.object[e]?this.set(t,r):r||this.remove(t),r}remove(t){t=this.storagePrefix+t,delete this.object[t],this.backingStore.remove(t)}removeAll(){this.object={},this.backingStore.clear()}keys(){return Object.keys(this.object)}dumpSizes(){Dt.instance().log("Ten largest settings: ");const t={__proto__:null};for(const e in this.object)t[e]=this.object[e].length;const e=Object.keys(t);e.sort((function(e,r){return t[r]-t[e]}));for(let r=0;r<10&&rt.name===e.experiment)):void 0}}class He{name;defaultValue;eventSupport;storage;#D;#_;#F=null;#j;#U;#$=JSON;#H;#q;#Y=null;#Z=!1;#X;constructor(t,e,r,s,n){this.name=t,this.defaultValue=e,this.eventSupport=r,this.storage=s,s.register(this.name),this.#X=n}setSerializer(t){this.#$=t}addChangeListener(t,e){return this.eventSupport.addEventListener(this.name,t,e)}removeChangeListener(t,e){this.eventSupport.removeEventListener(this.name,t,e)}title(){return this.#_?this.#_:this.#D?this.#D():""}setTitleFunction(t){t&&(this.#D=t)}setTitle(t){this.#_=t}setRequiresUserAction(t){this.#j=t}disabled(){if(this.#F?.disabledCondition){const{disabled:e}=this.#F.disabledCondition(t.Runtime.hostConfig);if(e)return!0}return this.#q||!1}disabledReasons(){if(this.#F?.disabledCondition){const e=this.#F.disabledCondition(t.Runtime.hostConfig);if(e.disabled)return e.reasons}return[]}setDisabled(t){this.#q=t,this.eventSupport.dispatchEventToListeners(this.name)}#K(t){const e="string"==typeof t||"number"==typeof t||"boolean"==typeof t?t:this.#$?.stringify(t);void 0!==e&&this.#X&&this.#X(this.name,e)}#J(t){this.#Z||(this.#K(t),this.#Z=!0)}get(){if(this.#j&&!this.#H)return this.#J(this.defaultValue),this.defaultValue;if(void 0!==this.#U)return this.#J(this.#U),this.#U;if(this.#U=this.defaultValue,this.storage.has(this.name))try{this.#U=this.#$.parse(this.storage.get(this.name))}catch{this.storage.remove(this.name)}return this.#J(this.#U),this.#U}getIfNotDisabled(){if(!this.disabled())return this.get()}async forceGet(){const t=this.name,e=this.storage.get(t),r=await this.storage.forceGet(t);if(this.#U=this.defaultValue,r)try{this.#U=this.#$.parse(r)}catch{this.storage.remove(this.name)}return e!==r&&this.eventSupport.dispatchEventToListeners(this.name,this.#U),this.#J(this.#U),this.#U}set(t){this.#K(t),this.#H=!0,this.#U=t;try{const e=this.#$.stringify(t);try{this.storage.set(this.name,e)}catch(t){this.printSettingsSavingError(t.message,this.name,e)}}catch(t){Dt.instance().error("Cannot stringify setting with name: "+this.name+", error: "+t.message)}this.eventSupport.dispatchEventToListeners(this.name,t)}setRegistration(e){this.#F=e;const{deprecationNotice:r}=e;if(r?.disabled){const e=r.experiment?t.Runtime.experiments.allConfigurableExperiments().find((t=>t.name===r.experiment)):void 0;e&&!e.isEnabled()||(this.set(this.defaultValue),this.setDisabled(!0))}}type(){return this.#F?this.#F.settingType:null}options(){return this.#F&&this.#F.options?this.#F.options.map((t=>{const{value:e,title:r,text:s,raw:n}=t;return{value:e,title:r(),text:"function"==typeof s?s():s,raw:n}})):[]}reloadRequired(){return this.#F&&this.#F.reloadRequired||null}category(){return this.#F&&this.#F.category||null}tags(){return this.#F&&this.#F.tags?this.#F.tags.map((t=>t())).join("\0"):null}order(){return this.#F&&this.#F.order||null}learnMore(){return this.#F?.learnMore??null}get deprecation(){return this.#F&&this.#F.deprecationNotice?(this.#Y||(this.#Y=new $e(this.#F)),this.#Y):null}printSettingsSavingError(t,e,r){const s="Error saving setting with name: "+this.name+", value length: "+r.length+". Error: "+t;console.error(s),Dt.instance().error(s),this.storage.dumpSizes()}}class qe extends He{#Q;#tt;constructor(t,e,r,s,n,i){super(t,e?[{pattern:e}]:[],r,s,i),this.#Q=n}get(){const t=[],e=this.getAsArray();for(let r=0;r`-url:${t}`)).join(" ");if(e){const t=De.instance().createSetting("console.textFilter",""),r=t.get()?` ${t.get()}`:"";t.set(`${e}${r}`)}Ue(t)}updateVersionFrom26To27(){function t(t,e,r){const s=De.instance().createSetting(t,{}),n=s.get();e in n&&(n[r]=n[e],delete n[e],s.set(n))}t("panel-tabOrder","audits2","audits"),t("panel-closeableTabs","audits2","audits"),function(t,e,r){const s=De.instance().createSetting(t,"");s.get()===e&&s.set(r)}("panel-selectedTab","audits2","audits")}updateVersionFrom27To28(){const t=De.instance().createSetting("uiTheme","systemPreferred");"default"===t.get()&&t.set("systemPreferred")}updateVersionFrom28To29(){function t(t,e,r){const s=De.instance().createSetting(t,{}),n=s.get();e in n&&(n[r]=n[e],delete n[e],s.set(n))}t("panel-tabOrder","audits","lighthouse"),t("panel-closeableTabs","audits","lighthouse"),function(t,e,r){const s=De.instance().createSetting(t,"");s.get()===e&&s.set(r)}("panel-selectedTab","audits","lighthouse")}updateVersionFrom29To30(){const t=De.instance().createSetting("closeableTabs",{}),e=De.instance().createSetting("panel-closeableTabs",{}),r=De.instance().createSetting("drawer-view-closeableTabs",{}),s=e.get(),n=e.get(),i=Object.assign(n,s);t.set(i),Ue(e),Ue(r)}updateVersionFrom30To31(){Ue(De.instance().createSetting("recorder_recordings",[]))}updateVersionFrom31To32(){const t=De.instance().createLocalSetting("breakpoints",[]),e=t.get();for(const t of e)t.resourceTypeName="script";t.set(e)}updateVersionFrom32To33(){const t=De.instance().createLocalSetting("previouslyViewedFiles",[]);let e=t.get();e=e.filter((t=>"url"in t));for(const t of e)t.resourceTypeName="script";t.set(e)}updateVersionFrom33To34(){const t=De.instance().createLocalSetting("breakpoints",[]),e=t.get();for(const t of e){const e=t.condition.startsWith("/** DEVTOOLS_LOGPOINT */ console.log(")&&t.condition.endsWith(")");t.isLogpoint=e}t.set(e)}updateVersionFrom34To35(){const t=De.instance().createLocalSetting("breakpoints",[]),e=t.get();for(const t of e){const{condition:e,isLogpoint:r}=t;r&&(t.condition=e.slice(37,e.length-1))}t.set(e)}updateVersionFrom35To36(){De.instance().createSetting("showThirdPartyIssues",!0).set(!0)}updateVersionFrom36To37(){const t=t=>{for(const e of t.keys()){const r=De.normalizeSettingName(e);if(r!==e){const s=t.get(e);Ue({name:e,storage:t}),t.set(r,s)}}};t(De.instance().globalStorage),t(De.instance().syncedStorage),t(De.instance().localStorage);for(const t of De.instance().globalStorage.keys()){if(t.startsWith("data-grid-")&&t.endsWith("-column-weights")||t.endsWith("-tab-order")||"views-location-override"===t||"closeable-tabs"===t){const r=De.instance().createSetting(t,{});r.set(e.StringUtilities.toKebabCaseKeys(r.get()))}if(t.endsWith("-selected-tab")){const r=De.instance().createSetting(t,"");r.set(e.StringUtilities.toKebabCase(r.get()))}}}updateVersionFrom37To38(){const t=(()=>{try{return Ze("console-insights-enabled")}catch{return}})(),e=De.instance().createLocalSetting("console-insights-onboarding-finished",!1);t&&!0===t.get()&&!1===e.get()&&t.set(!1),t&&!1===t.get()&&e.set(!1)}migrateSettingsFromLocalStorage(){const t=new Set(["advancedSearchConfig","breakpoints","consoleHistory","domBreakpoints","eventListenerBreakpoints","fileSystemMapping","lastSelectedSourcesSidebarPaneTab","previouslyViewedFiles","savedURLs","watchExpressions","workspaceExcludedFolders","xhrBreakpoints"]);if(window.localStorage)for(const e in window.localStorage){if(t.has(e))continue;const r=window.localStorage[e];window.localStorage.removeItem(e),De.instance().globalStorage.set(e,r)}}clearBreakpointsWhenTooMany(t,e){t.get().length>e&&t.set([])}}function Ze(t){return De.instance().moduleSetting(t)}var Ke=Object.freeze({__proto__:null,Deprecation:$e,NOOP_STORAGE:Fe,RegExpSetting:qe,Setting:He,Settings:De,SettingsStorage:je,VersionController:Ye,getLocalizedSettingsCategory:Me,maybeRemoveSettingExtension:Ge,moduleSetting:Ze,registerSettingExtension:_e,registerSettingsForTest:Ve,resetSettings:Be,settingForTest:function(t){return De.instance().settingForTest(t)}});var Je=Object.freeze({__proto__:null,SimpleHistoryManager:class{#nt;#it;#at;#ot;constructor(t){this.#nt=[],this.#it=-1,this.#at=0,this.#ot=t}readOnlyLock(){++this.#at}releaseReadOnlyLock(){--this.#at}getPreviousValidIndex(){if(this.empty())return-1;let t=this.#it-1;for(;t>=0&&!this.#nt[t].valid();)--t;return t<0?-1:t}getNextValidIndex(){let t=this.#it+1;for(;t=this.#nt.length?-1:t}readOnly(){return Boolean(this.#at)}filterOut(t){if(this.readOnly())return;const e=[];let r=0;for(let s=0;sthis.#ot&&this.#nt.shift(),this.#it=this.#nt.length-1)}canRollback(){return this.getPreviousValidIndex()>=0}canRollover(){return this.getNextValidIndex()>=0}rollback(){const t=this.getPreviousValidIndex();return-1!==t&&(this.readOnlyLock(),this.#it=t,this.#nt[t].reveal(),this.releaseReadOnlyLock(),!0)}rollover(){const t=this.getNextValidIndex();return-1!==t&&(this.readOnlyLock(),this.#it=t,this.#nt[t].reveal(),this.releaseReadOnlyLock(),!0)}}});var Qe=Object.freeze({__proto__:null,StringOutputStream:class{#lt;constructor(){this.#lt=""}async write(t){this.#lt+=t}async close(){}data(){return this.#lt}}});class tr{#ht;#ct;#ut;#gt;#dt;#pt;#mt;constructor(t){this.#ct=0,this.#mt=t,this.clear()}static newStringTrie(){return new tr({empty:()=>"",append:(t,e)=>t+e,slice:(t,e,r)=>t.slice(e,r)})}static newArrayTrie(){return new tr({empty:()=>[],append:(t,e)=>t.concat([e]),slice:(t,e,r)=>t.slice(e,r)})}add(t){let e=this.#ct;++this.#dt[this.#ct];for(let r=0;rthis.#yt,n="AsSoonAsPossible"===e||"Default"===e&&!r&&s,i=n&&!this.#ft;this.#ft=this.#ft||n,this.#zt(i),await this.#xt.promise}#zt(t){if(this.#bt)return;if(this.#vt&&!t)return;clearTimeout(this.#vt);const e=this.#ft?0:this.#yt;this.#vt=window.setTimeout(this.#It.bind(this),e)}#Rt(){return window.performance.now()}}});class nr{#At;#Pt;constructor(t){this.#At=new Promise((e=>{const r=new Worker(t,{type:"module"});r.onmessage=t=>{console.assert("workerReady"===t.data),r.onmessage=null,e(r)}}))}static fromURL(t){return new nr(t)}postMessage(t,e){this.#At.then((r=>{this.#Pt||r.postMessage(t,e??[])}))}dispose(){this.#Pt=!0,this.#At.then((t=>t.terminate()))}terminate(){this.dispose()}set onmessage(t){this.#At.then((e=>{e.onmessage=t}))}set onerror(t){this.#At.then((e=>{e.onerror=t}))}}var ir=Object.freeze({__proto__:null,WorkerWrapper:nr});export{s as App,i as AppProvider,l as Base64,h as CharacterIdMap,kt as Color,P as ColorConverter,$ as ColorUtils,Ut as Console,$t as Debouncer,Ht as EventTarget,qt as JavaScriptMetaData,Kt as Lazy,te as Linkifier,re as MapWithDefault,se as Mutex,Ct as ObjectWrapper,ae as ParsedURL,le as Progress,he as QueryParamHandler,ce as ResolverBase,ve as ResourceType,Wt as Revealer,ze as Runnable,Ae as SegmentedRange,We as SettingRegistration,Ke as Settings,Je as SimpleHistoryManager,Qe as StringOutputStream,rr as TextDictionary,sr as Throttler,er as Trie,ir as Worker}; diff --git a/packages/debugger-frontend/dist/third-party/front_end/core/sdk/sdk-meta.js b/packages/debugger-frontend/dist/third-party/front_end/core/sdk/sdk-meta.js index 83307fe7a067..f2086c815930 100644 --- a/packages/debugger-frontend/dist/third-party/front_end/core/sdk/sdk-meta.js +++ b/packages/debugger-frontend/dist/third-party/front_end/core/sdk/sdk-meta.js @@ -1 +1 @@ -import*as e from"../common/common.js";import*as t from"../i18n/i18n.js";const a={preserveLogUponNavigation:"Preserve log upon navigation",doNotPreserveLogUponNavigation:"Do not preserve log upon navigation",pauseOnExceptions:"Pause on exceptions",doNotPauseOnExceptions:"Do not pause on exceptions",disableJavascript:"Disable JavaScript",enableJavascript:"Enable JavaScript",disableAsyncStackTraces:"Disable async stack traces",doNotCaptureAsyncStackTraces:"Do not capture async stack traces",captureAsyncStackTraces:"Capture async stack traces",showRulersOnHover:"Show rulers on hover",doNotShowRulersOnHover:"Do not show rulers on hover",showAreaNames:"Show area names",showGridNamedAreas:"Show grid named areas",doNotShowGridNamedAreas:"Do not show grid named areas",showTrackSizes:"Show track sizes",showGridTrackSizes:"Show grid track sizes",doNotShowGridTrackSizes:"Do not show grid track sizes",extendGridLines:"Extend grid lines",doNotExtendGridLines:"Do not extend grid lines",showLineLabels:"Show line labels",hideLineLabels:"Hide line labels",showLineNumbers:"Show line numbers",showLineNames:"Show line names",showPaintFlashingRectangles:"Show paint flashing rectangles",hidePaintFlashingRectangles:"Hide paint flashing rectangles",showLayoutShiftRegions:"Show layout shift regions",hideLayoutShiftRegions:"Hide layout shift regions",highlightAdFrames:"Highlight ad frames",doNotHighlightAdFrames:"Do not highlight ad frames",showLayerBorders:"Show layer borders",hideLayerBorders:"Hide layer borders",showFramesPerSecondFpsMeter:"Show frames per second (FPS) meter",hideFramesPerSecondFpsMeter:"Hide frames per second (FPS) meter",showScrollPerformanceBottlenecks:"Show scroll performance bottlenecks",hideScrollPerformanceBottlenecks:"Hide scroll performance bottlenecks",emulateAFocusedPage:"Emulate a focused page",doNotEmulateAFocusedPage:"Do not emulate a focused page",doNotEmulateCssMediaType:"Do not emulate CSS media type",noEmulation:"No emulation",emulateCssPrintMediaType:"Emulate CSS print media type",print:"print",emulateCssScreenMediaType:"Emulate CSS screen media type",screen:"screen",query:"query",emulateCssMediaType:"Emulate CSS media type",doNotEmulateCss:"Do not emulate CSS {PH1}",emulateCss:"Emulate CSS {PH1}",emulateCssMediaFeature:"Emulate CSS media feature {PH1}",doNotEmulateAnyVisionDeficiency:"Do not emulate any vision deficiency",emulateBlurredVision:"Emulate blurred vision",emulateReducedContrast:"Emulate reduced contrast",blurredVision:"Blurred vision",reducedContrast:"Reduced contrast",emulateProtanopia:"Emulate protanopia (no red)",protanopia:"Protanopia (no red)",emulateDeuteranopia:"Emulate deuteranopia (no green)",deuteranopia:"Deuteranopia (no green)",emulateTritanopia:"Emulate tritanopia (no blue)",tritanopia:"Tritanopia (no blue)",emulateAchromatopsia:"Emulate achromatopsia (no color)",achromatopsia:"Achromatopsia (no color)",emulateVisionDeficiencies:"Emulate vision deficiencies",disableLocalFonts:"Disable local fonts",enableLocalFonts:"Enable local fonts",disableAvifFormat:"Disable `AVIF` format",enableAvifFormat:"Enable `AVIF` format",disableWebpFormat:"Disable `WebP` format",enableWebpFormat:"Enable `WebP` format",customFormatters:"Custom formatters",networkRequestBlocking:"Network request blocking",enableNetworkRequestBlocking:"Enable network request blocking",disableNetworkRequestBlocking:"Disable network request blocking",enableCache:"Enable cache",disableCache:"Disable cache while DevTools is open",emulateAutoDarkMode:"Emulate auto dark mode",enableRemoteFileLoading:"Allow `DevTools` to load resources, such as source maps, from remote file paths. Disabled by default for security reasons.",networkCacheExplanation:"Disabling the network cache will simulate a network experience similar to a first time visitor."},s=t.i18n.registerUIStrings("core/sdk/sdk-meta.ts",a),o=t.i18n.getLazilyComputedLocalizedString.bind(void 0,s);e.Settings.registerSettingExtension({storageType:"Synced",settingName:"skip-stack-frames-pattern",settingType:"regex",defaultValue:""}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"skip-content-scripts",settingType:"boolean",defaultValue:!0}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"automatically-ignore-list-known-third-party-scripts",settingType:"boolean",defaultValue:!0}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"skip-anonymous-scripts",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"enable-ignore-listing",settingType:"boolean",defaultValue:!0}),e.Settings.registerSettingExtension({category:"CONSOLE",storageType:"Synced",title:o(a.preserveLogUponNavigation),settingName:"preserve-console-log",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:o(a.preserveLogUponNavigation)},{value:!1,title:o(a.doNotPreserveLogUponNavigation)}]}),e.Settings.registerSettingExtension({category:"DEBUGGER",settingName:"pause-on-exception-enabled",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:o(a.pauseOnExceptions)},{value:!1,title:o(a.doNotPauseOnExceptions)}]}),e.Settings.registerSettingExtension({settingName:"pause-on-caught-exception",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({settingName:"pause-on-uncaught-exception",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({category:"DEBUGGER",title:o(a.disableJavascript),settingName:"java-script-disabled",settingType:"boolean",storageType:"Session",order:1,defaultValue:!1,options:[{value:!0,title:o(a.disableJavascript)},{value:!1,title:o(a.enableJavascript)}]}),e.Settings.registerSettingExtension({category:"DEBUGGER",title:o(a.disableAsyncStackTraces),settingName:"disable-async-stack-traces",settingType:"boolean",defaultValue:!1,order:2,options:[{value:!0,title:o(a.doNotCaptureAsyncStackTraces)},{value:!1,title:o(a.captureAsyncStackTraces)}]}),e.Settings.registerSettingExtension({category:"DEBUGGER",settingName:"breakpoints-active",settingType:"boolean",storageType:"Session",defaultValue:!0}),e.Settings.registerSettingExtension({category:"ELEMENTS",storageType:"Synced",title:o(a.showRulersOnHover),settingName:"show-metrics-rulers",settingType:"boolean",options:[{value:!0,title:o(a.showRulersOnHover)},{value:!1,title:o(a.doNotShowRulersOnHover)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"GRID",storageType:"Synced",title:o(a.showAreaNames),settingName:"show-grid-areas",settingType:"boolean",options:[{value:!0,title:o(a.showGridNamedAreas)},{value:!1,title:o(a.doNotShowGridNamedAreas)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"GRID",storageType:"Synced",title:o(a.showTrackSizes),settingName:"show-grid-track-sizes",settingType:"boolean",options:[{value:!0,title:o(a.showGridTrackSizes)},{value:!1,title:o(a.doNotShowGridTrackSizes)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"GRID",storageType:"Synced",title:o(a.extendGridLines),settingName:"extend-grid-lines",settingType:"boolean",options:[{value:!0,title:o(a.extendGridLines)},{value:!1,title:o(a.doNotExtendGridLines)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"GRID",storageType:"Synced",title:o(a.showLineLabels),settingName:"show-grid-line-labels",settingType:"enum",options:[{title:o(a.hideLineLabels),text:o(a.hideLineLabels),value:"none"},{title:o(a.showLineNumbers),text:o(a.showLineNumbers),value:"lineNumbers"},{title:o(a.showLineNames),text:o(a.showLineNames),value:"lineNames"}],defaultValue:"lineNumbers"}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"show-paint-rects",settingType:"boolean",storageType:"Session",options:[{value:!0,title:o(a.showPaintFlashingRectangles)},{value:!1,title:o(a.hidePaintFlashingRectangles)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"show-layout-shift-regions",settingType:"boolean",storageType:"Session",options:[{value:!0,title:o(a.showLayoutShiftRegions)},{value:!1,title:o(a.hideLayoutShiftRegions)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"show-ad-highlights",settingType:"boolean",storageType:"Session",options:[{value:!0,title:o(a.highlightAdFrames)},{value:!1,title:o(a.doNotHighlightAdFrames)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"show-debug-borders",settingType:"boolean",storageType:"Session",options:[{value:!0,title:o(a.showLayerBorders)},{value:!1,title:o(a.hideLayerBorders)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"show-fps-counter",settingType:"boolean",storageType:"Session",options:[{value:!0,title:o(a.showFramesPerSecondFpsMeter)},{value:!1,title:o(a.hideFramesPerSecondFpsMeter)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"show-scroll-bottleneck-rects",settingType:"boolean",storageType:"Session",options:[{value:!0,title:o(a.showScrollPerformanceBottlenecks)},{value:!1,title:o(a.hideScrollPerformanceBottlenecks)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",title:o(a.emulateAFocusedPage),settingName:"emulate-page-focus",settingType:"boolean",storageType:"Local",defaultValue:!1,options:[{value:!0,title:o(a.emulateAFocusedPage)},{value:!1,title:o(a.doNotEmulateAFocusedPage)}]}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"emulated-css-media",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:o(a.doNotEmulateCssMediaType),text:o(a.noEmulation),value:""},{title:o(a.emulateCssPrintMediaType),text:o(a.print),value:"print"},{title:o(a.emulateCssScreenMediaType),text:o(a.screen),value:"screen"}],tags:[o(a.query)],title:o(a.emulateCssMediaType)}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"emulated-css-media-feature-prefers-color-scheme",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:o(a.doNotEmulateCss,{PH1:"prefers-color-scheme"}),text:o(a.noEmulation),value:""},{title:o(a.emulateCss,{PH1:"prefers-color-scheme: light"}),text:t.i18n.lockedLazyString("prefers-color-scheme: light"),value:"light"},{title:o(a.emulateCss,{PH1:"prefers-color-scheme: dark"}),text:t.i18n.lockedLazyString("prefers-color-scheme: dark"),value:"dark"}],tags:[o(a.query)],title:o(a.emulateCssMediaFeature,{PH1:"prefers-color-scheme"})}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"emulated-css-media-feature-forced-colors",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:o(a.doNotEmulateCss,{PH1:"forced-colors"}),text:o(a.noEmulation),value:""},{title:o(a.emulateCss,{PH1:"forced-colors: active"}),text:t.i18n.lockedLazyString("forced-colors: active"),value:"active"},{title:o(a.emulateCss,{PH1:"forced-colors: none"}),text:t.i18n.lockedLazyString("forced-colors: none"),value:"none"}],tags:[o(a.query)],title:o(a.emulateCssMediaFeature,{PH1:"forced-colors"})}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"emulated-css-media-feature-prefers-reduced-motion",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:o(a.doNotEmulateCss,{PH1:"prefers-reduced-motion"}),text:o(a.noEmulation),value:""},{title:o(a.emulateCss,{PH1:"prefers-reduced-motion: reduce"}),text:t.i18n.lockedLazyString("prefers-reduced-motion: reduce"),value:"reduce"}],tags:[o(a.query)],title:o(a.emulateCssMediaFeature,{PH1:"prefers-reduced-motion"})}),e.Settings.registerSettingExtension({settingName:"emulated-css-media-feature-prefers-contrast",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:o(a.doNotEmulateCss,{PH1:"prefers-contrast"}),text:o(a.noEmulation),value:""},{title:o(a.emulateCss,{PH1:"prefers-contrast: more"}),text:t.i18n.lockedLazyString("prefers-contrast: more"),value:"more"},{title:o(a.emulateCss,{PH1:"prefers-contrast: less"}),text:t.i18n.lockedLazyString("prefers-contrast: less"),value:"less"},{title:o(a.emulateCss,{PH1:"prefers-contrast: custom"}),text:t.i18n.lockedLazyString("prefers-contrast: custom"),value:"custom"}],tags:[o(a.query)],title:o(a.emulateCssMediaFeature,{PH1:"prefers-contrast"})}),e.Settings.registerSettingExtension({settingName:"emulated-css-media-feature-prefers-reduced-data",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:o(a.doNotEmulateCss,{PH1:"prefers-reduced-data"}),text:o(a.noEmulation),value:""},{title:o(a.emulateCss,{PH1:"prefers-reduced-data: reduce"}),text:t.i18n.lockedLazyString("prefers-reduced-data: reduce"),value:"reduce"}],title:o(a.emulateCssMediaFeature,{PH1:"prefers-reduced-data"})}),e.Settings.registerSettingExtension({settingName:"emulated-css-media-feature-prefers-reduced-transparency",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:o(a.doNotEmulateCss,{PH1:"prefers-reduced-transparency"}),text:o(a.noEmulation),value:""},{title:o(a.emulateCss,{PH1:"prefers-reduced-transparency: reduce"}),text:t.i18n.lockedLazyString("prefers-reduced-transparency: reduce"),value:"reduce"}],title:o(a.emulateCssMediaFeature,{PH1:"prefers-reduced-transparency"})}),e.Settings.registerSettingExtension({settingName:"emulated-css-media-feature-color-gamut",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:o(a.doNotEmulateCss,{PH1:"color-gamut"}),text:o(a.noEmulation),value:""},{title:o(a.emulateCss,{PH1:"color-gamut: srgb"}),text:t.i18n.lockedLazyString("color-gamut: srgb"),value:"srgb"},{title:o(a.emulateCss,{PH1:"color-gamut: p3"}),text:t.i18n.lockedLazyString("color-gamut: p3"),value:"p3"},{title:o(a.emulateCss,{PH1:"color-gamut: rec2020"}),text:t.i18n.lockedLazyString("color-gamut: rec2020"),value:"rec2020"}],title:o(a.emulateCssMediaFeature,{PH1:"color-gamut"})}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"emulated-vision-deficiency",settingType:"enum",storageType:"Session",defaultValue:"none",options:[{title:o(a.doNotEmulateAnyVisionDeficiency),text:o(a.noEmulation),value:"none"},{title:o(a.emulateBlurredVision),text:o(a.blurredVision),value:"blurredVision"},{title:o(a.emulateReducedContrast),text:o(a.reducedContrast),value:"reducedContrast"},{title:o(a.emulateProtanopia),text:o(a.protanopia),value:"protanopia"},{title:o(a.emulateDeuteranopia),text:o(a.deuteranopia),value:"deuteranopia"},{title:o(a.emulateTritanopia),text:o(a.tritanopia),value:"tritanopia"},{title:o(a.emulateAchromatopsia),text:o(a.achromatopsia),value:"achromatopsia"}],tags:[o(a.query)],title:o(a.emulateVisionDeficiencies)}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"local-fonts-disabled",settingType:"boolean",storageType:"Session",options:[{value:!0,title:o(a.disableLocalFonts)},{value:!1,title:o(a.enableLocalFonts)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"avif-format-disabled",settingType:"boolean",storageType:"Session",options:[{value:!0,title:o(a.disableAvifFormat)},{value:!1,title:o(a.enableAvifFormat)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"webp-format-disabled",settingType:"boolean",storageType:"Session",options:[{value:!0,title:o(a.disableWebpFormat)},{value:!1,title:o(a.enableWebpFormat)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"CONSOLE",title:o(a.customFormatters),settingName:"custom-formatters",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({category:"",title:o(a.networkRequestBlocking),settingName:"request-blocking-enabled",settingType:"boolean",storageType:"Session",defaultValue:!1,options:[{value:!0,title:o(a.enableNetworkRequestBlocking)},{value:!1,title:o(a.disableNetworkRequestBlocking)}]}),e.Settings.registerSettingExtension({category:"NETWORK",title:o(a.disableCache),settingName:"cache-disabled",settingType:"boolean",order:0,defaultValue:!1,userActionCondition:"hasOtherClients",options:[{value:!0,title:o(a.disableCache)},{value:!1,title:o(a.enableCache)}],learnMore:{tooltip:o(a.networkCacheExplanation)}}),e.Settings.registerSettingExtension({category:"RENDERING",title:o(a.emulateAutoDarkMode),settingName:"emulate-auto-dark-mode",settingType:"boolean",storageType:"Session",defaultValue:!1}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:o(a.enableRemoteFileLoading),settingName:"network.enable-remote-file-loading",settingType:"boolean",defaultValue:!1}); +import*as e from"../common/common.js";import*as t from"../i18n/i18n.js";import"../root/root.js";const a={preserveLogUponNavigation:"Preserve log upon navigation",doNotPreserveLogUponNavigation:"Do not preserve log upon navigation",pauseOnExceptions:"Pause on exceptions",doNotPauseOnExceptions:"Do not pause on exceptions",disableJavascript:"Disable JavaScript",enableJavascript:"Enable JavaScript",disableAsyncStackTraces:"Disable async stack traces",doNotCaptureAsyncStackTraces:"Do not capture async stack traces",captureAsyncStackTraces:"Capture async stack traces",showRulersOnHover:"Show rulers on hover",doNotShowRulersOnHover:"Do not show rulers on hover",showAreaNames:"Show area names",showGridNamedAreas:"Show grid named areas",doNotShowGridNamedAreas:"Do not show grid named areas",showTrackSizes:"Show track sizes",showGridTrackSizes:"Show grid track sizes",doNotShowGridTrackSizes:"Do not show grid track sizes",extendGridLines:"Extend grid lines",doNotExtendGridLines:"Do not extend grid lines",showLineLabels:"Show line labels",hideLineLabels:"Hide line labels",showLineNumbers:"Show line numbers",showLineNames:"Show line names",showPaintFlashingRectangles:"Show paint flashing rectangles",hidePaintFlashingRectangles:"Hide paint flashing rectangles",showLayoutShiftRegions:"Show layout shift regions",hideLayoutShiftRegions:"Hide layout shift regions",highlightAdFrames:"Highlight ad frames",doNotHighlightAdFrames:"Do not highlight ad frames",showLayerBorders:"Show layer borders",hideLayerBorders:"Hide layer borders",showFramesPerSecondFpsMeter:"Show frames per second (FPS) meter",hideFramesPerSecondFpsMeter:"Hide frames per second (FPS) meter",showScrollPerformanceBottlenecks:"Show scroll performance bottlenecks",hideScrollPerformanceBottlenecks:"Hide scroll performance bottlenecks",emulateAFocusedPage:"Emulate a focused page",doNotEmulateAFocusedPage:"Do not emulate a focused page",doNotEmulateCssMediaType:"Do not emulate CSS media type",noEmulation:"No emulation",emulateCssPrintMediaType:"Emulate CSS print media type",print:"print",emulateCssScreenMediaType:"Emulate CSS screen media type",screen:"screen",query:"query",emulateCssMediaType:"Emulate CSS media type",doNotEmulateCss:"Do not emulate CSS {PH1}",emulateCss:"Emulate CSS {PH1}",emulateCssMediaFeature:"Emulate CSS media feature {PH1}",doNotEmulateAnyVisionDeficiency:"Do not emulate any vision deficiency",emulateBlurredVision:"Emulate blurred vision",emulateReducedContrast:"Emulate reduced contrast",blurredVision:"Blurred vision",reducedContrast:"Reduced contrast",emulateProtanopia:"Emulate protanopia (no red)",protanopia:"Protanopia (no red)",emulateDeuteranopia:"Emulate deuteranopia (no green)",deuteranopia:"Deuteranopia (no green)",emulateTritanopia:"Emulate tritanopia (no blue)",tritanopia:"Tritanopia (no blue)",emulateAchromatopsia:"Emulate achromatopsia (no color)",achromatopsia:"Achromatopsia (no color)",emulateVisionDeficiencies:"Emulate vision deficiencies",disableLocalFonts:"Disable local fonts",enableLocalFonts:"Enable local fonts",disableAvifFormat:"Disable `AVIF` format",enableAvifFormat:"Enable `AVIF` format",disableWebpFormat:"Disable `WebP` format",enableWebpFormat:"Enable `WebP` format",customFormatters:"Custom formatters",networkRequestBlocking:"Network request blocking",enableNetworkRequestBlocking:"Enable network request blocking",disableNetworkRequestBlocking:"Disable network request blocking",enableCache:"Enable cache",disableCache:"Disable cache while DevTools is open",emulateAutoDarkMode:"Emulate auto dark mode",enableRemoteFileLoading:"Allow `DevTools` to load resources, such as source maps, from remote file paths. Disabled by default for security reasons.",networkCacheExplanation:"Disabling the network cache will simulate a network experience similar to a first time visitor."},i=t.i18n.registerUIStrings("core/sdk/sdk-meta.ts",a),s=t.i18n.getLazilyComputedLocalizedString.bind(void 0,i);e.Settings.registerSettingExtension({storageType:"Synced",settingName:"skip-stack-frames-pattern",settingType:"regex",defaultValue:""}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"skip-content-scripts",settingType:"boolean",defaultValue:!0}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"automatically-ignore-list-known-third-party-scripts",settingType:"boolean",defaultValue:!0}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"skip-anonymous-scripts",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"enable-ignore-listing",settingType:"boolean",defaultValue:!0}),e.Settings.registerSettingExtension({category:"CONSOLE",storageType:"Synced",title:s(a.preserveLogUponNavigation),settingName:"preserve-console-log",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:s(a.preserveLogUponNavigation)},{value:!1,title:s(a.doNotPreserveLogUponNavigation)}]}),e.Settings.registerSettingExtension({category:"DEBUGGER",settingName:"pause-on-exception-enabled",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:s(a.pauseOnExceptions)},{value:!1,title:s(a.doNotPauseOnExceptions)}]}),e.Settings.registerSettingExtension({settingName:"pause-on-caught-exception",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({settingName:"pause-on-uncaught-exception",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({category:"DEBUGGER",experiment:"!react-native-specific-ui",title:s(a.disableJavascript),settingName:"java-script-disabled",settingType:"boolean",storageType:"Session",order:1,defaultValue:!1,options:[{value:!0,title:s(a.disableJavascript)},{value:!1,title:s(a.enableJavascript)}]}),e.Settings.registerSettingExtension({category:"DEBUGGER",title:s(a.disableAsyncStackTraces),settingName:"disable-async-stack-traces",settingType:"boolean",defaultValue:!1,order:2,options:[{value:!0,title:s(a.doNotCaptureAsyncStackTraces)},{value:!1,title:s(a.captureAsyncStackTraces)}]}),e.Settings.registerSettingExtension({category:"DEBUGGER",settingName:"breakpoints-active",settingType:"boolean",storageType:"Session",defaultValue:!0}),e.Settings.registerSettingExtension({category:"ELEMENTS",experiment:"!react-native-specific-ui",storageType:"Synced",title:s(a.showRulersOnHover),settingName:"show-metrics-rulers",settingType:"boolean",options:[{value:!0,title:s(a.showRulersOnHover)},{value:!1,title:s(a.doNotShowRulersOnHover)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"GRID",experiment:"!react-native-specific-ui",storageType:"Synced",title:s(a.showAreaNames),settingName:"show-grid-areas",settingType:"boolean",options:[{value:!0,title:s(a.showGridNamedAreas)},{value:!1,title:s(a.doNotShowGridNamedAreas)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"GRID",experiment:"!react-native-specific-ui",storageType:"Synced",title:s(a.showTrackSizes),settingName:"show-grid-track-sizes",settingType:"boolean",options:[{value:!0,title:s(a.showGridTrackSizes)},{value:!1,title:s(a.doNotShowGridTrackSizes)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"GRID",experiment:"!react-native-specific-ui",storageType:"Synced",title:s(a.extendGridLines),settingName:"extend-grid-lines",settingType:"boolean",options:[{value:!0,title:s(a.extendGridLines)},{value:!1,title:s(a.doNotExtendGridLines)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"GRID",experiment:"!react-native-specific-ui",storageType:"Synced",title:s(a.showLineLabels),settingName:"show-grid-line-labels",settingType:"enum",options:[{title:s(a.hideLineLabels),text:s(a.hideLineLabels),value:"none"},{title:s(a.showLineNumbers),text:s(a.showLineNumbers),value:"lineNumbers"},{title:s(a.showLineNames),text:s(a.showLineNames),value:"lineNames"}],defaultValue:"lineNumbers"}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"show-paint-rects",settingType:"boolean",storageType:"Session",options:[{value:!0,title:s(a.showPaintFlashingRectangles)},{value:!1,title:s(a.hidePaintFlashingRectangles)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"show-layout-shift-regions",settingType:"boolean",storageType:"Session",options:[{value:!0,title:s(a.showLayoutShiftRegions)},{value:!1,title:s(a.hideLayoutShiftRegions)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"show-ad-highlights",settingType:"boolean",storageType:"Session",options:[{value:!0,title:s(a.highlightAdFrames)},{value:!1,title:s(a.doNotHighlightAdFrames)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"show-debug-borders",settingType:"boolean",storageType:"Session",options:[{value:!0,title:s(a.showLayerBorders)},{value:!1,title:s(a.hideLayerBorders)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"show-fps-counter",settingType:"boolean",storageType:"Session",options:[{value:!0,title:s(a.showFramesPerSecondFpsMeter)},{value:!1,title:s(a.hideFramesPerSecondFpsMeter)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"show-scroll-bottleneck-rects",settingType:"boolean",storageType:"Session",options:[{value:!0,title:s(a.showScrollPerformanceBottlenecks)},{value:!1,title:s(a.hideScrollPerformanceBottlenecks)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",title:s(a.emulateAFocusedPage),settingName:"emulate-page-focus",settingType:"boolean",storageType:"Local",defaultValue:!1,options:[{value:!0,title:s(a.emulateAFocusedPage)},{value:!1,title:s(a.doNotEmulateAFocusedPage)}]}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"emulated-css-media",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:s(a.doNotEmulateCssMediaType),text:s(a.noEmulation),value:""},{title:s(a.emulateCssPrintMediaType),text:s(a.print),value:"print"},{title:s(a.emulateCssScreenMediaType),text:s(a.screen),value:"screen"}],tags:[s(a.query)],title:s(a.emulateCssMediaType)}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"emulated-css-media-feature-prefers-color-scheme",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:s(a.doNotEmulateCss,{PH1:"prefers-color-scheme"}),text:s(a.noEmulation),value:""},{title:s(a.emulateCss,{PH1:"prefers-color-scheme: light"}),text:t.i18n.lockedLazyString("prefers-color-scheme: light"),value:"light"},{title:s(a.emulateCss,{PH1:"prefers-color-scheme: dark"}),text:t.i18n.lockedLazyString("prefers-color-scheme: dark"),value:"dark"}],tags:[s(a.query)],title:s(a.emulateCssMediaFeature,{PH1:"prefers-color-scheme"})}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"emulated-css-media-feature-forced-colors",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:s(a.doNotEmulateCss,{PH1:"forced-colors"}),text:s(a.noEmulation),value:""},{title:s(a.emulateCss,{PH1:"forced-colors: active"}),text:t.i18n.lockedLazyString("forced-colors: active"),value:"active"},{title:s(a.emulateCss,{PH1:"forced-colors: none"}),text:t.i18n.lockedLazyString("forced-colors: none"),value:"none"}],tags:[s(a.query)],title:s(a.emulateCssMediaFeature,{PH1:"forced-colors"})}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"emulated-css-media-feature-prefers-reduced-motion",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:s(a.doNotEmulateCss,{PH1:"prefers-reduced-motion"}),text:s(a.noEmulation),value:""},{title:s(a.emulateCss,{PH1:"prefers-reduced-motion: reduce"}),text:t.i18n.lockedLazyString("prefers-reduced-motion: reduce"),value:"reduce"}],tags:[s(a.query)],title:s(a.emulateCssMediaFeature,{PH1:"prefers-reduced-motion"})}),e.Settings.registerSettingExtension({settingName:"emulated-css-media-feature-prefers-contrast",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:s(a.doNotEmulateCss,{PH1:"prefers-contrast"}),text:s(a.noEmulation),value:""},{title:s(a.emulateCss,{PH1:"prefers-contrast: more"}),text:t.i18n.lockedLazyString("prefers-contrast: more"),value:"more"},{title:s(a.emulateCss,{PH1:"prefers-contrast: less"}),text:t.i18n.lockedLazyString("prefers-contrast: less"),value:"less"},{title:s(a.emulateCss,{PH1:"prefers-contrast: custom"}),text:t.i18n.lockedLazyString("prefers-contrast: custom"),value:"custom"}],tags:[s(a.query)],title:s(a.emulateCssMediaFeature,{PH1:"prefers-contrast"})}),e.Settings.registerSettingExtension({settingName:"emulated-css-media-feature-prefers-reduced-data",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:s(a.doNotEmulateCss,{PH1:"prefers-reduced-data"}),text:s(a.noEmulation),value:""},{title:s(a.emulateCss,{PH1:"prefers-reduced-data: reduce"}),text:t.i18n.lockedLazyString("prefers-reduced-data: reduce"),value:"reduce"}],title:s(a.emulateCssMediaFeature,{PH1:"prefers-reduced-data"})}),e.Settings.registerSettingExtension({settingName:"emulated-css-media-feature-prefers-reduced-transparency",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:s(a.doNotEmulateCss,{PH1:"prefers-reduced-transparency"}),text:s(a.noEmulation),value:""},{title:s(a.emulateCss,{PH1:"prefers-reduced-transparency: reduce"}),text:t.i18n.lockedLazyString("prefers-reduced-transparency: reduce"),value:"reduce"}],title:s(a.emulateCssMediaFeature,{PH1:"prefers-reduced-transparency"})}),e.Settings.registerSettingExtension({settingName:"emulated-css-media-feature-color-gamut",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:s(a.doNotEmulateCss,{PH1:"color-gamut"}),text:s(a.noEmulation),value:""},{title:s(a.emulateCss,{PH1:"color-gamut: srgb"}),text:t.i18n.lockedLazyString("color-gamut: srgb"),value:"srgb"},{title:s(a.emulateCss,{PH1:"color-gamut: p3"}),text:t.i18n.lockedLazyString("color-gamut: p3"),value:"p3"},{title:s(a.emulateCss,{PH1:"color-gamut: rec2020"}),text:t.i18n.lockedLazyString("color-gamut: rec2020"),value:"rec2020"}],title:s(a.emulateCssMediaFeature,{PH1:"color-gamut"})}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"emulated-vision-deficiency",settingType:"enum",storageType:"Session",defaultValue:"none",options:[{title:s(a.doNotEmulateAnyVisionDeficiency),text:s(a.noEmulation),value:"none"},{title:s(a.emulateBlurredVision),text:s(a.blurredVision),value:"blurredVision"},{title:s(a.emulateReducedContrast),text:s(a.reducedContrast),value:"reducedContrast"},{title:s(a.emulateProtanopia),text:s(a.protanopia),value:"protanopia"},{title:s(a.emulateDeuteranopia),text:s(a.deuteranopia),value:"deuteranopia"},{title:s(a.emulateTritanopia),text:s(a.tritanopia),value:"tritanopia"},{title:s(a.emulateAchromatopsia),text:s(a.achromatopsia),value:"achromatopsia"}],tags:[s(a.query)],title:s(a.emulateVisionDeficiencies)}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"local-fonts-disabled",settingType:"boolean",storageType:"Session",options:[{value:!0,title:s(a.disableLocalFonts)},{value:!1,title:s(a.enableLocalFonts)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"avif-format-disabled",settingType:"boolean",storageType:"Session",options:[{value:!0,title:s(a.disableAvifFormat)},{value:!1,title:s(a.enableAvifFormat)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"webp-format-disabled",settingType:"boolean",storageType:"Session",options:[{value:!0,title:s(a.disableWebpFormat)},{value:!1,title:s(a.enableWebpFormat)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"CONSOLE",title:s(a.customFormatters),settingName:"custom-formatters",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({category:"",title:s(a.networkRequestBlocking),settingName:"request-blocking-enabled",settingType:"boolean",storageType:"Session",defaultValue:!1,options:[{value:!0,title:s(a.enableNetworkRequestBlocking)},{value:!1,title:s(a.disableNetworkRequestBlocking)}]}),e.Settings.registerSettingExtension({category:"NETWORK",experiment:"!react-native-specific-ui",title:s(a.disableCache),settingName:"cache-disabled",settingType:"boolean",order:0,defaultValue:!1,userActionCondition:"hasOtherClients",options:[{value:!0,title:s(a.disableCache)},{value:!1,title:s(a.enableCache)}],learnMore:{tooltip:s(a.networkCacheExplanation)}}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",title:s(a.emulateAutoDarkMode),settingName:"emulate-auto-dark-mode",settingType:"boolean",storageType:"Session",defaultValue:!1}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:s(a.enableRemoteFileLoading),settingName:"network.enable-remote-file-loading",settingType:"boolean",defaultValue:!1}); diff --git a/packages/debugger-frontend/dist/third-party/front_end/entrypoints/devtools_app/devtools_app.js b/packages/debugger-frontend/dist/third-party/front_end/entrypoints/devtools_app/devtools_app.js index 51a7f72adf9c..5915aa7859d6 100644 --- a/packages/debugger-frontend/dist/third-party/front_end/entrypoints/devtools_app/devtools_app.js +++ b/packages/debugger-frontend/dist/third-party/front_end/entrypoints/devtools_app/devtools_app.js @@ -1 +1 @@ -import"../shell/shell.js";import*as e from"../../core/i18n/i18n.js";import*as t from"../../ui/legacy/legacy.js";import*as o from"../../core/common/common.js";import*as i from"../../core/root/root.js";import*as n from"../../core/sdk/sdk.js";import*as a from"../../models/extensions/extensions.js";import*as r from"../../models/workspace/workspace.js";import*as s from"../../panels/network/forward/forward.js";import*as l from"../../panels/security/security.js";import*as c from"../../ui/components/legacy_wrapper/legacy_wrapper.js";import*as d from"../../panels/application/preloading/helper/helper.js";import*as g from"../../models/issues_manager/issues_manager.js";import*as w from"../main/main.js";const m={cssOverview:"CSS overview",showCssOverview:"Show CSS overview"},p=e.i18n.registerUIStrings("panels/css_overview/css_overview-meta.ts",m),u=e.i18n.getLazilyComputedLocalizedString.bind(void 0,p);let y;t.ViewManager.registerViewExtension({location:"panel",id:"cssoverview",commandPrompt:u(m.showCssOverview),title:u(m.cssOverview),order:95,persistence:"closeable",async loadView(){const e=await async function(){return y||(y=await import("../../panels/css_overview/css_overview.js")),y}();return new e.CSSOverviewPanel.CSSOverviewPanel(new e.CSSOverviewController.OverviewController)},isPreviewFeature:!0});const h={showElements:"Show Elements",elements:"Elements",showEventListeners:"Show Event Listeners",eventListeners:"Event Listeners",showProperties:"Show Properties",properties:"Properties",showStackTrace:"Show Stack Trace",stackTrace:"Stack Trace",showLayout:"Show Layout",layout:"Layout",hideElement:"Hide element",editAsHtml:"Edit as HTML",duplicateElement:"Duplicate element",undo:"Undo",redo:"Redo",captureAreaScreenshot:"Capture area screenshot",selectAnElementInThePageTo:"Select an element in the page to inspect it",newStyleRule:"New Style Rule",refreshEventListeners:"Refresh event listeners",wordWrap:"Word wrap",enableDomWordWrap:"Enable `DOM` word wrap",disableDomWordWrap:"Disable `DOM` word wrap",showHtmlComments:"Show `HTML` comments",hideHtmlComments:"Hide `HTML` comments",revealDomNodeOnHover:"Reveal `DOM` node on hover",showDetailedInspectTooltip:"Show detailed inspect tooltip",showCSSDocumentationTooltip:"Show CSS documentation tooltip",copyStyles:"Copy styles",showUserAgentShadowDOM:"Show user agent shadow `DOM`",showComputedStyles:"Show Computed Styles",showStyles:"Show Styles",toggleEyeDropper:"Toggle eye dropper"},v=e.i18n.registerUIStrings("panels/elements/elements-meta.ts",h),S=e.i18n.getLazilyComputedLocalizedString.bind(void 0,v);let R,E;async function A(){return R||(R=await import("../../panels/elements/elements.js")),R}function b(e){return void 0===R?[]:e(R)}t.ViewManager.registerViewExtension({location:"panel",id:"elements",commandPrompt:S(h.showElements),title:S(h.elements),order:10,persistence:"permanent",hasToolbar:!1,loadView:async()=>(await A()).ElementsPanel.ElementsPanel.instance()}),t.ActionRegistration.registerActionExtension({actionId:"elements.show-styles",category:"ELEMENTS",title:S(h.showStyles),loadActionDelegate:async()=>new((await A()).ElementsPanel.ElementsActionDelegate)}),t.ActionRegistration.registerActionExtension({actionId:"elements.show-computed",category:"ELEMENTS",title:S(h.showComputedStyles),loadActionDelegate:async()=>new((await A()).ElementsPanel.ElementsActionDelegate)}),t.ViewManager.registerViewExtension({location:"elements-sidebar",id:"elements.event-listeners",commandPrompt:S(h.showEventListeners),title:S(h.eventListeners),order:5,hasToolbar:!0,persistence:"permanent",loadView:async()=>(await A()).EventListenersWidget.EventListenersWidget.instance()}),t.ViewManager.registerViewExtension({location:"elements-sidebar",id:"elements.dom-properties",commandPrompt:S(h.showProperties),title:S(h.properties),order:7,persistence:"permanent",loadView:async()=>new((await A()).PropertiesWidget.PropertiesWidget)}),t.ViewManager.registerViewExtension({experiment:"capture-node-creation-stacks",location:"elements-sidebar",id:"elements.dom-creation",commandPrompt:S(h.showStackTrace),title:S(h.stackTrace),order:10,persistence:"permanent",loadView:async()=>new((await A()).NodeStackTraceWidget.NodeStackTraceWidget)}),t.ViewManager.registerViewExtension({location:"elements-sidebar",id:"elements.layout",commandPrompt:S(h.showLayout),title:S(h.layout),order:4,persistence:"permanent",loadView:async()=>(await async function(){return E||(E=await import("../../panels/elements/components/components.js")),E}()).LayoutPane.LayoutPane.instance().wrapper}),t.ActionRegistration.registerActionExtension({actionId:"elements.hide-element",category:"ELEMENTS",title:S(h.hideElement),loadActionDelegate:async()=>new((await A()).ElementsPanel.ElementsActionDelegate),contextTypes:()=>b((e=>[e.ElementsPanel.ElementsPanel])),bindings:[{shortcut:"H"}]}),t.ActionRegistration.registerActionExtension({actionId:"elements.toggle-eye-dropper",category:"ELEMENTS",title:S(h.toggleEyeDropper),loadActionDelegate:async()=>new((await A()).ElementsPanel.ElementsActionDelegate),contextTypes:()=>b((e=>[e.ColorSwatchPopoverIcon.ColorSwatchPopoverIcon])),bindings:[{shortcut:"c"}]}),t.ActionRegistration.registerActionExtension({actionId:"elements.edit-as-html",category:"ELEMENTS",title:S(h.editAsHtml),loadActionDelegate:async()=>new((await A()).ElementsPanel.ElementsActionDelegate),contextTypes:()=>b((e=>[e.ElementsPanel.ElementsPanel])),bindings:[{shortcut:"F2"}]}),t.ActionRegistration.registerActionExtension({actionId:"elements.duplicate-element",category:"ELEMENTS",title:S(h.duplicateElement),loadActionDelegate:async()=>new((await A()).ElementsPanel.ElementsActionDelegate),contextTypes:()=>b((e=>[e.ElementsPanel.ElementsPanel])),bindings:[{shortcut:"Shift+Alt+Down"}]}),t.ActionRegistration.registerActionExtension({actionId:"elements.copy-styles",category:"ELEMENTS",title:S(h.copyStyles),loadActionDelegate:async()=>new((await A()).ElementsPanel.ElementsActionDelegate),contextTypes:()=>b((e=>[e.ElementsPanel.ElementsPanel])),bindings:[{shortcut:"Ctrl+Alt+C",platform:"windows,linux"},{shortcut:"Meta+Alt+C",platform:"mac"}]}),t.ActionRegistration.registerActionExtension({actionId:"elements.undo",category:"ELEMENTS",title:S(h.undo),loadActionDelegate:async()=>new((await A()).ElementsPanel.ElementsActionDelegate),contextTypes:()=>b((e=>[e.ElementsPanel.ElementsPanel])),bindings:[{shortcut:"Ctrl+Z",platform:"windows,linux"},{shortcut:"Meta+Z",platform:"mac"}]}),t.ActionRegistration.registerActionExtension({actionId:"elements.redo",category:"ELEMENTS",title:S(h.redo),loadActionDelegate:async()=>new((await A()).ElementsPanel.ElementsActionDelegate),contextTypes:()=>b((e=>[e.ElementsPanel.ElementsPanel])),bindings:[{shortcut:"Ctrl+Y",platform:"windows,linux"},{shortcut:"Meta+Shift+Z",platform:"mac"}]}),t.ActionRegistration.registerActionExtension({actionId:"elements.capture-area-screenshot",loadActionDelegate:async()=>new((await A()).InspectElementModeController.ToggleSearchActionDelegate),condition:i.Runtime.conditions.canDock,title:S(h.captureAreaScreenshot),category:"SCREENSHOT"}),t.ActionRegistration.registerActionExtension({category:"ELEMENTS",actionId:"elements.toggle-element-search",toggleable:!0,loadActionDelegate:async()=>new((await A()).InspectElementModeController.ToggleSearchActionDelegate),title:S(h.selectAnElementInThePageTo),iconClass:"select-element",bindings:[{shortcut:"Ctrl+Shift+C",platform:"windows,linux"},{shortcut:"Meta+Shift+C",platform:"mac"}]}),t.ActionRegistration.registerActionExtension({category:"ELEMENTS",actionId:"elements.new-style-rule",title:S(h.newStyleRule),iconClass:"plus",loadActionDelegate:async()=>new((await A()).StylesSidebarPane.ActionDelegate),contextTypes:()=>b((e=>[e.StylesSidebarPane.StylesSidebarPane]))}),t.ActionRegistration.registerActionExtension({category:"ELEMENTS",actionId:"elements.refresh-event-listeners",title:S(h.refreshEventListeners),iconClass:"refresh",loadActionDelegate:async()=>new((await A()).EventListenersWidget.ActionDelegate),contextTypes:()=>b((e=>[e.EventListenersWidget.EventListenersWidget]))}),o.Settings.registerSettingExtension({category:"ELEMENTS",storageType:"Synced",order:1,title:S(h.showUserAgentShadowDOM),settingName:"show-ua-shadow-dom",settingType:"boolean",defaultValue:!1}),o.Settings.registerSettingExtension({category:"ELEMENTS",storageType:"Synced",order:2,title:S(h.wordWrap),settingName:"dom-word-wrap",settingType:"boolean",options:[{value:!0,title:S(h.enableDomWordWrap)},{value:!1,title:S(h.disableDomWordWrap)}],defaultValue:!0}),o.Settings.registerSettingExtension({category:"ELEMENTS",storageType:"Synced",order:3,title:S(h.showHtmlComments),settingName:"show-html-comments",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:S(h.showHtmlComments)},{value:!1,title:S(h.hideHtmlComments)}]}),o.Settings.registerSettingExtension({category:"ELEMENTS",storageType:"Synced",order:4,title:S(h.revealDomNodeOnHover),settingName:"highlight-node-on-hover-in-overlay",settingType:"boolean",defaultValue:!0}),o.Settings.registerSettingExtension({category:"ELEMENTS",storageType:"Synced",order:5,title:S(h.showDetailedInspectTooltip),settingName:"show-detailed-inspect-tooltip",settingType:"boolean",defaultValue:!0}),o.Settings.registerSettingExtension({settingName:"show-event-listeners-for-ancestors",settingType:"boolean",defaultValue:!0}),o.Settings.registerSettingExtension({category:"ADORNER",storageType:"Synced",settingName:"adorner-settings",settingType:"array",defaultValue:[]}),o.Settings.registerSettingExtension({category:"ELEMENTS",storageType:"Synced",title:S(h.showCSSDocumentationTooltip),settingName:"show-css-property-documentation-on-hover",settingType:"boolean",defaultValue:!0}),t.ContextMenu.registerProvider({contextTypes:()=>[n.RemoteObject.RemoteObject,n.DOMModel.DOMNode,n.DOMModel.DeferredDOMNode],loadProvider:async()=>new((await A()).ElementsPanel.ContextMenuProvider),experiment:void 0}),t.ViewManager.registerLocationResolver({name:"elements-sidebar",category:"ELEMENTS",loadResolver:async()=>(await A()).ElementsPanel.ElementsPanel.instance()}),o.Revealer.registerRevealer({contextTypes:()=>[n.DOMModel.DOMNode,n.DOMModel.DeferredDOMNode,n.RemoteObject.RemoteObject],destination:o.Revealer.RevealerDestination.ELEMENTS_PANEL,loadRevealer:async()=>new((await A()).ElementsPanel.DOMNodeRevealer)}),o.Revealer.registerRevealer({contextTypes:()=>[n.CSSProperty.CSSProperty],destination:o.Revealer.RevealerDestination.STYLES_SIDEBAR,loadRevealer:async()=>new((await A()).ElementsPanel.CSSPropertyRevealer)}),t.Toolbar.registerToolbarItem({loadItem:async()=>(await A()).LayersWidget.ButtonProvider.instance(),order:1,location:"styles-sidebarpane-toolbar"}),t.Toolbar.registerToolbarItem({loadItem:async()=>(await A()).ElementStatePaneWidget.ButtonProvider.instance(),order:2,location:"styles-sidebarpane-toolbar"}),t.Toolbar.registerToolbarItem({loadItem:async()=>(await A()).ClassesPaneWidget.ButtonProvider.instance(),order:3,location:"styles-sidebarpane-toolbar"}),t.Toolbar.registerToolbarItem({loadItem:async()=>(await A()).StylesSidebarPane.ButtonProvider.instance(),order:100,location:"styles-sidebarpane-toolbar"}),t.Toolbar.registerToolbarItem({actionId:"elements.toggle-element-search",location:"main-toolbar-left",order:0}),t.UIUtils.registerRenderer({contextTypes:()=>[n.DOMModel.DOMNode,n.DOMModel.DeferredDOMNode],loadRenderer:async()=>(await A()).ElementsTreeOutline.Renderer.instance()}),o.Linkifier.registerLinkifier({contextTypes:()=>[n.DOMModel.DOMNode,n.DOMModel.DeferredDOMNode],loadLinkifier:async()=>(await A()).DOMLinkifier.Linkifier.instance()});const P={showEventListenerBreakpoints:"Show Event Listener Breakpoints",eventListenerBreakpoints:"Event Listener Breakpoints",showCspViolationBreakpoints:"Show CSP Violation Breakpoints",cspViolationBreakpoints:"CSP Violation Breakpoints",showXhrfetchBreakpoints:"Show XHR/fetch Breakpoints",xhrfetchBreakpoints:"XHR/fetch Breakpoints",showDomBreakpoints:"Show DOM Breakpoints",domBreakpoints:"DOM Breakpoints",showGlobalListeners:"Show Global Listeners",globalListeners:"Global Listeners",page:"Page",showPage:"Show Page",overrides:"Overrides",showOverrides:"Show Overrides",contentScripts:"Content scripts",showContentScripts:"Show Content scripts",refreshGlobalListeners:"Refresh global listeners"},f=e.i18n.registerUIStrings("panels/browser_debugger/browser_debugger-meta.ts",P),T=e.i18n.getLazilyComputedLocalizedString.bind(void 0,f);let k,D;async function x(){return k||(k=await import("../../panels/browser_debugger/browser_debugger.js")),k}async function L(){return D||(D=await import("../../panels/sources/sources.js")),D}t.ViewManager.registerViewExtension({loadView:async()=>(await x()).EventListenerBreakpointsSidebarPane.EventListenerBreakpointsSidebarPane.instance(),id:"sources.event-listener-breakpoints",location:"sources.sidebar-bottom",commandPrompt:T(P.showEventListenerBreakpoints),title:T(P.eventListenerBreakpoints),order:9,persistence:"permanent"}),t.ViewManager.registerViewExtension({loadView:async()=>new((await x()).CSPViolationBreakpointsSidebarPane.CSPViolationBreakpointsSidebarPane),id:"sources.csp-violation-breakpoints",location:"sources.sidebar-bottom",commandPrompt:T(P.showCspViolationBreakpoints),title:T(P.cspViolationBreakpoints),order:10,persistence:"permanent"}),t.ViewManager.registerViewExtension({loadView:async()=>(await x()).XHRBreakpointsSidebarPane.XHRBreakpointsSidebarPane.instance(),id:"sources.xhr-breakpoints",location:"sources.sidebar-bottom",commandPrompt:T(P.showXhrfetchBreakpoints),title:T(P.xhrfetchBreakpoints),order:5,persistence:"permanent",hasToolbar:!0}),t.ViewManager.registerViewExtension({loadView:async()=>(await x()).DOMBreakpointsSidebarPane.DOMBreakpointsSidebarPane.instance(),id:"sources.dom-breakpoints",location:"sources.sidebar-bottom",commandPrompt:T(P.showDomBreakpoints),title:T(P.domBreakpoints),order:7,persistence:"permanent"}),t.ViewManager.registerViewExtension({loadView:async()=>new((await x()).ObjectEventListenersSidebarPane.ObjectEventListenersSidebarPane),id:"sources.global-listeners",location:"sources.sidebar-bottom",commandPrompt:T(P.showGlobalListeners),title:T(P.globalListeners),order:8,persistence:"permanent",hasToolbar:!0}),t.ViewManager.registerViewExtension({loadView:async()=>(await x()).DOMBreakpointsSidebarPane.DOMBreakpointsSidebarPane.instance(),id:"elements.dom-breakpoints",location:"elements-sidebar",commandPrompt:T(P.showDomBreakpoints),title:T(P.domBreakpoints),order:6,persistence:"permanent"}),t.ViewManager.registerViewExtension({location:"navigator-view",id:"navigator-network",title:T(P.page),commandPrompt:T(P.showPage),order:2,persistence:"permanent",loadView:async()=>(await L()).SourcesNavigator.NetworkNavigatorView.instance()}),t.ViewManager.registerViewExtension({location:"navigator-view",id:"navigator-overrides",title:T(P.overrides),commandPrompt:T(P.showOverrides),order:4,persistence:"permanent",loadView:async()=>(await L()).SourcesNavigator.OverridesNavigatorView.instance()}),t.ViewManager.registerViewExtension({location:"navigator-view",id:"navigator-content-scripts",title:T(P.contentScripts),commandPrompt:T(P.showContentScripts),order:5,persistence:"permanent",condition:()=>"/bundled/worker_app.html"!==i.Runtime.getPathName(),loadView:async()=>new((await L()).SourcesNavigator.ContentScriptsNavigatorView)}),t.ActionRegistration.registerActionExtension({category:"DEBUGGER",actionId:"browser-debugger.refresh-global-event-listeners",loadActionDelegate:async()=>new((await x()).ObjectEventListenersSidebarPane.ActionDelegate),title:T(P.refreshGlobalListeners),iconClass:"refresh",contextTypes:()=>void 0===k?[]:(e=>[e.ObjectEventListenersSidebarPane.ObjectEventListenersSidebarPane])(k)}),t.ContextMenu.registerProvider({contextTypes:()=>[n.DOMModel.DOMNode],loadProvider:async()=>new((await x()).DOMBreakpointsSidebarPane.ContextMenuProvider),experiment:void 0}),t.Context.registerListener({contextTypes:()=>[n.DebuggerModel.DebuggerPausedDetails],loadListener:async()=>(await x()).XHRBreakpointsSidebarPane.XHRBreakpointsSidebarPane.instance()}),t.Context.registerListener({contextTypes:()=>[n.DebuggerModel.DebuggerPausedDetails],loadListener:async()=>(await x()).DOMBreakpointsSidebarPane.DOMBreakpointsSidebarPane.instance()});const M={showNetwork:"Show Network",network:"Network",networkExpoUnstable:"Expo Network",showNetworkRequestBlocking:"Show Network request blocking",networkRequestBlocking:"Network request blocking",showNetworkConditions:"Show Network conditions",networkConditions:"Network conditions",diskCache:"disk cache",networkThrottling:"network throttling",showSearch:"Show Search",search:"Search",recordNetworkLog:"Record network log",stopRecordingNetworkLog:"Stop recording network log",hideRequestDetails:"Hide request details",colorcodeResourceTypes:"Color-code resource types",colorCode:"color code",resourceType:"resource type",colorCodeByResourceType:"Color code by resource type",useDefaultColors:"Use default colors",groupNetworkLogByFrame:"Group network log by frame",netWork:"network",frame:"frame",group:"group",groupNetworkLogItemsByFrame:"Group network log items by frame",dontGroupNetworkLogItemsByFrame:"Don't group network log items by frame",clear:"Clear network log",addNetworkRequestBlockingPattern:"Add network request blocking pattern",removeAllNetworkRequestBlockingPatterns:"Remove all network request blocking patterns",allowToGenerateHarWithSensitiveData:"Allow to generate `HAR` with sensitive data",dontAllowToGenerateHarWithSensitiveData:"Don't allow to generate `HAR` with sensitive data",allowToGenerateHarWithSensitiveDataDocumentation:"By default generated HAR logs are sanitized and don't include `Cookie`, `Set-Cookie`, or `Authorization` HTTP headers. When this setting is enabled, options to export/copy HAR with sensitive data are provided."},N=e.i18n.registerUIStrings("panels/network/network-meta.ts",M),I=e.i18n.getLazilyComputedLocalizedString.bind(void 0,N),C=e.i18n.getLocalizedString.bind(void 0,N);let V;async function O(){return V||(V=await import("../../panels/network/network.js")),V}function B(e){return void 0===V?[]:e(V)}t.ViewManager.registerViewExtension({location:"panel",id:"network",commandPrompt:I(M.showNetwork),title:()=>i.Runtime.conditions.reactNativeExpoNetworkPanel()?C(M.networkExpoUnstable):C(M.network),order:40,loadView:async()=>(await O()).NetworkPanel.NetworkPanel.instance()}),t.ViewManager.registerViewExtension({location:"drawer-view",id:"network.blocked-urls",commandPrompt:I(M.showNetworkRequestBlocking),title:I(M.networkRequestBlocking),persistence:"closeable",order:60,loadView:async()=>new((await O()).BlockedURLsPane.BlockedURLsPane)}),t.ViewManager.registerViewExtension({location:"drawer-view",id:"network.config",commandPrompt:I(M.showNetworkConditions),title:I(M.networkConditions),persistence:"closeable",order:40,tags:[I(M.diskCache),I(M.networkThrottling),e.i18n.lockedLazyString("useragent"),e.i18n.lockedLazyString("user agent"),e.i18n.lockedLazyString("user-agent")],loadView:async()=>(await O()).NetworkConfigView.NetworkConfigView.instance()}),t.ViewManager.registerViewExtension({location:"network-sidebar",id:"network.search-network-tab",commandPrompt:I(M.showSearch),title:I(M.search),persistence:"permanent",loadView:async()=>(await O()).NetworkPanel.SearchNetworkView.instance()}),t.ActionRegistration.registerActionExtension({actionId:"network.toggle-recording",category:"NETWORK",iconClass:"record-start",toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,contextTypes:()=>B((e=>[e.NetworkPanel.NetworkPanel])),loadActionDelegate:async()=>new((await O()).NetworkPanel.ActionDelegate),options:[{value:!0,title:I(M.recordNetworkLog)},{value:!1,title:I(M.stopRecordingNetworkLog)}],bindings:[{shortcut:"Ctrl+E",platform:"windows,linux"},{shortcut:"Meta+E",platform:"mac"}]}),t.ActionRegistration.registerActionExtension({actionId:"network.clear",category:"NETWORK",title:I(M.clear),iconClass:"clear",loadActionDelegate:async()=>new((await O()).NetworkPanel.ActionDelegate),contextTypes:()=>B((e=>[e.NetworkPanel.NetworkPanel])),bindings:[{shortcut:"Ctrl+L"},{shortcut:"Meta+K",platform:"mac"}]}),t.ActionRegistration.registerActionExtension({actionId:"network.hide-request-details",category:"NETWORK",title:I(M.hideRequestDetails),contextTypes:()=>B((e=>[e.NetworkPanel.NetworkPanel])),loadActionDelegate:async()=>new((await O()).NetworkPanel.ActionDelegate),bindings:[{shortcut:"Esc"}]}),t.ActionRegistration.registerActionExtension({actionId:"network.search",category:"NETWORK",title:I(M.search),contextTypes:()=>B((e=>[e.NetworkPanel.NetworkPanel])),loadActionDelegate:async()=>new((await O()).NetworkPanel.ActionDelegate),bindings:[{platform:"mac",shortcut:"Meta+F",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+F",keybindSets:["devToolsDefault","vsCode"]}]}),t.ActionRegistration.registerActionExtension({actionId:"network.add-network-request-blocking-pattern",category:"NETWORK",title:I(M.addNetworkRequestBlockingPattern),iconClass:"plus",contextTypes:()=>B((e=>[e.BlockedURLsPane.BlockedURLsPane])),loadActionDelegate:async()=>new((await O()).BlockedURLsPane.ActionDelegate)}),t.ActionRegistration.registerActionExtension({actionId:"network.remove-all-network-request-blocking-patterns",category:"NETWORK",title:I(M.removeAllNetworkRequestBlockingPatterns),iconClass:"clear",contextTypes:()=>B((e=>[e.BlockedURLsPane.BlockedURLsPane])),loadActionDelegate:async()=>new((await O()).BlockedURLsPane.ActionDelegate)}),o.Settings.registerSettingExtension({category:"NETWORK",storageType:"Synced",title:I(M.allowToGenerateHarWithSensitiveData),settingName:"network.show-options-to-generate-har-with-sensitive-data",settingType:"boolean",defaultValue:!1,tags:[e.i18n.lockedLazyString("HAR")],options:[{value:!0,title:I(M.allowToGenerateHarWithSensitiveData)},{value:!1,title:I(M.dontAllowToGenerateHarWithSensitiveData)}],learnMore:{url:"https://goo.gle/devtools-export-hars",tooltip:I(M.allowToGenerateHarWithSensitiveDataDocumentation)}}),o.Settings.registerSettingExtension({category:"NETWORK",storageType:"Synced",title:I(M.colorcodeResourceTypes),settingName:"network-color-code-resource-types",settingType:"boolean",defaultValue:!1,tags:[I(M.colorCode),I(M.resourceType)],options:[{value:!0,title:I(M.colorCodeByResourceType)},{value:!1,title:I(M.useDefaultColors)}]}),o.Settings.registerSettingExtension({category:"NETWORK",storageType:"Synced",title:I(M.groupNetworkLogByFrame),settingName:"network.group-by-frame",settingType:"boolean",defaultValue:!1,tags:[I(M.netWork),I(M.frame),I(M.group)],options:[{value:!0,title:I(M.groupNetworkLogItemsByFrame)},{value:!1,title:I(M.dontGroupNetworkLogItemsByFrame)}]}),t.ViewManager.registerLocationResolver({name:"network-sidebar",category:"NETWORK",loadResolver:async()=>(await O()).NetworkPanel.NetworkPanel.instance()}),t.ContextMenu.registerProvider({contextTypes:()=>[n.NetworkRequest.NetworkRequest,n.Resource.Resource,r.UISourceCode.UISourceCode,n.TraceObject.RevealableNetworkRequest],loadProvider:async()=>(await O()).NetworkPanel.NetworkPanel.instance(),experiment:void 0}),o.Revealer.registerRevealer({contextTypes:()=>[n.NetworkRequest.NetworkRequest],destination:o.Revealer.RevealerDestination.NETWORK_PANEL,loadRevealer:async()=>new((await O()).NetworkPanel.RequestRevealer)}),o.Revealer.registerRevealer({contextTypes:()=>[s.UIRequestLocation.UIRequestLocation],destination:void 0,loadRevealer:async()=>new((await O()).NetworkPanel.RequestLocationRevealer)}),o.Revealer.registerRevealer({contextTypes:()=>[s.NetworkRequestId.NetworkRequestId],destination:o.Revealer.RevealerDestination.NETWORK_PANEL,loadRevealer:async()=>new((await O()).NetworkPanel.RequestIdRevealer)}),o.Revealer.registerRevealer({contextTypes:()=>[s.UIFilter.UIRequestFilter,a.ExtensionServer.RevealableNetworkRequestFilter],destination:o.Revealer.RevealerDestination.NETWORK_PANEL,loadRevealer:async()=>new((await O()).NetworkPanel.NetworkLogWithFilterRevealer)});const W={security:"Security",PrivacyAndSecurity:"Privacy and security",showSecurity:"Show Security",showPrivacyAndSecurity:"Show Privacy and security"},U=e.i18n.registerUIStrings("panels/security/security-meta.ts",W),z=e.i18n.getLazilyComputedLocalizedString.bind(void 0,U);let _;async function j(){return _||(_=await import("../../panels/security/security.js")),_}t.ViewManager.registerViewExtension({location:"panel",id:"security",title:()=>i.Runtime.hostConfig.devToolsPrivacyUI?.enabled?z(W.PrivacyAndSecurity)():z(W.security)(),commandPrompt:()=>i.Runtime.hostConfig.devToolsPrivacyUI?.enabled?z(W.showPrivacyAndSecurity)():z(W.showSecurity)(),order:80,persistence:"closeable",loadView:async()=>(await j()).SecurityPanel.SecurityPanel.instance()}),o.Revealer.registerRevealer({contextTypes:()=>[l.CookieReportView.CookieReportView],destination:o.Revealer.RevealerDestination.SECURITY_PANEL,loadRevealer:async()=>new((await j()).SecurityPanel.SecurityRevealer)});const F={toggleDeviceToolbar:"Toggle device toolbar",captureScreenshot:"Capture screenshot",captureFullSizeScreenshot:"Capture full size screenshot",captureNodeScreenshot:"Capture node screenshot",showMediaQueries:"Show media queries",device:"device",hideMediaQueries:"Hide media queries",showRulers:"Show rulers in the Device Mode toolbar",hideRulers:"Hide rulers in the Device Mode toolbar",showDeviceFrame:"Show device frame",hideDeviceFrame:"Hide device frame"},H=e.i18n.registerUIStrings("panels/emulation/emulation-meta.ts",F),q=e.i18n.getLazilyComputedLocalizedString.bind(void 0,H);let G;async function K(){return G||(G=await import("../../panels/emulation/emulation.js")),G}t.ActionRegistration.registerActionExtension({category:"MOBILE",actionId:"emulation.toggle-device-mode",toggleable:!0,loadActionDelegate:async()=>new((await K()).DeviceModeWrapper.ActionDelegate),condition:i.Runtime.conditions.canDock,title:q(F.toggleDeviceToolbar),iconClass:"devices",bindings:[{platform:"windows,linux",shortcut:"Shift+Ctrl+M"},{platform:"mac",shortcut:"Shift+Meta+M"}]}),t.ActionRegistration.registerActionExtension({actionId:"emulation.capture-screenshot",category:"SCREENSHOT",loadActionDelegate:async()=>new((await K()).DeviceModeWrapper.ActionDelegate),condition:i.Runtime.conditions.canDock,title:q(F.captureScreenshot)}),t.ActionRegistration.registerActionExtension({actionId:"emulation.capture-full-height-screenshot",category:"SCREENSHOT",loadActionDelegate:async()=>new((await K()).DeviceModeWrapper.ActionDelegate),condition:i.Runtime.conditions.canDock,title:q(F.captureFullSizeScreenshot)}),t.ActionRegistration.registerActionExtension({actionId:"emulation.capture-node-screenshot",category:"SCREENSHOT",loadActionDelegate:async()=>new((await K()).DeviceModeWrapper.ActionDelegate),condition:i.Runtime.conditions.canDock,title:q(F.captureNodeScreenshot)}),o.Settings.registerSettingExtension({category:"MOBILE",settingName:"show-media-query-inspector",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:q(F.showMediaQueries)},{value:!1,title:q(F.hideMediaQueries)}],tags:[q(F.device)]}),o.Settings.registerSettingExtension({category:"MOBILE",settingName:"emulation.show-rulers",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:q(F.showRulers)},{value:!1,title:q(F.hideRulers)}],tags:[q(F.device)]}),o.Settings.registerSettingExtension({category:"MOBILE",settingName:"emulation.show-device-outline",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:q(F.showDeviceFrame)},{value:!1,title:q(F.hideDeviceFrame)}],tags:[q(F.device)]}),t.Toolbar.registerToolbarItem({actionId:"emulation.toggle-device-mode",condition:i.Runtime.conditions.canDock,location:"main-toolbar-left",order:1,loadItem:void 0,separator:void 0}),o.AppProvider.registerAppProvider({loadAppProvider:async()=>(await K()).AdvancedApp.AdvancedAppProvider.instance(),condition:i.Runtime.conditions.canDock,order:0}),t.ContextMenu.registerItem({location:"deviceModeMenu/save",order:12,actionId:"emulation.capture-screenshot"}),t.ContextMenu.registerItem({location:"deviceModeMenu/save",order:13,actionId:"emulation.capture-full-height-screenshot"});const Y={sensors:"Sensors",geolocation:"geolocation",timezones:"timezones",locale:"locale",locales:"locales",accelerometer:"accelerometer",deviceOrientation:"device orientation",locations:"Locations",touch:"Touch",devicebased:"Device-based",forceEnabled:"Force enabled",emulateIdleDetectorState:"Emulate Idle Detector state",noIdleEmulation:"No idle emulation",userActiveScreenUnlocked:"User active, screen unlocked",userActiveScreenLocked:"User active, screen locked",userIdleScreenUnlocked:"User idle, screen unlocked",userIdleScreenLocked:"User idle, screen locked",showSensors:"Show Sensors",showLocations:"Show Locations",cpuPressure:"CPU Pressure",noPressureEmulation:"No override",nominal:"Nominal",fair:"Fair",serious:"Serious",critical:"Critical"},X=e.i18n.registerUIStrings("panels/sensors/sensors-meta.ts",Y),Z=e.i18n.getLazilyComputedLocalizedString.bind(void 0,X);let Q,J;async function $(){return Q||(Q=await import("../../panels/sensors/sensors.js")),Q}t.ViewManager.registerViewExtension({location:"drawer-view",commandPrompt:Z(Y.showSensors),title:Z(Y.sensors),id:"sensors",persistence:"closeable",order:100,loadView:async()=>new((await $()).SensorsView.SensorsView),tags:[Z(Y.geolocation),Z(Y.timezones),Z(Y.locale),Z(Y.locales),Z(Y.accelerometer),Z(Y.deviceOrientation)]}),t.ViewManager.registerViewExtension({location:"settings-view",id:"emulation-locations",commandPrompt:Z(Y.showLocations),title:Z(Y.locations),order:40,loadView:async()=>new((await $()).LocationsSettingsTab.LocationsSettingsTab),settings:["emulation.locations"],iconName:"location-on"}),o.Settings.registerSettingExtension({storageType:"Synced",settingName:"emulation.locations",settingType:"array",defaultValue:[{title:"Berlin",lat:52.520007,long:13.404954,timezoneId:"Europe/Berlin",locale:"de-DE"},{title:"London",lat:51.507351,long:-.127758,timezoneId:"Europe/London",locale:"en-GB"},{title:"Moscow",lat:55.755826,long:37.6173,timezoneId:"Europe/Moscow",locale:"ru-RU"},{title:"Mountain View",lat:37.386052,long:-122.083851,timezoneId:"America/Los_Angeles",locale:"en-US"},{title:"Mumbai",lat:19.075984,long:72.877656,timezoneId:"Asia/Kolkata",locale:"mr-IN"},{title:"San Francisco",lat:37.774929,long:-122.419416,timezoneId:"America/Los_Angeles",locale:"en-US"},{title:"Shanghai",lat:31.230416,long:121.473701,timezoneId:"Asia/Shanghai",locale:"zh-Hans-CN"},{title:"Sรฃo Paulo",lat:-23.55052,long:-46.633309,timezoneId:"America/Sao_Paulo",locale:"pt-BR"},{title:"Tokyo",lat:35.689487,long:139.691706,timezoneId:"Asia/Tokyo",locale:"ja-JP"}]}),o.Settings.registerSettingExtension({title:Z(Y.cpuPressure),reloadRequired:!0,settingName:"emulation.cpu-pressure",settingType:"enum",defaultValue:"none",options:[{value:"none",title:Z(Y.noPressureEmulation),text:Z(Y.noPressureEmulation)},{value:"nominal",title:Z(Y.nominal),text:Z(Y.nominal)},{value:"fair",title:Z(Y.fair),text:Z(Y.fair)},{value:"serious",title:Z(Y.serious),text:Z(Y.serious)},{value:"critical",title:Z(Y.critical),text:Z(Y.critical)}]}),o.Settings.registerSettingExtension({title:Z(Y.touch),reloadRequired:!0,settingName:"emulation.touch",settingType:"enum",defaultValue:"none",options:[{value:"none",title:Z(Y.devicebased),text:Z(Y.devicebased)},{value:"force",title:Z(Y.forceEnabled),text:Z(Y.forceEnabled)}]}),o.Settings.registerSettingExtension({title:Z(Y.emulateIdleDetectorState),settingName:"emulation.idle-detection",settingType:"enum",defaultValue:"none",options:[{value:"none",title:Z(Y.noIdleEmulation),text:Z(Y.noIdleEmulation)},{value:'{"isUserActive":true,"isScreenUnlocked":true}',title:Z(Y.userActiveScreenUnlocked),text:Z(Y.userActiveScreenUnlocked)},{value:'{"isUserActive":true,"isScreenUnlocked":false}',title:Z(Y.userActiveScreenLocked),text:Z(Y.userActiveScreenLocked)},{value:'{"isUserActive":false,"isScreenUnlocked":true}',title:Z(Y.userIdleScreenUnlocked),text:Z(Y.userIdleScreenUnlocked)},{value:'{"isUserActive":false,"isScreenUnlocked":false}',title:Z(Y.userIdleScreenLocked),text:Z(Y.userIdleScreenLocked)}]});const ee={accessibility:"Accessibility",shoAccessibility:"Show Accessibility"},te=e.i18n.registerUIStrings("panels/accessibility/accessibility-meta.ts",ee),oe=e.i18n.getLazilyComputedLocalizedString.bind(void 0,te);let ie;t.ViewManager.registerViewExtension({location:"elements-sidebar",id:"accessibility.view",title:oe(ee.accessibility),commandPrompt:oe(ee.shoAccessibility),order:10,persistence:"permanent",loadView:async()=>(await async function(){return J||(J=await import("../../panels/accessibility/accessibility.js")),J}()).AccessibilitySidebarView.AccessibilitySidebarView.instance()});const ne={animations:"Animations",showAnimations:"Show Animations"},ae=e.i18n.registerUIStrings("panels/animation/animation-meta.ts",ne),re=e.i18n.getLazilyComputedLocalizedString.bind(void 0,ae);async function se(){return ie||(ie=await import("../../panels/animation/animation.js")),ie}t.ViewManager.registerViewExtension({location:"drawer-view",id:"animations",title:re(ne.animations),commandPrompt:re(ne.showAnimations),persistence:"closeable",order:0,loadView:async()=>(await se()).AnimationTimeline.AnimationTimeline.instance()}),o.Revealer.registerRevealer({contextTypes:()=>[n.AnimationModel.AnimationGroup],destination:o.Revealer.RevealerDestination.SOURCES_PANEL,loadRevealer:async()=>new((await se()).AnimationTimeline.AnimationGroupRevealer)});const le={developerResources:"Developer resources",showDeveloperResources:"Show Developer resources"},ce=e.i18n.registerUIStrings("panels/developer_resources/developer_resources-meta.ts",le),de=e.i18n.getLazilyComputedLocalizedString.bind(void 0,ce);let ge;async function we(){return ge||(ge=await import("../../panels/developer_resources/developer_resources.js")),ge}t.ViewManager.registerViewExtension({location:"drawer-view",id:"developer-resources",title:de(le.developerResources),commandPrompt:de(le.showDeveloperResources),order:100,persistence:"closeable",loadView:async()=>new((await we()).DeveloperResourcesView.DeveloperResourcesView)}),o.Revealer.registerRevealer({contextTypes:()=>[n.PageResourceLoader.ResourceKey],destination:o.Revealer.RevealerDestination.DEVELOPER_RESOURCES_PANEL,loadRevealer:async()=>new((await we()).DeveloperResourcesView.DeveloperResourcesRevealer)});const me={autofill:"Autofill",showAutofill:"Show Autofill"},pe=e.i18n.registerUIStrings("panels/autofill/autofill-meta.ts",me),ue=e.i18n.getLazilyComputedLocalizedString.bind(void 0,pe);let ye;t.ViewManager.registerViewExtension({location:"drawer-view",id:"autofill-view",title:ue(me.autofill),commandPrompt:ue(me.showAutofill),order:100,persistence:"closeable",async loadView(){const e=await async function(){return ye||(ye=await import("../../panels/autofill/autofill.js")),ye}();return c.LegacyWrapper.legacyWrapper(t.Widget.Widget,new e.AutofillView.AutofillView)}});const he={rendering:"Rendering",showRendering:"Show Rendering",paint:"paint",layout:"layout",fps:"fps",cssMediaType:"CSS media type",cssMediaFeature:"CSS media feature",visionDeficiency:"vision deficiency",colorVisionDeficiency:"color vision deficiency",reloadPage:"Reload page",hardReloadPage:"Hard reload page",forceAdBlocking:"Force ad blocking on this site",blockAds:"Block ads on this site",showAds:"Show ads on this site, if allowed",autoOpenDevTools:"Auto-open DevTools for popups",doNotAutoOpen:"Do not auto-open DevTools for popups",disablePaused:"Disable paused state overlay",toggleCssPrefersColorSchemeMedia:"Toggle CSS media feature prefers-color-scheme"},ve=e.i18n.registerUIStrings("entrypoints/inspector_main/inspector_main-meta.ts",he),Se=e.i18n.getLazilyComputedLocalizedString.bind(void 0,ve);let Re;async function Ee(){return Re||(Re=await import("../inspector_main/inspector_main.js")),Re}t.ViewManager.registerViewExtension({location:"drawer-view",id:"rendering",title:Se(he.rendering),commandPrompt:Se(he.showRendering),persistence:"closeable",order:50,loadView:async()=>new((await Ee()).RenderingOptions.RenderingOptionsView),tags:[Se(he.paint),Se(he.layout),Se(he.fps),Se(he.cssMediaType),Se(he.cssMediaFeature),Se(he.visionDeficiency),Se(he.colorVisionDeficiency)]}),t.ActionRegistration.registerActionExtension({category:"NAVIGATION",actionId:"inspector-main.reload",loadActionDelegate:async()=>new((await Ee()).InspectorMain.ReloadActionDelegate),iconClass:"refresh",title:Se(he.reloadPage),bindings:[{platform:"windows,linux",shortcut:"Ctrl+R"},{platform:"windows,linux",shortcut:"F5"},{platform:"mac",shortcut:"Meta+R"}]}),t.ActionRegistration.registerActionExtension({category:"NAVIGATION",actionId:"inspector-main.hard-reload",loadActionDelegate:async()=>new((await Ee()).InspectorMain.ReloadActionDelegate),title:Se(he.hardReloadPage),bindings:[{platform:"windows,linux",shortcut:"Shift+Ctrl+R"},{platform:"windows,linux",shortcut:"Shift+F5"},{platform:"windows,linux",shortcut:"Ctrl+F5"},{platform:"windows,linux",shortcut:"Ctrl+Shift+F5"},{platform:"mac",shortcut:"Shift+Meta+R"}]}),t.ActionRegistration.registerActionExtension({actionId:"rendering.toggle-prefers-color-scheme",category:"RENDERING",title:Se(he.toggleCssPrefersColorSchemeMedia),loadActionDelegate:async()=>new((await Ee()).RenderingOptions.ReloadActionDelegate)}),o.Settings.registerSettingExtension({category:"",title:Se(he.forceAdBlocking),settingName:"network.ad-blocking-enabled",settingType:"boolean",storageType:"Session",defaultValue:!1,options:[{value:!0,title:Se(he.blockAds)},{value:!1,title:Se(he.showAds)}]}),o.Settings.registerSettingExtension({category:"GLOBAL",storageType:"Synced",title:Se(he.autoOpenDevTools),settingName:"auto-attach-to-created-pages",settingType:"boolean",order:2,defaultValue:!1,options:[{value:!0,title:Se(he.autoOpenDevTools)},{value:!1,title:Se(he.doNotAutoOpen)}]}),o.Settings.registerSettingExtension({category:"APPEARANCE",storageType:"Synced",title:Se(he.disablePaused),settingName:"disable-paused-state-overlay",settingType:"boolean",defaultValue:!1}),t.Toolbar.registerToolbarItem({loadItem:async()=>(await Ee()).InspectorMain.NodeIndicator.instance(),order:2,location:"main-toolbar-left"}),t.Toolbar.registerToolbarItem({loadItem:async()=>(await Ee()).OutermostTargetSelector.OutermostTargetSelector.instance(),order:98,location:"main-toolbar-right"});const Ae={application:"Application",showApplication:"Show Application",pwa:"pwa",clearSiteData:"Clear site data",clearSiteDataIncludingThirdparty:"Clear site data (including third-party cookies)",startRecordingEvents:"Start recording events",stopRecordingEvents:"Stop recording events"},be=e.i18n.registerUIStrings("panels/application/application-meta.ts",Ae),Pe=e.i18n.getLazilyComputedLocalizedString.bind(void 0,be);let fe;async function Te(){return fe||(fe=await import("../../panels/application/application.js")),fe}t.ViewManager.registerViewExtension({location:"panel",id:"resources",title:Pe(Ae.application),commandPrompt:Pe(Ae.showApplication),order:70,loadView:async()=>(await Te()).ResourcesPanel.ResourcesPanel.instance(),tags:[Pe(Ae.pwa)]}),t.ActionRegistration.registerActionExtension({category:"RESOURCES",actionId:"resources.clear",title:Pe(Ae.clearSiteData),loadActionDelegate:async()=>new((await Te()).StorageView.ActionDelegate)}),t.ActionRegistration.registerActionExtension({category:"RESOURCES",actionId:"resources.clear-incl-third-party-cookies",title:Pe(Ae.clearSiteDataIncludingThirdparty),loadActionDelegate:async()=>new((await Te()).StorageView.ActionDelegate)}),t.ActionRegistration.registerActionExtension({actionId:"background-service.toggle-recording",iconClass:"record-start",toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,contextTypes:()=>void 0===fe?[]:(e=>[e.BackgroundServiceView.BackgroundServiceView])(fe),loadActionDelegate:async()=>new((await Te()).BackgroundServiceView.ActionDelegate),category:"BACKGROUND_SERVICES",options:[{value:!0,title:Pe(Ae.startRecordingEvents)},{value:!1,title:Pe(Ae.stopRecordingEvents)}],bindings:[{platform:"windows,linux",shortcut:"Ctrl+E"},{platform:"mac",shortcut:"Meta+E"}]}),o.Revealer.registerRevealer({contextTypes:()=>[n.Resource.Resource],destination:o.Revealer.RevealerDestination.APPLICATION_PANEL,loadRevealer:async()=>new((await Te()).ResourcesPanel.ResourceRevealer)}),o.Revealer.registerRevealer({contextTypes:()=>[n.ResourceTreeModel.ResourceTreeFrame],destination:o.Revealer.RevealerDestination.APPLICATION_PANEL,loadRevealer:async()=>new((await Te()).ResourcesPanel.FrameDetailsRevealer)}),o.Revealer.registerRevealer({contextTypes:()=>[d.PreloadingForward.RuleSetView],destination:o.Revealer.RevealerDestination.APPLICATION_PANEL,loadRevealer:async()=>new((await Te()).ResourcesPanel.RuleSetViewRevealer)}),o.Revealer.registerRevealer({contextTypes:()=>[d.PreloadingForward.AttemptViewWithFilter],destination:o.Revealer.RevealerDestination.APPLICATION_PANEL,loadRevealer:async()=>new((await Te()).ResourcesPanel.AttemptViewWithFilterRevealer)});const ke={issues:"Issues",showIssues:"Show Issues"},De=e.i18n.registerUIStrings("panels/issues/issues-meta.ts",ke),xe=e.i18n.getLazilyComputedLocalizedString.bind(void 0,De);let Le;async function Me(){return Le||(Le=await import("../../panels/issues/issues.js")),Le}t.ViewManager.registerViewExtension({location:"drawer-view",id:"issues-pane",title:xe(ke.issues),commandPrompt:xe(ke.showIssues),order:100,persistence:"closeable",loadView:async()=>new((await Me()).IssuesPane.IssuesPane)}),o.Revealer.registerRevealer({contextTypes:()=>[g.Issue.Issue],destination:o.Revealer.RevealerDestination.ISSUES_VIEW,loadRevealer:async()=>new((await Me()).IssueRevealer.IssueRevealer)});const Ne={layers:"Layers",showLayers:"Show Layers"},Ie=e.i18n.registerUIStrings("panels/layers/layers-meta.ts",Ne),Ce=e.i18n.getLazilyComputedLocalizedString.bind(void 0,Ie);let Ve;t.ViewManager.registerViewExtension({location:"panel",id:"layers",title:Ce(Ne.layers),commandPrompt:Ce(Ne.showLayers),order:100,persistence:"closeable",loadView:async()=>(await async function(){return Ve||(Ve=await import("../../panels/layers/layers.js")),Ve}()).LayersPanel.LayersPanel.instance()});const Oe={showLighthouse:"Show `Lighthouse`"},Be=e.i18n.registerUIStrings("panels/lighthouse/lighthouse-meta.ts",Oe),We=e.i18n.getLazilyComputedLocalizedString.bind(void 0,Be);let Ue;t.ViewManager.registerViewExtension({location:"panel",id:"lighthouse",title:e.i18n.lockedLazyString("Lighthouse"),commandPrompt:We(Oe.showLighthouse),order:90,loadView:async()=>(await async function(){return Ue||(Ue=await import("../../panels/lighthouse/lighthouse.js")),Ue}()).LighthousePanel.LighthousePanel.instance(),tags:[e.i18n.lockedLazyString("lighthouse"),e.i18n.lockedLazyString("pwa")]});const ze={media:"Media",video:"video",showMedia:"Show Media"},_e=e.i18n.registerUIStrings("panels/media/media-meta.ts",ze),je=e.i18n.getLazilyComputedLocalizedString.bind(void 0,_e);let Fe;t.ViewManager.registerViewExtension({location:"panel",id:"medias",title:je(ze.media),commandPrompt:je(ze.showMedia),persistence:"closeable",order:100,loadView:async()=>new((await async function(){return Fe||(Fe=await import("../../panels/media/media.js")),Fe}()).MainView.MainView),tags:[je(ze.media),je(ze.video)]});const He={throttling:"Throttling",showThrottling:"Show Throttling",goOffline:"Go offline",device:"device",throttlingTag:"throttling",enableSlowGThrottling:"Enable slow `3G` throttling",enableFastGThrottling:"Enable fast `3G` throttling",goOnline:"Go online"},qe=e.i18n.registerUIStrings("panels/mobile_throttling/mobile_throttling-meta.ts",He),Ge=e.i18n.getLazilyComputedLocalizedString.bind(void 0,qe);let Ke;async function Ye(){return Ke||(Ke=await import("../../panels/mobile_throttling/mobile_throttling.js")),Ke}t.ViewManager.registerViewExtension({location:"settings-view",id:"throttling-conditions",title:Ge(He.throttling),commandPrompt:Ge(He.showThrottling),order:35,loadView:async()=>new((await Ye()).ThrottlingSettingsTab.ThrottlingSettingsTab),settings:["custom-network-conditions","calibrated-cpu-throttling"],iconName:"performance"}),t.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-offline",category:"NETWORK",title:Ge(He.goOffline),loadActionDelegate:async()=>new((await Ye()).ThrottlingManager.ActionDelegate),tags:[Ge(He.device),Ge(He.throttlingTag)]}),t.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-low-end-mobile",category:"NETWORK",title:Ge(He.enableSlowGThrottling),loadActionDelegate:async()=>new((await Ye()).ThrottlingManager.ActionDelegate),tags:[Ge(He.device),Ge(He.throttlingTag)]}),t.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-mid-tier-mobile",category:"NETWORK",title:Ge(He.enableFastGThrottling),loadActionDelegate:async()=>new((await Ye()).ThrottlingManager.ActionDelegate),tags:[Ge(He.device),Ge(He.throttlingTag)]}),t.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-online",category:"NETWORK",title:Ge(He.goOnline),loadActionDelegate:async()=>new((await Ye()).ThrottlingManager.ActionDelegate),tags:[Ge(He.device),Ge(He.throttlingTag)]}),o.Settings.registerSettingExtension({storageType:"Synced",settingName:"custom-network-conditions",settingType:"array",defaultValue:[]});const Xe={performanceMonitor:"Performance monitor",performance:"performance",systemMonitor:"system monitor",monitor:"monitor",activity:"activity",metrics:"metrics",showPerformanceMonitor:"Show Performance monitor"},Ze=e.i18n.registerUIStrings("panels/performance_monitor/performance_monitor-meta.ts",Xe),Qe=e.i18n.getLazilyComputedLocalizedString.bind(void 0,Ze);let Je;t.ViewManager.registerViewExtension({location:"drawer-view",id:"performance.monitor",title:Qe(Xe.performanceMonitor),commandPrompt:Qe(Xe.showPerformanceMonitor),persistence:"closeable",order:100,loadView:async()=>new((await async function(){return Je||(Je=await import("../../panels/performance_monitor/performance_monitor.js")),Je}()).PerformanceMonitor.PerformanceMonitorImpl),tags:[Qe(Xe.performance),Qe(Xe.systemMonitor),Qe(Xe.monitor),Qe(Xe.activity),Qe(Xe.metrics)]});const $e={performance:"Performance",showPerformance:"Show Performance",record:"Record",stop:"Stop",recordAndReload:"Record and reload",saveProfile:"Save profileโ€ฆ",loadProfile:"Load profileโ€ฆ",previousFrame:"Previous frame",nextFrame:"Next frame",showRecentTimelineSessions:"Show recent timeline sessions",previousRecording:"Previous recording",nextRecording:"Next recording",hideChromeFrameInLayersView:"Hide `chrome` frame in Layers view"},et=e.i18n.registerUIStrings("panels/timeline/timeline-meta.ts",$e),tt=e.i18n.getLazilyComputedLocalizedString.bind(void 0,et);let ot;async function it(){return ot||(ot=await import("../../panels/timeline/timeline.js")),ot}function nt(e){return void 0===ot?[]:e(ot)}t.ViewManager.registerViewExtension({location:"panel",id:"timeline",title:tt($e.performance),commandPrompt:tt($e.showPerformance),order:50,loadView:async()=>(await it()).TimelinePanel.TimelinePanel.instance()}),t.ActionRegistration.registerActionExtension({actionId:"timeline.toggle-recording",category:"PERFORMANCE",iconClass:"record-start",toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,contextTypes:()=>nt((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await it()).TimelinePanel.ActionDelegate),options:[{value:!0,title:tt($e.record)},{value:!1,title:tt($e.stop)}],bindings:[{platform:"windows,linux",shortcut:"Ctrl+E"},{platform:"mac",shortcut:"Meta+E"}]}),t.ActionRegistration.registerActionExtension({actionId:"timeline.record-reload",iconClass:"refresh",contextTypes:()=>nt((e=>[e.TimelinePanel.TimelinePanel])),category:"PERFORMANCE",title:tt($e.recordAndReload),loadActionDelegate:async()=>new((await it()).TimelinePanel.ActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+E"},{platform:"mac",shortcut:"Meta+Shift+E"}],experiment:"!react-native-specific-ui"}),t.ActionRegistration.registerActionExtension({category:"PERFORMANCE",actionId:"timeline.save-to-file",contextTypes:()=>nt((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await it()).TimelinePanel.ActionDelegate),title:tt($e.saveProfile),bindings:[{platform:"windows,linux",shortcut:"Ctrl+S"},{platform:"mac",shortcut:"Meta+S"}]}),t.ActionRegistration.registerActionExtension({category:"PERFORMANCE",actionId:"timeline.load-from-file",contextTypes:()=>nt((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await it()).TimelinePanel.ActionDelegate),title:tt($e.loadProfile),bindings:[{platform:"windows,linux",shortcut:"Ctrl+O"},{platform:"mac",shortcut:"Meta+O"}]}),t.ActionRegistration.registerActionExtension({actionId:"timeline.jump-to-previous-frame",category:"PERFORMANCE",title:tt($e.previousFrame),contextTypes:()=>nt((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await it()).TimelinePanel.ActionDelegate),bindings:[{shortcut:"["}]}),t.ActionRegistration.registerActionExtension({actionId:"timeline.jump-to-next-frame",category:"PERFORMANCE",title:tt($e.nextFrame),contextTypes:()=>nt((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await it()).TimelinePanel.ActionDelegate),bindings:[{shortcut:"]"}]}),t.ActionRegistration.registerActionExtension({actionId:"timeline.show-history",loadActionDelegate:async()=>new((await it()).TimelinePanel.ActionDelegate),category:"PERFORMANCE",title:tt($e.showRecentTimelineSessions),contextTypes:()=>nt((e=>[e.TimelinePanel.TimelinePanel])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+H"},{platform:"mac",shortcut:"Meta+Y"}]}),t.ActionRegistration.registerActionExtension({actionId:"timeline.previous-recording",category:"PERFORMANCE",loadActionDelegate:async()=>new((await it()).TimelinePanel.ActionDelegate),title:tt($e.previousRecording),contextTypes:()=>nt((e=>[e.TimelinePanel.TimelinePanel])),bindings:[{platform:"windows,linux",shortcut:"Alt+Left"},{platform:"mac",shortcut:"Meta+Left"}]}),t.ActionRegistration.registerActionExtension({actionId:"timeline.next-recording",category:"PERFORMANCE",loadActionDelegate:async()=>new((await it()).TimelinePanel.ActionDelegate),title:tt($e.nextRecording),contextTypes:()=>nt((e=>[e.TimelinePanel.TimelinePanel])),bindings:[{platform:"windows,linux",shortcut:"Alt+Right"},{platform:"mac",shortcut:"Meta+Right"}]}),o.Settings.registerSettingExtension({category:"PERFORMANCE",storageType:"Synced",title:tt($e.hideChromeFrameInLayersView),settingName:"frame-viewer-hide-chrome-window",settingType:"boolean",defaultValue:!1}),o.Settings.registerSettingExtension({category:"PERFORMANCE",storageType:"Synced",settingName:"annotations-hidden",settingType:"boolean",defaultValue:!1}),o.Linkifier.registerLinkifier({contextTypes:()=>nt((e=>[e.CLSLinkifier.CLSRect])),loadLinkifier:async()=>(await it()).CLSLinkifier.Linkifier.instance()}),t.ContextMenu.registerItem({location:"timelineMenu/open",actionId:"timeline.load-from-file",order:10}),t.ContextMenu.registerItem({location:"timelineMenu/open",actionId:"timeline.save-to-file",order:15}),o.Revealer.registerRevealer({contextTypes:()=>[n.TraceObject.TraceObject],destination:o.Revealer.RevealerDestination.TIMELINE_PANEL,loadRevealer:async()=>new((await it()).TimelinePanel.TraceRevealer)}),o.Revealer.registerRevealer({contextTypes:()=>[n.TraceObject.RevealableEvent],destination:o.Revealer.RevealerDestination.TIMELINE_PANEL,loadRevealer:async()=>new((await it()).TimelinePanel.EventRevealer)});const at={webaudio:"WebAudio",audio:"audio",showWebaudio:"Show WebAudio"},rt=e.i18n.registerUIStrings("panels/web_audio/web_audio-meta.ts",at),st=e.i18n.getLazilyComputedLocalizedString.bind(void 0,rt);let lt;t.ViewManager.registerViewExtension({location:"drawer-view",id:"web-audio",title:st(at.webaudio),commandPrompt:st(at.showWebaudio),persistence:"closeable",order:100,loadView:async()=>new((await async function(){return lt||(lt=await import("../../panels/web_audio/web_audio.js")),lt}()).WebAudioView.WebAudioView),tags:[st(at.audio)]});const ct={webauthn:"WebAuthn",showWebauthn:"Show WebAuthn"},dt=e.i18n.registerUIStrings("panels/webauthn/webauthn-meta.ts",ct),gt=e.i18n.getLazilyComputedLocalizedString.bind(void 0,dt);let wt;t.ViewManager.registerViewExtension({location:"drawer-view",id:"webauthn-pane",title:gt(ct.webauthn),commandPrompt:gt(ct.showWebauthn),order:100,persistence:"closeable",loadView:async()=>new((await async function(){return wt||(wt=await import("../../panels/webauthn/webauthn.js")),wt}()).WebauthnPane.WebauthnPaneImpl)});const mt={resetView:"Reset view",switchToPanMode:"Switch to pan mode",switchToRotateMode:"Switch to rotate mode",zoomIn:"Zoom in",zoomOut:"Zoom out",panOrRotateUp:"Pan or rotate up",panOrRotateDown:"Pan or rotate down",panOrRotateLeft:"Pan or rotate left",panOrRotateRight:"Pan or rotate right"},pt=e.i18n.registerUIStrings("panels/layer_viewer/layer_viewer-meta.ts",mt),ut=e.i18n.getLazilyComputedLocalizedString.bind(void 0,pt);t.ActionRegistration.registerActionExtension({actionId:"layers.reset-view",category:"LAYERS",title:ut(mt.resetView),bindings:[{shortcut:"0"}]}),t.ActionRegistration.registerActionExtension({actionId:"layers.pan-mode",category:"LAYERS",title:ut(mt.switchToPanMode),bindings:[{shortcut:"x"}]}),t.ActionRegistration.registerActionExtension({actionId:"layers.rotate-mode",category:"LAYERS",title:ut(mt.switchToRotateMode),bindings:[{shortcut:"v"}]}),t.ActionRegistration.registerActionExtension({actionId:"layers.zoom-in",category:"LAYERS",title:ut(mt.zoomIn),bindings:[{shortcut:"Shift+Plus"},{shortcut:"NumpadPlus"}]}),t.ActionRegistration.registerActionExtension({actionId:"layers.zoom-out",category:"LAYERS",title:ut(mt.zoomOut),bindings:[{shortcut:"Shift+Minus"},{shortcut:"NumpadMinus"}]}),t.ActionRegistration.registerActionExtension({actionId:"layers.up",category:"LAYERS",title:ut(mt.panOrRotateUp),bindings:[{shortcut:"Up"},{shortcut:"w"}]}),t.ActionRegistration.registerActionExtension({actionId:"layers.down",category:"LAYERS",title:ut(mt.panOrRotateDown),bindings:[{shortcut:"Down"},{shortcut:"s"}]}),t.ActionRegistration.registerActionExtension({actionId:"layers.left",category:"LAYERS",title:ut(mt.panOrRotateLeft),bindings:[{shortcut:"Left"},{shortcut:"a"}]}),t.ActionRegistration.registerActionExtension({actionId:"layers.right",category:"LAYERS",title:ut(mt.panOrRotateRight),bindings:[{shortcut:"Right"},{shortcut:"d"}]});const yt={recorder:"Recorder",showRecorder:"Show Recorder",startStopRecording:"Start/Stop recording",createRecording:"Create a new recording",replayRecording:"Replay recording",toggleCode:"Toggle code view"},ht=e.i18n.registerUIStrings("panels/recorder/recorder-meta.ts",yt),vt=e.i18n.getLazilyComputedLocalizedString.bind(void 0,ht);let St;async function Rt(){return St||(St=await import("../../panels/recorder/recorder.js")),St}function Et(e,t){return void 0===St?[]:t&&St.RecorderPanel.RecorderPanel.instance().isActionPossible(t)?e(St):[]}const At="chrome-recorder";t.ViewManager.defaultOptionsForTabs[At]=!0,t.ViewManager.registerViewExtension({location:"panel",id:At,commandPrompt:vt(yt.showRecorder),title:vt(yt.recorder),order:90,persistence:"closeable",loadView:async()=>(await Rt()).RecorderPanel.RecorderPanel.instance()}),t.ActionRegistration.registerActionExtension({category:"RECORDER",actionId:"chrome-recorder.create-recording",title:vt(yt.createRecording),loadActionDelegate:async()=>new((await Rt()).RecorderPanel.ActionDelegate)}),t.ActionRegistration.registerActionExtension({category:"RECORDER",actionId:"chrome-recorder.start-recording",title:vt(yt.startStopRecording),contextTypes:()=>Et((e=>[e.RecorderPanel.RecorderPanel]),"chrome-recorder.start-recording"),loadActionDelegate:async()=>new((await Rt()).RecorderPanel.ActionDelegate),bindings:[{shortcut:"Ctrl+E",platform:"windows,linux"},{shortcut:"Meta+E",platform:"mac"}]}),t.ActionRegistration.registerActionExtension({category:"RECORDER",actionId:"chrome-recorder.replay-recording",title:vt(yt.replayRecording),contextTypes:()=>Et((e=>[e.RecorderPanel.RecorderPanel]),"chrome-recorder.replay-recording"),loadActionDelegate:async()=>new((await Rt()).RecorderPanel.ActionDelegate),bindings:[{shortcut:"Ctrl+Enter",platform:"windows,linux"},{shortcut:"Meta+Enter",platform:"mac"}]}),t.ActionRegistration.registerActionExtension({category:"RECORDER",actionId:"chrome-recorder.toggle-code-view",title:vt(yt.toggleCode),contextTypes:()=>Et((e=>[e.RecorderPanel.RecorderPanel]),"chrome-recorder.toggle-code-view"),loadActionDelegate:async()=>new((await Rt()).RecorderPanel.ActionDelegate),bindings:[{shortcut:"Ctrl+B",platform:"windows,linux"},{shortcut:"Meta+B",platform:"mac"}]});const bt={whatsNew:"What's new",showWhatsNew:"Show what's new",releaseNotes:"Release notes",reportADevtoolsIssue:"Report a DevTools issue",bug:"bug",showWhatsNewAfterEachUpdate:"Show what's new after each update",doNotShowWhatsNewAfterEachUpdate:"Don't show what's new after each update"},Pt=e.i18n.registerUIStrings("panels/whats_new/whats_new-meta.ts",bt),ft=e.i18n.getLazilyComputedLocalizedString.bind(void 0,Pt);let Tt;async function kt(){return Tt||(Tt=await import("../../panels/whats_new/whats_new.js")),Tt}t.ViewManager.maybeRemoveViewExtension("release-note"),t.ActionRegistration.maybeRemoveActionExtension("help.release-notes"),t.ActionRegistration.maybeRemoveActionExtension("help.report-issue"),o.Settings.maybeRemoveSettingExtension("help.show-release-note"),t.ContextMenu.maybeRemoveItem({location:"mainMenuHelp/default",actionId:"help.release-notes",order:void 0}),t.ContextMenu.maybeRemoveItem({location:"mainMenuHelp/default",actionId:"help.report-issue",order:void 0}),o.Runnable.maybeRemoveLateInitializationRunnable("whats-new"),t.ViewManager.registerViewExtension({location:"drawer-view",id:"release-note",title:ft(bt.whatsNew),commandPrompt:ft(bt.showWhatsNew),persistence:"closeable",order:1,loadView:async()=>new((await kt()).ReleaseNoteView.ReleaseNoteView)}),t.ActionRegistration.registerActionExtension({category:"HELP",actionId:"help.release-notes",title:ft(bt.releaseNotes),loadActionDelegate:async()=>(await kt()).WhatsNew.ReleaseNotesActionDelegate.instance()}),t.ActionRegistration.registerActionExtension({category:"HELP",actionId:"help.report-issue",title:ft(bt.reportADevtoolsIssue),loadActionDelegate:async()=>(await kt()).WhatsNew.ReportIssueActionDelegate.instance(),tags:[ft(bt.bug)]}),o.Settings.registerSettingExtension({category:"APPEARANCE",title:ft(bt.showWhatsNewAfterEachUpdate),settingName:"help.show-release-note",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:ft(bt.showWhatsNewAfterEachUpdate)},{value:!1,title:ft(bt.doNotShowWhatsNewAfterEachUpdate)}]}),t.ContextMenu.registerItem({location:"mainMenuHelp/default",actionId:"help.release-notes",order:10}),t.ContextMenu.registerItem({location:"mainMenuHelp/default",actionId:"help.report-issue",order:11}),o.Runnable.registerLateInitializationRunnable({id:"whats-new",loadRunnable:async()=>(await kt()).WhatsNew.HelpLateInitialization.instance()}),self.runtime=i.Runtime.Runtime.instance({forceNew:!0}),new w.MainImpl.MainImpl; +import"../shell/shell.js";import*as e from"../../core/i18n/i18n.js";import*as t from"../../ui/legacy/legacy.js";import*as i from"../../core/common/common.js";import*as o from"../../core/root/root.js";import*as n from"../../core/sdk/sdk.js";import*as a from"../../models/extensions/extensions.js";import*as r from"../../models/workspace/workspace.js";import*as s from"../../panels/network/forward/forward.js";import*as l from"../../panels/security/security.js";import*as c from"../../ui/components/legacy_wrapper/legacy_wrapper.js";import*as d from"../../panels/application/preloading/helper/helper.js";import*as g from"../../models/issues_manager/issues_manager.js";import*as w from"../main/main.js";const m={cssOverview:"CSS overview",showCssOverview:"Show CSS overview"},p=e.i18n.registerUIStrings("panels/css_overview/css_overview-meta.ts",m),u=e.i18n.getLazilyComputedLocalizedString.bind(void 0,p);let y;t.ViewManager.registerViewExtension({location:"panel",id:"cssoverview",commandPrompt:u(m.showCssOverview),title:u(m.cssOverview),order:95,persistence:"closeable",async loadView(){const e=await async function(){return y||(y=await import("../../panels/css_overview/css_overview.js")),y}();return new e.CSSOverviewPanel.CSSOverviewPanel(new e.CSSOverviewController.OverviewController)},isPreviewFeature:!0});const h={showElements:"Show Elements",elements:"Elements",showEventListeners:"Show Event Listeners",eventListeners:"Event Listeners",showProperties:"Show Properties",properties:"Properties",showStackTrace:"Show Stack Trace",stackTrace:"Stack Trace",showLayout:"Show Layout",layout:"Layout",hideElement:"Hide element",editAsHtml:"Edit as HTML",duplicateElement:"Duplicate element",undo:"Undo",redo:"Redo",captureAreaScreenshot:"Capture area screenshot",selectAnElementInThePageTo:"Select an element in the page to inspect it",newStyleRule:"New Style Rule",refreshEventListeners:"Refresh event listeners",wordWrap:"Word wrap",enableDomWordWrap:"Enable `DOM` word wrap",disableDomWordWrap:"Disable `DOM` word wrap",showHtmlComments:"Show `HTML` comments",hideHtmlComments:"Hide `HTML` comments",revealDomNodeOnHover:"Reveal `DOM` node on hover",showDetailedInspectTooltip:"Show detailed inspect tooltip",showCSSDocumentationTooltip:"Show CSS documentation tooltip",copyStyles:"Copy styles",showUserAgentShadowDOM:"Show user agent shadow `DOM`",showComputedStyles:"Show Computed Styles",showStyles:"Show Styles",toggleEyeDropper:"Toggle eye dropper"},v=e.i18n.registerUIStrings("panels/elements/elements-meta.ts",h),S=e.i18n.getLazilyComputedLocalizedString.bind(void 0,v);let R,E;async function A(){return R||(R=await import("../../panels/elements/elements.js")),R}function b(e){return void 0===R?[]:e(R)}t.ViewManager.registerViewExtension({location:"panel",id:"elements",commandPrompt:S(h.showElements),title:S(h.elements),order:10,persistence:"permanent",hasToolbar:!1,loadView:async()=>(await A()).ElementsPanel.ElementsPanel.instance()}),t.ActionRegistration.registerActionExtension({actionId:"elements.show-styles",category:"ELEMENTS",title:S(h.showStyles),loadActionDelegate:async()=>new((await A()).ElementsPanel.ElementsActionDelegate)}),t.ActionRegistration.registerActionExtension({actionId:"elements.show-computed",category:"ELEMENTS",title:S(h.showComputedStyles),loadActionDelegate:async()=>new((await A()).ElementsPanel.ElementsActionDelegate)}),t.ViewManager.registerViewExtension({location:"elements-sidebar",id:"elements.event-listeners",commandPrompt:S(h.showEventListeners),title:S(h.eventListeners),order:5,hasToolbar:!0,persistence:"permanent",loadView:async()=>(await A()).EventListenersWidget.EventListenersWidget.instance()}),t.ViewManager.registerViewExtension({location:"elements-sidebar",id:"elements.dom-properties",commandPrompt:S(h.showProperties),title:S(h.properties),order:7,persistence:"permanent",loadView:async()=>new((await A()).PropertiesWidget.PropertiesWidget)}),t.ViewManager.registerViewExtension({experiment:"capture-node-creation-stacks",location:"elements-sidebar",id:"elements.dom-creation",commandPrompt:S(h.showStackTrace),title:S(h.stackTrace),order:10,persistence:"permanent",loadView:async()=>new((await A()).NodeStackTraceWidget.NodeStackTraceWidget)}),t.ViewManager.registerViewExtension({location:"elements-sidebar",id:"elements.layout",commandPrompt:S(h.showLayout),title:S(h.layout),order:4,persistence:"permanent",loadView:async()=>(await async function(){return E||(E=await import("../../panels/elements/components/components.js")),E}()).LayoutPane.LayoutPane.instance().wrapper}),t.ActionRegistration.registerActionExtension({actionId:"elements.hide-element",category:"ELEMENTS",title:S(h.hideElement),loadActionDelegate:async()=>new((await A()).ElementsPanel.ElementsActionDelegate),contextTypes:()=>b((e=>[e.ElementsPanel.ElementsPanel])),bindings:[{shortcut:"H"}]}),t.ActionRegistration.registerActionExtension({actionId:"elements.toggle-eye-dropper",category:"ELEMENTS",title:S(h.toggleEyeDropper),loadActionDelegate:async()=>new((await A()).ElementsPanel.ElementsActionDelegate),contextTypes:()=>b((e=>[e.ColorSwatchPopoverIcon.ColorSwatchPopoverIcon])),bindings:[{shortcut:"c"}]}),t.ActionRegistration.registerActionExtension({actionId:"elements.edit-as-html",category:"ELEMENTS",title:S(h.editAsHtml),loadActionDelegate:async()=>new((await A()).ElementsPanel.ElementsActionDelegate),contextTypes:()=>b((e=>[e.ElementsPanel.ElementsPanel])),bindings:[{shortcut:"F2"}]}),t.ActionRegistration.registerActionExtension({actionId:"elements.duplicate-element",category:"ELEMENTS",title:S(h.duplicateElement),loadActionDelegate:async()=>new((await A()).ElementsPanel.ElementsActionDelegate),contextTypes:()=>b((e=>[e.ElementsPanel.ElementsPanel])),bindings:[{shortcut:"Shift+Alt+Down"}]}),t.ActionRegistration.registerActionExtension({actionId:"elements.copy-styles",category:"ELEMENTS",title:S(h.copyStyles),loadActionDelegate:async()=>new((await A()).ElementsPanel.ElementsActionDelegate),contextTypes:()=>b((e=>[e.ElementsPanel.ElementsPanel])),bindings:[{shortcut:"Ctrl+Alt+C",platform:"windows,linux"},{shortcut:"Meta+Alt+C",platform:"mac"}]}),t.ActionRegistration.registerActionExtension({actionId:"elements.undo",category:"ELEMENTS",title:S(h.undo),loadActionDelegate:async()=>new((await A()).ElementsPanel.ElementsActionDelegate),contextTypes:()=>b((e=>[e.ElementsPanel.ElementsPanel])),bindings:[{shortcut:"Ctrl+Z",platform:"windows,linux"},{shortcut:"Meta+Z",platform:"mac"}]}),t.ActionRegistration.registerActionExtension({actionId:"elements.redo",category:"ELEMENTS",title:S(h.redo),loadActionDelegate:async()=>new((await A()).ElementsPanel.ElementsActionDelegate),contextTypes:()=>b((e=>[e.ElementsPanel.ElementsPanel])),bindings:[{shortcut:"Ctrl+Y",platform:"windows,linux"},{shortcut:"Meta+Shift+Z",platform:"mac"}]}),t.ActionRegistration.registerActionExtension({actionId:"elements.capture-area-screenshot",loadActionDelegate:async()=>new((await A()).InspectElementModeController.ToggleSearchActionDelegate),condition:o.Runtime.conditions.canDock,title:S(h.captureAreaScreenshot),category:"SCREENSHOT"}),t.ActionRegistration.registerActionExtension({category:"ELEMENTS",actionId:"elements.toggle-element-search",toggleable:!0,loadActionDelegate:async()=>new((await A()).InspectElementModeController.ToggleSearchActionDelegate),title:S(h.selectAnElementInThePageTo),iconClass:"select-element",bindings:[{shortcut:"Ctrl+Shift+C",platform:"windows,linux"},{shortcut:"Meta+Shift+C",platform:"mac"}]}),t.ActionRegistration.registerActionExtension({category:"ELEMENTS",actionId:"elements.new-style-rule",title:S(h.newStyleRule),iconClass:"plus",loadActionDelegate:async()=>new((await A()).StylesSidebarPane.ActionDelegate),contextTypes:()=>b((e=>[e.StylesSidebarPane.StylesSidebarPane]))}),t.ActionRegistration.registerActionExtension({category:"ELEMENTS",actionId:"elements.refresh-event-listeners",title:S(h.refreshEventListeners),iconClass:"refresh",loadActionDelegate:async()=>new((await A()).EventListenersWidget.ActionDelegate),contextTypes:()=>b((e=>[e.EventListenersWidget.EventListenersWidget]))}),i.Settings.registerSettingExtension({category:"ELEMENTS",storageType:"Synced",order:1,title:S(h.showUserAgentShadowDOM),settingName:"show-ua-shadow-dom",settingType:"boolean",defaultValue:!1}),i.Settings.registerSettingExtension({category:"ELEMENTS",storageType:"Synced",order:2,title:S(h.wordWrap),settingName:"dom-word-wrap",settingType:"boolean",options:[{value:!0,title:S(h.enableDomWordWrap)},{value:!1,title:S(h.disableDomWordWrap)}],defaultValue:!0}),i.Settings.registerSettingExtension({category:"ELEMENTS",storageType:"Synced",order:3,title:S(h.showHtmlComments),settingName:"show-html-comments",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:S(h.showHtmlComments)},{value:!1,title:S(h.hideHtmlComments)}]}),i.Settings.registerSettingExtension({category:"ELEMENTS",storageType:"Synced",order:4,title:S(h.revealDomNodeOnHover),settingName:"highlight-node-on-hover-in-overlay",settingType:"boolean",defaultValue:!0}),i.Settings.registerSettingExtension({category:"ELEMENTS",storageType:"Synced",order:5,title:S(h.showDetailedInspectTooltip),settingName:"show-detailed-inspect-tooltip",settingType:"boolean",defaultValue:!0}),i.Settings.registerSettingExtension({settingName:"show-event-listeners-for-ancestors",settingType:"boolean",defaultValue:!0}),i.Settings.registerSettingExtension({category:"ADORNER",storageType:"Synced",settingName:"adorner-settings",settingType:"array",defaultValue:[]}),i.Settings.registerSettingExtension({category:"ELEMENTS",storageType:"Synced",title:S(h.showCSSDocumentationTooltip),settingName:"show-css-property-documentation-on-hover",settingType:"boolean",defaultValue:!0}),t.ContextMenu.registerProvider({contextTypes:()=>[n.RemoteObject.RemoteObject,n.DOMModel.DOMNode,n.DOMModel.DeferredDOMNode],loadProvider:async()=>new((await A()).ElementsPanel.ContextMenuProvider),experiment:void 0}),t.ViewManager.registerLocationResolver({name:"elements-sidebar",category:"ELEMENTS",loadResolver:async()=>(await A()).ElementsPanel.ElementsPanel.instance()}),i.Revealer.registerRevealer({contextTypes:()=>[n.DOMModel.DOMNode,n.DOMModel.DeferredDOMNode,n.RemoteObject.RemoteObject],destination:i.Revealer.RevealerDestination.ELEMENTS_PANEL,loadRevealer:async()=>new((await A()).ElementsPanel.DOMNodeRevealer)}),i.Revealer.registerRevealer({contextTypes:()=>[n.CSSProperty.CSSProperty],destination:i.Revealer.RevealerDestination.STYLES_SIDEBAR,loadRevealer:async()=>new((await A()).ElementsPanel.CSSPropertyRevealer)}),t.Toolbar.registerToolbarItem({loadItem:async()=>(await A()).LayersWidget.ButtonProvider.instance(),order:1,location:"styles-sidebarpane-toolbar"}),t.Toolbar.registerToolbarItem({loadItem:async()=>(await A()).ElementStatePaneWidget.ButtonProvider.instance(),order:2,location:"styles-sidebarpane-toolbar"}),t.Toolbar.registerToolbarItem({loadItem:async()=>(await A()).ClassesPaneWidget.ButtonProvider.instance(),order:3,location:"styles-sidebarpane-toolbar"}),t.Toolbar.registerToolbarItem({loadItem:async()=>(await A()).StylesSidebarPane.ButtonProvider.instance(),order:100,location:"styles-sidebarpane-toolbar"}),t.Toolbar.registerToolbarItem({actionId:"elements.toggle-element-search",location:"main-toolbar-left",order:0}),t.UIUtils.registerRenderer({contextTypes:()=>[n.DOMModel.DOMNode,n.DOMModel.DeferredDOMNode],loadRenderer:async()=>(await A()).ElementsTreeOutline.Renderer.instance()}),i.Linkifier.registerLinkifier({contextTypes:()=>[n.DOMModel.DOMNode,n.DOMModel.DeferredDOMNode],loadLinkifier:async()=>(await A()).DOMLinkifier.Linkifier.instance()});const P={showEventListenerBreakpoints:"Show Event Listener Breakpoints",eventListenerBreakpoints:"Event Listener Breakpoints",showCspViolationBreakpoints:"Show CSP Violation Breakpoints",cspViolationBreakpoints:"CSP Violation Breakpoints",showXhrfetchBreakpoints:"Show XHR/fetch Breakpoints",xhrfetchBreakpoints:"XHR/fetch Breakpoints",showDomBreakpoints:"Show DOM Breakpoints",domBreakpoints:"DOM Breakpoints",showGlobalListeners:"Show Global Listeners",globalListeners:"Global Listeners",page:"Page",showPage:"Show Page",overrides:"Overrides",showOverrides:"Show Overrides",contentScripts:"Content scripts",showContentScripts:"Show Content scripts",refreshGlobalListeners:"Refresh global listeners"},f=e.i18n.registerUIStrings("panels/browser_debugger/browser_debugger-meta.ts",P),T=e.i18n.getLazilyComputedLocalizedString.bind(void 0,f);let k,x;async function D(){return k||(k=await import("../../panels/browser_debugger/browser_debugger.js")),k}async function L(){return x||(x=await import("../../panels/sources/sources.js")),x}t.ViewManager.registerViewExtension({loadView:async()=>(await D()).EventListenerBreakpointsSidebarPane.EventListenerBreakpointsSidebarPane.instance(),id:"sources.event-listener-breakpoints",location:"sources.sidebar-bottom",commandPrompt:T(P.showEventListenerBreakpoints),title:T(P.eventListenerBreakpoints),order:9,persistence:"permanent"}),t.ViewManager.registerViewExtension({loadView:async()=>new((await D()).CSPViolationBreakpointsSidebarPane.CSPViolationBreakpointsSidebarPane),id:"sources.csp-violation-breakpoints",location:"sources.sidebar-bottom",commandPrompt:T(P.showCspViolationBreakpoints),title:T(P.cspViolationBreakpoints),order:10,persistence:"permanent"}),t.ViewManager.registerViewExtension({loadView:async()=>(await D()).XHRBreakpointsSidebarPane.XHRBreakpointsSidebarPane.instance(),id:"sources.xhr-breakpoints",location:"sources.sidebar-bottom",commandPrompt:T(P.showXhrfetchBreakpoints),title:T(P.xhrfetchBreakpoints),order:5,persistence:"permanent",hasToolbar:!0}),t.ViewManager.registerViewExtension({loadView:async()=>(await D()).DOMBreakpointsSidebarPane.DOMBreakpointsSidebarPane.instance(),id:"sources.dom-breakpoints",location:"sources.sidebar-bottom",commandPrompt:T(P.showDomBreakpoints),title:T(P.domBreakpoints),order:7,persistence:"permanent"}),t.ViewManager.registerViewExtension({loadView:async()=>new((await D()).ObjectEventListenersSidebarPane.ObjectEventListenersSidebarPane),id:"sources.global-listeners",location:"sources.sidebar-bottom",commandPrompt:T(P.showGlobalListeners),title:T(P.globalListeners),order:8,persistence:"permanent",hasToolbar:!0}),t.ViewManager.registerViewExtension({loadView:async()=>(await D()).DOMBreakpointsSidebarPane.DOMBreakpointsSidebarPane.instance(),id:"elements.dom-breakpoints",location:"elements-sidebar",commandPrompt:T(P.showDomBreakpoints),title:T(P.domBreakpoints),order:6,persistence:"permanent"}),t.ViewManager.registerViewExtension({location:"navigator-view",id:"navigator-network",title:T(P.page),commandPrompt:T(P.showPage),order:2,persistence:"permanent",loadView:async()=>(await L()).SourcesNavigator.NetworkNavigatorView.instance()}),t.ViewManager.registerViewExtension({location:"navigator-view",id:"navigator-overrides",title:T(P.overrides),commandPrompt:T(P.showOverrides),order:4,persistence:"permanent",loadView:async()=>(await L()).SourcesNavigator.OverridesNavigatorView.instance()}),t.ViewManager.registerViewExtension({location:"navigator-view",id:"navigator-content-scripts",title:T(P.contentScripts),commandPrompt:T(P.showContentScripts),order:5,persistence:"permanent",condition:()=>"/bundled/worker_app.html"!==o.Runtime.getPathName(),loadView:async()=>new((await L()).SourcesNavigator.ContentScriptsNavigatorView)}),t.ActionRegistration.registerActionExtension({category:"DEBUGGER",actionId:"browser-debugger.refresh-global-event-listeners",loadActionDelegate:async()=>new((await D()).ObjectEventListenersSidebarPane.ActionDelegate),title:T(P.refreshGlobalListeners),iconClass:"refresh",contextTypes:()=>void 0===k?[]:(e=>[e.ObjectEventListenersSidebarPane.ObjectEventListenersSidebarPane])(k)}),t.ContextMenu.registerProvider({contextTypes:()=>[n.DOMModel.DOMNode],loadProvider:async()=>new((await D()).DOMBreakpointsSidebarPane.ContextMenuProvider),experiment:void 0}),t.Context.registerListener({contextTypes:()=>[n.DebuggerModel.DebuggerPausedDetails],loadListener:async()=>(await D()).XHRBreakpointsSidebarPane.XHRBreakpointsSidebarPane.instance()}),t.Context.registerListener({contextTypes:()=>[n.DebuggerModel.DebuggerPausedDetails],loadListener:async()=>(await D()).DOMBreakpointsSidebarPane.DOMBreakpointsSidebarPane.instance()});const M={showNetwork:"Show Network",network:"Network",networkExpoUnstable:"Expo Network",showNetworkRequestBlocking:"Show Network request blocking",networkRequestBlocking:"Network request blocking",showNetworkConditions:"Show Network conditions",networkConditions:"Network conditions",diskCache:"disk cache",networkThrottling:"network throttling",showSearch:"Show Search",search:"Search",recordNetworkLog:"Record network log",stopRecordingNetworkLog:"Stop recording network log",hideRequestDetails:"Hide request details",colorcodeResourceTypes:"Color-code resource types",colorCode:"color code",resourceType:"resource type",colorCodeByResourceType:"Color code by resource type",useDefaultColors:"Use default colors",groupNetworkLogByFrame:"Group network log by frame",netWork:"network",frame:"frame",group:"group",groupNetworkLogItemsByFrame:"Group network log items by frame",dontGroupNetworkLogItemsByFrame:"Don't group network log items by frame",clear:"Clear network log",addNetworkRequestBlockingPattern:"Add network request blocking pattern",removeAllNetworkRequestBlockingPatterns:"Remove all network request blocking patterns",allowToGenerateHarWithSensitiveData:"Allow to generate `HAR` with sensitive data",dontAllowToGenerateHarWithSensitiveData:"Don't allow to generate `HAR` with sensitive data",allowToGenerateHarWithSensitiveDataDocumentation:"By default generated HAR logs are sanitized and don't include `Cookie`, `Set-Cookie`, or `Authorization` HTTP headers. When this setting is enabled, options to export/copy HAR with sensitive data are provided."},N=e.i18n.registerUIStrings("panels/network/network-meta.ts",M),I=e.i18n.getLazilyComputedLocalizedString.bind(void 0,N),C=e.i18n.getLocalizedString.bind(void 0,N);let V;async function O(){return V||(V=await import("../../panels/network/network.js")),V}function B(e){return void 0===V?[]:e(V)}t.ViewManager.registerViewExtension({location:"panel",id:"network",commandPrompt:I(M.showNetwork),title:()=>o.Runtime.conditions.reactNativeExpoNetworkPanel()?C(M.networkExpoUnstable):C(M.network),order:40,loadView:async()=>(await O()).NetworkPanel.NetworkPanel.instance()}),t.ViewManager.registerViewExtension({location:"drawer-view",id:"network.blocked-urls",commandPrompt:I(M.showNetworkRequestBlocking),title:I(M.networkRequestBlocking),persistence:"closeable",order:60,loadView:async()=>new((await O()).BlockedURLsPane.BlockedURLsPane)}),t.ViewManager.registerViewExtension({location:"drawer-view",id:"network.config",commandPrompt:I(M.showNetworkConditions),title:I(M.networkConditions),persistence:"closeable",order:40,tags:[I(M.diskCache),I(M.networkThrottling),e.i18n.lockedLazyString("useragent"),e.i18n.lockedLazyString("user agent"),e.i18n.lockedLazyString("user-agent")],loadView:async()=>(await O()).NetworkConfigView.NetworkConfigView.instance()}),t.ViewManager.registerViewExtension({location:"network-sidebar",id:"network.search-network-tab",commandPrompt:I(M.showSearch),title:I(M.search),persistence:"permanent",loadView:async()=>(await O()).NetworkPanel.SearchNetworkView.instance()}),t.ActionRegistration.registerActionExtension({actionId:"network.toggle-recording",category:"NETWORK",iconClass:"record-start",toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,contextTypes:()=>B((e=>[e.NetworkPanel.NetworkPanel])),loadActionDelegate:async()=>new((await O()).NetworkPanel.ActionDelegate),options:[{value:!0,title:I(M.recordNetworkLog)},{value:!1,title:I(M.stopRecordingNetworkLog)}],bindings:[{shortcut:"Ctrl+E",platform:"windows,linux"},{shortcut:"Meta+E",platform:"mac"}]}),t.ActionRegistration.registerActionExtension({actionId:"network.clear",category:"NETWORK",title:I(M.clear),iconClass:"clear",loadActionDelegate:async()=>new((await O()).NetworkPanel.ActionDelegate),contextTypes:()=>B((e=>[e.NetworkPanel.NetworkPanel])),bindings:[{shortcut:"Ctrl+L"},{shortcut:"Meta+K",platform:"mac"}]}),t.ActionRegistration.registerActionExtension({actionId:"network.hide-request-details",category:"NETWORK",title:I(M.hideRequestDetails),contextTypes:()=>B((e=>[e.NetworkPanel.NetworkPanel])),loadActionDelegate:async()=>new((await O()).NetworkPanel.ActionDelegate),bindings:[{shortcut:"Esc"}]}),t.ActionRegistration.registerActionExtension({actionId:"network.search",category:"NETWORK",title:I(M.search),contextTypes:()=>B((e=>[e.NetworkPanel.NetworkPanel])),loadActionDelegate:async()=>new((await O()).NetworkPanel.ActionDelegate),bindings:[{platform:"mac",shortcut:"Meta+F",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+F",keybindSets:["devToolsDefault","vsCode"]}]}),t.ActionRegistration.registerActionExtension({actionId:"network.add-network-request-blocking-pattern",category:"NETWORK",title:I(M.addNetworkRequestBlockingPattern),iconClass:"plus",contextTypes:()=>B((e=>[e.BlockedURLsPane.BlockedURLsPane])),loadActionDelegate:async()=>new((await O()).BlockedURLsPane.ActionDelegate)}),t.ActionRegistration.registerActionExtension({actionId:"network.remove-all-network-request-blocking-patterns",category:"NETWORK",title:I(M.removeAllNetworkRequestBlockingPatterns),iconClass:"clear",contextTypes:()=>B((e=>[e.BlockedURLsPane.BlockedURLsPane])),loadActionDelegate:async()=>new((await O()).BlockedURLsPane.ActionDelegate)}),i.Settings.registerSettingExtension({category:"NETWORK",storageType:"Synced",title:I(M.allowToGenerateHarWithSensitiveData),settingName:"network.show-options-to-generate-har-with-sensitive-data",settingType:"boolean",defaultValue:!1,tags:[e.i18n.lockedLazyString("HAR")],options:[{value:!0,title:I(M.allowToGenerateHarWithSensitiveData)},{value:!1,title:I(M.dontAllowToGenerateHarWithSensitiveData)}],learnMore:{url:"https://goo.gle/devtools-export-hars",tooltip:I(M.allowToGenerateHarWithSensitiveDataDocumentation)}}),i.Settings.registerSettingExtension({category:"NETWORK",storageType:"Synced",title:I(M.colorcodeResourceTypes),settingName:"network-color-code-resource-types",settingType:"boolean",defaultValue:!1,tags:[I(M.colorCode),I(M.resourceType)],options:[{value:!0,title:I(M.colorCodeByResourceType)},{value:!1,title:I(M.useDefaultColors)}]}),i.Settings.registerSettingExtension({category:"NETWORK",storageType:"Synced",title:I(M.groupNetworkLogByFrame),settingName:"network.group-by-frame",settingType:"boolean",defaultValue:!1,tags:[I(M.netWork),I(M.frame),I(M.group)],options:[{value:!0,title:I(M.groupNetworkLogItemsByFrame)},{value:!1,title:I(M.dontGroupNetworkLogItemsByFrame)}]}),t.ViewManager.registerLocationResolver({name:"network-sidebar",category:"NETWORK",loadResolver:async()=>(await O()).NetworkPanel.NetworkPanel.instance()}),t.ContextMenu.registerProvider({contextTypes:()=>[n.NetworkRequest.NetworkRequest,n.Resource.Resource,r.UISourceCode.UISourceCode,n.TraceObject.RevealableNetworkRequest],loadProvider:async()=>(await O()).NetworkPanel.NetworkPanel.instance(),experiment:void 0}),i.Revealer.registerRevealer({contextTypes:()=>[n.NetworkRequest.NetworkRequest],destination:i.Revealer.RevealerDestination.NETWORK_PANEL,loadRevealer:async()=>new((await O()).NetworkPanel.RequestRevealer)}),i.Revealer.registerRevealer({contextTypes:()=>[s.UIRequestLocation.UIRequestLocation],destination:void 0,loadRevealer:async()=>new((await O()).NetworkPanel.RequestLocationRevealer)}),i.Revealer.registerRevealer({contextTypes:()=>[s.NetworkRequestId.NetworkRequestId],destination:i.Revealer.RevealerDestination.NETWORK_PANEL,loadRevealer:async()=>new((await O()).NetworkPanel.RequestIdRevealer)}),i.Revealer.registerRevealer({contextTypes:()=>[s.UIFilter.UIRequestFilter,a.ExtensionServer.RevealableNetworkRequestFilter],destination:i.Revealer.RevealerDestination.NETWORK_PANEL,loadRevealer:async()=>new((await O()).NetworkPanel.NetworkLogWithFilterRevealer)});const W={security:"Security",PrivacyAndSecurity:"Privacy and security",showSecurity:"Show Security",showPrivacyAndSecurity:"Show Privacy and security"},U=e.i18n.registerUIStrings("panels/security/security-meta.ts",W),z=e.i18n.getLazilyComputedLocalizedString.bind(void 0,U);let _;async function j(){return _||(_=await import("../../panels/security/security.js")),_}t.ViewManager.registerViewExtension({location:"panel",id:"security",title:()=>o.Runtime.hostConfig.devToolsPrivacyUI?.enabled?z(W.PrivacyAndSecurity)():z(W.security)(),commandPrompt:()=>o.Runtime.hostConfig.devToolsPrivacyUI?.enabled?z(W.showPrivacyAndSecurity)():z(W.showSecurity)(),order:80,persistence:"closeable",loadView:async()=>(await j()).SecurityPanel.SecurityPanel.instance()}),i.Revealer.registerRevealer({contextTypes:()=>[l.CookieReportView.CookieReportView],destination:i.Revealer.RevealerDestination.SECURITY_PANEL,loadRevealer:async()=>new((await j()).SecurityPanel.SecurityRevealer)});const F={toggleDeviceToolbar:"Toggle device toolbar",captureScreenshot:"Capture screenshot",captureFullSizeScreenshot:"Capture full size screenshot",captureNodeScreenshot:"Capture node screenshot",showMediaQueries:"Show media queries",device:"device",hideMediaQueries:"Hide media queries",showRulers:"Show rulers in the Device Mode toolbar",hideRulers:"Hide rulers in the Device Mode toolbar",showDeviceFrame:"Show device frame",hideDeviceFrame:"Hide device frame"},H=e.i18n.registerUIStrings("panels/emulation/emulation-meta.ts",F),q=e.i18n.getLazilyComputedLocalizedString.bind(void 0,H);let G;async function K(){return G||(G=await import("../../panels/emulation/emulation.js")),G}t.ActionRegistration.registerActionExtension({category:"MOBILE",experiment:"!react-native-specific-ui",actionId:"emulation.toggle-device-mode",toggleable:!0,loadActionDelegate:async()=>new((await K()).DeviceModeWrapper.ActionDelegate),condition:o.Runtime.conditions.canDock,title:q(F.toggleDeviceToolbar),iconClass:"devices",bindings:[{platform:"windows,linux",shortcut:"Shift+Ctrl+M"},{platform:"mac",shortcut:"Shift+Meta+M"}]}),t.ActionRegistration.registerActionExtension({actionId:"emulation.capture-screenshot",category:"SCREENSHOT",loadActionDelegate:async()=>new((await K()).DeviceModeWrapper.ActionDelegate),title:q(F.captureScreenshot)}),t.ActionRegistration.registerActionExtension({actionId:"emulation.capture-full-height-screenshot",category:"SCREENSHOT",experiment:"!react-native-specific-ui",loadActionDelegate:async()=>new((await K()).DeviceModeWrapper.ActionDelegate),condition:o.Runtime.conditions.canDock,title:q(F.captureFullSizeScreenshot)}),t.ActionRegistration.registerActionExtension({actionId:"emulation.capture-node-screenshot",category:"SCREENSHOT",experiment:"!react-native-specific-ui",loadActionDelegate:async()=>new((await K()).DeviceModeWrapper.ActionDelegate),condition:o.Runtime.conditions.canDock,title:q(F.captureNodeScreenshot)}),i.Settings.registerSettingExtension({category:"MOBILE",experiment:"!react-native-specific-ui",settingName:"show-media-query-inspector",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:q(F.showMediaQueries)},{value:!1,title:q(F.hideMediaQueries)}],tags:[q(F.device)]}),i.Settings.registerSettingExtension({category:"MOBILE",experiment:"!react-native-specific-ui",settingName:"emulation.show-rulers",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:q(F.showRulers)},{value:!1,title:q(F.hideRulers)}],tags:[q(F.device)]}),i.Settings.registerSettingExtension({category:"MOBILE",experiment:"!react-native-specific-ui",settingName:"emulation.show-device-outline",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:q(F.showDeviceFrame)},{value:!1,title:q(F.hideDeviceFrame)}],tags:[q(F.device)]}),t.Toolbar.registerToolbarItem({actionId:"emulation.toggle-device-mode",condition:o.Runtime.conditions.canDock,location:"main-toolbar-left",order:1,loadItem:void 0,separator:void 0}),i.AppProvider.registerAppProvider({loadAppProvider:async()=>(await K()).AdvancedApp.AdvancedAppProvider.instance(),condition:o.Runtime.conditions.canDock,order:0}),t.ContextMenu.registerItem({location:"deviceModeMenu/save",order:12,actionId:"emulation.capture-screenshot"}),t.ContextMenu.registerItem({location:"deviceModeMenu/save",order:13,actionId:"emulation.capture-full-height-screenshot"});const Y={sensors:"Sensors",geolocation:"geolocation",timezones:"timezones",locale:"locale",locales:"locales",accelerometer:"accelerometer",deviceOrientation:"device orientation",locations:"Locations",touch:"Touch",devicebased:"Device-based",forceEnabled:"Force enabled",emulateIdleDetectorState:"Emulate Idle Detector state",noIdleEmulation:"No idle emulation",userActiveScreenUnlocked:"User active, screen unlocked",userActiveScreenLocked:"User active, screen locked",userIdleScreenUnlocked:"User idle, screen unlocked",userIdleScreenLocked:"User idle, screen locked",showSensors:"Show Sensors",showLocations:"Show Locations",cpuPressure:"CPU Pressure",noPressureEmulation:"No override",nominal:"Nominal",fair:"Fair",serious:"Serious",critical:"Critical"},X=e.i18n.registerUIStrings("panels/sensors/sensors-meta.ts",Y),Z=e.i18n.getLazilyComputedLocalizedString.bind(void 0,X);let Q,J;async function $(){return Q||(Q=await import("../../panels/sensors/sensors.js")),Q}t.ViewManager.registerViewExtension({location:"drawer-view",commandPrompt:Z(Y.showSensors),title:Z(Y.sensors),id:"sensors",persistence:"closeable",order:100,loadView:async()=>new((await $()).SensorsView.SensorsView),tags:[Z(Y.geolocation),Z(Y.timezones),Z(Y.locale),Z(Y.locales),Z(Y.accelerometer),Z(Y.deviceOrientation)]}),t.ViewManager.registerViewExtension({location:"settings-view",id:"emulation-locations",commandPrompt:Z(Y.showLocations),title:Z(Y.locations),order:40,loadView:async()=>new((await $()).LocationsSettingsTab.LocationsSettingsTab),settings:["emulation.locations"],iconName:"location-on"}),i.Settings.registerSettingExtension({storageType:"Synced",settingName:"emulation.locations",settingType:"array",defaultValue:[{title:"Berlin",lat:52.520007,long:13.404954,timezoneId:"Europe/Berlin",locale:"de-DE"},{title:"London",lat:51.507351,long:-.127758,timezoneId:"Europe/London",locale:"en-GB"},{title:"Moscow",lat:55.755826,long:37.6173,timezoneId:"Europe/Moscow",locale:"ru-RU"},{title:"Mountain View",lat:37.386052,long:-122.083851,timezoneId:"America/Los_Angeles",locale:"en-US"},{title:"Mumbai",lat:19.075984,long:72.877656,timezoneId:"Asia/Kolkata",locale:"mr-IN"},{title:"San Francisco",lat:37.774929,long:-122.419416,timezoneId:"America/Los_Angeles",locale:"en-US"},{title:"Shanghai",lat:31.230416,long:121.473701,timezoneId:"Asia/Shanghai",locale:"zh-Hans-CN"},{title:"Sรฃo Paulo",lat:-23.55052,long:-46.633309,timezoneId:"America/Sao_Paulo",locale:"pt-BR"},{title:"Tokyo",lat:35.689487,long:139.691706,timezoneId:"Asia/Tokyo",locale:"ja-JP"}]}),i.Settings.registerSettingExtension({title:Z(Y.cpuPressure),reloadRequired:!0,settingName:"emulation.cpu-pressure",settingType:"enum",defaultValue:"none",options:[{value:"none",title:Z(Y.noPressureEmulation),text:Z(Y.noPressureEmulation)},{value:"nominal",title:Z(Y.nominal),text:Z(Y.nominal)},{value:"fair",title:Z(Y.fair),text:Z(Y.fair)},{value:"serious",title:Z(Y.serious),text:Z(Y.serious)},{value:"critical",title:Z(Y.critical),text:Z(Y.critical)}]}),i.Settings.registerSettingExtension({title:Z(Y.touch),reloadRequired:!0,settingName:"emulation.touch",settingType:"enum",defaultValue:"none",options:[{value:"none",title:Z(Y.devicebased),text:Z(Y.devicebased)},{value:"force",title:Z(Y.forceEnabled),text:Z(Y.forceEnabled)}]}),i.Settings.registerSettingExtension({title:Z(Y.emulateIdleDetectorState),settingName:"emulation.idle-detection",settingType:"enum",defaultValue:"none",options:[{value:"none",title:Z(Y.noIdleEmulation),text:Z(Y.noIdleEmulation)},{value:'{"isUserActive":true,"isScreenUnlocked":true}',title:Z(Y.userActiveScreenUnlocked),text:Z(Y.userActiveScreenUnlocked)},{value:'{"isUserActive":true,"isScreenUnlocked":false}',title:Z(Y.userActiveScreenLocked),text:Z(Y.userActiveScreenLocked)},{value:'{"isUserActive":false,"isScreenUnlocked":true}',title:Z(Y.userIdleScreenUnlocked),text:Z(Y.userIdleScreenUnlocked)},{value:'{"isUserActive":false,"isScreenUnlocked":false}',title:Z(Y.userIdleScreenLocked),text:Z(Y.userIdleScreenLocked)}]});const ee={accessibility:"Accessibility",shoAccessibility:"Show Accessibility"},te=e.i18n.registerUIStrings("panels/accessibility/accessibility-meta.ts",ee),ie=e.i18n.getLazilyComputedLocalizedString.bind(void 0,te);let oe;t.ViewManager.registerViewExtension({location:"elements-sidebar",id:"accessibility.view",title:ie(ee.accessibility),commandPrompt:ie(ee.shoAccessibility),order:10,persistence:"permanent",loadView:async()=>(await async function(){return J||(J=await import("../../panels/accessibility/accessibility.js")),J}()).AccessibilitySidebarView.AccessibilitySidebarView.instance()});const ne={animations:"Animations",showAnimations:"Show Animations"},ae=e.i18n.registerUIStrings("panels/animation/animation-meta.ts",ne),re=e.i18n.getLazilyComputedLocalizedString.bind(void 0,ae);async function se(){return oe||(oe=await import("../../panels/animation/animation.js")),oe}t.ViewManager.registerViewExtension({location:"drawer-view",id:"animations",title:re(ne.animations),commandPrompt:re(ne.showAnimations),persistence:"closeable",order:0,loadView:async()=>(await se()).AnimationTimeline.AnimationTimeline.instance()}),i.Revealer.registerRevealer({contextTypes:()=>[n.AnimationModel.AnimationGroup],destination:i.Revealer.RevealerDestination.SOURCES_PANEL,loadRevealer:async()=>new((await se()).AnimationTimeline.AnimationGroupRevealer)});const le={developerResources:"Developer resources",showDeveloperResources:"Show Developer resources"},ce=e.i18n.registerUIStrings("panels/developer_resources/developer_resources-meta.ts",le),de=e.i18n.getLazilyComputedLocalizedString.bind(void 0,ce);let ge;async function we(){return ge||(ge=await import("../../panels/developer_resources/developer_resources.js")),ge}t.ViewManager.registerViewExtension({location:"drawer-view",id:"developer-resources",title:de(le.developerResources),commandPrompt:de(le.showDeveloperResources),order:100,persistence:"closeable",loadView:async()=>new((await we()).DeveloperResourcesView.DeveloperResourcesView)}),i.Revealer.registerRevealer({contextTypes:()=>[n.PageResourceLoader.ResourceKey],destination:i.Revealer.RevealerDestination.DEVELOPER_RESOURCES_PANEL,loadRevealer:async()=>new((await we()).DeveloperResourcesView.DeveloperResourcesRevealer)});const me={autofill:"Autofill",showAutofill:"Show Autofill"},pe=e.i18n.registerUIStrings("panels/autofill/autofill-meta.ts",me),ue=e.i18n.getLazilyComputedLocalizedString.bind(void 0,pe);let ye;t.ViewManager.registerViewExtension({location:"drawer-view",id:"autofill-view",title:ue(me.autofill),commandPrompt:ue(me.showAutofill),order:100,persistence:"closeable",async loadView(){const e=await async function(){return ye||(ye=await import("../../panels/autofill/autofill.js")),ye}();return c.LegacyWrapper.legacyWrapper(t.Widget.Widget,new e.AutofillView.AutofillView)}});const he={rendering:"Rendering",showRendering:"Show Rendering",paint:"paint",layout:"layout",fps:"fps",cssMediaType:"CSS media type",cssMediaFeature:"CSS media feature",visionDeficiency:"vision deficiency",colorVisionDeficiency:"color vision deficiency",reloadPage:"Reload page",hardReloadPage:"Hard reload page",forceAdBlocking:"Force ad blocking on this site",blockAds:"Block ads on this site",showAds:"Show ads on this site, if allowed",autoOpenDevTools:"Auto-open DevTools for popups",doNotAutoOpen:"Do not auto-open DevTools for popups",disablePaused:"Disable paused state overlay",toggleCssPrefersColorSchemeMedia:"Toggle CSS media feature prefers-color-scheme"},ve=e.i18n.registerUIStrings("entrypoints/inspector_main/inspector_main-meta.ts",he),Se=e.i18n.getLazilyComputedLocalizedString.bind(void 0,ve);let Re;async function Ee(){return Re||(Re=await import("../inspector_main/inspector_main.js")),Re}t.ViewManager.registerViewExtension({location:"drawer-view",id:"rendering",title:Se(he.rendering),commandPrompt:Se(he.showRendering),persistence:"closeable",experiment:"!react-native-specific-ui",order:50,loadView:async()=>new((await Ee()).RenderingOptions.RenderingOptionsView),tags:[Se(he.paint),Se(he.layout),Se(he.fps),Se(he.cssMediaType),Se(he.cssMediaFeature),Se(he.visionDeficiency),Se(he.colorVisionDeficiency)]}),t.ActionRegistration.registerActionExtension({category:"NAVIGATION",actionId:"inspector-main.reload",loadActionDelegate:async()=>new((await Ee()).InspectorMain.ReloadActionDelegate),iconClass:"refresh",title:Se(he.reloadPage),bindings:[{platform:"windows,linux",shortcut:"Ctrl+R"},{platform:"windows,linux",shortcut:"F5"},{platform:"mac",shortcut:"Meta+R"}]}),t.ActionRegistration.registerActionExtension({category:"NAVIGATION",actionId:"inspector-main.hard-reload",loadActionDelegate:async()=>new((await Ee()).InspectorMain.ReloadActionDelegate),title:Se(he.hardReloadPage),bindings:[{platform:"windows,linux",shortcut:"Shift+Ctrl+R"},{platform:"windows,linux",shortcut:"Shift+F5"},{platform:"windows,linux",shortcut:"Ctrl+F5"},{platform:"windows,linux",shortcut:"Ctrl+Shift+F5"},{platform:"mac",shortcut:"Shift+Meta+R"}]}),t.ActionRegistration.registerActionExtension({actionId:"rendering.toggle-prefers-color-scheme",category:"RENDERING",experiment:"!react-native-specific-ui",title:Se(he.toggleCssPrefersColorSchemeMedia),loadActionDelegate:async()=>new((await Ee()).RenderingOptions.ReloadActionDelegate)}),i.Settings.registerSettingExtension({category:"",title:Se(he.forceAdBlocking),settingName:"network.ad-blocking-enabled",settingType:"boolean",storageType:"Session",defaultValue:!1,options:[{value:!0,title:Se(he.blockAds)},{value:!1,title:Se(he.showAds)}]}),i.Settings.registerSettingExtension({category:"GLOBAL",storageType:"Synced",title:Se(he.autoOpenDevTools),settingName:"auto-attach-to-created-pages",settingType:"boolean",order:2,defaultValue:!1,options:[{value:!0,title:Se(he.autoOpenDevTools)},{value:!1,title:Se(he.doNotAutoOpen)}]}),i.Settings.registerSettingExtension({category:"APPEARANCE",storageType:"Synced",title:Se(he.disablePaused),settingName:"disable-paused-state-overlay",settingType:"boolean",defaultValue:!1}),t.Toolbar.registerToolbarItem({loadItem:async()=>(await Ee()).InspectorMain.NodeIndicator.instance(),order:2,location:"main-toolbar-left"}),t.Toolbar.registerToolbarItem({loadItem:async()=>(await Ee()).OutermostTargetSelector.OutermostTargetSelector.instance(),order:98,location:"main-toolbar-right"});const Ae={application:"Application",showApplication:"Show Application",pwa:"pwa",clearSiteData:"Clear site data",clearSiteDataIncludingThirdparty:"Clear site data (including third-party cookies)",startRecordingEvents:"Start recording events",stopRecordingEvents:"Stop recording events"},be=e.i18n.registerUIStrings("panels/application/application-meta.ts",Ae),Pe=e.i18n.getLazilyComputedLocalizedString.bind(void 0,be);let fe;async function Te(){return fe||(fe=await import("../../panels/application/application.js")),fe}t.ViewManager.registerViewExtension({location:"panel",id:"resources",title:Pe(Ae.application),commandPrompt:Pe(Ae.showApplication),order:70,loadView:async()=>(await Te()).ResourcesPanel.ResourcesPanel.instance(),tags:[Pe(Ae.pwa)]}),t.ActionRegistration.registerActionExtension({category:"RESOURCES",actionId:"resources.clear",title:Pe(Ae.clearSiteData),loadActionDelegate:async()=>new((await Te()).StorageView.ActionDelegate)}),t.ActionRegistration.registerActionExtension({category:"RESOURCES",actionId:"resources.clear-incl-third-party-cookies",title:Pe(Ae.clearSiteDataIncludingThirdparty),loadActionDelegate:async()=>new((await Te()).StorageView.ActionDelegate)}),t.ActionRegistration.registerActionExtension({actionId:"background-service.toggle-recording",iconClass:"record-start",toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,contextTypes:()=>void 0===fe?[]:(e=>[e.BackgroundServiceView.BackgroundServiceView])(fe),loadActionDelegate:async()=>new((await Te()).BackgroundServiceView.ActionDelegate),category:"BACKGROUND_SERVICES",options:[{value:!0,title:Pe(Ae.startRecordingEvents)},{value:!1,title:Pe(Ae.stopRecordingEvents)}],bindings:[{platform:"windows,linux",shortcut:"Ctrl+E"},{platform:"mac",shortcut:"Meta+E"}]}),i.Revealer.registerRevealer({contextTypes:()=>[n.Resource.Resource],destination:i.Revealer.RevealerDestination.APPLICATION_PANEL,loadRevealer:async()=>new((await Te()).ResourcesPanel.ResourceRevealer)}),i.Revealer.registerRevealer({contextTypes:()=>[n.ResourceTreeModel.ResourceTreeFrame],destination:i.Revealer.RevealerDestination.APPLICATION_PANEL,loadRevealer:async()=>new((await Te()).ResourcesPanel.FrameDetailsRevealer)}),i.Revealer.registerRevealer({contextTypes:()=>[d.PreloadingForward.RuleSetView],destination:i.Revealer.RevealerDestination.APPLICATION_PANEL,loadRevealer:async()=>new((await Te()).ResourcesPanel.RuleSetViewRevealer)}),i.Revealer.registerRevealer({contextTypes:()=>[d.PreloadingForward.AttemptViewWithFilter],destination:i.Revealer.RevealerDestination.APPLICATION_PANEL,loadRevealer:async()=>new((await Te()).ResourcesPanel.AttemptViewWithFilterRevealer)});const ke={issues:"Issues",showIssues:"Show Issues"},xe=e.i18n.registerUIStrings("panels/issues/issues-meta.ts",ke),De=e.i18n.getLazilyComputedLocalizedString.bind(void 0,xe);let Le;async function Me(){return Le||(Le=await import("../../panels/issues/issues.js")),Le}t.ViewManager.registerViewExtension({location:"drawer-view",id:"issues-pane",title:De(ke.issues),commandPrompt:De(ke.showIssues),order:100,persistence:"closeable",loadView:async()=>new((await Me()).IssuesPane.IssuesPane)}),i.Revealer.registerRevealer({contextTypes:()=>[g.Issue.Issue],destination:i.Revealer.RevealerDestination.ISSUES_VIEW,loadRevealer:async()=>new((await Me()).IssueRevealer.IssueRevealer)});const Ne={layers:"Layers",showLayers:"Show Layers"},Ie=e.i18n.registerUIStrings("panels/layers/layers-meta.ts",Ne),Ce=e.i18n.getLazilyComputedLocalizedString.bind(void 0,Ie);let Ve;t.ViewManager.registerViewExtension({location:"panel",id:"layers",title:Ce(Ne.layers),commandPrompt:Ce(Ne.showLayers),order:100,persistence:"closeable",loadView:async()=>(await async function(){return Ve||(Ve=await import("../../panels/layers/layers.js")),Ve}()).LayersPanel.LayersPanel.instance()});const Oe={showLighthouse:"Show `Lighthouse`"},Be=e.i18n.registerUIStrings("panels/lighthouse/lighthouse-meta.ts",Oe),We=e.i18n.getLazilyComputedLocalizedString.bind(void 0,Be);let Ue;t.ViewManager.registerViewExtension({location:"panel",id:"lighthouse",title:e.i18n.lockedLazyString("Lighthouse"),commandPrompt:We(Oe.showLighthouse),order:90,loadView:async()=>(await async function(){return Ue||(Ue=await import("../../panels/lighthouse/lighthouse.js")),Ue}()).LighthousePanel.LighthousePanel.instance(),tags:[e.i18n.lockedLazyString("lighthouse"),e.i18n.lockedLazyString("pwa")]});const ze={media:"Media",video:"video",showMedia:"Show Media"},_e=e.i18n.registerUIStrings("panels/media/media-meta.ts",ze),je=e.i18n.getLazilyComputedLocalizedString.bind(void 0,_e);let Fe;t.ViewManager.registerViewExtension({location:"panel",id:"medias",title:je(ze.media),commandPrompt:je(ze.showMedia),persistence:"closeable",order:100,loadView:async()=>new((await async function(){return Fe||(Fe=await import("../../panels/media/media.js")),Fe}()).MainView.MainView),tags:[je(ze.media),je(ze.video)]});const He={throttling:"Throttling",showThrottling:"Show Throttling",goOffline:"Go offline",device:"device",throttlingTag:"throttling",enableSlowGThrottling:"Enable slow `3G` throttling",enableFastGThrottling:"Enable fast `3G` throttling",goOnline:"Go online"},qe=e.i18n.registerUIStrings("panels/mobile_throttling/mobile_throttling-meta.ts",He),Ge=e.i18n.getLazilyComputedLocalizedString.bind(void 0,qe);let Ke;async function Ye(){return Ke||(Ke=await import("../../panels/mobile_throttling/mobile_throttling.js")),Ke}t.ViewManager.registerViewExtension({location:"settings-view",id:"throttling-conditions",title:Ge(He.throttling),commandPrompt:Ge(He.showThrottling),order:35,loadView:async()=>new((await Ye()).ThrottlingSettingsTab.ThrottlingSettingsTab),settings:["custom-network-conditions","calibrated-cpu-throttling"],iconName:"performance"}),t.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-offline",category:"NETWORK",experiment:"!react-native-specific-ui",title:Ge(He.goOffline),loadActionDelegate:async()=>new((await Ye()).ThrottlingManager.ActionDelegate),tags:[Ge(He.device),Ge(He.throttlingTag)]}),t.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-low-end-mobile",category:"NETWORK",experiment:"!react-native-specific-ui",title:Ge(He.enableSlowGThrottling),loadActionDelegate:async()=>new((await Ye()).ThrottlingManager.ActionDelegate),tags:[Ge(He.device),Ge(He.throttlingTag)]}),t.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-mid-tier-mobile",category:"NETWORK",experiment:"!react-native-specific-ui",title:Ge(He.enableFastGThrottling),loadActionDelegate:async()=>new((await Ye()).ThrottlingManager.ActionDelegate),tags:[Ge(He.device),Ge(He.throttlingTag)]}),t.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-online",category:"NETWORK",experiment:"!react-native-specific-ui",title:Ge(He.goOnline),loadActionDelegate:async()=>new((await Ye()).ThrottlingManager.ActionDelegate),tags:[Ge(He.device),Ge(He.throttlingTag)]}),i.Settings.registerSettingExtension({storageType:"Synced",settingName:"custom-network-conditions",settingType:"array",defaultValue:[]});const Xe={performanceMonitor:"Performance monitor",performance:"performance",systemMonitor:"system monitor",monitor:"monitor",activity:"activity",metrics:"metrics",showPerformanceMonitor:"Show Performance monitor"},Ze=e.i18n.registerUIStrings("panels/performance_monitor/performance_monitor-meta.ts",Xe),Qe=e.i18n.getLazilyComputedLocalizedString.bind(void 0,Ze);let Je;t.ViewManager.registerViewExtension({location:"drawer-view",id:"performance.monitor",title:Qe(Xe.performanceMonitor),commandPrompt:Qe(Xe.showPerformanceMonitor),persistence:"closeable",order:100,loadView:async()=>new((await async function(){return Je||(Je=await import("../../panels/performance_monitor/performance_monitor.js")),Je}()).PerformanceMonitor.PerformanceMonitorImpl),tags:[Qe(Xe.performance),Qe(Xe.systemMonitor),Qe(Xe.monitor),Qe(Xe.activity),Qe(Xe.metrics)]});const $e={performance:"Performance",showPerformance:"Show Performance",record:"Record",stop:"Stop",recordAndReload:"Record and reload",saveProfile:"Save profileโ€ฆ",loadProfile:"Load profileโ€ฆ",previousFrame:"Previous frame",nextFrame:"Next frame",showRecentTimelineSessions:"Show recent timeline sessions",previousRecording:"Previous recording",nextRecording:"Next recording",hideChromeFrameInLayersView:"Hide `chrome` frame in Layers view"},et=e.i18n.registerUIStrings("panels/timeline/timeline-meta.ts",$e),tt=e.i18n.getLazilyComputedLocalizedString.bind(void 0,et);let it;async function ot(){return it||(it=await import("../../panels/timeline/timeline.js")),it}function nt(e){return void 0===it?[]:e(it)}t.ViewManager.registerViewExtension({location:"panel",id:"timeline",title:tt($e.performance),commandPrompt:tt($e.showPerformance),order:50,loadView:async()=>(await ot()).TimelinePanel.TimelinePanel.instance()}),t.ActionRegistration.registerActionExtension({actionId:"timeline.toggle-recording",category:"PERFORMANCE",iconClass:"record-start",toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,contextTypes:()=>nt((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await ot()).TimelinePanel.ActionDelegate),options:[{value:!0,title:tt($e.record)},{value:!1,title:tt($e.stop)}],bindings:[{platform:"windows,linux",shortcut:"Ctrl+E"},{platform:"mac",shortcut:"Meta+E"}]}),t.ActionRegistration.registerActionExtension({actionId:"timeline.record-reload",iconClass:"refresh",contextTypes:()=>nt((e=>[e.TimelinePanel.TimelinePanel])),category:"PERFORMANCE",title:tt($e.recordAndReload),loadActionDelegate:async()=>new((await ot()).TimelinePanel.ActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+E"},{platform:"mac",shortcut:"Meta+Shift+E"}],experiment:"!react-native-specific-ui"}),t.ActionRegistration.registerActionExtension({category:"PERFORMANCE",actionId:"timeline.save-to-file",contextTypes:()=>nt((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await ot()).TimelinePanel.ActionDelegate),title:tt($e.saveProfile),bindings:[{platform:"windows,linux",shortcut:"Ctrl+S"},{platform:"mac",shortcut:"Meta+S"}]}),t.ActionRegistration.registerActionExtension({category:"PERFORMANCE",actionId:"timeline.load-from-file",contextTypes:()=>nt((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await ot()).TimelinePanel.ActionDelegate),title:tt($e.loadProfile),bindings:[{platform:"windows,linux",shortcut:"Ctrl+O"},{platform:"mac",shortcut:"Meta+O"}]}),t.ActionRegistration.registerActionExtension({actionId:"timeline.jump-to-previous-frame",category:"PERFORMANCE",title:tt($e.previousFrame),contextTypes:()=>nt((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await ot()).TimelinePanel.ActionDelegate),bindings:[{shortcut:"["}]}),t.ActionRegistration.registerActionExtension({actionId:"timeline.jump-to-next-frame",category:"PERFORMANCE",title:tt($e.nextFrame),contextTypes:()=>nt((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await ot()).TimelinePanel.ActionDelegate),bindings:[{shortcut:"]"}]}),t.ActionRegistration.registerActionExtension({actionId:"timeline.show-history",loadActionDelegate:async()=>new((await ot()).TimelinePanel.ActionDelegate),category:"PERFORMANCE",title:tt($e.showRecentTimelineSessions),contextTypes:()=>nt((e=>[e.TimelinePanel.TimelinePanel])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+H"},{platform:"mac",shortcut:"Meta+Y"}]}),t.ActionRegistration.registerActionExtension({actionId:"timeline.previous-recording",category:"PERFORMANCE",loadActionDelegate:async()=>new((await ot()).TimelinePanel.ActionDelegate),title:tt($e.previousRecording),contextTypes:()=>nt((e=>[e.TimelinePanel.TimelinePanel])),bindings:[{platform:"windows,linux",shortcut:"Alt+Left"},{platform:"mac",shortcut:"Meta+Left"}]}),t.ActionRegistration.registerActionExtension({actionId:"timeline.next-recording",category:"PERFORMANCE",loadActionDelegate:async()=>new((await ot()).TimelinePanel.ActionDelegate),title:tt($e.nextRecording),contextTypes:()=>nt((e=>[e.TimelinePanel.TimelinePanel])),bindings:[{platform:"windows,linux",shortcut:"Alt+Right"},{platform:"mac",shortcut:"Meta+Right"}]}),i.Settings.registerSettingExtension({category:"PERFORMANCE",storageType:"Synced",title:tt($e.hideChromeFrameInLayersView),settingName:"frame-viewer-hide-chrome-window",settingType:"boolean",defaultValue:!1}),i.Settings.registerSettingExtension({category:"PERFORMANCE",storageType:"Synced",settingName:"annotations-hidden",settingType:"boolean",defaultValue:!1}),i.Linkifier.registerLinkifier({contextTypes:()=>nt((e=>[e.CLSLinkifier.CLSRect])),loadLinkifier:async()=>(await ot()).CLSLinkifier.Linkifier.instance()}),t.ContextMenu.registerItem({location:"timelineMenu/open",actionId:"timeline.load-from-file",order:10}),t.ContextMenu.registerItem({location:"timelineMenu/open",actionId:"timeline.save-to-file",order:15}),i.Revealer.registerRevealer({contextTypes:()=>[n.TraceObject.TraceObject],destination:i.Revealer.RevealerDestination.TIMELINE_PANEL,loadRevealer:async()=>new((await ot()).TimelinePanel.TraceRevealer)}),i.Revealer.registerRevealer({contextTypes:()=>[n.TraceObject.RevealableEvent],destination:i.Revealer.RevealerDestination.TIMELINE_PANEL,loadRevealer:async()=>new((await ot()).TimelinePanel.EventRevealer)});const at={webaudio:"WebAudio",audio:"audio",showWebaudio:"Show WebAudio"},rt=e.i18n.registerUIStrings("panels/web_audio/web_audio-meta.ts",at),st=e.i18n.getLazilyComputedLocalizedString.bind(void 0,rt);let lt;t.ViewManager.registerViewExtension({location:"drawer-view",id:"web-audio",title:st(at.webaudio),commandPrompt:st(at.showWebaudio),persistence:"closeable",order:100,loadView:async()=>new((await async function(){return lt||(lt=await import("../../panels/web_audio/web_audio.js")),lt}()).WebAudioView.WebAudioView),tags:[st(at.audio)]});const ct={webauthn:"WebAuthn",showWebauthn:"Show WebAuthn"},dt=e.i18n.registerUIStrings("panels/webauthn/webauthn-meta.ts",ct),gt=e.i18n.getLazilyComputedLocalizedString.bind(void 0,dt);let wt;t.ViewManager.registerViewExtension({location:"drawer-view",id:"webauthn-pane",title:gt(ct.webauthn),commandPrompt:gt(ct.showWebauthn),order:100,persistence:"closeable",loadView:async()=>new((await async function(){return wt||(wt=await import("../../panels/webauthn/webauthn.js")),wt}()).WebauthnPane.WebauthnPaneImpl)});const mt={resetView:"Reset view",switchToPanMode:"Switch to pan mode",switchToRotateMode:"Switch to rotate mode",zoomIn:"Zoom in",zoomOut:"Zoom out",panOrRotateUp:"Pan or rotate up",panOrRotateDown:"Pan or rotate down",panOrRotateLeft:"Pan or rotate left",panOrRotateRight:"Pan or rotate right"},pt=e.i18n.registerUIStrings("panels/layer_viewer/layer_viewer-meta.ts",mt),ut=e.i18n.getLazilyComputedLocalizedString.bind(void 0,pt);t.ActionRegistration.registerActionExtension({actionId:"layers.reset-view",category:"LAYERS",title:ut(mt.resetView),bindings:[{shortcut:"0"}]}),t.ActionRegistration.registerActionExtension({actionId:"layers.pan-mode",category:"LAYERS",title:ut(mt.switchToPanMode),bindings:[{shortcut:"x"}]}),t.ActionRegistration.registerActionExtension({actionId:"layers.rotate-mode",category:"LAYERS",title:ut(mt.switchToRotateMode),bindings:[{shortcut:"v"}]}),t.ActionRegistration.registerActionExtension({actionId:"layers.zoom-in",category:"LAYERS",title:ut(mt.zoomIn),bindings:[{shortcut:"Shift+Plus"},{shortcut:"NumpadPlus"}]}),t.ActionRegistration.registerActionExtension({actionId:"layers.zoom-out",category:"LAYERS",title:ut(mt.zoomOut),bindings:[{shortcut:"Shift+Minus"},{shortcut:"NumpadMinus"}]}),t.ActionRegistration.registerActionExtension({actionId:"layers.up",category:"LAYERS",title:ut(mt.panOrRotateUp),bindings:[{shortcut:"Up"},{shortcut:"w"}]}),t.ActionRegistration.registerActionExtension({actionId:"layers.down",category:"LAYERS",title:ut(mt.panOrRotateDown),bindings:[{shortcut:"Down"},{shortcut:"s"}]}),t.ActionRegistration.registerActionExtension({actionId:"layers.left",category:"LAYERS",title:ut(mt.panOrRotateLeft),bindings:[{shortcut:"Left"},{shortcut:"a"}]}),t.ActionRegistration.registerActionExtension({actionId:"layers.right",category:"LAYERS",title:ut(mt.panOrRotateRight),bindings:[{shortcut:"Right"},{shortcut:"d"}]});const yt={recorder:"Recorder",showRecorder:"Show Recorder",startStopRecording:"Start/Stop recording",createRecording:"Create a new recording",replayRecording:"Replay recording",toggleCode:"Toggle code view"},ht=e.i18n.registerUIStrings("panels/recorder/recorder-meta.ts",yt),vt=e.i18n.getLazilyComputedLocalizedString.bind(void 0,ht);let St;async function Rt(){return St||(St=await import("../../panels/recorder/recorder.js")),St}function Et(e,t){return void 0===St?[]:t&&St.RecorderPanel.RecorderPanel.instance().isActionPossible(t)?e(St):[]}const At="chrome-recorder";t.ViewManager.defaultOptionsForTabs[At]=!0,t.ViewManager.registerViewExtension({location:"panel",id:At,commandPrompt:vt(yt.showRecorder),title:vt(yt.recorder),order:90,persistence:"closeable",loadView:async()=>(await Rt()).RecorderPanel.RecorderPanel.instance()}),t.ActionRegistration.registerActionExtension({category:"RECORDER",actionId:"chrome-recorder.create-recording",title:vt(yt.createRecording),loadActionDelegate:async()=>new((await Rt()).RecorderPanel.ActionDelegate)}),t.ActionRegistration.registerActionExtension({category:"RECORDER",actionId:"chrome-recorder.start-recording",title:vt(yt.startStopRecording),contextTypes:()=>Et((e=>[e.RecorderPanel.RecorderPanel]),"chrome-recorder.start-recording"),loadActionDelegate:async()=>new((await Rt()).RecorderPanel.ActionDelegate),bindings:[{shortcut:"Ctrl+E",platform:"windows,linux"},{shortcut:"Meta+E",platform:"mac"}]}),t.ActionRegistration.registerActionExtension({category:"RECORDER",actionId:"chrome-recorder.replay-recording",title:vt(yt.replayRecording),contextTypes:()=>Et((e=>[e.RecorderPanel.RecorderPanel]),"chrome-recorder.replay-recording"),loadActionDelegate:async()=>new((await Rt()).RecorderPanel.ActionDelegate),bindings:[{shortcut:"Ctrl+Enter",platform:"windows,linux"},{shortcut:"Meta+Enter",platform:"mac"}]}),t.ActionRegistration.registerActionExtension({category:"RECORDER",actionId:"chrome-recorder.toggle-code-view",title:vt(yt.toggleCode),contextTypes:()=>Et((e=>[e.RecorderPanel.RecorderPanel]),"chrome-recorder.toggle-code-view"),loadActionDelegate:async()=>new((await Rt()).RecorderPanel.ActionDelegate),bindings:[{shortcut:"Ctrl+B",platform:"windows,linux"},{shortcut:"Meta+B",platform:"mac"}]});const bt={whatsNew:"What's new",showWhatsNew:"Show what's new",releaseNotes:"Release notes",reportADevtoolsIssue:"Report a DevTools issue",bug:"bug",showWhatsNewAfterEachUpdate:"Show what's new after each update",doNotShowWhatsNewAfterEachUpdate:"Don't show what's new after each update"},Pt=e.i18n.registerUIStrings("panels/whats_new/whats_new-meta.ts",bt),ft=e.i18n.getLazilyComputedLocalizedString.bind(void 0,Pt);let Tt;async function kt(){return Tt||(Tt=await import("../../panels/whats_new/whats_new.js")),Tt}t.ViewManager.maybeRemoveViewExtension("release-note"),t.ActionRegistration.maybeRemoveActionExtension("help.release-notes"),t.ActionRegistration.maybeRemoveActionExtension("help.report-issue"),i.Settings.maybeRemoveSettingExtension("help.show-release-note"),t.ContextMenu.maybeRemoveItem({location:"mainMenuHelp/default",actionId:"help.release-notes",order:void 0}),t.ContextMenu.maybeRemoveItem({location:"mainMenuHelp/default",actionId:"help.report-issue",order:void 0}),i.Runnable.maybeRemoveLateInitializationRunnable("whats-new"),t.ViewManager.registerViewExtension({location:"drawer-view",id:"release-note",title:ft(bt.whatsNew),commandPrompt:ft(bt.showWhatsNew),persistence:"closeable",order:1,loadView:async()=>new((await kt()).ReleaseNoteView.ReleaseNoteView)}),t.ActionRegistration.registerActionExtension({category:"HELP",actionId:"help.release-notes",title:ft(bt.releaseNotes),loadActionDelegate:async()=>(await kt()).WhatsNew.ReleaseNotesActionDelegate.instance()}),t.ActionRegistration.registerActionExtension({category:"HELP",actionId:"help.report-issue",title:ft(bt.reportADevtoolsIssue),loadActionDelegate:async()=>(await kt()).WhatsNew.ReportIssueActionDelegate.instance(),tags:[ft(bt.bug)]}),i.Settings.registerSettingExtension({category:"APPEARANCE",title:ft(bt.showWhatsNewAfterEachUpdate),settingName:"help.show-release-note",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:ft(bt.showWhatsNewAfterEachUpdate)},{value:!1,title:ft(bt.doNotShowWhatsNewAfterEachUpdate)}]}),t.ContextMenu.registerItem({location:"mainMenuHelp/default",actionId:"help.release-notes",order:10}),t.ContextMenu.registerItem({location:"mainMenuHelp/default",actionId:"help.report-issue",order:11}),i.Runnable.registerLateInitializationRunnable({id:"whats-new",loadRunnable:async()=>(await kt()).WhatsNew.HelpLateInitialization.instance()}),self.runtime=o.Runtime.Runtime.instance({forceNew:!0}),new w.MainImpl.MainImpl; diff --git a/packages/debugger-frontend/dist/third-party/front_end/entrypoints/inspector_main/inspector_main-meta.js b/packages/debugger-frontend/dist/third-party/front_end/entrypoints/inspector_main/inspector_main-meta.js index d7ef2c075f78..17fc728562d4 100644 --- a/packages/debugger-frontend/dist/third-party/front_end/entrypoints/inspector_main/inspector_main-meta.js +++ b/packages/debugger-frontend/dist/third-party/front_end/entrypoints/inspector_main/inspector_main-meta.js @@ -1 +1 @@ -import*as e from"../../core/common/common.js";import*as t from"../../core/i18n/i18n.js";import*as o from"../../ui/legacy/legacy.js";const i={rendering:"Rendering",showRendering:"Show Rendering",paint:"paint",layout:"layout",fps:"fps",cssMediaType:"CSS media type",cssMediaFeature:"CSS media feature",visionDeficiency:"vision deficiency",colorVisionDeficiency:"color vision deficiency",reloadPage:"Reload page",hardReloadPage:"Hard reload page",forceAdBlocking:"Force ad blocking on this site",blockAds:"Block ads on this site",showAds:"Show ads on this site, if allowed",autoOpenDevTools:"Auto-open DevTools for popups",doNotAutoOpen:"Do not auto-open DevTools for popups",disablePaused:"Disable paused state overlay",toggleCssPrefersColorSchemeMedia:"Toggle CSS media feature prefers-color-scheme"},a=t.i18n.registerUIStrings("entrypoints/inspector_main/inspector_main-meta.ts",i),n=t.i18n.getLazilyComputedLocalizedString.bind(void 0,a);let r;async function s(){return r||(r=await import("./inspector_main.js")),r}o.ViewManager.registerViewExtension({location:"drawer-view",id:"rendering",title:n(i.rendering),commandPrompt:n(i.showRendering),persistence:"closeable",order:50,loadView:async()=>new((await s()).RenderingOptions.RenderingOptionsView),tags:[n(i.paint),n(i.layout),n(i.fps),n(i.cssMediaType),n(i.cssMediaFeature),n(i.visionDeficiency),n(i.colorVisionDeficiency)]}),o.ActionRegistration.registerActionExtension({category:"NAVIGATION",actionId:"inspector-main.reload",loadActionDelegate:async()=>new((await s()).InspectorMain.ReloadActionDelegate),iconClass:"refresh",title:n(i.reloadPage),bindings:[{platform:"windows,linux",shortcut:"Ctrl+R"},{platform:"windows,linux",shortcut:"F5"},{platform:"mac",shortcut:"Meta+R"}]}),o.ActionRegistration.registerActionExtension({category:"NAVIGATION",actionId:"inspector-main.hard-reload",loadActionDelegate:async()=>new((await s()).InspectorMain.ReloadActionDelegate),title:n(i.hardReloadPage),bindings:[{platform:"windows,linux",shortcut:"Shift+Ctrl+R"},{platform:"windows,linux",shortcut:"Shift+F5"},{platform:"windows,linux",shortcut:"Ctrl+F5"},{platform:"windows,linux",shortcut:"Ctrl+Shift+F5"},{platform:"mac",shortcut:"Shift+Meta+R"}]}),o.ActionRegistration.registerActionExtension({actionId:"rendering.toggle-prefers-color-scheme",category:"RENDERING",title:n(i.toggleCssPrefersColorSchemeMedia),loadActionDelegate:async()=>new((await s()).RenderingOptions.ReloadActionDelegate)}),e.Settings.registerSettingExtension({category:"",title:n(i.forceAdBlocking),settingName:"network.ad-blocking-enabled",settingType:"boolean",storageType:"Session",defaultValue:!1,options:[{value:!0,title:n(i.blockAds)},{value:!1,title:n(i.showAds)}]}),e.Settings.registerSettingExtension({category:"GLOBAL",storageType:"Synced",title:n(i.autoOpenDevTools),settingName:"auto-attach-to-created-pages",settingType:"boolean",order:2,defaultValue:!1,options:[{value:!0,title:n(i.autoOpenDevTools)},{value:!1,title:n(i.doNotAutoOpen)}]}),e.Settings.registerSettingExtension({category:"APPEARANCE",storageType:"Synced",title:n(i.disablePaused),settingName:"disable-paused-state-overlay",settingType:"boolean",defaultValue:!1}),o.Toolbar.registerToolbarItem({loadItem:async()=>(await s()).InspectorMain.NodeIndicator.instance(),order:2,location:"main-toolbar-left"}),o.Toolbar.registerToolbarItem({loadItem:async()=>(await s()).OutermostTargetSelector.OutermostTargetSelector.instance(),order:98,location:"main-toolbar-right"}); +import*as e from"../../core/common/common.js";import*as t from"../../core/i18n/i18n.js";import"../../core/root/root.js";import*as o from"../../ui/legacy/legacy.js";const i={rendering:"Rendering",showRendering:"Show Rendering",paint:"paint",layout:"layout",fps:"fps",cssMediaType:"CSS media type",cssMediaFeature:"CSS media feature",visionDeficiency:"vision deficiency",colorVisionDeficiency:"color vision deficiency",reloadPage:"Reload page",hardReloadPage:"Hard reload page",forceAdBlocking:"Force ad blocking on this site",blockAds:"Block ads on this site",showAds:"Show ads on this site, if allowed",autoOpenDevTools:"Auto-open DevTools for popups",doNotAutoOpen:"Do not auto-open DevTools for popups",disablePaused:"Disable paused state overlay",toggleCssPrefersColorSchemeMedia:"Toggle CSS media feature prefers-color-scheme"},a=t.i18n.registerUIStrings("entrypoints/inspector_main/inspector_main-meta.ts",i),n=t.i18n.getLazilyComputedLocalizedString.bind(void 0,a);let r;async function s(){return r||(r=await import("./inspector_main.js")),r}o.ViewManager.registerViewExtension({location:"drawer-view",id:"rendering",title:n(i.rendering),commandPrompt:n(i.showRendering),persistence:"closeable",experiment:"!react-native-specific-ui",order:50,loadView:async()=>new((await s()).RenderingOptions.RenderingOptionsView),tags:[n(i.paint),n(i.layout),n(i.fps),n(i.cssMediaType),n(i.cssMediaFeature),n(i.visionDeficiency),n(i.colorVisionDeficiency)]}),o.ActionRegistration.registerActionExtension({category:"NAVIGATION",actionId:"inspector-main.reload",loadActionDelegate:async()=>new((await s()).InspectorMain.ReloadActionDelegate),iconClass:"refresh",title:n(i.reloadPage),bindings:[{platform:"windows,linux",shortcut:"Ctrl+R"},{platform:"windows,linux",shortcut:"F5"},{platform:"mac",shortcut:"Meta+R"}]}),o.ActionRegistration.registerActionExtension({category:"NAVIGATION",actionId:"inspector-main.hard-reload",loadActionDelegate:async()=>new((await s()).InspectorMain.ReloadActionDelegate),title:n(i.hardReloadPage),bindings:[{platform:"windows,linux",shortcut:"Shift+Ctrl+R"},{platform:"windows,linux",shortcut:"Shift+F5"},{platform:"windows,linux",shortcut:"Ctrl+F5"},{platform:"windows,linux",shortcut:"Ctrl+Shift+F5"},{platform:"mac",shortcut:"Shift+Meta+R"}]}),o.ActionRegistration.registerActionExtension({actionId:"rendering.toggle-prefers-color-scheme",category:"RENDERING",experiment:"!react-native-specific-ui",title:n(i.toggleCssPrefersColorSchemeMedia),loadActionDelegate:async()=>new((await s()).RenderingOptions.ReloadActionDelegate)}),e.Settings.registerSettingExtension({category:"",title:n(i.forceAdBlocking),settingName:"network.ad-blocking-enabled",settingType:"boolean",storageType:"Session",defaultValue:!1,options:[{value:!0,title:n(i.blockAds)},{value:!1,title:n(i.showAds)}]}),e.Settings.registerSettingExtension({category:"GLOBAL",storageType:"Synced",title:n(i.autoOpenDevTools),settingName:"auto-attach-to-created-pages",settingType:"boolean",order:2,defaultValue:!1,options:[{value:!0,title:n(i.autoOpenDevTools)},{value:!1,title:n(i.doNotAutoOpen)}]}),e.Settings.registerSettingExtension({category:"APPEARANCE",storageType:"Synced",title:n(i.disablePaused),settingName:"disable-paused-state-overlay",settingType:"boolean",defaultValue:!1}),o.Toolbar.registerToolbarItem({loadItem:async()=>(await s()).InspectorMain.NodeIndicator.instance(),order:2,location:"main-toolbar-left"}),o.Toolbar.registerToolbarItem({loadItem:async()=>(await s()).OutermostTargetSelector.OutermostTargetSelector.instance(),order:98,location:"main-toolbar-right"}); diff --git a/packages/debugger-frontend/dist/third-party/front_end/entrypoints/js_app/js_app.js b/packages/debugger-frontend/dist/third-party/front_end/entrypoints/js_app/js_app.js index 5373ae7539bd..872ec3b43ae5 100644 --- a/packages/debugger-frontend/dist/third-party/front_end/entrypoints/js_app/js_app.js +++ b/packages/debugger-frontend/dist/third-party/front_end/entrypoints/js_app/js_app.js @@ -1 +1 @@ -import"../shell/shell.js";import*as e from"../../core/common/common.js";import*as t from"../../core/i18n/i18n.js";import*as o from"../../ui/legacy/legacy.js";import*as n from"../../core/root/root.js";import*as i from"../../core/sdk/sdk.js";import*as r from"../../models/extensions/extensions.js";import*as a from"../../models/workspace/workspace.js";import*as s from"../../panels/network/forward/forward.js";import*as l from"../../core/host/host.js";import*as c from"../../ui/legacy/components/utils/utils.js";import*as g from"../main/main.js";const w={performance:"Performance",showPerformance:"Show Performance",showRecentTimelineSessions:"Show recent timeline sessions",record:"Record",stop:"Stop",recordAndReload:"Record and reload"},d=t.i18n.registerUIStrings("panels/js_timeline/js_timeline-meta.ts",w),k=t.i18n.getLazilyComputedLocalizedString.bind(void 0,d);let m;async function u(){return m||(m=await import("../../panels/timeline/timeline.js")),m}function p(e){return void 0===m?[]:e(m)}o.ViewManager.registerViewExtension({location:"panel",id:"timeline",title:k(w.performance),commandPrompt:k(w.showPerformance),order:66,hasToolbar:!1,isPreviewFeature:!0,loadView:async()=>(await u()).TimelinePanel.TimelinePanel.instance({forceNew:null,isNode:!0})}),o.ActionRegistration.registerActionExtension({actionId:"timeline.show-history",loadActionDelegate:async()=>new((await u()).TimelinePanel.ActionDelegate),category:"PERFORMANCE",title:k(w.showRecentTimelineSessions),contextTypes:()=>p((e=>[e.TimelinePanel.TimelinePanel])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+H"},{platform:"mac",shortcut:"Meta+Y"}]}),o.ActionRegistration.registerActionExtension({actionId:"timeline.toggle-recording",category:"PERFORMANCE",iconClass:"record-start",toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,contextTypes:()=>p((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await u()).TimelinePanel.ActionDelegate),options:[{value:!0,title:k(w.record)},{value:!1,title:k(w.stop)}],bindings:[{platform:"windows,linux",shortcut:"Ctrl+E"},{platform:"mac",shortcut:"Meta+E"}]}),o.ActionRegistration.registerActionExtension({actionId:"timeline.record-reload",iconClass:"refresh",contextTypes:()=>p((e=>[e.TimelinePanel.TimelinePanel])),category:"PERFORMANCE",title:k(w.recordAndReload),loadActionDelegate:async()=>new((await u()).TimelinePanel.ActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+E"},{platform:"mac",shortcut:"Meta+Shift+E"}]}),e.Settings.registerSettingExtension({category:"PERFORMANCE",storageType:"Synced",settingName:"annotations-hidden",settingType:"boolean",defaultValue:!0});const y={throttling:"Throttling",showThrottling:"Show Throttling",goOffline:"Go offline",device:"device",throttlingTag:"throttling",enableSlowGThrottling:"Enable slow `3G` throttling",enableFastGThrottling:"Enable fast `3G` throttling",goOnline:"Go online"},R=t.i18n.registerUIStrings("panels/mobile_throttling/mobile_throttling-meta.ts",y),h=t.i18n.getLazilyComputedLocalizedString.bind(void 0,R);let T;async function N(){return T||(T=await import("../../panels/mobile_throttling/mobile_throttling.js")),T}o.ViewManager.registerViewExtension({location:"settings-view",id:"throttling-conditions",title:h(y.throttling),commandPrompt:h(y.showThrottling),order:35,loadView:async()=>new((await N()).ThrottlingSettingsTab.ThrottlingSettingsTab),settings:["custom-network-conditions","calibrated-cpu-throttling"],iconName:"performance"}),o.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-offline",category:"NETWORK",title:h(y.goOffline),loadActionDelegate:async()=>new((await N()).ThrottlingManager.ActionDelegate),tags:[h(y.device),h(y.throttlingTag)]}),o.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-low-end-mobile",category:"NETWORK",title:h(y.enableSlowGThrottling),loadActionDelegate:async()=>new((await N()).ThrottlingManager.ActionDelegate),tags:[h(y.device),h(y.throttlingTag)]}),o.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-mid-tier-mobile",category:"NETWORK",title:h(y.enableFastGThrottling),loadActionDelegate:async()=>new((await N()).ThrottlingManager.ActionDelegate),tags:[h(y.device),h(y.throttlingTag)]}),o.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-online",category:"NETWORK",title:h(y.goOnline),loadActionDelegate:async()=>new((await N()).ThrottlingManager.ActionDelegate),tags:[h(y.device),h(y.throttlingTag)]}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"custom-network-conditions",settingType:"array",defaultValue:[]});const v={showNetwork:"Show Network",network:"Network",networkExpoUnstable:"Expo Network",showNetworkRequestBlocking:"Show Network request blocking",networkRequestBlocking:"Network request blocking",showNetworkConditions:"Show Network conditions",networkConditions:"Network conditions",diskCache:"disk cache",networkThrottling:"network throttling",showSearch:"Show Search",search:"Search",recordNetworkLog:"Record network log",stopRecordingNetworkLog:"Stop recording network log",hideRequestDetails:"Hide request details",colorcodeResourceTypes:"Color-code resource types",colorCode:"color code",resourceType:"resource type",colorCodeByResourceType:"Color code by resource type",useDefaultColors:"Use default colors",groupNetworkLogByFrame:"Group network log by frame",netWork:"network",frame:"frame",group:"group",groupNetworkLogItemsByFrame:"Group network log items by frame",dontGroupNetworkLogItemsByFrame:"Don't group network log items by frame",clear:"Clear network log",addNetworkRequestBlockingPattern:"Add network request blocking pattern",removeAllNetworkRequestBlockingPatterns:"Remove all network request blocking patterns",allowToGenerateHarWithSensitiveData:"Allow to generate `HAR` with sensitive data",dontAllowToGenerateHarWithSensitiveData:"Don't allow to generate `HAR` with sensitive data",allowToGenerateHarWithSensitiveDataDocumentation:"By default generated HAR logs are sanitized and don't include `Cookie`, `Set-Cookie`, or `Authorization` HTTP headers. When this setting is enabled, options to export/copy HAR with sensitive data are provided."},A=t.i18n.registerUIStrings("panels/network/network-meta.ts",v),f=t.i18n.getLazilyComputedLocalizedString.bind(void 0,A),E=t.i18n.getLocalizedString.bind(void 0,A);let P;async function S(){return P||(P=await import("../../panels/network/network.js")),P}function b(e){return void 0===P?[]:e(P)}o.ViewManager.registerViewExtension({location:"panel",id:"network",commandPrompt:f(v.showNetwork),title:()=>n.Runtime.conditions.reactNativeExpoNetworkPanel()?E(v.networkExpoUnstable):E(v.network),order:40,loadView:async()=>(await S()).NetworkPanel.NetworkPanel.instance()}),o.ViewManager.registerViewExtension({location:"drawer-view",id:"network.blocked-urls",commandPrompt:f(v.showNetworkRequestBlocking),title:f(v.networkRequestBlocking),persistence:"closeable",order:60,loadView:async()=>new((await S()).BlockedURLsPane.BlockedURLsPane)}),o.ViewManager.registerViewExtension({location:"drawer-view",id:"network.config",commandPrompt:f(v.showNetworkConditions),title:f(v.networkConditions),persistence:"closeable",order:40,tags:[f(v.diskCache),f(v.networkThrottling),t.i18n.lockedLazyString("useragent"),t.i18n.lockedLazyString("user agent"),t.i18n.lockedLazyString("user-agent")],loadView:async()=>(await S()).NetworkConfigView.NetworkConfigView.instance()}),o.ViewManager.registerViewExtension({location:"network-sidebar",id:"network.search-network-tab",commandPrompt:f(v.showSearch),title:f(v.search),persistence:"permanent",loadView:async()=>(await S()).NetworkPanel.SearchNetworkView.instance()}),o.ActionRegistration.registerActionExtension({actionId:"network.toggle-recording",category:"NETWORK",iconClass:"record-start",toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,contextTypes:()=>b((e=>[e.NetworkPanel.NetworkPanel])),loadActionDelegate:async()=>new((await S()).NetworkPanel.ActionDelegate),options:[{value:!0,title:f(v.recordNetworkLog)},{value:!1,title:f(v.stopRecordingNetworkLog)}],bindings:[{shortcut:"Ctrl+E",platform:"windows,linux"},{shortcut:"Meta+E",platform:"mac"}]}),o.ActionRegistration.registerActionExtension({actionId:"network.clear",category:"NETWORK",title:f(v.clear),iconClass:"clear",loadActionDelegate:async()=>new((await S()).NetworkPanel.ActionDelegate),contextTypes:()=>b((e=>[e.NetworkPanel.NetworkPanel])),bindings:[{shortcut:"Ctrl+L"},{shortcut:"Meta+K",platform:"mac"}]}),o.ActionRegistration.registerActionExtension({actionId:"network.hide-request-details",category:"NETWORK",title:f(v.hideRequestDetails),contextTypes:()=>b((e=>[e.NetworkPanel.NetworkPanel])),loadActionDelegate:async()=>new((await S()).NetworkPanel.ActionDelegate),bindings:[{shortcut:"Esc"}]}),o.ActionRegistration.registerActionExtension({actionId:"network.search",category:"NETWORK",title:f(v.search),contextTypes:()=>b((e=>[e.NetworkPanel.NetworkPanel])),loadActionDelegate:async()=>new((await S()).NetworkPanel.ActionDelegate),bindings:[{platform:"mac",shortcut:"Meta+F",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+F",keybindSets:["devToolsDefault","vsCode"]}]}),o.ActionRegistration.registerActionExtension({actionId:"network.add-network-request-blocking-pattern",category:"NETWORK",title:f(v.addNetworkRequestBlockingPattern),iconClass:"plus",contextTypes:()=>b((e=>[e.BlockedURLsPane.BlockedURLsPane])),loadActionDelegate:async()=>new((await S()).BlockedURLsPane.ActionDelegate)}),o.ActionRegistration.registerActionExtension({actionId:"network.remove-all-network-request-blocking-patterns",category:"NETWORK",title:f(v.removeAllNetworkRequestBlockingPatterns),iconClass:"clear",contextTypes:()=>b((e=>[e.BlockedURLsPane.BlockedURLsPane])),loadActionDelegate:async()=>new((await S()).BlockedURLsPane.ActionDelegate)}),e.Settings.registerSettingExtension({category:"NETWORK",storageType:"Synced",title:f(v.allowToGenerateHarWithSensitiveData),settingName:"network.show-options-to-generate-har-with-sensitive-data",settingType:"boolean",defaultValue:!1,tags:[t.i18n.lockedLazyString("HAR")],options:[{value:!0,title:f(v.allowToGenerateHarWithSensitiveData)},{value:!1,title:f(v.dontAllowToGenerateHarWithSensitiveData)}],learnMore:{url:"https://goo.gle/devtools-export-hars",tooltip:f(v.allowToGenerateHarWithSensitiveDataDocumentation)}}),e.Settings.registerSettingExtension({category:"NETWORK",storageType:"Synced",title:f(v.colorcodeResourceTypes),settingName:"network-color-code-resource-types",settingType:"boolean",defaultValue:!1,tags:[f(v.colorCode),f(v.resourceType)],options:[{value:!0,title:f(v.colorCodeByResourceType)},{value:!1,title:f(v.useDefaultColors)}]}),e.Settings.registerSettingExtension({category:"NETWORK",storageType:"Synced",title:f(v.groupNetworkLogByFrame),settingName:"network.group-by-frame",settingType:"boolean",defaultValue:!1,tags:[f(v.netWork),f(v.frame),f(v.group)],options:[{value:!0,title:f(v.groupNetworkLogItemsByFrame)},{value:!1,title:f(v.dontGroupNetworkLogItemsByFrame)}]}),o.ViewManager.registerLocationResolver({name:"network-sidebar",category:"NETWORK",loadResolver:async()=>(await S()).NetworkPanel.NetworkPanel.instance()}),o.ContextMenu.registerProvider({contextTypes:()=>[i.NetworkRequest.NetworkRequest,i.Resource.Resource,a.UISourceCode.UISourceCode,i.TraceObject.RevealableNetworkRequest],loadProvider:async()=>(await S()).NetworkPanel.NetworkPanel.instance(),experiment:void 0}),e.Revealer.registerRevealer({contextTypes:()=>[i.NetworkRequest.NetworkRequest],destination:e.Revealer.RevealerDestination.NETWORK_PANEL,loadRevealer:async()=>new((await S()).NetworkPanel.RequestRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[s.UIRequestLocation.UIRequestLocation],destination:void 0,loadRevealer:async()=>new((await S()).NetworkPanel.RequestLocationRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[s.NetworkRequestId.NetworkRequestId],destination:e.Revealer.RevealerDestination.NETWORK_PANEL,loadRevealer:async()=>new((await S()).NetworkPanel.RequestIdRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[s.UIFilter.UIRequestFilter,r.ExtensionServer.RevealableNetworkRequestFilter],destination:e.Revealer.RevealerDestination.NETWORK_PANEL,loadRevealer:async()=>new((await S()).NetworkPanel.NetworkLogWithFilterRevealer)});const x={main:"Main",networkTitle:"Scripts",showNode:"Show Scripts"},D=t.i18n.registerUIStrings("entrypoints/js_app/js_app.ts",x),C=t.i18n.getLocalizedString.bind(void 0,D),L=t.i18n.getLazilyComputedLocalizedString.bind(void 0,D);let I,q;class M{static instance(e={forceNew:null}){const{forceNew:t}=e;return I&&!t||(I=new M),I}async run(){l.userMetrics.actionTaken(l.UserMetrics.Action.ConnectToNodeJSDirectly),i.Connections.initMainConnection((async()=>{i.TargetManager.TargetManager.instance().createTarget("main",C(x.main),i.Target.Type.NODE,null).runtimeAgent().invoke_runIfWaitingForDebugger()}),c.TargetDetachedDialog.TargetDetachedDialog.connectionLost)}}o.ViewManager.registerViewExtension({location:"navigator-view",id:"navigator-network",title:L(x.networkTitle),commandPrompt:L(x.showNode),order:2,persistence:"permanent",loadView:async()=>(await async function(){return q||(q=await import("../../panels/sources/sources.js")),q}()).SourcesNavigator.NetworkNavigatorView.instance()}),e.Runnable.registerEarlyInitializationRunnable(M.instance),new g.MainImpl.MainImpl;export{M as JsMainImpl}; +import"../shell/shell.js";import*as e from"../../core/common/common.js";import*as t from"../../core/i18n/i18n.js";import*as o from"../../ui/legacy/legacy.js";import*as n from"../../core/root/root.js";import*as i from"../../core/sdk/sdk.js";import*as r from"../../models/extensions/extensions.js";import*as a from"../../models/workspace/workspace.js";import*as s from"../../panels/network/forward/forward.js";import*as l from"../../core/host/host.js";import*as c from"../../ui/legacy/components/utils/utils.js";import*as g from"../main/main.js";const w={performance:"Performance",showPerformance:"Show Performance",showRecentTimelineSessions:"Show recent timeline sessions",record:"Record",stop:"Stop",recordAndReload:"Record and reload"},d=t.i18n.registerUIStrings("panels/js_timeline/js_timeline-meta.ts",w),m=t.i18n.getLazilyComputedLocalizedString.bind(void 0,d);let k;async function u(){return k||(k=await import("../../panels/timeline/timeline.js")),k}function p(e){return void 0===k?[]:e(k)}o.ViewManager.registerViewExtension({location:"panel",id:"timeline",title:m(w.performance),commandPrompt:m(w.showPerformance),order:66,hasToolbar:!1,isPreviewFeature:!0,loadView:async()=>(await u()).TimelinePanel.TimelinePanel.instance({forceNew:null,isNode:!0})}),o.ActionRegistration.registerActionExtension({actionId:"timeline.show-history",loadActionDelegate:async()=>new((await u()).TimelinePanel.ActionDelegate),category:"PERFORMANCE",title:m(w.showRecentTimelineSessions),contextTypes:()=>p((e=>[e.TimelinePanel.TimelinePanel])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+H"},{platform:"mac",shortcut:"Meta+Y"}]}),o.ActionRegistration.registerActionExtension({actionId:"timeline.toggle-recording",category:"PERFORMANCE",iconClass:"record-start",toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,contextTypes:()=>p((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await u()).TimelinePanel.ActionDelegate),options:[{value:!0,title:m(w.record)},{value:!1,title:m(w.stop)}],bindings:[{platform:"windows,linux",shortcut:"Ctrl+E"},{platform:"mac",shortcut:"Meta+E"}]}),o.ActionRegistration.registerActionExtension({actionId:"timeline.record-reload",iconClass:"refresh",contextTypes:()=>p((e=>[e.TimelinePanel.TimelinePanel])),category:"PERFORMANCE",title:m(w.recordAndReload),loadActionDelegate:async()=>new((await u()).TimelinePanel.ActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+E"},{platform:"mac",shortcut:"Meta+Shift+E"}]}),e.Settings.registerSettingExtension({category:"PERFORMANCE",storageType:"Synced",settingName:"annotations-hidden",settingType:"boolean",defaultValue:!0});const y={throttling:"Throttling",showThrottling:"Show Throttling",goOffline:"Go offline",device:"device",throttlingTag:"throttling",enableSlowGThrottling:"Enable slow `3G` throttling",enableFastGThrottling:"Enable fast `3G` throttling",goOnline:"Go online"},R=t.i18n.registerUIStrings("panels/mobile_throttling/mobile_throttling-meta.ts",y),h=t.i18n.getLazilyComputedLocalizedString.bind(void 0,R);let T;async function N(){return T||(T=await import("../../panels/mobile_throttling/mobile_throttling.js")),T}o.ViewManager.registerViewExtension({location:"settings-view",id:"throttling-conditions",title:h(y.throttling),commandPrompt:h(y.showThrottling),order:35,loadView:async()=>new((await N()).ThrottlingSettingsTab.ThrottlingSettingsTab),settings:["custom-network-conditions","calibrated-cpu-throttling"],iconName:"performance"}),o.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-offline",category:"NETWORK",experiment:"!react-native-specific-ui",title:h(y.goOffline),loadActionDelegate:async()=>new((await N()).ThrottlingManager.ActionDelegate),tags:[h(y.device),h(y.throttlingTag)]}),o.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-low-end-mobile",category:"NETWORK",experiment:"!react-native-specific-ui",title:h(y.enableSlowGThrottling),loadActionDelegate:async()=>new((await N()).ThrottlingManager.ActionDelegate),tags:[h(y.device),h(y.throttlingTag)]}),o.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-mid-tier-mobile",category:"NETWORK",experiment:"!react-native-specific-ui",title:h(y.enableFastGThrottling),loadActionDelegate:async()=>new((await N()).ThrottlingManager.ActionDelegate),tags:[h(y.device),h(y.throttlingTag)]}),o.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-online",category:"NETWORK",experiment:"!react-native-specific-ui",title:h(y.goOnline),loadActionDelegate:async()=>new((await N()).ThrottlingManager.ActionDelegate),tags:[h(y.device),h(y.throttlingTag)]}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"custom-network-conditions",settingType:"array",defaultValue:[]});const v={showNetwork:"Show Network",network:"Network",networkExpoUnstable:"Expo Network",showNetworkRequestBlocking:"Show Network request blocking",networkRequestBlocking:"Network request blocking",showNetworkConditions:"Show Network conditions",networkConditions:"Network conditions",diskCache:"disk cache",networkThrottling:"network throttling",showSearch:"Show Search",search:"Search",recordNetworkLog:"Record network log",stopRecordingNetworkLog:"Stop recording network log",hideRequestDetails:"Hide request details",colorcodeResourceTypes:"Color-code resource types",colorCode:"color code",resourceType:"resource type",colorCodeByResourceType:"Color code by resource type",useDefaultColors:"Use default colors",groupNetworkLogByFrame:"Group network log by frame",netWork:"network",frame:"frame",group:"group",groupNetworkLogItemsByFrame:"Group network log items by frame",dontGroupNetworkLogItemsByFrame:"Don't group network log items by frame",clear:"Clear network log",addNetworkRequestBlockingPattern:"Add network request blocking pattern",removeAllNetworkRequestBlockingPatterns:"Remove all network request blocking patterns",allowToGenerateHarWithSensitiveData:"Allow to generate `HAR` with sensitive data",dontAllowToGenerateHarWithSensitiveData:"Don't allow to generate `HAR` with sensitive data",allowToGenerateHarWithSensitiveDataDocumentation:"By default generated HAR logs are sanitized and don't include `Cookie`, `Set-Cookie`, or `Authorization` HTTP headers. When this setting is enabled, options to export/copy HAR with sensitive data are provided."},f=t.i18n.registerUIStrings("panels/network/network-meta.ts",v),A=t.i18n.getLazilyComputedLocalizedString.bind(void 0,f),E=t.i18n.getLocalizedString.bind(void 0,f);let P;async function S(){return P||(P=await import("../../panels/network/network.js")),P}function b(e){return void 0===P?[]:e(P)}o.ViewManager.registerViewExtension({location:"panel",id:"network",commandPrompt:A(v.showNetwork),title:()=>n.Runtime.conditions.reactNativeExpoNetworkPanel()?E(v.networkExpoUnstable):E(v.network),order:40,loadView:async()=>(await S()).NetworkPanel.NetworkPanel.instance()}),o.ViewManager.registerViewExtension({location:"drawer-view",id:"network.blocked-urls",commandPrompt:A(v.showNetworkRequestBlocking),title:A(v.networkRequestBlocking),persistence:"closeable",order:60,loadView:async()=>new((await S()).BlockedURLsPane.BlockedURLsPane)}),o.ViewManager.registerViewExtension({location:"drawer-view",id:"network.config",commandPrompt:A(v.showNetworkConditions),title:A(v.networkConditions),persistence:"closeable",order:40,tags:[A(v.diskCache),A(v.networkThrottling),t.i18n.lockedLazyString("useragent"),t.i18n.lockedLazyString("user agent"),t.i18n.lockedLazyString("user-agent")],loadView:async()=>(await S()).NetworkConfigView.NetworkConfigView.instance()}),o.ViewManager.registerViewExtension({location:"network-sidebar",id:"network.search-network-tab",commandPrompt:A(v.showSearch),title:A(v.search),persistence:"permanent",loadView:async()=>(await S()).NetworkPanel.SearchNetworkView.instance()}),o.ActionRegistration.registerActionExtension({actionId:"network.toggle-recording",category:"NETWORK",iconClass:"record-start",toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,contextTypes:()=>b((e=>[e.NetworkPanel.NetworkPanel])),loadActionDelegate:async()=>new((await S()).NetworkPanel.ActionDelegate),options:[{value:!0,title:A(v.recordNetworkLog)},{value:!1,title:A(v.stopRecordingNetworkLog)}],bindings:[{shortcut:"Ctrl+E",platform:"windows,linux"},{shortcut:"Meta+E",platform:"mac"}]}),o.ActionRegistration.registerActionExtension({actionId:"network.clear",category:"NETWORK",title:A(v.clear),iconClass:"clear",loadActionDelegate:async()=>new((await S()).NetworkPanel.ActionDelegate),contextTypes:()=>b((e=>[e.NetworkPanel.NetworkPanel])),bindings:[{shortcut:"Ctrl+L"},{shortcut:"Meta+K",platform:"mac"}]}),o.ActionRegistration.registerActionExtension({actionId:"network.hide-request-details",category:"NETWORK",title:A(v.hideRequestDetails),contextTypes:()=>b((e=>[e.NetworkPanel.NetworkPanel])),loadActionDelegate:async()=>new((await S()).NetworkPanel.ActionDelegate),bindings:[{shortcut:"Esc"}]}),o.ActionRegistration.registerActionExtension({actionId:"network.search",category:"NETWORK",title:A(v.search),contextTypes:()=>b((e=>[e.NetworkPanel.NetworkPanel])),loadActionDelegate:async()=>new((await S()).NetworkPanel.ActionDelegate),bindings:[{platform:"mac",shortcut:"Meta+F",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+F",keybindSets:["devToolsDefault","vsCode"]}]}),o.ActionRegistration.registerActionExtension({actionId:"network.add-network-request-blocking-pattern",category:"NETWORK",title:A(v.addNetworkRequestBlockingPattern),iconClass:"plus",contextTypes:()=>b((e=>[e.BlockedURLsPane.BlockedURLsPane])),loadActionDelegate:async()=>new((await S()).BlockedURLsPane.ActionDelegate)}),o.ActionRegistration.registerActionExtension({actionId:"network.remove-all-network-request-blocking-patterns",category:"NETWORK",title:A(v.removeAllNetworkRequestBlockingPatterns),iconClass:"clear",contextTypes:()=>b((e=>[e.BlockedURLsPane.BlockedURLsPane])),loadActionDelegate:async()=>new((await S()).BlockedURLsPane.ActionDelegate)}),e.Settings.registerSettingExtension({category:"NETWORK",storageType:"Synced",title:A(v.allowToGenerateHarWithSensitiveData),settingName:"network.show-options-to-generate-har-with-sensitive-data",settingType:"boolean",defaultValue:!1,tags:[t.i18n.lockedLazyString("HAR")],options:[{value:!0,title:A(v.allowToGenerateHarWithSensitiveData)},{value:!1,title:A(v.dontAllowToGenerateHarWithSensitiveData)}],learnMore:{url:"https://goo.gle/devtools-export-hars",tooltip:A(v.allowToGenerateHarWithSensitiveDataDocumentation)}}),e.Settings.registerSettingExtension({category:"NETWORK",storageType:"Synced",title:A(v.colorcodeResourceTypes),settingName:"network-color-code-resource-types",settingType:"boolean",defaultValue:!1,tags:[A(v.colorCode),A(v.resourceType)],options:[{value:!0,title:A(v.colorCodeByResourceType)},{value:!1,title:A(v.useDefaultColors)}]}),e.Settings.registerSettingExtension({category:"NETWORK",storageType:"Synced",title:A(v.groupNetworkLogByFrame),settingName:"network.group-by-frame",settingType:"boolean",defaultValue:!1,tags:[A(v.netWork),A(v.frame),A(v.group)],options:[{value:!0,title:A(v.groupNetworkLogItemsByFrame)},{value:!1,title:A(v.dontGroupNetworkLogItemsByFrame)}]}),o.ViewManager.registerLocationResolver({name:"network-sidebar",category:"NETWORK",loadResolver:async()=>(await S()).NetworkPanel.NetworkPanel.instance()}),o.ContextMenu.registerProvider({contextTypes:()=>[i.NetworkRequest.NetworkRequest,i.Resource.Resource,a.UISourceCode.UISourceCode,i.TraceObject.RevealableNetworkRequest],loadProvider:async()=>(await S()).NetworkPanel.NetworkPanel.instance(),experiment:void 0}),e.Revealer.registerRevealer({contextTypes:()=>[i.NetworkRequest.NetworkRequest],destination:e.Revealer.RevealerDestination.NETWORK_PANEL,loadRevealer:async()=>new((await S()).NetworkPanel.RequestRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[s.UIRequestLocation.UIRequestLocation],destination:void 0,loadRevealer:async()=>new((await S()).NetworkPanel.RequestLocationRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[s.NetworkRequestId.NetworkRequestId],destination:e.Revealer.RevealerDestination.NETWORK_PANEL,loadRevealer:async()=>new((await S()).NetworkPanel.RequestIdRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[s.UIFilter.UIRequestFilter,r.ExtensionServer.RevealableNetworkRequestFilter],destination:e.Revealer.RevealerDestination.NETWORK_PANEL,loadRevealer:async()=>new((await S()).NetworkPanel.NetworkLogWithFilterRevealer)});const x={main:"Main",networkTitle:"Scripts",showNode:"Show Scripts"},D=t.i18n.registerUIStrings("entrypoints/js_app/js_app.ts",x),C=t.i18n.getLocalizedString.bind(void 0,D),L=t.i18n.getLazilyComputedLocalizedString.bind(void 0,D);let I,q;class M{static instance(e={forceNew:null}){const{forceNew:t}=e;return I&&!t||(I=new M),I}async run(){l.userMetrics.actionTaken(l.UserMetrics.Action.ConnectToNodeJSDirectly),i.Connections.initMainConnection((async()=>{i.TargetManager.TargetManager.instance().createTarget("main",C(x.main),i.Target.Type.NODE,null).runtimeAgent().invoke_runIfWaitingForDebugger()}),c.TargetDetachedDialog.TargetDetachedDialog.connectionLost)}}o.ViewManager.registerViewExtension({location:"navigator-view",id:"navigator-network",title:L(x.networkTitle),commandPrompt:L(x.showNode),order:2,persistence:"permanent",loadView:async()=>(await async function(){return q||(q=await import("../../panels/sources/sources.js")),q}()).SourcesNavigator.NetworkNavigatorView.instance()}),e.Runnable.registerEarlyInitializationRunnable(M.instance),new g.MainImpl.MainImpl;export{M as JsMainImpl}; diff --git a/packages/debugger-frontend/dist/third-party/front_end/entrypoints/main/main-meta.js b/packages/debugger-frontend/dist/third-party/front_end/entrypoints/main/main-meta.js index ef45bcecb434..cd2f3e2a953a 100644 --- a/packages/debugger-frontend/dist/third-party/front_end/entrypoints/main/main-meta.js +++ b/packages/debugger-frontend/dist/third-party/front_end/entrypoints/main/main-meta.js @@ -1 +1 @@ -import*as e from"../../core/common/common.js";import*as t from"../../core/host/host.js";import*as o from"../../core/i18n/i18n.js";import*as a from"../../core/sdk/sdk.js";import*as n from"../../models/workspace/workspace.js";import*as i from"../../ui/legacy/components/utils/utils.js";import*as r from"../../ui/legacy/legacy.js";const s={focusDebuggee:"Focus page",toggleDrawer:"Toggle drawer",nextPanel:"Next panel",previousPanel:"Previous panel",reloadDevtools:"Reload DevTools",restoreLastDockPosition:"Restore last dock position",zoomIn:"Zoom in",zoomOut:"Zoom out",resetZoomLevel:"Reset zoom level",searchInPanel:"Search in panel",cancelSearch:"Cancel search",findNextResult:"Find next result",findPreviousResult:"Find previous result",theme:"Theme:",switchToBrowserPreferredTheme:"Switch to browser's preferred theme",autoTheme:"Auto",switchToLightTheme:"Switch to light theme",lightCapital:"Light",switchToDarkTheme:"Switch to dark theme",darkCapital:"Dark",darkLower:"dark",lightLower:"light",panelLayout:"Panel layout:",useHorizontalPanelLayout:"Use horizontal panel layout",horizontal:"horizontal",useVerticalPanelLayout:"Use vertical panel layout",vertical:"vertical",useAutomaticPanelLayout:"Use automatic panel layout",auto:"auto",enableCtrlShortcutToSwitchPanels:"Enable Ctrl + 1-9 shortcut to switch panels",enableShortcutToSwitchPanels:"Enable โŒ˜ + 1-9 shortcut to switch panels",right:"Right",dockToRight:"Dock to right",bottom:"Bottom",dockToBottom:"Dock to bottom",left:"Left",dockToLeft:"Dock to left",undocked:"Undocked",undockIntoSeparateWindow:"Undock into separate window",devtoolsDefault:"DevTools (Default)",language:"Language:",browserLanguage:"Browser UI language",enableSync:"Enable settings sync",searchAsYouTypeSetting:"Search as you type",searchAsYouTypeCommand:"Enable search as you type",searchOnEnterCommand:"Disable search as you type (press Enter to search)",matchChromeColorScheme:"Match Chrome color scheme",matchChromeColorSchemeDocumentation:"Match DevTools colors to your customized Chrome theme (when enabled)",matchChromeColorSchemeCommand:"Match Chrome color scheme",dontMatchChromeColorSchemeCommand:"Don't match Chrome color scheme"},l=o.i18n.registerUIStrings("entrypoints/main/main-meta.ts",s),c=o.i18n.getLazilyComputedLocalizedString.bind(void 0,l);let u,d;async function m(){return u||(u=await import("./main.js")),u}function g(){return!t.InspectorFrontendHost.InspectorFrontendHostInstance.isHostedMode()}function h(e){return()=>o.i18n.getLocalizedLanguageRegion(e,o.DevToolsLocale.DevToolsLocale.instance())}r.ActionRegistration.registerActionExtension({category:"DRAWER",actionId:"inspector-main.focus-debuggee",loadActionDelegate:async()=>new((await async function(){return d||(d=await import("../inspector_main/inspector_main.js")),d}()).InspectorMain.FocusDebuggeeActionDelegate),order:100,title:c(s.focusDebuggee)}),r.ActionRegistration.registerActionExtension({category:"DRAWER",actionId:"main.toggle-drawer",loadActionDelegate:async()=>new r.InspectorView.ActionDelegate,order:101,title:c(s.toggleDrawer),bindings:[{shortcut:"Esc"}]}),r.ActionRegistration.registerActionExtension({actionId:"main.next-tab",category:"GLOBAL",title:c(s.nextPanel),loadActionDelegate:async()=>new r.InspectorView.ActionDelegate,bindings:[{platform:"windows,linux",shortcut:"Ctrl+]"},{platform:"mac",shortcut:"Meta+]"}]}),r.ActionRegistration.registerActionExtension({actionId:"main.previous-tab",category:"GLOBAL",title:c(s.previousPanel),loadActionDelegate:async()=>new r.InspectorView.ActionDelegate,bindings:[{platform:"windows,linux",shortcut:"Ctrl+["},{platform:"mac",shortcut:"Meta+["}]}),r.ActionRegistration.registerActionExtension({actionId:"main.debug-reload",category:"GLOBAL",title:c(s.reloadDevtools),loadActionDelegate:async()=>new((await m()).MainImpl.ReloadActionDelegate),bindings:[{shortcut:"Alt+R"}]}),r.ActionRegistration.registerActionExtension({category:"GLOBAL",title:c(s.restoreLastDockPosition),actionId:"main.toggle-dock",loadActionDelegate:async()=>new r.DockController.ToggleDockActionDelegate,bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+D"},{platform:"mac",shortcut:"Meta+Shift+D"}]}),r.ActionRegistration.registerActionExtension({actionId:"main.zoom-in",category:"GLOBAL",title:c(s.zoomIn),loadActionDelegate:async()=>new((await m()).MainImpl.ZoomActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Plus",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+Shift+Plus"},{platform:"windows,linux",shortcut:"Ctrl+NumpadPlus"},{platform:"windows,linux",shortcut:"Ctrl+Shift+NumpadPlus"},{platform:"mac",shortcut:"Meta+Plus",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+Shift+Plus"},{platform:"mac",shortcut:"Meta+NumpadPlus"},{platform:"mac",shortcut:"Meta+Shift+NumpadPlus"}],condition:g}),r.ActionRegistration.registerActionExtension({actionId:"main.zoom-out",category:"GLOBAL",title:c(s.zoomOut),loadActionDelegate:async()=>new((await m()).MainImpl.ZoomActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Minus",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+Shift+Minus"},{platform:"windows,linux",shortcut:"Ctrl+NumpadMinus"},{platform:"windows,linux",shortcut:"Ctrl+Shift+NumpadMinus"},{platform:"mac",shortcut:"Meta+Minus",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+Shift+Minus"},{platform:"mac",shortcut:"Meta+NumpadMinus"},{platform:"mac",shortcut:"Meta+Shift+NumpadMinus"}],condition:g}),r.ActionRegistration.registerActionExtension({actionId:"main.zoom-reset",category:"GLOBAL",title:c(s.resetZoomLevel),loadActionDelegate:async()=>new((await m()).MainImpl.ZoomActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+0"},{platform:"windows,linux",shortcut:"Ctrl+Numpad0"},{platform:"mac",shortcut:"Meta+Numpad0"},{platform:"mac",shortcut:"Meta+0"}],condition:g}),r.ActionRegistration.registerActionExtension({actionId:"main.search-in-panel.find",category:"GLOBAL",title:c(s.searchInPanel),loadActionDelegate:async()=>new((await m()).MainImpl.SearchActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+F",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+F",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"F3"}]}),r.ActionRegistration.registerActionExtension({actionId:"main.search-in-panel.cancel",category:"GLOBAL",title:c(s.cancelSearch),loadActionDelegate:async()=>new((await m()).MainImpl.SearchActionDelegate),order:10,bindings:[{shortcut:"Esc"}]}),r.ActionRegistration.registerActionExtension({actionId:"main.search-in-panel.find-next",category:"GLOBAL",title:c(s.findNextResult),loadActionDelegate:async()=>new((await m()).MainImpl.SearchActionDelegate),bindings:[{platform:"mac",shortcut:"Meta+G",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+G"},{platform:"windows,linux",shortcut:"F3",keybindSets:["devToolsDefault","vsCode"]}]}),r.ActionRegistration.registerActionExtension({actionId:"main.search-in-panel.find-previous",category:"GLOBAL",title:c(s.findPreviousResult),loadActionDelegate:async()=>new((await m()).MainImpl.SearchActionDelegate),bindings:[{platform:"mac",shortcut:"Meta+Shift+G",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+Shift+G"},{platform:"windows,linux",shortcut:"Shift+F3",keybindSets:["devToolsDefault","vsCode"]}]}),e.Settings.registerSettingExtension({category:"APPEARANCE",storageType:"Synced",title:c(s.theme),settingName:"ui-theme",settingType:"enum",defaultValue:"systemPreferred",reloadRequired:!1,options:[{title:c(s.switchToBrowserPreferredTheme),text:c(s.autoTheme),value:"systemPreferred"},{title:c(s.switchToLightTheme),text:c(s.lightCapital),value:"default"},{title:c(s.switchToDarkTheme),text:c(s.darkCapital),value:"dark"}],tags:[c(s.darkLower),c(s.lightLower)]}),e.Settings.registerSettingExtension({category:"APPEARANCE",storageType:"Synced",title:c(s.matchChromeColorScheme),settingName:"chrome-theme-colors",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:c(s.matchChromeColorSchemeCommand)},{value:!1,title:c(s.dontMatchChromeColorSchemeCommand)}],reloadRequired:!0,learnMore:{url:"https://goo.gle/devtools-customize-theme",tooltip:c(s.matchChromeColorSchemeDocumentation)}}),e.Settings.registerSettingExtension({category:"APPEARANCE",storageType:"Synced",title:c(s.panelLayout),settingName:"sidebar-position",settingType:"enum",defaultValue:"auto",options:[{title:c(s.useHorizontalPanelLayout),text:c(s.horizontal),value:"bottom"},{title:c(s.useVerticalPanelLayout),text:c(s.vertical),value:"right"},{title:c(s.useAutomaticPanelLayout),text:c(s.auto),value:"auto"}]}),e.Settings.registerSettingExtension({category:"APPEARANCE",storageType:"Synced",settingName:"language",settingType:"enum",title:c(s.language),defaultValue:"en-US",options:[{value:"browserLanguage",title:c(s.browserLanguage),text:c(s.browserLanguage)},...o.i18n.getAllSupportedDevToolsLocales().sort().map((e=>{return{value:t=e,title:h(t),text:h(t)};var t}))],reloadRequired:!0}),e.Settings.registerSettingExtension({category:"APPEARANCE",storageType:"Synced",title:"mac"===t.Platform.platform()?c(s.enableShortcutToSwitchPanels):c(s.enableCtrlShortcutToSwitchPanels),settingName:"shortcut-panel-switch",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({category:"GLOBAL",settingName:"currentDockState",settingType:"enum",defaultValue:"right",options:[{value:"right",text:c(s.right),title:c(s.dockToRight)},{value:"bottom",text:c(s.bottom),title:c(s.dockToBottom)},{value:"left",text:c(s.left),title:c(s.dockToLeft)},{value:"undocked",text:c(s.undocked),title:c(s.undockIntoSeparateWindow)}]}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"active-keybind-set",settingType:"enum",defaultValue:"devToolsDefault",options:[{value:"devToolsDefault",title:c(s.devtoolsDefault),text:c(s.devtoolsDefault)},{value:"vsCode",title:o.i18n.lockedLazyString("Visual Studio Code"),text:o.i18n.lockedLazyString("Visual Studio Code")}]}),e.Settings.registerSettingExtension({category:"SYNC",settingName:"sync-preferences",settingType:"boolean",title:c(s.enableSync),defaultValue:!1,reloadRequired:!0}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"user-shortcuts",settingType:"array",defaultValue:[]}),e.Settings.registerSettingExtension({category:"GLOBAL",storageType:"Local",title:c(s.searchAsYouTypeSetting),settingName:"search-as-you-type",settingType:"boolean",order:3,defaultValue:!0,options:[{value:!0,title:c(s.searchAsYouTypeCommand)},{value:!1,title:c(s.searchOnEnterCommand)}]}),r.ViewManager.registerLocationResolver({name:"drawer-view",category:"DRAWER",loadResolver:async()=>r.InspectorView.InspectorView.instance()}),r.ViewManager.registerLocationResolver({name:"drawer-sidebar",category:"DRAWER_SIDEBAR",loadResolver:async()=>r.InspectorView.InspectorView.instance()}),r.ViewManager.registerLocationResolver({name:"panel",category:"PANEL",loadResolver:async()=>r.InspectorView.InspectorView.instance()}),r.ContextMenu.registerProvider({contextTypes:()=>[n.UISourceCode.UISourceCode,a.Resource.Resource,a.NetworkRequest.NetworkRequest],loadProvider:async()=>new i.Linkifier.ContentProviderContextMenuProvider,experiment:void 0}),r.ContextMenu.registerProvider({contextTypes:()=>[Node],loadProvider:async()=>new r.XLink.ContextMenuProvider,experiment:void 0}),r.ContextMenu.registerProvider({contextTypes:()=>[Node],loadProvider:async()=>new i.Linkifier.LinkContextMenuProvider,experiment:void 0}),r.Toolbar.registerToolbarItem({separator:!0,location:"main-toolbar-left",order:100}),r.Toolbar.registerToolbarItem({separator:!0,order:97,location:"main-toolbar-right"}),r.Toolbar.registerToolbarItem({loadItem:async()=>(await m()).MainImpl.SettingsButtonProvider.instance(),order:99,location:"main-toolbar-right"}),r.Toolbar.registerToolbarItem({loadItem:async()=>(await m()).MainImpl.MainMenuItem.instance(),order:100,location:"main-toolbar-right"}),r.Toolbar.registerToolbarItem({loadItem:async()=>r.DockController.CloseButtonProvider.instance(),order:101,location:"main-toolbar-right"}),e.AppProvider.registerAppProvider({loadAppProvider:async()=>(await m()).SimpleApp.SimpleAppProvider.instance(),order:10}); +import*as e from"../../core/common/common.js";import*as t from"../../core/host/host.js";import*as o from"../../core/i18n/i18n.js";import"../../core/root/root.js";import*as a from"../../core/sdk/sdk.js";import*as i from"../../models/workspace/workspace.js";import*as n from"../../ui/legacy/components/utils/utils.js";import*as r from"../../ui/legacy/legacy.js";const s={focusDebuggee:"Focus page",toggleDrawer:"Toggle drawer",nextPanel:"Next panel",previousPanel:"Previous panel",reloadDevtools:"Reload DevTools",restoreLastDockPosition:"Restore last dock position",zoomIn:"Zoom in",zoomOut:"Zoom out",resetZoomLevel:"Reset zoom level",searchInPanel:"Search in panel",cancelSearch:"Cancel search",findNextResult:"Find next result",findPreviousResult:"Find previous result",theme:"Theme:",switchToBrowserPreferredTheme:"Switch to browser's preferred theme",autoTheme:"Auto",switchToLightTheme:"Switch to light theme",lightCapital:"Light",switchToDarkTheme:"Switch to dark theme",darkCapital:"Dark",darkLower:"dark",lightLower:"light",panelLayout:"Panel layout:",useHorizontalPanelLayout:"Use horizontal panel layout",horizontal:"horizontal",useVerticalPanelLayout:"Use vertical panel layout",vertical:"vertical",useAutomaticPanelLayout:"Use automatic panel layout",auto:"auto",enableCtrlShortcutToSwitchPanels:"Enable Ctrl + 1-9 shortcut to switch panels",enableShortcutToSwitchPanels:"Enable โŒ˜ + 1-9 shortcut to switch panels",right:"Right",dockToRight:"Dock to right",bottom:"Bottom",dockToBottom:"Dock to bottom",left:"Left",dockToLeft:"Dock to left",undocked:"Undocked",undockIntoSeparateWindow:"Undock into separate window",devtoolsDefault:"DevTools (Default)",language:"Language:",browserLanguage:"Browser UI language",enableSync:"Enable settings sync",searchAsYouTypeSetting:"Search as you type",searchAsYouTypeCommand:"Enable search as you type",searchOnEnterCommand:"Disable search as you type (press Enter to search)",matchChromeColorScheme:"Match Chrome color scheme",matchChromeColorSchemeDocumentation:"Match DevTools colors to your customized Chrome theme (when enabled)",matchChromeColorSchemeCommand:"Match Chrome color scheme",dontMatchChromeColorSchemeCommand:"Don't match Chrome color scheme"},l=o.i18n.registerUIStrings("entrypoints/main/main-meta.ts",s),c=o.i18n.getLazilyComputedLocalizedString.bind(void 0,l);let u,d;async function m(){return u||(u=await import("./main.js")),u}function g(){return!t.InspectorFrontendHost.InspectorFrontendHostInstance.isHostedMode()}function h(e){return()=>o.i18n.getLocalizedLanguageRegion(e,o.DevToolsLocale.DevToolsLocale.instance())}r.ActionRegistration.registerActionExtension({category:"DRAWER",actionId:"inspector-main.focus-debuggee",loadActionDelegate:async()=>new((await async function(){return d||(d=await import("../inspector_main/inspector_main.js")),d}()).InspectorMain.FocusDebuggeeActionDelegate),order:100,title:c(s.focusDebuggee)}),r.ActionRegistration.registerActionExtension({category:"DRAWER",actionId:"main.toggle-drawer",loadActionDelegate:async()=>new r.InspectorView.ActionDelegate,order:101,title:c(s.toggleDrawer),bindings:[{shortcut:"Esc"}]}),r.ActionRegistration.registerActionExtension({actionId:"main.next-tab",category:"GLOBAL",title:c(s.nextPanel),loadActionDelegate:async()=>new r.InspectorView.ActionDelegate,bindings:[{platform:"windows,linux",shortcut:"Ctrl+]"},{platform:"mac",shortcut:"Meta+]"}]}),r.ActionRegistration.registerActionExtension({actionId:"main.previous-tab",category:"GLOBAL",title:c(s.previousPanel),loadActionDelegate:async()=>new r.InspectorView.ActionDelegate,bindings:[{platform:"windows,linux",shortcut:"Ctrl+["},{platform:"mac",shortcut:"Meta+["}]}),r.ActionRegistration.registerActionExtension({actionId:"main.debug-reload",category:"GLOBAL",title:c(s.reloadDevtools),loadActionDelegate:async()=>new((await m()).MainImpl.ReloadActionDelegate),bindings:[{shortcut:"Alt+R"}]}),r.ActionRegistration.registerActionExtension({category:"GLOBAL",experiment:"!react-native-specific-ui",title:c(s.restoreLastDockPosition),actionId:"main.toggle-dock",loadActionDelegate:async()=>new r.DockController.ToggleDockActionDelegate,bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+D"},{platform:"mac",shortcut:"Meta+Shift+D"}]}),r.ActionRegistration.registerActionExtension({actionId:"main.zoom-in",category:"GLOBAL",title:c(s.zoomIn),loadActionDelegate:async()=>new((await m()).MainImpl.ZoomActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Plus",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+Shift+Plus"},{platform:"windows,linux",shortcut:"Ctrl+NumpadPlus"},{platform:"windows,linux",shortcut:"Ctrl+Shift+NumpadPlus"},{platform:"mac",shortcut:"Meta+Plus",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+Shift+Plus"},{platform:"mac",shortcut:"Meta+NumpadPlus"},{platform:"mac",shortcut:"Meta+Shift+NumpadPlus"}],condition:g}),r.ActionRegistration.registerActionExtension({actionId:"main.zoom-out",category:"GLOBAL",title:c(s.zoomOut),loadActionDelegate:async()=>new((await m()).MainImpl.ZoomActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Minus",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+Shift+Minus"},{platform:"windows,linux",shortcut:"Ctrl+NumpadMinus"},{platform:"windows,linux",shortcut:"Ctrl+Shift+NumpadMinus"},{platform:"mac",shortcut:"Meta+Minus",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+Shift+Minus"},{platform:"mac",shortcut:"Meta+NumpadMinus"},{platform:"mac",shortcut:"Meta+Shift+NumpadMinus"}],condition:g}),r.ActionRegistration.registerActionExtension({actionId:"main.zoom-reset",category:"GLOBAL",title:c(s.resetZoomLevel),loadActionDelegate:async()=>new((await m()).MainImpl.ZoomActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+0"},{platform:"windows,linux",shortcut:"Ctrl+Numpad0"},{platform:"mac",shortcut:"Meta+Numpad0"},{platform:"mac",shortcut:"Meta+0"}],condition:g}),r.ActionRegistration.registerActionExtension({actionId:"main.search-in-panel.find",category:"GLOBAL",title:c(s.searchInPanel),loadActionDelegate:async()=>new((await m()).MainImpl.SearchActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+F",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+F",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"F3"}]}),r.ActionRegistration.registerActionExtension({actionId:"main.search-in-panel.cancel",category:"GLOBAL",title:c(s.cancelSearch),loadActionDelegate:async()=>new((await m()).MainImpl.SearchActionDelegate),order:10,bindings:[{shortcut:"Esc"}]}),r.ActionRegistration.registerActionExtension({actionId:"main.search-in-panel.find-next",category:"GLOBAL",title:c(s.findNextResult),loadActionDelegate:async()=>new((await m()).MainImpl.SearchActionDelegate),bindings:[{platform:"mac",shortcut:"Meta+G",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+G"},{platform:"windows,linux",shortcut:"F3",keybindSets:["devToolsDefault","vsCode"]}]}),r.ActionRegistration.registerActionExtension({actionId:"main.search-in-panel.find-previous",category:"GLOBAL",title:c(s.findPreviousResult),loadActionDelegate:async()=>new((await m()).MainImpl.SearchActionDelegate),bindings:[{platform:"mac",shortcut:"Meta+Shift+G",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+Shift+G"},{platform:"windows,linux",shortcut:"Shift+F3",keybindSets:["devToolsDefault","vsCode"]}]}),e.Settings.registerSettingExtension({category:"APPEARANCE",storageType:"Synced",title:c(s.theme),settingName:"ui-theme",settingType:"enum",defaultValue:"systemPreferred",reloadRequired:!1,options:[{title:c(s.switchToBrowserPreferredTheme),text:c(s.autoTheme),value:"systemPreferred"},{title:c(s.switchToLightTheme),text:c(s.lightCapital),value:"default"},{title:c(s.switchToDarkTheme),text:c(s.darkCapital),value:"dark"}],tags:[c(s.darkLower),c(s.lightLower)]}),e.Settings.registerSettingExtension({category:"APPEARANCE",storageType:"Synced",title:c(s.matchChromeColorScheme),settingName:"chrome-theme-colors",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:c(s.matchChromeColorSchemeCommand)},{value:!1,title:c(s.dontMatchChromeColorSchemeCommand)}],reloadRequired:!0,learnMore:{url:"https://goo.gle/devtools-customize-theme",tooltip:c(s.matchChromeColorSchemeDocumentation)}}),e.Settings.registerSettingExtension({category:"APPEARANCE",storageType:"Synced",title:c(s.panelLayout),settingName:"sidebar-position",settingType:"enum",defaultValue:"auto",options:[{title:c(s.useHorizontalPanelLayout),text:c(s.horizontal),value:"bottom"},{title:c(s.useVerticalPanelLayout),text:c(s.vertical),value:"right"},{title:c(s.useAutomaticPanelLayout),text:c(s.auto),value:"auto"}]}),e.Settings.registerSettingExtension({category:"APPEARANCE",storageType:"Synced",settingName:"language",settingType:"enum",title:c(s.language),defaultValue:"en-US",options:[{value:"browserLanguage",title:c(s.browserLanguage),text:c(s.browserLanguage)},...o.i18n.getAllSupportedDevToolsLocales().sort().map((e=>{return{value:t=e,title:h(t),text:h(t)};var t}))],reloadRequired:!0}),e.Settings.registerSettingExtension({category:"APPEARANCE",storageType:"Synced",title:"mac"===t.Platform.platform()?c(s.enableShortcutToSwitchPanels):c(s.enableCtrlShortcutToSwitchPanels),settingName:"shortcut-panel-switch",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({category:"GLOBAL",experiment:"!react-native-specific-ui",settingName:"currentDockState",settingType:"enum",defaultValue:"right",options:[{value:"right",text:c(s.right),title:c(s.dockToRight)},{value:"bottom",text:c(s.bottom),title:c(s.dockToBottom)},{value:"left",text:c(s.left),title:c(s.dockToLeft)},{value:"undocked",text:c(s.undocked),title:c(s.undockIntoSeparateWindow)}]}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"active-keybind-set",settingType:"enum",defaultValue:"devToolsDefault",options:[{value:"devToolsDefault",title:c(s.devtoolsDefault),text:c(s.devtoolsDefault)},{value:"vsCode",title:o.i18n.lockedLazyString("Visual Studio Code"),text:o.i18n.lockedLazyString("Visual Studio Code")}]}),e.Settings.registerSettingExtension({category:"SYNC",settingName:"sync-preferences",settingType:"boolean",title:c(s.enableSync),defaultValue:!1,reloadRequired:!0}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"user-shortcuts",settingType:"array",defaultValue:[]}),e.Settings.registerSettingExtension({category:"GLOBAL",storageType:"Local",title:c(s.searchAsYouTypeSetting),settingName:"search-as-you-type",settingType:"boolean",order:3,defaultValue:!0,options:[{value:!0,title:c(s.searchAsYouTypeCommand)},{value:!1,title:c(s.searchOnEnterCommand)}]}),r.ViewManager.registerLocationResolver({name:"drawer-view",category:"DRAWER",loadResolver:async()=>r.InspectorView.InspectorView.instance()}),r.ViewManager.registerLocationResolver({name:"drawer-sidebar",category:"DRAWER_SIDEBAR",loadResolver:async()=>r.InspectorView.InspectorView.instance()}),r.ViewManager.registerLocationResolver({name:"panel",category:"PANEL",loadResolver:async()=>r.InspectorView.InspectorView.instance()}),r.ContextMenu.registerProvider({contextTypes:()=>[i.UISourceCode.UISourceCode,a.Resource.Resource,a.NetworkRequest.NetworkRequest],loadProvider:async()=>new n.Linkifier.ContentProviderContextMenuProvider,experiment:void 0}),r.ContextMenu.registerProvider({contextTypes:()=>[Node],loadProvider:async()=>new r.XLink.ContextMenuProvider,experiment:void 0}),r.ContextMenu.registerProvider({contextTypes:()=>[Node],loadProvider:async()=>new n.Linkifier.LinkContextMenuProvider,experiment:void 0}),r.Toolbar.registerToolbarItem({separator:!0,location:"main-toolbar-left",order:100}),r.Toolbar.registerToolbarItem({separator:!0,order:97,location:"main-toolbar-right"}),r.Toolbar.registerToolbarItem({loadItem:async()=>(await m()).MainImpl.SettingsButtonProvider.instance(),order:99,location:"main-toolbar-right"}),r.Toolbar.registerToolbarItem({loadItem:async()=>(await m()).MainImpl.MainMenuItem.instance(),order:100,location:"main-toolbar-right"}),r.Toolbar.registerToolbarItem({loadItem:async()=>r.DockController.CloseButtonProvider.instance(),order:101,location:"main-toolbar-right"}),e.AppProvider.registerAppProvider({loadAppProvider:async()=>(await m()).SimpleApp.SimpleAppProvider.instance(),order:10}); diff --git a/packages/debugger-frontend/dist/third-party/front_end/entrypoints/node_app/node_app.js b/packages/debugger-frontend/dist/third-party/front_end/entrypoints/node_app/node_app.js index 05db0e43e77b..293f0e8c7f7b 100644 --- a/packages/debugger-frontend/dist/third-party/front_end/entrypoints/node_app/node_app.js +++ b/packages/debugger-frontend/dist/third-party/front_end/entrypoints/node_app/node_app.js @@ -1 +1 @@ -import"../shell/shell.js";import*as e from"../../core/common/common.js";import*as t from"../../core/i18n/i18n.js";import*as o from"../../ui/legacy/legacy.js";import*as n from"../../core/root/root.js";import*as i from"../../core/sdk/sdk.js";import*as r from"../../models/extensions/extensions.js";import*as s from"../../models/workspace/workspace.js";import*as a from"../../panels/network/forward/forward.js";import*as c from"../main/main.js";import*as l from"../../core/host/host.js";import"../../ui/components/buttons/buttons.js";import*as d from"../../ui/legacy/components/utils/utils.js";const g={throttling:"Throttling",showThrottling:"Show Throttling",goOffline:"Go offline",device:"device",throttlingTag:"throttling",enableSlowGThrottling:"Enable slow `3G` throttling",enableFastGThrottling:"Enable fast `3G` throttling",goOnline:"Go online"},w=t.i18n.registerUIStrings("panels/mobile_throttling/mobile_throttling-meta.ts",g),p=t.i18n.getLazilyComputedLocalizedString.bind(void 0,w);let h;async function m(){return h||(h=await import("../../panels/mobile_throttling/mobile_throttling.js")),h}o.ViewManager.registerViewExtension({location:"settings-view",id:"throttling-conditions",title:p(g.throttling),commandPrompt:p(g.showThrottling),order:35,loadView:async()=>new((await m()).ThrottlingSettingsTab.ThrottlingSettingsTab),settings:["custom-network-conditions","calibrated-cpu-throttling"],iconName:"performance"}),o.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-offline",category:"NETWORK",title:p(g.goOffline),loadActionDelegate:async()=>new((await m()).ThrottlingManager.ActionDelegate),tags:[p(g.device),p(g.throttlingTag)]}),o.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-low-end-mobile",category:"NETWORK",title:p(g.enableSlowGThrottling),loadActionDelegate:async()=>new((await m()).ThrottlingManager.ActionDelegate),tags:[p(g.device),p(g.throttlingTag)]}),o.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-mid-tier-mobile",category:"NETWORK",title:p(g.enableFastGThrottling),loadActionDelegate:async()=>new((await m()).ThrottlingManager.ActionDelegate),tags:[p(g.device),p(g.throttlingTag)]}),o.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-online",category:"NETWORK",title:p(g.goOnline),loadActionDelegate:async()=>new((await m()).ThrottlingManager.ActionDelegate),tags:[p(g.device),p(g.throttlingTag)]}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"custom-network-conditions",settingType:"array",defaultValue:[]});const u={performance:"Performance",showPerformance:"Show Performance",showRecentTimelineSessions:"Show recent timeline sessions",record:"Record",stop:"Stop",recordAndReload:"Record and reload"},k=t.i18n.registerUIStrings("panels/js_timeline/js_timeline-meta.ts",u),v=t.i18n.getLazilyComputedLocalizedString.bind(void 0,k);let y;async function f(){return y||(y=await import("../../panels/timeline/timeline.js")),y}function T(e){return void 0===y?[]:e(y)}o.ViewManager.registerViewExtension({location:"panel",id:"timeline",title:v(u.performance),commandPrompt:v(u.showPerformance),order:66,hasToolbar:!1,isPreviewFeature:!0,loadView:async()=>(await f()).TimelinePanel.TimelinePanel.instance({forceNew:null,isNode:!0})}),o.ActionRegistration.registerActionExtension({actionId:"timeline.show-history",loadActionDelegate:async()=>new((await f()).TimelinePanel.ActionDelegate),category:"PERFORMANCE",title:v(u.showRecentTimelineSessions),contextTypes:()=>T((e=>[e.TimelinePanel.TimelinePanel])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+H"},{platform:"mac",shortcut:"Meta+Y"}]}),o.ActionRegistration.registerActionExtension({actionId:"timeline.toggle-recording",category:"PERFORMANCE",iconClass:"record-start",toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,contextTypes:()=>T((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await f()).TimelinePanel.ActionDelegate),options:[{value:!0,title:v(u.record)},{value:!1,title:v(u.stop)}],bindings:[{platform:"windows,linux",shortcut:"Ctrl+E"},{platform:"mac",shortcut:"Meta+E"}]}),o.ActionRegistration.registerActionExtension({actionId:"timeline.record-reload",iconClass:"refresh",contextTypes:()=>T((e=>[e.TimelinePanel.TimelinePanel])),category:"PERFORMANCE",title:v(u.recordAndReload),loadActionDelegate:async()=>new((await f()).TimelinePanel.ActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+E"},{platform:"mac",shortcut:"Meta+Shift+E"}]}),e.Settings.registerSettingExtension({category:"PERFORMANCE",storageType:"Synced",settingName:"annotations-hidden",settingType:"boolean",defaultValue:!0});const R={showNetwork:"Show Network",network:"Network",networkExpoUnstable:"Expo Network",showNetworkRequestBlocking:"Show Network request blocking",networkRequestBlocking:"Network request blocking",showNetworkConditions:"Show Network conditions",networkConditions:"Network conditions",diskCache:"disk cache",networkThrottling:"network throttling",showSearch:"Show Search",search:"Search",recordNetworkLog:"Record network log",stopRecordingNetworkLog:"Stop recording network log",hideRequestDetails:"Hide request details",colorcodeResourceTypes:"Color-code resource types",colorCode:"color code",resourceType:"resource type",colorCodeByResourceType:"Color code by resource type",useDefaultColors:"Use default colors",groupNetworkLogByFrame:"Group network log by frame",netWork:"network",frame:"frame",group:"group",groupNetworkLogItemsByFrame:"Group network log items by frame",dontGroupNetworkLogItemsByFrame:"Don't group network log items by frame",clear:"Clear network log",addNetworkRequestBlockingPattern:"Add network request blocking pattern",removeAllNetworkRequestBlockingPatterns:"Remove all network request blocking patterns",allowToGenerateHarWithSensitiveData:"Allow to generate `HAR` with sensitive data",dontAllowToGenerateHarWithSensitiveData:"Don't allow to generate `HAR` with sensitive data",allowToGenerateHarWithSensitiveDataDocumentation:"By default generated HAR logs are sanitized and don't include `Cookie`, `Set-Cookie`, or `Authorization` HTTP headers. When this setting is enabled, options to export/copy HAR with sensitive data are provided."},N=t.i18n.registerUIStrings("panels/network/network-meta.ts",R),x=t.i18n.getLazilyComputedLocalizedString.bind(void 0,N),C=t.i18n.getLocalizedString.bind(void 0,N);let D;async function E(){return D||(D=await import("../../panels/network/network.js")),D}function I(e){return void 0===D?[]:e(D)}o.ViewManager.registerViewExtension({location:"panel",id:"network",commandPrompt:x(R.showNetwork),title:()=>n.Runtime.conditions.reactNativeExpoNetworkPanel()?C(R.networkExpoUnstable):C(R.network),order:40,loadView:async()=>(await E()).NetworkPanel.NetworkPanel.instance()}),o.ViewManager.registerViewExtension({location:"drawer-view",id:"network.blocked-urls",commandPrompt:x(R.showNetworkRequestBlocking),title:x(R.networkRequestBlocking),persistence:"closeable",order:60,loadView:async()=>new((await E()).BlockedURLsPane.BlockedURLsPane)}),o.ViewManager.registerViewExtension({location:"drawer-view",id:"network.config",commandPrompt:x(R.showNetworkConditions),title:x(R.networkConditions),persistence:"closeable",order:40,tags:[x(R.diskCache),x(R.networkThrottling),t.i18n.lockedLazyString("useragent"),t.i18n.lockedLazyString("user agent"),t.i18n.lockedLazyString("user-agent")],loadView:async()=>(await E()).NetworkConfigView.NetworkConfigView.instance()}),o.ViewManager.registerViewExtension({location:"network-sidebar",id:"network.search-network-tab",commandPrompt:x(R.showSearch),title:x(R.search),persistence:"permanent",loadView:async()=>(await E()).NetworkPanel.SearchNetworkView.instance()}),o.ActionRegistration.registerActionExtension({actionId:"network.toggle-recording",category:"NETWORK",iconClass:"record-start",toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,contextTypes:()=>I((e=>[e.NetworkPanel.NetworkPanel])),loadActionDelegate:async()=>new((await E()).NetworkPanel.ActionDelegate),options:[{value:!0,title:x(R.recordNetworkLog)},{value:!1,title:x(R.stopRecordingNetworkLog)}],bindings:[{shortcut:"Ctrl+E",platform:"windows,linux"},{shortcut:"Meta+E",platform:"mac"}]}),o.ActionRegistration.registerActionExtension({actionId:"network.clear",category:"NETWORK",title:x(R.clear),iconClass:"clear",loadActionDelegate:async()=>new((await E()).NetworkPanel.ActionDelegate),contextTypes:()=>I((e=>[e.NetworkPanel.NetworkPanel])),bindings:[{shortcut:"Ctrl+L"},{shortcut:"Meta+K",platform:"mac"}]}),o.ActionRegistration.registerActionExtension({actionId:"network.hide-request-details",category:"NETWORK",title:x(R.hideRequestDetails),contextTypes:()=>I((e=>[e.NetworkPanel.NetworkPanel])),loadActionDelegate:async()=>new((await E()).NetworkPanel.ActionDelegate),bindings:[{shortcut:"Esc"}]}),o.ActionRegistration.registerActionExtension({actionId:"network.search",category:"NETWORK",title:x(R.search),contextTypes:()=>I((e=>[e.NetworkPanel.NetworkPanel])),loadActionDelegate:async()=>new((await E()).NetworkPanel.ActionDelegate),bindings:[{platform:"mac",shortcut:"Meta+F",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+F",keybindSets:["devToolsDefault","vsCode"]}]}),o.ActionRegistration.registerActionExtension({actionId:"network.add-network-request-blocking-pattern",category:"NETWORK",title:x(R.addNetworkRequestBlockingPattern),iconClass:"plus",contextTypes:()=>I((e=>[e.BlockedURLsPane.BlockedURLsPane])),loadActionDelegate:async()=>new((await E()).BlockedURLsPane.ActionDelegate)}),o.ActionRegistration.registerActionExtension({actionId:"network.remove-all-network-request-blocking-patterns",category:"NETWORK",title:x(R.removeAllNetworkRequestBlockingPatterns),iconClass:"clear",contextTypes:()=>I((e=>[e.BlockedURLsPane.BlockedURLsPane])),loadActionDelegate:async()=>new((await E()).BlockedURLsPane.ActionDelegate)}),e.Settings.registerSettingExtension({category:"NETWORK",storageType:"Synced",title:x(R.allowToGenerateHarWithSensitiveData),settingName:"network.show-options-to-generate-har-with-sensitive-data",settingType:"boolean",defaultValue:!1,tags:[t.i18n.lockedLazyString("HAR")],options:[{value:!0,title:x(R.allowToGenerateHarWithSensitiveData)},{value:!1,title:x(R.dontAllowToGenerateHarWithSensitiveData)}],learnMore:{url:"https://goo.gle/devtools-export-hars",tooltip:x(R.allowToGenerateHarWithSensitiveDataDocumentation)}}),e.Settings.registerSettingExtension({category:"NETWORK",storageType:"Synced",title:x(R.colorcodeResourceTypes),settingName:"network-color-code-resource-types",settingType:"boolean",defaultValue:!1,tags:[x(R.colorCode),x(R.resourceType)],options:[{value:!0,title:x(R.colorCodeByResourceType)},{value:!1,title:x(R.useDefaultColors)}]}),e.Settings.registerSettingExtension({category:"NETWORK",storageType:"Synced",title:x(R.groupNetworkLogByFrame),settingName:"network.group-by-frame",settingType:"boolean",defaultValue:!1,tags:[x(R.netWork),x(R.frame),x(R.group)],options:[{value:!0,title:x(R.groupNetworkLogItemsByFrame)},{value:!1,title:x(R.dontGroupNetworkLogItemsByFrame)}]}),o.ViewManager.registerLocationResolver({name:"network-sidebar",category:"NETWORK",loadResolver:async()=>(await E()).NetworkPanel.NetworkPanel.instance()}),o.ContextMenu.registerProvider({contextTypes:()=>[i.NetworkRequest.NetworkRequest,i.Resource.Resource,s.UISourceCode.UISourceCode,i.TraceObject.RevealableNetworkRequest],loadProvider:async()=>(await E()).NetworkPanel.NetworkPanel.instance(),experiment:void 0}),e.Revealer.registerRevealer({contextTypes:()=>[i.NetworkRequest.NetworkRequest],destination:e.Revealer.RevealerDestination.NETWORK_PANEL,loadRevealer:async()=>new((await E()).NetworkPanel.RequestRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[a.UIRequestLocation.UIRequestLocation],destination:void 0,loadRevealer:async()=>new((await E()).NetworkPanel.RequestLocationRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[a.NetworkRequestId.NetworkRequestId],destination:e.Revealer.RevealerDestination.NETWORK_PANEL,loadRevealer:async()=>new((await E()).NetworkPanel.RequestIdRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[a.UIFilter.UIRequestFilter,r.ExtensionServer.RevealableNetworkRequestFilter],destination:e.Revealer.RevealerDestination.NETWORK_PANEL,loadRevealer:async()=>new((await E()).NetworkPanel.NetworkLogWithFilterRevealer)});var A={cssText:`.add-network-target-button{margin:10px 25px;align-self:center}.network-discovery-list{flex:none;max-width:600px;max-height:202px;margin:20px 0 5px}.network-discovery-list-empty{flex:auto;height:30px;display:flex;align-items:center;justify-content:center}.network-discovery-list-item{padding:3px 5px;height:30px;display:flex;align-items:center;position:relative;flex:auto 1 1}.network-discovery-value{flex:3 1 0}.list-item .network-discovery-value{white-space:nowrap;text-overflow:ellipsis;user-select:none;color:var(--sys-color-on-surface);overflow:hidden}.network-discovery-edit-row{flex:none;display:flex;flex-direction:row;margin:6px 5px;align-items:center}.network-discovery-edit-row input{width:100%;text-align:inherit}.network-discovery-footer{margin:0;overflow:hidden;max-width:500px;padding:3px}.network-discovery-footer > *{white-space:pre-wrap}.node-panel{align-items:center;justify-content:flex-start;overflow-y:auto}.network-discovery-view{min-width:400px;text-align:left}:host-context(.node-frontend) .network-discovery-list-empty{height:40px}:host-context(.node-frontend) .network-discovery-list-item{padding:3px 15px;height:40px}.node-panel-center{max-width:600px;padding-top:50px;text-align:center}.node-panel-logo{width:400px;margin-bottom:50px}:host-context(.node-frontend) .network-discovery-edit-row input{height:30px;padding-left:5px}:host-context(.node-frontend) .network-discovery-edit-row{margin:6px 9px}\n/*# sourceURL=${import.meta.resolve("./nodeConnectionsPanel.css")} */\n`};const S={nodejsDebuggingGuide:"Node.js debugging guide",specifyNetworkEndpointAnd:"Specify network endpoint and DevTools will connect to it automatically. Read {PH1} to learn more.",noConnectionsSpecified:"No connections specified",addConnection:"Add connection",networkAddressEgLocalhost:"Network address (e.g. localhost:9229)"},b=t.i18n.registerUIStrings("entrypoints/node_app/NodeConnectionsPanel.ts",S),P=t.i18n.getLocalizedString.bind(void 0,b),L=new URL("../../Images/node-stack-icon.svg",import.meta.url).toString();class M extends o.Panel.Panel{#e;#t;constructor(){super("node-connection"),this.contentElement.classList.add("node-panel");const e=this.contentElement.createChild("div","node-panel-center");e.createChild("img","node-panel-logo").src=L,l.InspectorFrontendHost.InspectorFrontendHostInstance.events.addEventListener(l.InspectorFrontendHostAPI.Events.DevicesDiscoveryConfigChanged,this.#o,this),this.contentElement.tabIndex=0,this.setDefaultFocusedElement(this.contentElement),l.InspectorFrontendHost.InspectorFrontendHostInstance.setDevicesUpdatesEnabled(!1),l.InspectorFrontendHost.InspectorFrontendHostInstance.setDevicesUpdatesEnabled(!0),this.#t=new F((e=>{this.#e.networkDiscoveryConfig=e,l.InspectorFrontendHost.InspectorFrontendHostInstance.setDevicesDiscoveryConfig(this.#e)})),this.#t.show(e)}#o({data:e}){this.#e=e,this.#t.discoveryConfigChanged(this.#e.networkDiscoveryConfig)}wasShown(){super.wasShown(),this.registerRequiredCSS(A)}}class F extends o.Widget.VBox{#n;#i;#r;#s;constructor(e){super(),this.#n=e,this.element.classList.add("network-discovery-view");const n=this.element.createChild("div","network-discovery-footer"),i=o.XLink.XLink.create("https://nodejs.org/en/docs/inspector/",P(S.nodejsDebuggingGuide),void 0,void 0,"node-js-debugging");n.appendChild(t.i18n.getFormatLocalizedString(b,S.specifyNetworkEndpointAnd,{PH1:i})),this.#i=new o.ListWidget.ListWidget(this),this.#i.registerRequiredCSS(A),this.#i.element.classList.add("network-discovery-list");const r=document.createElement("div");r.classList.add("network-discovery-list-empty"),r.textContent=P(S.noConnectionsSpecified),this.#i.setEmptyPlaceholder(r),this.#i.show(this.element),this.#r=null;const s=o.UIUtils.createTextButton(P(S.addConnection),this.#a.bind(this),{className:"add-network-target-button",variant:"primary"});this.element.appendChild(s),this.#s=[],this.element.classList.add("node-frontend")}#c(){const e=this.#s.map((e=>e.address));this.#n.call(null,e)}#a(){this.#i.addNewItem(this.#s.length,{address:"",port:""})}discoveryConfigChanged(e){this.#s=[],this.#i.clear();for(const t of e){const e={address:t,port:""};this.#s.push(e),this.#i.appendItem(e,!0)}}renderItem(e,t){const o=document.createElement("div");return o.classList.add("network-discovery-list-item"),o.createChild("div","network-discovery-value network-discovery-address").textContent=e.address,o}removeItemRequested(e,t){this.#s.splice(t,1),this.#i.removeItem(t),this.#c()}commitEdit(e,t,o){e.address=t.control("address").value.trim(),o&&this.#s.push(e),this.#c()}beginEdit(e){const t=this.#l();return t.control("address").value=e.address,t}#l(){if(this.#r)return this.#r;const e=new o.ListWidget.Editor;this.#r=e;const t=e.contentElement().createChild("div","network-discovery-edit-row"),n=e.createInput("address","text",P(S.networkAddressEgLocalhost),(function(e,t,o){const n=o.value.trim().match(/^([a-zA-Z0-9\.\-_]+):(\d+)$/);if(!n)return{valid:!1,errorMessage:void 0};return{valid:parseInt(n[2],10)<=65535,errorMessage:void 0}}));return t.createChild("div","network-discovery-value network-discovery-address").appendChild(n),e}}const H={main:"Main",nodejsS:"Node.js: {PH1}",NodejsTitleS:"DevTools - Node.js: {PH1}"},V=t.i18n.registerUIStrings("entrypoints/node_app/NodeMain.ts",H),W=t.i18n.getLocalizedString.bind(void 0,V);let q;class j{static instance(e={forceNew:null}){const{forceNew:t}=e;return q&&!t||(q=new j),q}async run(){l.userMetrics.actionTaken(l.UserMetrics.Action.ConnectToNodeJSFromFrontend),i.Connections.initMainConnection((async()=>{i.TargetManager.TargetManager.instance().createTarget("main",W(H.main),i.Target.Type.BROWSER,null).setInspectedURL("Node.js")}),d.TargetDetachedDialog.TargetDetachedDialog.connectionLost)}}class U extends i.SDKModel.SDKModel{#d;#g;#w;#p=new Map;#h=new Map;constructor(e){super(e),this.#d=e.targetManager(),this.#g=e,this.#w=e.targetAgent(),e.registerTargetDispatcher(this),this.#w.invoke_setDiscoverTargets({discover:!0}),l.InspectorFrontendHost.InspectorFrontendHostInstance.events.addEventListener(l.InspectorFrontendHostAPI.Events.DevicesDiscoveryConfigChanged,this.#o,this),l.InspectorFrontendHost.InspectorFrontendHostInstance.setDevicesUpdatesEnabled(!1),l.InspectorFrontendHost.InspectorFrontendHostInstance.setDevicesUpdatesEnabled(!0)}#o({data:e}){const t=[];for(const o of e.networkDiscoveryConfig){const e=o.split(":"),n=parseInt(e[1],10);e[0]&&n&&t.push({host:e[0],port:n})}this.#w.invoke_setRemoteLocations({locations:t})}dispose(){l.InspectorFrontendHost.InspectorFrontendHostInstance.events.removeEventListener(l.InspectorFrontendHostAPI.Events.DevicesDiscoveryConfigChanged,this.#o,this);for(const e of this.#p.keys())this.detachedFromTarget({sessionId:e})}targetCreated({targetInfo:e}){"node"!==e.type||e.attached||this.#w.invoke_attachToTarget({targetId:e.targetId,flatten:!1})}targetInfoChanged(e){}targetDestroyed(e){}attachedToTarget({sessionId:e,targetInfo:t}){const o=W(H.nodejsS,{PH1:t.url});document.title=W(H.NodejsTitleS,{PH1:t.url});const n=new B(this.#w,e);this.#h.set(e,n);const r=this.#d.createTarget(t.targetId,o,i.Target.Type.NODE,this.#g,void 0,void 0,n);this.#p.set(e,r),r.runtimeAgent().invoke_runIfWaitingForDebugger()}detachedFromTarget({sessionId:e}){const t=this.#p.get(e);t&&t.dispose("target terminated"),this.#p.delete(e),this.#h.delete(e)}receivedMessageFromTarget({sessionId:e,message:t}){const o=this.#h.get(e),n=o?o.onMessage:null;n&&n.call(null,t)}targetCrashed(e){}}class B{#w;#m;onMessage;#u;constructor(e,t){this.#w=e,this.#m=t,this.onMessage=null,this.#u=null}setOnMessage(e){this.onMessage=e}setOnDisconnect(e){this.#u=e}sendRawMessage(e){this.#w.invoke_sendMessageToTarget({message:e,sessionId:this.#m})}async disconnect(){this.#u&&this.#u.call(null,"force disconnect"),this.#u=null,this.onMessage=null,await this.#w.invoke_detachFromTarget({sessionId:this.#m})}}i.SDKModel.SDKModel.register(U,{capabilities:32,autostart:!0});const O={connection:"Connection",node:"node",showConnection:"Show Connection",networkTitle:"Node",showNode:"Show Node"},K=t.i18n.registerUIStrings("entrypoints/node_app/node_app.ts",O),G=t.i18n.getLazilyComputedLocalizedString.bind(void 0,K);let z;o.ViewManager.registerViewExtension({location:"panel",id:"node-connection",title:G(O.connection),commandPrompt:G(O.showConnection),order:0,loadView:async()=>new M,tags:[G(O.node)]}),o.ViewManager.registerViewExtension({location:"navigator-view",id:"navigator-network",title:G(O.networkTitle),commandPrompt:G(O.showNode),order:2,persistence:"permanent",loadView:async()=>(await async function(){return z||(z=await import("../../panels/sources/sources.js")),z}()).SourcesNavigator.NetworkNavigatorView.instance()}),self.runtime=n.Runtime.Runtime.instance({forceNew:!0}),e.Runnable.registerEarlyInitializationRunnable(j.instance),new c.MainImpl.MainImpl; +import"../shell/shell.js";import*as e from"../../core/common/common.js";import*as t from"../../core/i18n/i18n.js";import*as o from"../../core/root/root.js";import*as n from"../../ui/legacy/legacy.js";import*as i from"../../core/sdk/sdk.js";import*as r from"../../models/extensions/extensions.js";import*as s from"../../models/workspace/workspace.js";import*as a from"../../panels/network/forward/forward.js";import*as c from"../main/main.js";import*as l from"../../core/host/host.js";import"../../ui/components/buttons/buttons.js";import*as d from"../../ui/legacy/components/utils/utils.js";const g={throttling:"Throttling",showThrottling:"Show Throttling",goOffline:"Go offline",device:"device",throttlingTag:"throttling",enableSlowGThrottling:"Enable slow `3G` throttling",enableFastGThrottling:"Enable fast `3G` throttling",goOnline:"Go online"},w=t.i18n.registerUIStrings("panels/mobile_throttling/mobile_throttling-meta.ts",g),p=t.i18n.getLazilyComputedLocalizedString.bind(void 0,w);let h;async function m(){return h||(h=await import("../../panels/mobile_throttling/mobile_throttling.js")),h}n.ViewManager.registerViewExtension({location:"settings-view",id:"throttling-conditions",title:p(g.throttling),commandPrompt:p(g.showThrottling),order:35,loadView:async()=>new((await m()).ThrottlingSettingsTab.ThrottlingSettingsTab),settings:["custom-network-conditions","calibrated-cpu-throttling"],iconName:"performance"}),n.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-offline",category:"NETWORK",experiment:"!react-native-specific-ui",title:p(g.goOffline),loadActionDelegate:async()=>new((await m()).ThrottlingManager.ActionDelegate),tags:[p(g.device),p(g.throttlingTag)]}),n.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-low-end-mobile",category:"NETWORK",experiment:"!react-native-specific-ui",title:p(g.enableSlowGThrottling),loadActionDelegate:async()=>new((await m()).ThrottlingManager.ActionDelegate),tags:[p(g.device),p(g.throttlingTag)]}),n.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-mid-tier-mobile",category:"NETWORK",experiment:"!react-native-specific-ui",title:p(g.enableFastGThrottling),loadActionDelegate:async()=>new((await m()).ThrottlingManager.ActionDelegate),tags:[p(g.device),p(g.throttlingTag)]}),n.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-online",category:"NETWORK",experiment:"!react-native-specific-ui",title:p(g.goOnline),loadActionDelegate:async()=>new((await m()).ThrottlingManager.ActionDelegate),tags:[p(g.device),p(g.throttlingTag)]}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"custom-network-conditions",settingType:"array",defaultValue:[]});const u={performance:"Performance",showPerformance:"Show Performance",showRecentTimelineSessions:"Show recent timeline sessions",record:"Record",stop:"Stop",recordAndReload:"Record and reload"},k=t.i18n.registerUIStrings("panels/js_timeline/js_timeline-meta.ts",u),v=t.i18n.getLazilyComputedLocalizedString.bind(void 0,k);let y;async function f(){return y||(y=await import("../../panels/timeline/timeline.js")),y}function T(e){return void 0===y?[]:e(y)}n.ViewManager.registerViewExtension({location:"panel",id:"timeline",title:v(u.performance),commandPrompt:v(u.showPerformance),order:66,hasToolbar:!1,isPreviewFeature:!0,loadView:async()=>(await f()).TimelinePanel.TimelinePanel.instance({forceNew:null,isNode:!0})}),n.ActionRegistration.registerActionExtension({actionId:"timeline.show-history",loadActionDelegate:async()=>new((await f()).TimelinePanel.ActionDelegate),category:"PERFORMANCE",title:v(u.showRecentTimelineSessions),contextTypes:()=>T((e=>[e.TimelinePanel.TimelinePanel])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+H"},{platform:"mac",shortcut:"Meta+Y"}]}),n.ActionRegistration.registerActionExtension({actionId:"timeline.toggle-recording",category:"PERFORMANCE",iconClass:"record-start",toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,contextTypes:()=>T((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await f()).TimelinePanel.ActionDelegate),options:[{value:!0,title:v(u.record)},{value:!1,title:v(u.stop)}],bindings:[{platform:"windows,linux",shortcut:"Ctrl+E"},{platform:"mac",shortcut:"Meta+E"}]}),n.ActionRegistration.registerActionExtension({actionId:"timeline.record-reload",iconClass:"refresh",contextTypes:()=>T((e=>[e.TimelinePanel.TimelinePanel])),category:"PERFORMANCE",title:v(u.recordAndReload),loadActionDelegate:async()=>new((await f()).TimelinePanel.ActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+E"},{platform:"mac",shortcut:"Meta+Shift+E"}]}),e.Settings.registerSettingExtension({category:"PERFORMANCE",storageType:"Synced",settingName:"annotations-hidden",settingType:"boolean",defaultValue:!0});const R={showNetwork:"Show Network",network:"Network",networkExpoUnstable:"Expo Network",showNetworkRequestBlocking:"Show Network request blocking",networkRequestBlocking:"Network request blocking",showNetworkConditions:"Show Network conditions",networkConditions:"Network conditions",diskCache:"disk cache",networkThrottling:"network throttling",showSearch:"Show Search",search:"Search",recordNetworkLog:"Record network log",stopRecordingNetworkLog:"Stop recording network log",hideRequestDetails:"Hide request details",colorcodeResourceTypes:"Color-code resource types",colorCode:"color code",resourceType:"resource type",colorCodeByResourceType:"Color code by resource type",useDefaultColors:"Use default colors",groupNetworkLogByFrame:"Group network log by frame",netWork:"network",frame:"frame",group:"group",groupNetworkLogItemsByFrame:"Group network log items by frame",dontGroupNetworkLogItemsByFrame:"Don't group network log items by frame",clear:"Clear network log",addNetworkRequestBlockingPattern:"Add network request blocking pattern",removeAllNetworkRequestBlockingPatterns:"Remove all network request blocking patterns",allowToGenerateHarWithSensitiveData:"Allow to generate `HAR` with sensitive data",dontAllowToGenerateHarWithSensitiveData:"Don't allow to generate `HAR` with sensitive data",allowToGenerateHarWithSensitiveDataDocumentation:"By default generated HAR logs are sanitized and don't include `Cookie`, `Set-Cookie`, or `Authorization` HTTP headers. When this setting is enabled, options to export/copy HAR with sensitive data are provided."},N=t.i18n.registerUIStrings("panels/network/network-meta.ts",R),x=t.i18n.getLazilyComputedLocalizedString.bind(void 0,N),C=t.i18n.getLocalizedString.bind(void 0,N);let D;async function E(){return D||(D=await import("../../panels/network/network.js")),D}function I(e){return void 0===D?[]:e(D)}n.ViewManager.registerViewExtension({location:"panel",id:"network",commandPrompt:x(R.showNetwork),title:()=>o.Runtime.conditions.reactNativeExpoNetworkPanel()?C(R.networkExpoUnstable):C(R.network),order:40,loadView:async()=>(await E()).NetworkPanel.NetworkPanel.instance()}),n.ViewManager.registerViewExtension({location:"drawer-view",id:"network.blocked-urls",commandPrompt:x(R.showNetworkRequestBlocking),title:x(R.networkRequestBlocking),persistence:"closeable",order:60,loadView:async()=>new((await E()).BlockedURLsPane.BlockedURLsPane)}),n.ViewManager.registerViewExtension({location:"drawer-view",id:"network.config",commandPrompt:x(R.showNetworkConditions),title:x(R.networkConditions),persistence:"closeable",order:40,tags:[x(R.diskCache),x(R.networkThrottling),t.i18n.lockedLazyString("useragent"),t.i18n.lockedLazyString("user agent"),t.i18n.lockedLazyString("user-agent")],loadView:async()=>(await E()).NetworkConfigView.NetworkConfigView.instance()}),n.ViewManager.registerViewExtension({location:"network-sidebar",id:"network.search-network-tab",commandPrompt:x(R.showSearch),title:x(R.search),persistence:"permanent",loadView:async()=>(await E()).NetworkPanel.SearchNetworkView.instance()}),n.ActionRegistration.registerActionExtension({actionId:"network.toggle-recording",category:"NETWORK",iconClass:"record-start",toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,contextTypes:()=>I((e=>[e.NetworkPanel.NetworkPanel])),loadActionDelegate:async()=>new((await E()).NetworkPanel.ActionDelegate),options:[{value:!0,title:x(R.recordNetworkLog)},{value:!1,title:x(R.stopRecordingNetworkLog)}],bindings:[{shortcut:"Ctrl+E",platform:"windows,linux"},{shortcut:"Meta+E",platform:"mac"}]}),n.ActionRegistration.registerActionExtension({actionId:"network.clear",category:"NETWORK",title:x(R.clear),iconClass:"clear",loadActionDelegate:async()=>new((await E()).NetworkPanel.ActionDelegate),contextTypes:()=>I((e=>[e.NetworkPanel.NetworkPanel])),bindings:[{shortcut:"Ctrl+L"},{shortcut:"Meta+K",platform:"mac"}]}),n.ActionRegistration.registerActionExtension({actionId:"network.hide-request-details",category:"NETWORK",title:x(R.hideRequestDetails),contextTypes:()=>I((e=>[e.NetworkPanel.NetworkPanel])),loadActionDelegate:async()=>new((await E()).NetworkPanel.ActionDelegate),bindings:[{shortcut:"Esc"}]}),n.ActionRegistration.registerActionExtension({actionId:"network.search",category:"NETWORK",title:x(R.search),contextTypes:()=>I((e=>[e.NetworkPanel.NetworkPanel])),loadActionDelegate:async()=>new((await E()).NetworkPanel.ActionDelegate),bindings:[{platform:"mac",shortcut:"Meta+F",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+F",keybindSets:["devToolsDefault","vsCode"]}]}),n.ActionRegistration.registerActionExtension({actionId:"network.add-network-request-blocking-pattern",category:"NETWORK",title:x(R.addNetworkRequestBlockingPattern),iconClass:"plus",contextTypes:()=>I((e=>[e.BlockedURLsPane.BlockedURLsPane])),loadActionDelegate:async()=>new((await E()).BlockedURLsPane.ActionDelegate)}),n.ActionRegistration.registerActionExtension({actionId:"network.remove-all-network-request-blocking-patterns",category:"NETWORK",title:x(R.removeAllNetworkRequestBlockingPatterns),iconClass:"clear",contextTypes:()=>I((e=>[e.BlockedURLsPane.BlockedURLsPane])),loadActionDelegate:async()=>new((await E()).BlockedURLsPane.ActionDelegate)}),e.Settings.registerSettingExtension({category:"NETWORK",storageType:"Synced",title:x(R.allowToGenerateHarWithSensitiveData),settingName:"network.show-options-to-generate-har-with-sensitive-data",settingType:"boolean",defaultValue:!1,tags:[t.i18n.lockedLazyString("HAR")],options:[{value:!0,title:x(R.allowToGenerateHarWithSensitiveData)},{value:!1,title:x(R.dontAllowToGenerateHarWithSensitiveData)}],learnMore:{url:"https://goo.gle/devtools-export-hars",tooltip:x(R.allowToGenerateHarWithSensitiveDataDocumentation)}}),e.Settings.registerSettingExtension({category:"NETWORK",storageType:"Synced",title:x(R.colorcodeResourceTypes),settingName:"network-color-code-resource-types",settingType:"boolean",defaultValue:!1,tags:[x(R.colorCode),x(R.resourceType)],options:[{value:!0,title:x(R.colorCodeByResourceType)},{value:!1,title:x(R.useDefaultColors)}]}),e.Settings.registerSettingExtension({category:"NETWORK",storageType:"Synced",title:x(R.groupNetworkLogByFrame),settingName:"network.group-by-frame",settingType:"boolean",defaultValue:!1,tags:[x(R.netWork),x(R.frame),x(R.group)],options:[{value:!0,title:x(R.groupNetworkLogItemsByFrame)},{value:!1,title:x(R.dontGroupNetworkLogItemsByFrame)}]}),n.ViewManager.registerLocationResolver({name:"network-sidebar",category:"NETWORK",loadResolver:async()=>(await E()).NetworkPanel.NetworkPanel.instance()}),n.ContextMenu.registerProvider({contextTypes:()=>[i.NetworkRequest.NetworkRequest,i.Resource.Resource,s.UISourceCode.UISourceCode,i.TraceObject.RevealableNetworkRequest],loadProvider:async()=>(await E()).NetworkPanel.NetworkPanel.instance(),experiment:void 0}),e.Revealer.registerRevealer({contextTypes:()=>[i.NetworkRequest.NetworkRequest],destination:e.Revealer.RevealerDestination.NETWORK_PANEL,loadRevealer:async()=>new((await E()).NetworkPanel.RequestRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[a.UIRequestLocation.UIRequestLocation],destination:void 0,loadRevealer:async()=>new((await E()).NetworkPanel.RequestLocationRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[a.NetworkRequestId.NetworkRequestId],destination:e.Revealer.RevealerDestination.NETWORK_PANEL,loadRevealer:async()=>new((await E()).NetworkPanel.RequestIdRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[a.UIFilter.UIRequestFilter,r.ExtensionServer.RevealableNetworkRequestFilter],destination:e.Revealer.RevealerDestination.NETWORK_PANEL,loadRevealer:async()=>new((await E()).NetworkPanel.NetworkLogWithFilterRevealer)});var A={cssText:`.add-network-target-button{margin:10px 25px;align-self:center}.network-discovery-list{flex:none;max-width:600px;max-height:202px;margin:20px 0 5px}.network-discovery-list-empty{flex:auto;height:30px;display:flex;align-items:center;justify-content:center}.network-discovery-list-item{padding:3px 5px;height:30px;display:flex;align-items:center;position:relative;flex:auto 1 1}.network-discovery-value{flex:3 1 0}.list-item .network-discovery-value{white-space:nowrap;text-overflow:ellipsis;user-select:none;color:var(--sys-color-on-surface);overflow:hidden}.network-discovery-edit-row{flex:none;display:flex;flex-direction:row;margin:6px 5px;align-items:center}.network-discovery-edit-row input{width:100%;text-align:inherit}.network-discovery-footer{margin:0;overflow:hidden;max-width:500px;padding:3px}.network-discovery-footer > *{white-space:pre-wrap}.node-panel{align-items:center;justify-content:flex-start;overflow-y:auto}.network-discovery-view{min-width:400px;text-align:left}:host-context(.node-frontend) .network-discovery-list-empty{height:40px}:host-context(.node-frontend) .network-discovery-list-item{padding:3px 15px;height:40px}.node-panel-center{max-width:600px;padding-top:50px;text-align:center}.node-panel-logo{width:400px;margin-bottom:50px}:host-context(.node-frontend) .network-discovery-edit-row input{height:30px;padding-left:5px}:host-context(.node-frontend) .network-discovery-edit-row{margin:6px 9px}\n/*# sourceURL=${import.meta.resolve("./nodeConnectionsPanel.css")} */\n`};const S={nodejsDebuggingGuide:"Node.js debugging guide",specifyNetworkEndpointAnd:"Specify network endpoint and DevTools will connect to it automatically. Read {PH1} to learn more.",noConnectionsSpecified:"No connections specified",addConnection:"Add connection",networkAddressEgLocalhost:"Network address (e.g. localhost:9229)"},b=t.i18n.registerUIStrings("entrypoints/node_app/NodeConnectionsPanel.ts",S),P=t.i18n.getLocalizedString.bind(void 0,b),L=new URL("../../Images/node-stack-icon.svg",import.meta.url).toString();class M extends n.Panel.Panel{#e;#t;constructor(){super("node-connection"),this.contentElement.classList.add("node-panel");const e=this.contentElement.createChild("div","node-panel-center");e.createChild("img","node-panel-logo").src=L,l.InspectorFrontendHost.InspectorFrontendHostInstance.events.addEventListener(l.InspectorFrontendHostAPI.Events.DevicesDiscoveryConfigChanged,this.#o,this),this.contentElement.tabIndex=0,this.setDefaultFocusedElement(this.contentElement),l.InspectorFrontendHost.InspectorFrontendHostInstance.setDevicesUpdatesEnabled(!1),l.InspectorFrontendHost.InspectorFrontendHostInstance.setDevicesUpdatesEnabled(!0),this.#t=new F((e=>{this.#e.networkDiscoveryConfig=e,l.InspectorFrontendHost.InspectorFrontendHostInstance.setDevicesDiscoveryConfig(this.#e)})),this.#t.show(e)}#o({data:e}){this.#e=e,this.#t.discoveryConfigChanged(this.#e.networkDiscoveryConfig)}wasShown(){super.wasShown(),this.registerRequiredCSS(A)}}class F extends n.Widget.VBox{#n;#i;#r;#s;constructor(e){super(),this.#n=e,this.element.classList.add("network-discovery-view");const o=this.element.createChild("div","network-discovery-footer"),i=n.XLink.XLink.create("https://nodejs.org/en/docs/inspector/",P(S.nodejsDebuggingGuide),void 0,void 0,"node-js-debugging");o.appendChild(t.i18n.getFormatLocalizedString(b,S.specifyNetworkEndpointAnd,{PH1:i})),this.#i=new n.ListWidget.ListWidget(this),this.#i.registerRequiredCSS(A),this.#i.element.classList.add("network-discovery-list");const r=document.createElement("div");r.classList.add("network-discovery-list-empty"),r.textContent=P(S.noConnectionsSpecified),this.#i.setEmptyPlaceholder(r),this.#i.show(this.element),this.#r=null;const s=n.UIUtils.createTextButton(P(S.addConnection),this.#a.bind(this),{className:"add-network-target-button",variant:"primary"});this.element.appendChild(s),this.#s=[],this.element.classList.add("node-frontend")}#c(){const e=this.#s.map((e=>e.address));this.#n.call(null,e)}#a(){this.#i.addNewItem(this.#s.length,{address:"",port:""})}discoveryConfigChanged(e){this.#s=[],this.#i.clear();for(const t of e){const e={address:t,port:""};this.#s.push(e),this.#i.appendItem(e,!0)}}renderItem(e,t){const o=document.createElement("div");return o.classList.add("network-discovery-list-item"),o.createChild("div","network-discovery-value network-discovery-address").textContent=e.address,o}removeItemRequested(e,t){this.#s.splice(t,1),this.#i.removeItem(t),this.#c()}commitEdit(e,t,o){e.address=t.control("address").value.trim(),o&&this.#s.push(e),this.#c()}beginEdit(e){const t=this.#l();return t.control("address").value=e.address,t}#l(){if(this.#r)return this.#r;const e=new n.ListWidget.Editor;this.#r=e;const t=e.contentElement().createChild("div","network-discovery-edit-row"),o=e.createInput("address","text",P(S.networkAddressEgLocalhost),(function(e,t,o){const n=o.value.trim().match(/^([a-zA-Z0-9\.\-_]+):(\d+)$/);if(!n)return{valid:!1,errorMessage:void 0};return{valid:parseInt(n[2],10)<=65535,errorMessage:void 0}}));return t.createChild("div","network-discovery-value network-discovery-address").appendChild(o),e}}const H={main:"Main",nodejsS:"Node.js: {PH1}",NodejsTitleS:"DevTools - Node.js: {PH1}"},V=t.i18n.registerUIStrings("entrypoints/node_app/NodeMain.ts",H),W=t.i18n.getLocalizedString.bind(void 0,V);let q;class j{static instance(e={forceNew:null}){const{forceNew:t}=e;return q&&!t||(q=new j),q}async run(){l.userMetrics.actionTaken(l.UserMetrics.Action.ConnectToNodeJSFromFrontend),i.Connections.initMainConnection((async()=>{i.TargetManager.TargetManager.instance().createTarget("main",W(H.main),i.Target.Type.BROWSER,null).setInspectedURL("Node.js")}),d.TargetDetachedDialog.TargetDetachedDialog.connectionLost)}}class U extends i.SDKModel.SDKModel{#d;#g;#w;#p=new Map;#h=new Map;constructor(e){super(e),this.#d=e.targetManager(),this.#g=e,this.#w=e.targetAgent(),e.registerTargetDispatcher(this),this.#w.invoke_setDiscoverTargets({discover:!0}),l.InspectorFrontendHost.InspectorFrontendHostInstance.events.addEventListener(l.InspectorFrontendHostAPI.Events.DevicesDiscoveryConfigChanged,this.#o,this),l.InspectorFrontendHost.InspectorFrontendHostInstance.setDevicesUpdatesEnabled(!1),l.InspectorFrontendHost.InspectorFrontendHostInstance.setDevicesUpdatesEnabled(!0)}#o({data:e}){const t=[];for(const o of e.networkDiscoveryConfig){const e=o.split(":"),n=parseInt(e[1],10);e[0]&&n&&t.push({host:e[0],port:n})}this.#w.invoke_setRemoteLocations({locations:t})}dispose(){l.InspectorFrontendHost.InspectorFrontendHostInstance.events.removeEventListener(l.InspectorFrontendHostAPI.Events.DevicesDiscoveryConfigChanged,this.#o,this);for(const e of this.#p.keys())this.detachedFromTarget({sessionId:e})}targetCreated({targetInfo:e}){"node"!==e.type||e.attached||this.#w.invoke_attachToTarget({targetId:e.targetId,flatten:!1})}targetInfoChanged(e){}targetDestroyed(e){}attachedToTarget({sessionId:e,targetInfo:t}){const o=W(H.nodejsS,{PH1:t.url});document.title=W(H.NodejsTitleS,{PH1:t.url});const n=new B(this.#w,e);this.#h.set(e,n);const r=this.#d.createTarget(t.targetId,o,i.Target.Type.NODE,this.#g,void 0,void 0,n);this.#p.set(e,r),r.runtimeAgent().invoke_runIfWaitingForDebugger()}detachedFromTarget({sessionId:e}){const t=this.#p.get(e);t&&t.dispose("target terminated"),this.#p.delete(e),this.#h.delete(e)}receivedMessageFromTarget({sessionId:e,message:t}){const o=this.#h.get(e),n=o?o.onMessage:null;n&&n.call(null,t)}targetCrashed(e){}}class B{#w;#m;onMessage;#u;constructor(e,t){this.#w=e,this.#m=t,this.onMessage=null,this.#u=null}setOnMessage(e){this.onMessage=e}setOnDisconnect(e){this.#u=e}sendRawMessage(e){this.#w.invoke_sendMessageToTarget({message:e,sessionId:this.#m})}async disconnect(){this.#u&&this.#u.call(null,"force disconnect"),this.#u=null,this.onMessage=null,await this.#w.invoke_detachFromTarget({sessionId:this.#m})}}i.SDKModel.SDKModel.register(U,{capabilities:32,autostart:!0});const O={connection:"Connection",node:"node",showConnection:"Show Connection",networkTitle:"Node",showNode:"Show Node"},K=t.i18n.registerUIStrings("entrypoints/node_app/node_app.ts",O),G=t.i18n.getLazilyComputedLocalizedString.bind(void 0,K);let z;n.ViewManager.registerViewExtension({location:"panel",id:"node-connection",title:G(O.connection),commandPrompt:G(O.showConnection),order:0,loadView:async()=>new M,tags:[G(O.node)]}),n.ViewManager.registerViewExtension({location:"navigator-view",id:"navigator-network",title:G(O.networkTitle),commandPrompt:G(O.showNode),order:2,persistence:"permanent",loadView:async()=>(await async function(){return z||(z=await import("../../panels/sources/sources.js")),z}()).SourcesNavigator.NetworkNavigatorView.instance()}),self.runtime=o.Runtime.Runtime.instance({forceNew:!0}),e.Runnable.registerEarlyInitializationRunnable(j.instance),new c.MainImpl.MainImpl; diff --git a/packages/debugger-frontend/dist/third-party/front_end/entrypoints/rehydrated_devtools_app/rehydrated_devtools_app.js b/packages/debugger-frontend/dist/third-party/front_end/entrypoints/rehydrated_devtools_app/rehydrated_devtools_app.js index 3fa06f4d09f7..6c86a800df6e 100644 --- a/packages/debugger-frontend/dist/third-party/front_end/entrypoints/rehydrated_devtools_app/rehydrated_devtools_app.js +++ b/packages/debugger-frontend/dist/third-party/front_end/entrypoints/rehydrated_devtools_app/rehydrated_devtools_app.js @@ -1 +1 @@ -import*as e from"../../core/common/common.js";import*as t from"../../core/host/host.js";import*as o from"../../core/i18n/i18n.js";import*as i from"../../core/sdk/sdk.js";import*as n from"../../models/workspace/workspace.js";import*as a from"../../ui/legacy/components/utils/utils.js";import*as s from"../../ui/legacy/legacy.js";import"../../Images/Images.js";import*as r from"../../core/root/root.js";import*as l from"../../ui/components/legacy_wrapper/legacy_wrapper.js";import*as c from"../../models/breakpoints/breakpoints.js";import*as d from"../../ui/legacy/components/object_ui/object_ui.js";import*as g from"../../ui/legacy/components/quick_open/quick_open.js";import*as u from"../main/main.js";const p={focusDebuggee:"Focus page",toggleDrawer:"Toggle drawer",nextPanel:"Next panel",previousPanel:"Previous panel",reloadDevtools:"Reload DevTools",restoreLastDockPosition:"Restore last dock position",zoomIn:"Zoom in",zoomOut:"Zoom out",resetZoomLevel:"Reset zoom level",searchInPanel:"Search in panel",cancelSearch:"Cancel search",findNextResult:"Find next result",findPreviousResult:"Find previous result",theme:"Theme:",switchToBrowserPreferredTheme:"Switch to browser's preferred theme",autoTheme:"Auto",switchToLightTheme:"Switch to light theme",lightCapital:"Light",switchToDarkTheme:"Switch to dark theme",darkCapital:"Dark",darkLower:"dark",lightLower:"light",panelLayout:"Panel layout:",useHorizontalPanelLayout:"Use horizontal panel layout",horizontal:"horizontal",useVerticalPanelLayout:"Use vertical panel layout",vertical:"vertical",useAutomaticPanelLayout:"Use automatic panel layout",auto:"auto",enableCtrlShortcutToSwitchPanels:"Enable Ctrl + 1-9 shortcut to switch panels",enableShortcutToSwitchPanels:"Enable โŒ˜ + 1-9 shortcut to switch panels",right:"Right",dockToRight:"Dock to right",bottom:"Bottom",dockToBottom:"Dock to bottom",left:"Left",dockToLeft:"Dock to left",undocked:"Undocked",undockIntoSeparateWindow:"Undock into separate window",devtoolsDefault:"DevTools (Default)",language:"Language:",browserLanguage:"Browser UI language",enableSync:"Enable settings sync",searchAsYouTypeSetting:"Search as you type",searchAsYouTypeCommand:"Enable search as you type",searchOnEnterCommand:"Disable search as you type (press Enter to search)",matchChromeColorScheme:"Match Chrome color scheme",matchChromeColorSchemeDocumentation:"Match DevTools colors to your customized Chrome theme (when enabled)",matchChromeColorSchemeCommand:"Match Chrome color scheme",dontMatchChromeColorSchemeCommand:"Don't match Chrome color scheme"},m=o.i18n.registerUIStrings("entrypoints/main/main-meta.ts",p),S=o.i18n.getLazilyComputedLocalizedString.bind(void 0,m);let w,y;async function h(){return w||(w=await import("../main/main.js")),w}function b(){return!t.InspectorFrontendHost.InspectorFrontendHostInstance.isHostedMode()}function v(e){return()=>o.i18n.getLocalizedLanguageRegion(e,o.DevToolsLocale.DevToolsLocale.instance())}s.ActionRegistration.registerActionExtension({category:"DRAWER",actionId:"inspector-main.focus-debuggee",loadActionDelegate:async()=>new((await async function(){return y||(y=await import("../inspector_main/inspector_main.js")),y}()).InspectorMain.FocusDebuggeeActionDelegate),order:100,title:S(p.focusDebuggee)}),s.ActionRegistration.registerActionExtension({category:"DRAWER",actionId:"main.toggle-drawer",loadActionDelegate:async()=>new s.InspectorView.ActionDelegate,order:101,title:S(p.toggleDrawer),bindings:[{shortcut:"Esc"}]}),s.ActionRegistration.registerActionExtension({actionId:"main.next-tab",category:"GLOBAL",title:S(p.nextPanel),loadActionDelegate:async()=>new s.InspectorView.ActionDelegate,bindings:[{platform:"windows,linux",shortcut:"Ctrl+]"},{platform:"mac",shortcut:"Meta+]"}]}),s.ActionRegistration.registerActionExtension({actionId:"main.previous-tab",category:"GLOBAL",title:S(p.previousPanel),loadActionDelegate:async()=>new s.InspectorView.ActionDelegate,bindings:[{platform:"windows,linux",shortcut:"Ctrl+["},{platform:"mac",shortcut:"Meta+["}]}),s.ActionRegistration.registerActionExtension({actionId:"main.debug-reload",category:"GLOBAL",title:S(p.reloadDevtools),loadActionDelegate:async()=>new((await h()).MainImpl.ReloadActionDelegate),bindings:[{shortcut:"Alt+R"}]}),s.ActionRegistration.registerActionExtension({category:"GLOBAL",title:S(p.restoreLastDockPosition),actionId:"main.toggle-dock",loadActionDelegate:async()=>new s.DockController.ToggleDockActionDelegate,bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+D"},{platform:"mac",shortcut:"Meta+Shift+D"}]}),s.ActionRegistration.registerActionExtension({actionId:"main.zoom-in",category:"GLOBAL",title:S(p.zoomIn),loadActionDelegate:async()=>new((await h()).MainImpl.ZoomActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Plus",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+Shift+Plus"},{platform:"windows,linux",shortcut:"Ctrl+NumpadPlus"},{platform:"windows,linux",shortcut:"Ctrl+Shift+NumpadPlus"},{platform:"mac",shortcut:"Meta+Plus",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+Shift+Plus"},{platform:"mac",shortcut:"Meta+NumpadPlus"},{platform:"mac",shortcut:"Meta+Shift+NumpadPlus"}],condition:b}),s.ActionRegistration.registerActionExtension({actionId:"main.zoom-out",category:"GLOBAL",title:S(p.zoomOut),loadActionDelegate:async()=>new((await h()).MainImpl.ZoomActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Minus",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+Shift+Minus"},{platform:"windows,linux",shortcut:"Ctrl+NumpadMinus"},{platform:"windows,linux",shortcut:"Ctrl+Shift+NumpadMinus"},{platform:"mac",shortcut:"Meta+Minus",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+Shift+Minus"},{platform:"mac",shortcut:"Meta+NumpadMinus"},{platform:"mac",shortcut:"Meta+Shift+NumpadMinus"}],condition:b}),s.ActionRegistration.registerActionExtension({actionId:"main.zoom-reset",category:"GLOBAL",title:S(p.resetZoomLevel),loadActionDelegate:async()=>new((await h()).MainImpl.ZoomActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+0"},{platform:"windows,linux",shortcut:"Ctrl+Numpad0"},{platform:"mac",shortcut:"Meta+Numpad0"},{platform:"mac",shortcut:"Meta+0"}],condition:b}),s.ActionRegistration.registerActionExtension({actionId:"main.search-in-panel.find",category:"GLOBAL",title:S(p.searchInPanel),loadActionDelegate:async()=>new((await h()).MainImpl.SearchActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+F",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+F",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"F3"}]}),s.ActionRegistration.registerActionExtension({actionId:"main.search-in-panel.cancel",category:"GLOBAL",title:S(p.cancelSearch),loadActionDelegate:async()=>new((await h()).MainImpl.SearchActionDelegate),order:10,bindings:[{shortcut:"Esc"}]}),s.ActionRegistration.registerActionExtension({actionId:"main.search-in-panel.find-next",category:"GLOBAL",title:S(p.findNextResult),loadActionDelegate:async()=>new((await h()).MainImpl.SearchActionDelegate),bindings:[{platform:"mac",shortcut:"Meta+G",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+G"},{platform:"windows,linux",shortcut:"F3",keybindSets:["devToolsDefault","vsCode"]}]}),s.ActionRegistration.registerActionExtension({actionId:"main.search-in-panel.find-previous",category:"GLOBAL",title:S(p.findPreviousResult),loadActionDelegate:async()=>new((await h()).MainImpl.SearchActionDelegate),bindings:[{platform:"mac",shortcut:"Meta+Shift+G",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+Shift+G"},{platform:"windows,linux",shortcut:"Shift+F3",keybindSets:["devToolsDefault","vsCode"]}]}),e.Settings.registerSettingExtension({category:"APPEARANCE",storageType:"Synced",title:S(p.theme),settingName:"ui-theme",settingType:"enum",defaultValue:"systemPreferred",reloadRequired:!1,options:[{title:S(p.switchToBrowserPreferredTheme),text:S(p.autoTheme),value:"systemPreferred"},{title:S(p.switchToLightTheme),text:S(p.lightCapital),value:"default"},{title:S(p.switchToDarkTheme),text:S(p.darkCapital),value:"dark"}],tags:[S(p.darkLower),S(p.lightLower)]}),e.Settings.registerSettingExtension({category:"APPEARANCE",storageType:"Synced",title:S(p.matchChromeColorScheme),settingName:"chrome-theme-colors",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:S(p.matchChromeColorSchemeCommand)},{value:!1,title:S(p.dontMatchChromeColorSchemeCommand)}],reloadRequired:!0,learnMore:{url:"https://goo.gle/devtools-customize-theme",tooltip:S(p.matchChromeColorSchemeDocumentation)}}),e.Settings.registerSettingExtension({category:"APPEARANCE",storageType:"Synced",title:S(p.panelLayout),settingName:"sidebar-position",settingType:"enum",defaultValue:"auto",options:[{title:S(p.useHorizontalPanelLayout),text:S(p.horizontal),value:"bottom"},{title:S(p.useVerticalPanelLayout),text:S(p.vertical),value:"right"},{title:S(p.useAutomaticPanelLayout),text:S(p.auto),value:"auto"}]}),e.Settings.registerSettingExtension({category:"APPEARANCE",storageType:"Synced",settingName:"language",settingType:"enum",title:S(p.language),defaultValue:"en-US",options:[{value:"browserLanguage",title:S(p.browserLanguage),text:S(p.browserLanguage)},...o.i18n.getAllSupportedDevToolsLocales().sort().map((e=>{return{value:t=e,title:v(t),text:v(t)};var t}))],reloadRequired:!0}),e.Settings.registerSettingExtension({category:"APPEARANCE",storageType:"Synced",title:"mac"===t.Platform.platform()?S(p.enableShortcutToSwitchPanels):S(p.enableCtrlShortcutToSwitchPanels),settingName:"shortcut-panel-switch",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({category:"GLOBAL",settingName:"currentDockState",settingType:"enum",defaultValue:"right",options:[{value:"right",text:S(p.right),title:S(p.dockToRight)},{value:"bottom",text:S(p.bottom),title:S(p.dockToBottom)},{value:"left",text:S(p.left),title:S(p.dockToLeft)},{value:"undocked",text:S(p.undocked),title:S(p.undockIntoSeparateWindow)}]}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"active-keybind-set",settingType:"enum",defaultValue:"devToolsDefault",options:[{value:"devToolsDefault",title:S(p.devtoolsDefault),text:S(p.devtoolsDefault)},{value:"vsCode",title:o.i18n.lockedLazyString("Visual Studio Code"),text:o.i18n.lockedLazyString("Visual Studio Code")}]}),e.Settings.registerSettingExtension({category:"SYNC",settingName:"sync-preferences",settingType:"boolean",title:S(p.enableSync),defaultValue:!1,reloadRequired:!0}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"user-shortcuts",settingType:"array",defaultValue:[]}),e.Settings.registerSettingExtension({category:"GLOBAL",storageType:"Local",title:S(p.searchAsYouTypeSetting),settingName:"search-as-you-type",settingType:"boolean",order:3,defaultValue:!0,options:[{value:!0,title:S(p.searchAsYouTypeCommand)},{value:!1,title:S(p.searchOnEnterCommand)}]}),s.ViewManager.registerLocationResolver({name:"drawer-view",category:"DRAWER",loadResolver:async()=>s.InspectorView.InspectorView.instance()}),s.ViewManager.registerLocationResolver({name:"drawer-sidebar",category:"DRAWER_SIDEBAR",loadResolver:async()=>s.InspectorView.InspectorView.instance()}),s.ViewManager.registerLocationResolver({name:"panel",category:"PANEL",loadResolver:async()=>s.InspectorView.InspectorView.instance()}),s.ContextMenu.registerProvider({contextTypes:()=>[n.UISourceCode.UISourceCode,i.Resource.Resource,i.NetworkRequest.NetworkRequest],loadProvider:async()=>new a.Linkifier.ContentProviderContextMenuProvider,experiment:void 0}),s.ContextMenu.registerProvider({contextTypes:()=>[Node],loadProvider:async()=>new s.XLink.ContextMenuProvider,experiment:void 0}),s.ContextMenu.registerProvider({contextTypes:()=>[Node],loadProvider:async()=>new a.Linkifier.LinkContextMenuProvider,experiment:void 0}),s.Toolbar.registerToolbarItem({separator:!0,location:"main-toolbar-left",order:100}),s.Toolbar.registerToolbarItem({separator:!0,order:97,location:"main-toolbar-right"}),s.Toolbar.registerToolbarItem({loadItem:async()=>(await h()).MainImpl.SettingsButtonProvider.instance(),order:99,location:"main-toolbar-right"}),s.Toolbar.registerToolbarItem({loadItem:async()=>(await h()).MainImpl.MainMenuItem.instance(),order:100,location:"main-toolbar-right"}),s.Toolbar.registerToolbarItem({loadItem:async()=>s.DockController.CloseButtonProvider.instance(),order:101,location:"main-toolbar-right"}),e.AppProvider.registerAppProvider({loadAppProvider:async()=>(await h()).SimpleApp.SimpleAppProvider.instance(),order:10});const f={rendering:"Rendering",showRendering:"Show Rendering",paint:"paint",layout:"layout",fps:"fps",cssMediaType:"CSS media type",cssMediaFeature:"CSS media feature",visionDeficiency:"vision deficiency",colorVisionDeficiency:"color vision deficiency",reloadPage:"Reload page",hardReloadPage:"Hard reload page",forceAdBlocking:"Force ad blocking on this site",blockAds:"Block ads on this site",showAds:"Show ads on this site, if allowed",autoOpenDevTools:"Auto-open DevTools for popups",doNotAutoOpen:"Do not auto-open DevTools for popups",disablePaused:"Disable paused state overlay",toggleCssPrefersColorSchemeMedia:"Toggle CSS media feature prefers-color-scheme"},E=o.i18n.registerUIStrings("entrypoints/inspector_main/inspector_main-meta.ts",f),x=o.i18n.getLazilyComputedLocalizedString.bind(void 0,E);let T;async function A(){return T||(T=await import("../inspector_main/inspector_main.js")),T}s.ViewManager.registerViewExtension({location:"drawer-view",id:"rendering",title:x(f.rendering),commandPrompt:x(f.showRendering),persistence:"closeable",order:50,loadView:async()=>new((await A()).RenderingOptions.RenderingOptionsView),tags:[x(f.paint),x(f.layout),x(f.fps),x(f.cssMediaType),x(f.cssMediaFeature),x(f.visionDeficiency),x(f.colorVisionDeficiency)]}),s.ActionRegistration.registerActionExtension({category:"NAVIGATION",actionId:"inspector-main.reload",loadActionDelegate:async()=>new((await A()).InspectorMain.ReloadActionDelegate),iconClass:"refresh",title:x(f.reloadPage),bindings:[{platform:"windows,linux",shortcut:"Ctrl+R"},{platform:"windows,linux",shortcut:"F5"},{platform:"mac",shortcut:"Meta+R"}]}),s.ActionRegistration.registerActionExtension({category:"NAVIGATION",actionId:"inspector-main.hard-reload",loadActionDelegate:async()=>new((await A()).InspectorMain.ReloadActionDelegate),title:x(f.hardReloadPage),bindings:[{platform:"windows,linux",shortcut:"Shift+Ctrl+R"},{platform:"windows,linux",shortcut:"Shift+F5"},{platform:"windows,linux",shortcut:"Ctrl+F5"},{platform:"windows,linux",shortcut:"Ctrl+Shift+F5"},{platform:"mac",shortcut:"Shift+Meta+R"}]}),s.ActionRegistration.registerActionExtension({actionId:"rendering.toggle-prefers-color-scheme",category:"RENDERING",title:x(f.toggleCssPrefersColorSchemeMedia),loadActionDelegate:async()=>new((await A()).RenderingOptions.ReloadActionDelegate)}),e.Settings.registerSettingExtension({category:"",title:x(f.forceAdBlocking),settingName:"network.ad-blocking-enabled",settingType:"boolean",storageType:"Session",defaultValue:!1,options:[{value:!0,title:x(f.blockAds)},{value:!1,title:x(f.showAds)}]}),e.Settings.registerSettingExtension({category:"GLOBAL",storageType:"Synced",title:x(f.autoOpenDevTools),settingName:"auto-attach-to-created-pages",settingType:"boolean",order:2,defaultValue:!1,options:[{value:!0,title:x(f.autoOpenDevTools)},{value:!1,title:x(f.doNotAutoOpen)}]}),e.Settings.registerSettingExtension({category:"APPEARANCE",storageType:"Synced",title:x(f.disablePaused),settingName:"disable-paused-state-overlay",settingType:"boolean",defaultValue:!1}),s.Toolbar.registerToolbarItem({loadItem:async()=>(await A()).InspectorMain.NodeIndicator.instance(),order:2,location:"main-toolbar-left"}),s.Toolbar.registerToolbarItem({loadItem:async()=>(await A()).OutermostTargetSelector.OutermostTargetSelector.instance(),order:98,location:"main-toolbar-right"});const C={preserveLogUponNavigation:"Preserve log upon navigation",doNotPreserveLogUponNavigation:"Do not preserve log upon navigation",pauseOnExceptions:"Pause on exceptions",doNotPauseOnExceptions:"Do not pause on exceptions",disableJavascript:"Disable JavaScript",enableJavascript:"Enable JavaScript",disableAsyncStackTraces:"Disable async stack traces",doNotCaptureAsyncStackTraces:"Do not capture async stack traces",captureAsyncStackTraces:"Capture async stack traces",showRulersOnHover:"Show rulers on hover",doNotShowRulersOnHover:"Do not show rulers on hover",showAreaNames:"Show area names",showGridNamedAreas:"Show grid named areas",doNotShowGridNamedAreas:"Do not show grid named areas",showTrackSizes:"Show track sizes",showGridTrackSizes:"Show grid track sizes",doNotShowGridTrackSizes:"Do not show grid track sizes",extendGridLines:"Extend grid lines",doNotExtendGridLines:"Do not extend grid lines",showLineLabels:"Show line labels",hideLineLabels:"Hide line labels",showLineNumbers:"Show line numbers",showLineNames:"Show line names",showPaintFlashingRectangles:"Show paint flashing rectangles",hidePaintFlashingRectangles:"Hide paint flashing rectangles",showLayoutShiftRegions:"Show layout shift regions",hideLayoutShiftRegions:"Hide layout shift regions",highlightAdFrames:"Highlight ad frames",doNotHighlightAdFrames:"Do not highlight ad frames",showLayerBorders:"Show layer borders",hideLayerBorders:"Hide layer borders",showFramesPerSecondFpsMeter:"Show frames per second (FPS) meter",hideFramesPerSecondFpsMeter:"Hide frames per second (FPS) meter",showScrollPerformanceBottlenecks:"Show scroll performance bottlenecks",hideScrollPerformanceBottlenecks:"Hide scroll performance bottlenecks",emulateAFocusedPage:"Emulate a focused page",doNotEmulateAFocusedPage:"Do not emulate a focused page",doNotEmulateCssMediaType:"Do not emulate CSS media type",noEmulation:"No emulation",emulateCssPrintMediaType:"Emulate CSS print media type",print:"print",emulateCssScreenMediaType:"Emulate CSS screen media type",screen:"screen",query:"query",emulateCssMediaType:"Emulate CSS media type",doNotEmulateCss:"Do not emulate CSS {PH1}",emulateCss:"Emulate CSS {PH1}",emulateCssMediaFeature:"Emulate CSS media feature {PH1}",doNotEmulateAnyVisionDeficiency:"Do not emulate any vision deficiency",emulateBlurredVision:"Emulate blurred vision",emulateReducedContrast:"Emulate reduced contrast",blurredVision:"Blurred vision",reducedContrast:"Reduced contrast",emulateProtanopia:"Emulate protanopia (no red)",protanopia:"Protanopia (no red)",emulateDeuteranopia:"Emulate deuteranopia (no green)",deuteranopia:"Deuteranopia (no green)",emulateTritanopia:"Emulate tritanopia (no blue)",tritanopia:"Tritanopia (no blue)",emulateAchromatopsia:"Emulate achromatopsia (no color)",achromatopsia:"Achromatopsia (no color)",emulateVisionDeficiencies:"Emulate vision deficiencies",disableLocalFonts:"Disable local fonts",enableLocalFonts:"Enable local fonts",disableAvifFormat:"Disable `AVIF` format",enableAvifFormat:"Enable `AVIF` format",disableWebpFormat:"Disable `WebP` format",enableWebpFormat:"Enable `WebP` format",customFormatters:"Custom formatters",networkRequestBlocking:"Network request blocking",enableNetworkRequestBlocking:"Enable network request blocking",disableNetworkRequestBlocking:"Disable network request blocking",enableCache:"Enable cache",disableCache:"Disable cache while DevTools is open",emulateAutoDarkMode:"Emulate auto dark mode",enableRemoteFileLoading:"Allow `DevTools` to load resources, such as source maps, from remote file paths. Disabled by default for security reasons.",networkCacheExplanation:"Disabling the network cache will simulate a network experience similar to a first time visitor."},R=o.i18n.registerUIStrings("core/sdk/sdk-meta.ts",C),k=o.i18n.getLazilyComputedLocalizedString.bind(void 0,R);e.Settings.registerSettingExtension({storageType:"Synced",settingName:"skip-stack-frames-pattern",settingType:"regex",defaultValue:""}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"skip-content-scripts",settingType:"boolean",defaultValue:!0}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"automatically-ignore-list-known-third-party-scripts",settingType:"boolean",defaultValue:!0}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"skip-anonymous-scripts",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"enable-ignore-listing",settingType:"boolean",defaultValue:!0}),e.Settings.registerSettingExtension({category:"CONSOLE",storageType:"Synced",title:k(C.preserveLogUponNavigation),settingName:"preserve-console-log",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:k(C.preserveLogUponNavigation)},{value:!1,title:k(C.doNotPreserveLogUponNavigation)}]}),e.Settings.registerSettingExtension({category:"DEBUGGER",settingName:"pause-on-exception-enabled",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:k(C.pauseOnExceptions)},{value:!1,title:k(C.doNotPauseOnExceptions)}]}),e.Settings.registerSettingExtension({settingName:"pause-on-caught-exception",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({settingName:"pause-on-uncaught-exception",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({category:"DEBUGGER",title:k(C.disableJavascript),settingName:"java-script-disabled",settingType:"boolean",storageType:"Session",order:1,defaultValue:!1,options:[{value:!0,title:k(C.disableJavascript)},{value:!1,title:k(C.enableJavascript)}]}),e.Settings.registerSettingExtension({category:"DEBUGGER",title:k(C.disableAsyncStackTraces),settingName:"disable-async-stack-traces",settingType:"boolean",defaultValue:!1,order:2,options:[{value:!0,title:k(C.doNotCaptureAsyncStackTraces)},{value:!1,title:k(C.captureAsyncStackTraces)}]}),e.Settings.registerSettingExtension({category:"DEBUGGER",settingName:"breakpoints-active",settingType:"boolean",storageType:"Session",defaultValue:!0}),e.Settings.registerSettingExtension({category:"ELEMENTS",storageType:"Synced",title:k(C.showRulersOnHover),settingName:"show-metrics-rulers",settingType:"boolean",options:[{value:!0,title:k(C.showRulersOnHover)},{value:!1,title:k(C.doNotShowRulersOnHover)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"GRID",storageType:"Synced",title:k(C.showAreaNames),settingName:"show-grid-areas",settingType:"boolean",options:[{value:!0,title:k(C.showGridNamedAreas)},{value:!1,title:k(C.doNotShowGridNamedAreas)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"GRID",storageType:"Synced",title:k(C.showTrackSizes),settingName:"show-grid-track-sizes",settingType:"boolean",options:[{value:!0,title:k(C.showGridTrackSizes)},{value:!1,title:k(C.doNotShowGridTrackSizes)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"GRID",storageType:"Synced",title:k(C.extendGridLines),settingName:"extend-grid-lines",settingType:"boolean",options:[{value:!0,title:k(C.extendGridLines)},{value:!1,title:k(C.doNotExtendGridLines)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"GRID",storageType:"Synced",title:k(C.showLineLabels),settingName:"show-grid-line-labels",settingType:"enum",options:[{title:k(C.hideLineLabels),text:k(C.hideLineLabels),value:"none"},{title:k(C.showLineNumbers),text:k(C.showLineNumbers),value:"lineNumbers"},{title:k(C.showLineNames),text:k(C.showLineNames),value:"lineNames"}],defaultValue:"lineNumbers"}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"show-paint-rects",settingType:"boolean",storageType:"Session",options:[{value:!0,title:k(C.showPaintFlashingRectangles)},{value:!1,title:k(C.hidePaintFlashingRectangles)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"show-layout-shift-regions",settingType:"boolean",storageType:"Session",options:[{value:!0,title:k(C.showLayoutShiftRegions)},{value:!1,title:k(C.hideLayoutShiftRegions)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"show-ad-highlights",settingType:"boolean",storageType:"Session",options:[{value:!0,title:k(C.highlightAdFrames)},{value:!1,title:k(C.doNotHighlightAdFrames)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"show-debug-borders",settingType:"boolean",storageType:"Session",options:[{value:!0,title:k(C.showLayerBorders)},{value:!1,title:k(C.hideLayerBorders)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"show-fps-counter",settingType:"boolean",storageType:"Session",options:[{value:!0,title:k(C.showFramesPerSecondFpsMeter)},{value:!1,title:k(C.hideFramesPerSecondFpsMeter)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"show-scroll-bottleneck-rects",settingType:"boolean",storageType:"Session",options:[{value:!0,title:k(C.showScrollPerformanceBottlenecks)},{value:!1,title:k(C.hideScrollPerformanceBottlenecks)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",title:k(C.emulateAFocusedPage),settingName:"emulate-page-focus",settingType:"boolean",storageType:"Local",defaultValue:!1,options:[{value:!0,title:k(C.emulateAFocusedPage)},{value:!1,title:k(C.doNotEmulateAFocusedPage)}]}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"emulated-css-media",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:k(C.doNotEmulateCssMediaType),text:k(C.noEmulation),value:""},{title:k(C.emulateCssPrintMediaType),text:k(C.print),value:"print"},{title:k(C.emulateCssScreenMediaType),text:k(C.screen),value:"screen"}],tags:[k(C.query)],title:k(C.emulateCssMediaType)}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"emulated-css-media-feature-prefers-color-scheme",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:k(C.doNotEmulateCss,{PH1:"prefers-color-scheme"}),text:k(C.noEmulation),value:""},{title:k(C.emulateCss,{PH1:"prefers-color-scheme: light"}),text:o.i18n.lockedLazyString("prefers-color-scheme: light"),value:"light"},{title:k(C.emulateCss,{PH1:"prefers-color-scheme: dark"}),text:o.i18n.lockedLazyString("prefers-color-scheme: dark"),value:"dark"}],tags:[k(C.query)],title:k(C.emulateCssMediaFeature,{PH1:"prefers-color-scheme"})}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"emulated-css-media-feature-forced-colors",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:k(C.doNotEmulateCss,{PH1:"forced-colors"}),text:k(C.noEmulation),value:""},{title:k(C.emulateCss,{PH1:"forced-colors: active"}),text:o.i18n.lockedLazyString("forced-colors: active"),value:"active"},{title:k(C.emulateCss,{PH1:"forced-colors: none"}),text:o.i18n.lockedLazyString("forced-colors: none"),value:"none"}],tags:[k(C.query)],title:k(C.emulateCssMediaFeature,{PH1:"forced-colors"})}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"emulated-css-media-feature-prefers-reduced-motion",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:k(C.doNotEmulateCss,{PH1:"prefers-reduced-motion"}),text:k(C.noEmulation),value:""},{title:k(C.emulateCss,{PH1:"prefers-reduced-motion: reduce"}),text:o.i18n.lockedLazyString("prefers-reduced-motion: reduce"),value:"reduce"}],tags:[k(C.query)],title:k(C.emulateCssMediaFeature,{PH1:"prefers-reduced-motion"})}),e.Settings.registerSettingExtension({settingName:"emulated-css-media-feature-prefers-contrast",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:k(C.doNotEmulateCss,{PH1:"prefers-contrast"}),text:k(C.noEmulation),value:""},{title:k(C.emulateCss,{PH1:"prefers-contrast: more"}),text:o.i18n.lockedLazyString("prefers-contrast: more"),value:"more"},{title:k(C.emulateCss,{PH1:"prefers-contrast: less"}),text:o.i18n.lockedLazyString("prefers-contrast: less"),value:"less"},{title:k(C.emulateCss,{PH1:"prefers-contrast: custom"}),text:o.i18n.lockedLazyString("prefers-contrast: custom"),value:"custom"}],tags:[k(C.query)],title:k(C.emulateCssMediaFeature,{PH1:"prefers-contrast"})}),e.Settings.registerSettingExtension({settingName:"emulated-css-media-feature-prefers-reduced-data",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:k(C.doNotEmulateCss,{PH1:"prefers-reduced-data"}),text:k(C.noEmulation),value:""},{title:k(C.emulateCss,{PH1:"prefers-reduced-data: reduce"}),text:o.i18n.lockedLazyString("prefers-reduced-data: reduce"),value:"reduce"}],title:k(C.emulateCssMediaFeature,{PH1:"prefers-reduced-data"})}),e.Settings.registerSettingExtension({settingName:"emulated-css-media-feature-prefers-reduced-transparency",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:k(C.doNotEmulateCss,{PH1:"prefers-reduced-transparency"}),text:k(C.noEmulation),value:""},{title:k(C.emulateCss,{PH1:"prefers-reduced-transparency: reduce"}),text:o.i18n.lockedLazyString("prefers-reduced-transparency: reduce"),value:"reduce"}],title:k(C.emulateCssMediaFeature,{PH1:"prefers-reduced-transparency"})}),e.Settings.registerSettingExtension({settingName:"emulated-css-media-feature-color-gamut",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:k(C.doNotEmulateCss,{PH1:"color-gamut"}),text:k(C.noEmulation),value:""},{title:k(C.emulateCss,{PH1:"color-gamut: srgb"}),text:o.i18n.lockedLazyString("color-gamut: srgb"),value:"srgb"},{title:k(C.emulateCss,{PH1:"color-gamut: p3"}),text:o.i18n.lockedLazyString("color-gamut: p3"),value:"p3"},{title:k(C.emulateCss,{PH1:"color-gamut: rec2020"}),text:o.i18n.lockedLazyString("color-gamut: rec2020"),value:"rec2020"}],title:k(C.emulateCssMediaFeature,{PH1:"color-gamut"})}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"emulated-vision-deficiency",settingType:"enum",storageType:"Session",defaultValue:"none",options:[{title:k(C.doNotEmulateAnyVisionDeficiency),text:k(C.noEmulation),value:"none"},{title:k(C.emulateBlurredVision),text:k(C.blurredVision),value:"blurredVision"},{title:k(C.emulateReducedContrast),text:k(C.reducedContrast),value:"reducedContrast"},{title:k(C.emulateProtanopia),text:k(C.protanopia),value:"protanopia"},{title:k(C.emulateDeuteranopia),text:k(C.deuteranopia),value:"deuteranopia"},{title:k(C.emulateTritanopia),text:k(C.tritanopia),value:"tritanopia"},{title:k(C.emulateAchromatopsia),text:k(C.achromatopsia),value:"achromatopsia"}],tags:[k(C.query)],title:k(C.emulateVisionDeficiencies)}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"local-fonts-disabled",settingType:"boolean",storageType:"Session",options:[{value:!0,title:k(C.disableLocalFonts)},{value:!1,title:k(C.enableLocalFonts)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"avif-format-disabled",settingType:"boolean",storageType:"Session",options:[{value:!0,title:k(C.disableAvifFormat)},{value:!1,title:k(C.enableAvifFormat)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"webp-format-disabled",settingType:"boolean",storageType:"Session",options:[{value:!0,title:k(C.disableWebpFormat)},{value:!1,title:k(C.enableWebpFormat)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"CONSOLE",title:k(C.customFormatters),settingName:"custom-formatters",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({category:"",title:k(C.networkRequestBlocking),settingName:"request-blocking-enabled",settingType:"boolean",storageType:"Session",defaultValue:!1,options:[{value:!0,title:k(C.enableNetworkRequestBlocking)},{value:!1,title:k(C.disableNetworkRequestBlocking)}]}),e.Settings.registerSettingExtension({category:"NETWORK",title:k(C.disableCache),settingName:"cache-disabled",settingType:"boolean",order:0,defaultValue:!1,userActionCondition:"hasOtherClients",options:[{value:!0,title:k(C.disableCache)},{value:!1,title:k(C.enableCache)}],learnMore:{tooltip:k(C.networkCacheExplanation)}}),e.Settings.registerSettingExtension({category:"RENDERING",title:k(C.emulateAutoDarkMode),settingName:"emulate-auto-dark-mode",settingType:"boolean",storageType:"Session",defaultValue:!1}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:k(C.enableRemoteFileLoading),settingName:"network.enable-remote-file-loading",settingType:"boolean",defaultValue:!1});const P={preserveLog:"Preserve log",preserve:"preserve",clear:"clear",reset:"reset",preserveLogOnPageReload:"Preserve log on page reload / navigation",doNotPreserveLogOnPageReload:"Do not preserve log on page reload / navigation",recordNetworkLog:"Record network log"},D=o.i18n.registerUIStrings("models/logs/logs-meta.ts",P),N=o.i18n.getLazilyComputedLocalizedString.bind(void 0,D);e.Settings.registerSettingExtension({category:"NETWORK",title:N(P.preserveLog),settingName:"network-log.preserve-log",settingType:"boolean",defaultValue:!1,tags:[N(P.preserve),N(P.clear),N(P.reset)],options:[{value:!0,title:N(P.preserveLogOnPageReload)},{value:!1,title:N(P.doNotPreserveLogOnPageReload)}]}),e.Settings.registerSettingExtension({category:"NETWORK",title:N(P.recordNetworkLog),settingName:"network-log.record-log",settingType:"boolean",defaultValue:!0,storageType:"Session"});const I={workspace:"Workspace",showWorkspace:"Show Workspace settings",enableLocalOverrides:"Enable Local Overrides",interception:"interception",override:"override",network:"network",rewrite:"rewrite",request:"request",enableOverrideNetworkRequests:"Enable override network requests",disableOverrideNetworkRequests:"Disable override network requests",enableAutomaticWorkspaceFolders:"Enable automatic workspace folders"},V=o.i18n.registerUIStrings("models/persistence/persistence-meta.ts",I),L=o.i18n.getLazilyComputedLocalizedString.bind(void 0,V);let M;async function O(){return M||(M=await import("../../models/persistence/persistence.js")),M}s.ViewManager.registerViewExtension({location:"settings-view",id:"workspace",title:L(I.workspace),commandPrompt:L(I.showWorkspace),order:1,loadView:async()=>new((await O()).WorkspaceSettingsTab.WorkspaceSettingsTab),iconName:"folder"}),e.Settings.registerSettingExtension({category:"PERSISTENCE",title:L(I.enableAutomaticWorkspaceFolders),settingName:"persistence-automatic-workspace-folders",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({category:"PERSISTENCE",title:L(I.enableLocalOverrides),settingName:"persistence-network-overrides-enabled",settingType:"boolean",defaultValue:!1,tags:[L(I.interception),L(I.override),L(I.network),L(I.rewrite),L(I.request)],options:[{value:!0,title:L(I.enableOverrideNetworkRequests)},{value:!1,title:L(I.disableOverrideNetworkRequests)}]}),s.ContextMenu.registerProvider({contextTypes:()=>[n.UISourceCode.UISourceCode,i.Resource.Resource,i.NetworkRequest.NetworkRequest],loadProvider:async()=>new((await O()).PersistenceActions.ContextMenuProvider),experiment:void 0});const F={showEventListenerBreakpoints:"Show Event Listener Breakpoints",eventListenerBreakpoints:"Event Listener Breakpoints",showCspViolationBreakpoints:"Show CSP Violation Breakpoints",cspViolationBreakpoints:"CSP Violation Breakpoints",showXhrfetchBreakpoints:"Show XHR/fetch Breakpoints",xhrfetchBreakpoints:"XHR/fetch Breakpoints",showDomBreakpoints:"Show DOM Breakpoints",domBreakpoints:"DOM Breakpoints",showGlobalListeners:"Show Global Listeners",globalListeners:"Global Listeners",page:"Page",showPage:"Show Page",overrides:"Overrides",showOverrides:"Show Overrides",contentScripts:"Content scripts",showContentScripts:"Show Content scripts",refreshGlobalListeners:"Refresh global listeners"},U=o.i18n.registerUIStrings("panels/browser_debugger/browser_debugger-meta.ts",F),B=o.i18n.getLazilyComputedLocalizedString.bind(void 0,U);let G,z;async function W(){return G||(G=await import("../../panels/browser_debugger/browser_debugger.js")),G}async function H(){return z||(z=await import("../../panels/sources/sources.js")),z}s.ViewManager.registerViewExtension({loadView:async()=>(await W()).EventListenerBreakpointsSidebarPane.EventListenerBreakpointsSidebarPane.instance(),id:"sources.event-listener-breakpoints",location:"sources.sidebar-bottom",commandPrompt:B(F.showEventListenerBreakpoints),title:B(F.eventListenerBreakpoints),order:9,persistence:"permanent"}),s.ViewManager.registerViewExtension({loadView:async()=>new((await W()).CSPViolationBreakpointsSidebarPane.CSPViolationBreakpointsSidebarPane),id:"sources.csp-violation-breakpoints",location:"sources.sidebar-bottom",commandPrompt:B(F.showCspViolationBreakpoints),title:B(F.cspViolationBreakpoints),order:10,persistence:"permanent"}),s.ViewManager.registerViewExtension({loadView:async()=>(await W()).XHRBreakpointsSidebarPane.XHRBreakpointsSidebarPane.instance(),id:"sources.xhr-breakpoints",location:"sources.sidebar-bottom",commandPrompt:B(F.showXhrfetchBreakpoints),title:B(F.xhrfetchBreakpoints),order:5,persistence:"permanent",hasToolbar:!0}),s.ViewManager.registerViewExtension({loadView:async()=>(await W()).DOMBreakpointsSidebarPane.DOMBreakpointsSidebarPane.instance(),id:"sources.dom-breakpoints",location:"sources.sidebar-bottom",commandPrompt:B(F.showDomBreakpoints),title:B(F.domBreakpoints),order:7,persistence:"permanent"}),s.ViewManager.registerViewExtension({loadView:async()=>new((await W()).ObjectEventListenersSidebarPane.ObjectEventListenersSidebarPane),id:"sources.global-listeners",location:"sources.sidebar-bottom",commandPrompt:B(F.showGlobalListeners),title:B(F.globalListeners),order:8,persistence:"permanent",hasToolbar:!0}),s.ViewManager.registerViewExtension({loadView:async()=>(await W()).DOMBreakpointsSidebarPane.DOMBreakpointsSidebarPane.instance(),id:"elements.dom-breakpoints",location:"elements-sidebar",commandPrompt:B(F.showDomBreakpoints),title:B(F.domBreakpoints),order:6,persistence:"permanent"}),s.ViewManager.registerViewExtension({location:"navigator-view",id:"navigator-network",title:B(F.page),commandPrompt:B(F.showPage),order:2,persistence:"permanent",loadView:async()=>(await H()).SourcesNavigator.NetworkNavigatorView.instance()}),s.ViewManager.registerViewExtension({location:"navigator-view",id:"navigator-overrides",title:B(F.overrides),commandPrompt:B(F.showOverrides),order:4,persistence:"permanent",loadView:async()=>(await H()).SourcesNavigator.OverridesNavigatorView.instance()}),s.ViewManager.registerViewExtension({location:"navigator-view",id:"navigator-content-scripts",title:B(F.contentScripts),commandPrompt:B(F.showContentScripts),order:5,persistence:"permanent",condition:()=>"/bundled/worker_app.html"!==r.Runtime.getPathName(),loadView:async()=>new((await H()).SourcesNavigator.ContentScriptsNavigatorView)}),s.ActionRegistration.registerActionExtension({category:"DEBUGGER",actionId:"browser-debugger.refresh-global-event-listeners",loadActionDelegate:async()=>new((await W()).ObjectEventListenersSidebarPane.ActionDelegate),title:B(F.refreshGlobalListeners),iconClass:"refresh",contextTypes:()=>void 0===G?[]:(e=>[e.ObjectEventListenersSidebarPane.ObjectEventListenersSidebarPane])(G)}),s.ContextMenu.registerProvider({contextTypes:()=>[i.DOMModel.DOMNode],loadProvider:async()=>new((await W()).DOMBreakpointsSidebarPane.ContextMenuProvider),experiment:void 0}),s.Context.registerListener({contextTypes:()=>[i.DebuggerModel.DebuggerPausedDetails],loadListener:async()=>(await W()).XHRBreakpointsSidebarPane.XHRBreakpointsSidebarPane.instance()}),s.Context.registerListener({contextTypes:()=>[i.DebuggerModel.DebuggerPausedDetails],loadListener:async()=>(await W()).DOMBreakpointsSidebarPane.DOMBreakpointsSidebarPane.instance()});const j={throttling:"Throttling",showThrottling:"Show Throttling",goOffline:"Go offline",device:"device",throttlingTag:"throttling",enableSlowGThrottling:"Enable slow `3G` throttling",enableFastGThrottling:"Enable fast `3G` throttling",goOnline:"Go online"},q=o.i18n.registerUIStrings("panels/mobile_throttling/mobile_throttling-meta.ts",j),_=o.i18n.getLazilyComputedLocalizedString.bind(void 0,q);let J;async function K(){return J||(J=await import("../../panels/mobile_throttling/mobile_throttling.js")),J}s.ViewManager.registerViewExtension({location:"settings-view",id:"throttling-conditions",title:_(j.throttling),commandPrompt:_(j.showThrottling),order:35,loadView:async()=>new((await K()).ThrottlingSettingsTab.ThrottlingSettingsTab),settings:["custom-network-conditions","calibrated-cpu-throttling"],iconName:"performance"}),s.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-offline",category:"NETWORK",title:_(j.goOffline),loadActionDelegate:async()=>new((await K()).ThrottlingManager.ActionDelegate),tags:[_(j.device),_(j.throttlingTag)]}),s.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-low-end-mobile",category:"NETWORK",title:_(j.enableSlowGThrottling),loadActionDelegate:async()=>new((await K()).ThrottlingManager.ActionDelegate),tags:[_(j.device),_(j.throttlingTag)]}),s.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-mid-tier-mobile",category:"NETWORK",title:_(j.enableFastGThrottling),loadActionDelegate:async()=>new((await K()).ThrottlingManager.ActionDelegate),tags:[_(j.device),_(j.throttlingTag)]}),s.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-online",category:"NETWORK",title:_(j.goOnline),loadActionDelegate:async()=>new((await K()).ThrottlingManager.ActionDelegate),tags:[_(j.device),_(j.throttlingTag)]}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"custom-network-conditions",settingType:"array",defaultValue:[]});const Q={protocolMonitor:"Protocol monitor",showProtocolMonitor:"Show Protocol monitor"},X=o.i18n.registerUIStrings("panels/protocol_monitor/protocol_monitor-meta.ts",Q),Y=o.i18n.getLazilyComputedLocalizedString.bind(void 0,X);let Z;s.ViewManager.registerViewExtension({location:"drawer-view",id:"protocol-monitor",title:Y(Q.protocolMonitor),commandPrompt:Y(Q.showProtocolMonitor),order:100,persistence:"closeable",loadView:async()=>new((await async function(){return Z||(Z=await import("../../panels/protocol_monitor/protocol_monitor.js")),Z}()).ProtocolMonitor.ProtocolMonitorImpl),experiment:"protocol-monitor"});const $={devices:"Devices",showDevices:"Show Devices"},ee=o.i18n.registerUIStrings("panels/settings/emulation/emulation-meta.ts",$),te=o.i18n.getLazilyComputedLocalizedString.bind(void 0,ee);let oe;s.ViewManager.registerViewExtension({location:"settings-view",commandPrompt:te($.showDevices),title:te($.devices),order:30,loadView:async()=>new((await async function(){return oe||(oe=await import("../../panels/settings/emulation/emulation.js")),oe}()).DevicesSettingsTab.DevicesSettingsTab),id:"devices",settings:["standard-emulated-device-list","custom-emulated-device-list"],iconName:"devices"});const ie={shortcuts:"Shortcuts",preferences:"Preferences",experiments:"Experiments",ignoreList:"Ignore list",showShortcuts:"Show Shortcuts",showPreferences:"Show Preferences",showExperiments:"Show Experiments",showIgnoreList:"Show Ignore list",settings:"Settings",documentation:"Documentation",aiInnovations:"AI innovations",showAiInnovations:"Show AI innovations"},ne=o.i18n.registerUIStrings("panels/settings/settings-meta.ts",ie),ae=o.i18n.getLazilyComputedLocalizedString.bind(void 0,ne);let se;async function re(){return se||(se=await import("../../panels/settings/settings.js")),se}s.ViewManager.registerViewExtension({location:"settings-view",id:"preferences",title:ae(ie.preferences),commandPrompt:ae(ie.showPreferences),order:0,loadView:async()=>new((await re()).SettingsScreen.GenericSettingsTab),iconName:"gear"}),s.ViewManager.registerViewExtension({location:"settings-view",id:"chrome-ai",title:ae(ie.aiInnovations),commandPrompt:ae(ie.showAiInnovations),order:2,async loadView(){const e=await re();return l.LegacyWrapper.legacyWrapper(s.Widget.VBox,new e.AISettingsTab.AISettingsTab)},iconName:"button-magic",settings:["console-insights-enabled"],condition:e=>(e?.aidaAvailability?.enabled&&(e?.devToolsConsoleInsights?.enabled||e?.devToolsFreestyler?.enabled))??!1}),s.ViewManager.registerViewExtension({location:"settings-view",id:"experiments",title:ae(ie.experiments),commandPrompt:ae(ie.showExperiments),order:3,experiment:"*",loadView:async()=>new((await re()).SettingsScreen.ExperimentsSettingsTab),iconName:"experiment"}),s.ViewManager.registerViewExtension({location:"settings-view",id:"blackbox",title:ae(ie.ignoreList),commandPrompt:ae(ie.showIgnoreList),order:4,loadView:async()=>new((await re()).FrameworkIgnoreListSettingsTab.FrameworkIgnoreListSettingsTab),iconName:"clear-list"}),s.ViewManager.registerViewExtension({location:"settings-view",id:"keybinds",title:ae(ie.shortcuts),commandPrompt:ae(ie.showShortcuts),order:100,loadView:async()=>new((await re()).KeybindsSettingsTab.KeybindsSettingsTab),iconName:"keyboard"}),s.ActionRegistration.registerActionExtension({category:"SETTINGS",actionId:"settings.show",title:ae(ie.settings),loadActionDelegate:async()=>new((await re()).SettingsScreen.ActionDelegate),iconClass:"gear",bindings:[{shortcut:"F1",keybindSets:["devToolsDefault"]},{shortcut:"Shift+?"},{platform:"windows,linux",shortcut:"Ctrl+,",keybindSets:["vsCode"]},{platform:"mac",shortcut:"Meta+,",keybindSets:["vsCode"]}]}),s.ActionRegistration.registerActionExtension({category:"SETTINGS",actionId:"settings.documentation",title:ae(ie.documentation),loadActionDelegate:async()=>new((await re()).SettingsScreen.ActionDelegate)}),s.ActionRegistration.registerActionExtension({category:"SETTINGS",actionId:"settings.shortcuts",title:ae(ie.showShortcuts),loadActionDelegate:async()=>new((await re()).SettingsScreen.ActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+K Ctrl+S",keybindSets:["vsCode"]},{platform:"mac",shortcut:"Meta+K Meta+S",keybindSets:["vsCode"]}]}),s.ViewManager.registerLocationResolver({name:"settings-view",category:"SETTINGS",loadResolver:async()=>(await re()).SettingsScreen.SettingsScreen.instance()}),e.Revealer.registerRevealer({contextTypes:()=>[e.Settings.Setting,r.Runtime.Experiment],destination:void 0,loadRevealer:async()=>new((await re()).SettingsScreen.Revealer)}),s.ContextMenu.registerItem({location:"mainMenu/footer",actionId:"settings.shortcuts",order:void 0}),s.ContextMenu.registerItem({location:"mainMenuHelp/default",actionId:"settings.documentation",order:void 0});const le={showSources:"Show Sources",sources:"Sources",showWorkspace:"Show Workspace",workspace:"Workspace",showSnippets:"Show Snippets",snippets:"Snippets",showSearch:"Show Search",search:"Search",showQuickSource:"Show Quick source",quickSource:"Quick source",showThreads:"Show Threads",threads:"Threads",showScope:"Show Scope",scope:"Scope",showWatch:"Show Watch",watch:"Watch",showBreakpoints:"Show Breakpoints",breakpoints:"Breakpoints",pauseScriptExecution:"Pause script execution",resumeScriptExecution:"Resume script execution",stepOverNextFunctionCall:"Step over next function call",stepIntoNextFunctionCall:"Step into next function call",step:"Step",stepOutOfCurrentFunction:"Step out of current function",runSnippet:"Run snippet",deactivateBreakpoints:"Deactivate breakpoints",activateBreakpoints:"Activate breakpoints",addSelectedTextToWatches:"Add selected text to watches",evaluateSelectedTextInConsole:"Evaluate selected text in console",switchFile:"Switch file",rename:"Rename",closeAll:"Close all",jumpToPreviousEditingLocation:"Jump to previous editing location",jumpToNextEditingLocation:"Jump to next editing location",closeTheActiveTab:"Close the active tab",goToLine:"Go to line",goToAFunctionDeclarationruleSet:"Go to a function declaration/rule set",toggleBreakpoint:"Toggle breakpoint",toggleBreakpointEnabled:"Toggle breakpoint enabled",toggleBreakpointInputWindow:"Toggle breakpoint input window",save:"Save",saveAll:"Save all",createNewSnippet:"Create new snippet",addFolderToWorkspace:"Add folder to workspace",addFolder:"Add folder",previousCallFrame:"Previous call frame",nextCallFrame:"Next call frame",incrementCssUnitBy:"Increment CSS unit by {PH1}",decrementCssUnitBy:"Decrement CSS unit by {PH1}",searchInAnonymousAndContent:"Search in anonymous and content scripts",doNotSearchInAnonymousAndContent:"Do not search in anonymous and content scripts",automaticallyRevealFilesIn:"Automatically reveal files in sidebar",doNotAutomaticallyRevealFilesIn:"Do not automatically reveal files in sidebar",javaScriptSourceMaps:"JavaScript source maps",enableJavaScriptSourceMaps:"Enable JavaScript source maps",disableJavaScriptSourceMaps:"Disable JavaScript source maps",tabMovesFocus:"Tab moves focus",enableTabMovesFocus:"Enable tab moves focus",disableTabMovesFocus:"Disable tab moves focus",detectIndentation:"Detect indentation",doNotDetectIndentation:"Do not detect indentation",automaticallyPrettyPrintMinifiedSources:"Automatically pretty print minified sources",doNotAutomaticallyPrettyPrintMinifiedSources:"Do not automatically pretty print minified sources",autocompletion:"Autocompletion",enableAutocompletion:"Enable autocompletion",disableAutocompletion:"Disable autocompletion",bracketClosing:"Auto closing brackets",enableBracketClosing:"Enable auto closing brackets",disableBracketClosing:"Disable auto closing brackets",bracketMatching:"Bracket matching",enableBracketMatching:"Enable bracket matching",disableBracketMatching:"Disable bracket matching",codeFolding:"Code folding",enableCodeFolding:"Enable code folding",disableCodeFolding:"Disable code folding",showWhitespaceCharacters:"Show whitespace characters:",doNotShowWhitespaceCharacters:"Do not show whitespace characters",none:"None",showAllWhitespaceCharacters:"Show all whitespace characters",all:"All",showTrailingWhitespaceCharacters:"Show trailing whitespace characters",trailing:"Trailing",displayVariableValuesInlineWhile:"Display variable values inline while debugging",doNotDisplayVariableValuesInline:"Do not display variable values inline while debugging",cssSourceMaps:"CSS source maps",enableCssSourceMaps:"Enable CSS source maps",disableCssSourceMaps:"Disable CSS source maps",allowScrollingPastEndOfFile:"Allow scrolling past end of file",disallowScrollingPastEndOfFile:"Disallow scrolling past end of file",wasmAutoStepping:"When debugging Wasm with debug information, do not pause on wasm bytecode if possible",enableWasmAutoStepping:"Enable Wasm auto-stepping",disableWasmAutoStepping:"Disable Wasm auto-stepping",goTo:"Go to",line:"Line",symbol:"Symbol",goToSymbol:"Go to symbol",open:"Open",file:"File",openFile:"Open file",disableAutoFocusOnDebuggerPaused:"Do not focus Sources panel when triggering a breakpoint",enableAutoFocusOnDebuggerPaused:"Focus Sources panel when triggering a breakpoint",revealActiveFileInSidebar:"Reveal active file in navigator sidebar",toggleNavigatorSidebar:"Toggle navigator sidebar",toggleDebuggerSidebar:"Toggle debugger sidebar",nextEditorTab:"Next editor",previousEditorTab:"Previous editor"},ce=o.i18n.registerUIStrings("panels/sources/sources-meta.ts",le),de=o.i18n.getLazilyComputedLocalizedString.bind(void 0,ce);let ge,ue;async function pe(){return ge||(ge=await import("../../panels/sources/sources.js")),ge}async function me(){return ue||(ue=await import("../../panels/sources/components/components.js")),ue}function Se(e){return void 0===ge?[]:e(ge)}s.ViewManager.registerViewExtension({location:"panel",id:"sources",commandPrompt:de(le.showSources),title:de(le.sources),order:30,loadView:async()=>(await pe()).SourcesPanel.SourcesPanel.instance()}),s.ViewManager.registerViewExtension({location:"navigator-view",id:"navigator-files",commandPrompt:de(le.showWorkspace),title:de(le.workspace),order:3,persistence:"permanent",loadView:async()=>new((await pe()).SourcesNavigator.FilesNavigatorView),condition:r.Runtime.conditions.notSourcesHideAddFolder}),s.ViewManager.registerViewExtension({location:"navigator-view",id:"navigator-snippets",commandPrompt:de(le.showSnippets),title:de(le.snippets),order:6,persistence:"permanent",loadView:async()=>new((await pe()).SourcesNavigator.SnippetsNavigatorView)}),s.ViewManager.registerViewExtension({location:"drawer-view",id:"sources.search-sources-tab",commandPrompt:de(le.showSearch),title:de(le.search),order:7,persistence:"closeable",loadView:async()=>new((await pe()).SearchSourcesView.SearchSourcesView)}),s.ViewManager.registerViewExtension({location:"drawer-view",id:"sources.quick",commandPrompt:de(le.showQuickSource),title:de(le.quickSource),persistence:"closeable",order:1e3,loadView:async()=>new((await pe()).SourcesPanel.QuickSourceView)}),s.ViewManager.registerViewExtension({id:"sources.threads",commandPrompt:de(le.showThreads),title:de(le.threads),persistence:"permanent",loadView:async()=>new((await pe()).ThreadsSidebarPane.ThreadsSidebarPane)}),s.ViewManager.registerViewExtension({id:"sources.scope-chain",commandPrompt:de(le.showScope),title:de(le.scope),persistence:"permanent",loadView:async()=>(await pe()).ScopeChainSidebarPane.ScopeChainSidebarPane.instance()}),s.ViewManager.registerViewExtension({id:"sources.watch",commandPrompt:de(le.showWatch),title:de(le.watch),persistence:"permanent",loadView:async()=>(await pe()).WatchExpressionsSidebarPane.WatchExpressionsSidebarPane.instance(),hasToolbar:!0}),s.ViewManager.registerViewExtension({id:"sources.js-breakpoints",commandPrompt:de(le.showBreakpoints),title:de(le.breakpoints),persistence:"permanent",loadView:async()=>(await me()).BreakpointsView.BreakpointsView.instance().wrapper}),s.ActionRegistration.registerActionExtension({category:"DEBUGGER",actionId:"debugger.toggle-pause",iconClass:"pause",toggleable:!0,toggledIconClass:"resume",loadActionDelegate:async()=>new((await pe()).SourcesPanel.RevealingActionDelegate),contextTypes:()=>Se((e=>[e.SourcesView.SourcesView,s.ShortcutRegistry.ForwardedShortcut])),options:[{value:!0,title:de(le.pauseScriptExecution)},{value:!1,title:de(le.resumeScriptExecution)}],bindings:[{shortcut:"F8",keybindSets:["devToolsDefault"]},{platform:"windows,linux",shortcut:"Ctrl+\\"},{shortcut:"F5",keybindSets:["vsCode"]},{shortcut:"Shift+F5",keybindSets:["vsCode"]},{platform:"mac",shortcut:"Meta+\\"}]}),s.ActionRegistration.registerActionExtension({category:"DEBUGGER",actionId:"debugger.step-over",loadActionDelegate:async()=>new((await pe()).SourcesPanel.ActionDelegate),title:de(le.stepOverNextFunctionCall),iconClass:"step-over",contextTypes:()=>[i.DebuggerModel.DebuggerPausedDetails],bindings:[{shortcut:"F10",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+'"},{platform:"mac",shortcut:"Meta+'"}]}),s.ActionRegistration.registerActionExtension({category:"DEBUGGER",actionId:"debugger.step-into",loadActionDelegate:async()=>new((await pe()).SourcesPanel.ActionDelegate),title:de(le.stepIntoNextFunctionCall),iconClass:"step-into",contextTypes:()=>[i.DebuggerModel.DebuggerPausedDetails],bindings:[{shortcut:"F11",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+;"},{platform:"mac",shortcut:"Meta+;"}]}),s.ActionRegistration.registerActionExtension({category:"DEBUGGER",actionId:"debugger.step",loadActionDelegate:async()=>new((await pe()).SourcesPanel.ActionDelegate),title:de(le.step),iconClass:"step",contextTypes:()=>[i.DebuggerModel.DebuggerPausedDetails],bindings:[{shortcut:"F9",keybindSets:["devToolsDefault"]}]}),s.ActionRegistration.registerActionExtension({category:"DEBUGGER",actionId:"debugger.step-out",loadActionDelegate:async()=>new((await pe()).SourcesPanel.ActionDelegate),title:de(le.stepOutOfCurrentFunction),iconClass:"step-out",contextTypes:()=>[i.DebuggerModel.DebuggerPausedDetails],bindings:[{shortcut:"Shift+F11",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Shift+Ctrl+;"},{platform:"mac",shortcut:"Shift+Meta+;"}]}),s.ActionRegistration.registerActionExtension({actionId:"debugger.run-snippet",category:"DEBUGGER",loadActionDelegate:async()=>new((await pe()).SourcesPanel.ActionDelegate),title:de(le.runSnippet),iconClass:"play",contextTypes:()=>Se((e=>[e.SourcesView.SourcesView])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Enter"},{platform:"mac",shortcut:"Meta+Enter"}]}),s.ActionRegistration.registerActionExtension({category:"DEBUGGER",actionId:"debugger.toggle-breakpoints-active",iconClass:"breakpoint-crossed",toggledIconClass:"breakpoint-crossed-filled",toggleable:!0,loadActionDelegate:async()=>new((await pe()).SourcesPanel.ActionDelegate),contextTypes:()=>Se((e=>[e.SourcesView.SourcesView])),options:[{value:!0,title:de(le.deactivateBreakpoints)},{value:!1,title:de(le.activateBreakpoints)}],bindings:[{platform:"windows,linux",shortcut:"Ctrl+F8"},{platform:"mac",shortcut:"Meta+F8"}]}),s.ActionRegistration.registerActionExtension({actionId:"sources.add-to-watch",loadActionDelegate:async()=>(await pe()).WatchExpressionsSidebarPane.WatchExpressionsSidebarPane.instance(),category:"DEBUGGER",title:de(le.addSelectedTextToWatches),contextTypes:()=>Se((e=>[e.UISourceCodeFrame.UISourceCodeFrame])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+A"},{platform:"mac",shortcut:"Meta+Shift+A"}]}),s.ActionRegistration.registerActionExtension({actionId:"debugger.evaluate-selection",category:"DEBUGGER",loadActionDelegate:async()=>new((await pe()).SourcesPanel.ActionDelegate),title:de(le.evaluateSelectedTextInConsole),contextTypes:()=>Se((e=>[e.UISourceCodeFrame.UISourceCodeFrame])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+E"},{platform:"mac",shortcut:"Meta+Shift+E"}]}),s.ActionRegistration.registerActionExtension({actionId:"sources.switch-file",category:"SOURCES",title:de(le.switchFile),loadActionDelegate:async()=>new((await pe()).SourcesView.SwitchFileActionDelegate),contextTypes:()=>Se((e=>[e.SourcesView.SourcesView])),bindings:[{shortcut:"Alt+O"}]}),s.ActionRegistration.registerActionExtension({actionId:"sources.rename",category:"SOURCES",title:de(le.rename),bindings:[{platform:"windows,linux",shortcut:"F2"},{platform:"mac",shortcut:"Enter"}]}),s.ActionRegistration.registerActionExtension({category:"SOURCES",actionId:"sources.close-all",loadActionDelegate:async()=>new((await pe()).SourcesView.ActionDelegate),title:de(le.closeAll),bindings:[{platform:"windows,linux",shortcut:"Ctrl+K W",keybindSets:["vsCode"]},{platform:"mac",shortcut:"Meta+K W",keybindSets:["vsCode"]}]}),s.ActionRegistration.registerActionExtension({actionId:"sources.jump-to-previous-location",category:"SOURCES",title:de(le.jumpToPreviousEditingLocation),loadActionDelegate:async()=>new((await pe()).SourcesView.ActionDelegate),contextTypes:()=>Se((e=>[e.SourcesView.SourcesView])),bindings:[{shortcut:"Alt+Minus"}]}),s.ActionRegistration.registerActionExtension({actionId:"sources.jump-to-next-location",category:"SOURCES",title:de(le.jumpToNextEditingLocation),loadActionDelegate:async()=>new((await pe()).SourcesView.ActionDelegate),contextTypes:()=>Se((e=>[e.SourcesView.SourcesView])),bindings:[{shortcut:"Alt+Plus"}]}),s.ActionRegistration.registerActionExtension({actionId:"sources.close-editor-tab",category:"SOURCES",title:de(le.closeTheActiveTab),loadActionDelegate:async()=>new((await pe()).SourcesView.ActionDelegate),contextTypes:()=>Se((e=>[e.SourcesView.SourcesView])),bindings:[{shortcut:"Alt+w"},{shortcut:"Ctrl+W",keybindSets:["vsCode"]},{platform:"windows",shortcut:"Ctrl+F4",keybindSets:["vsCode"]}]}),s.ActionRegistration.registerActionExtension({actionId:"sources.next-editor-tab",category:"SOURCES",title:de(le.nextEditorTab),loadActionDelegate:async()=>new((await pe()).SourcesView.ActionDelegate),contextTypes:()=>Se((e=>[e.SourcesView.SourcesView])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+PageDown",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+PageDown",keybindSets:["devToolsDefault","vsCode"]}]}),s.ActionRegistration.registerActionExtension({actionId:"sources.previous-editor-tab",category:"SOURCES",title:de(le.previousEditorTab),loadActionDelegate:async()=>new((await pe()).SourcesView.ActionDelegate),contextTypes:()=>Se((e=>[e.SourcesView.SourcesView])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+PageUp",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+PageUp",keybindSets:["devToolsDefault","vsCode"]}]}),s.ActionRegistration.registerActionExtension({actionId:"sources.go-to-line",category:"SOURCES",title:de(le.goToLine),loadActionDelegate:async()=>new((await pe()).SourcesView.ActionDelegate),contextTypes:()=>Se((e=>[e.SourcesView.SourcesView])),bindings:[{shortcut:"Ctrl+g",keybindSets:["devToolsDefault","vsCode"]}]}),s.ActionRegistration.registerActionExtension({actionId:"sources.go-to-member",category:"SOURCES",title:de(le.goToAFunctionDeclarationruleSet),loadActionDelegate:async()=>new((await pe()).SourcesView.ActionDelegate),contextTypes:()=>Se((e=>[e.SourcesView.SourcesView])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+o",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+Shift+o",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+T",keybindSets:["vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+T",keybindSets:["vsCode"]},{shortcut:"F12",keybindSets:["vsCode"]}]}),s.ActionRegistration.registerActionExtension({actionId:"debugger.toggle-breakpoint",category:"DEBUGGER",title:de(le.toggleBreakpoint),bindings:[{platform:"windows,linux",shortcut:"Ctrl+b",keybindSets:["devToolsDefault"]},{platform:"mac",shortcut:"Meta+b",keybindSets:["devToolsDefault"]},{shortcut:"F9",keybindSets:["vsCode"]}]}),s.ActionRegistration.registerActionExtension({actionId:"debugger.toggle-breakpoint-enabled",category:"DEBUGGER",title:de(le.toggleBreakpointEnabled),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+b"},{platform:"mac",shortcut:"Meta+Shift+b"}]}),s.ActionRegistration.registerActionExtension({actionId:"debugger.breakpoint-input-window",category:"DEBUGGER",title:de(le.toggleBreakpointInputWindow),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Alt+b"},{platform:"mac",shortcut:"Meta+Alt+b"}]}),s.ActionRegistration.registerActionExtension({actionId:"sources.save",category:"SOURCES",title:de(le.save),loadActionDelegate:async()=>new((await pe()).SourcesView.ActionDelegate),contextTypes:()=>Se((e=>[e.SourcesView.SourcesView])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+s",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+s",keybindSets:["devToolsDefault","vsCode"]}]}),s.ActionRegistration.registerActionExtension({actionId:"sources.save-all",category:"SOURCES",title:de(le.saveAll),loadActionDelegate:async()=>new((await pe()).SourcesView.ActionDelegate),contextTypes:()=>Se((e=>[e.SourcesView.SourcesView])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+s"},{platform:"mac",shortcut:"Meta+Alt+s"},{platform:"windows,linux",shortcut:"Ctrl+K S",keybindSets:["vsCode"]},{platform:"mac",shortcut:"Meta+Alt+S",keybindSets:["vsCode"]}]}),s.ActionRegistration.registerActionExtension({category:"SOURCES",actionId:"sources.create-snippet",loadActionDelegate:async()=>new((await pe()).SourcesNavigator.ActionDelegate),title:de(le.createNewSnippet)}),t.InspectorFrontendHost.InspectorFrontendHostInstance.isHostedMode()||s.ActionRegistration.registerActionExtension({category:"SOURCES",actionId:"sources.add-folder-to-workspace",loadActionDelegate:async()=>new((await pe()).SourcesNavigator.ActionDelegate),iconClass:"plus",title:de(le.addFolderToWorkspace)}),s.ActionRegistration.registerActionExtension({category:"DEBUGGER",actionId:"debugger.previous-call-frame",loadActionDelegate:async()=>new((await pe()).CallStackSidebarPane.ActionDelegate),title:de(le.previousCallFrame),contextTypes:()=>[i.DebuggerModel.DebuggerPausedDetails],bindings:[{shortcut:"Ctrl+,"}]}),s.ActionRegistration.registerActionExtension({category:"DEBUGGER",actionId:"debugger.next-call-frame",loadActionDelegate:async()=>new((await pe()).CallStackSidebarPane.ActionDelegate),title:de(le.nextCallFrame),contextTypes:()=>[i.DebuggerModel.DebuggerPausedDetails],bindings:[{shortcut:"Ctrl+."}]}),s.ActionRegistration.registerActionExtension({actionId:"sources.search",title:de(le.search),loadActionDelegate:async()=>new((await pe()).SearchSourcesView.ActionDelegate),category:"SOURCES",bindings:[{platform:"mac",shortcut:"Meta+Alt+F",keybindSets:["devToolsDefault"]},{platform:"windows,linux",shortcut:"Ctrl+Shift+F",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+Shift+J",keybindSets:["vsCode"]},{platform:"mac",shortcut:"Meta+Shift+F",keybindSets:["vsCode"]},{platform:"mac",shortcut:"Meta+Shift+J",keybindSets:["vsCode"]}]}),s.ActionRegistration.registerActionExtension({actionId:"sources.increment-css",category:"SOURCES",title:de(le.incrementCssUnitBy,{PH1:1}),bindings:[{shortcut:"Alt+Up"}]}),s.ActionRegistration.registerActionExtension({actionId:"sources.increment-css-by-ten",title:de(le.incrementCssUnitBy,{PH1:10}),category:"SOURCES",bindings:[{shortcut:"Alt+PageUp"}]}),s.ActionRegistration.registerActionExtension({actionId:"sources.decrement-css",category:"SOURCES",title:de(le.decrementCssUnitBy,{PH1:1}),bindings:[{shortcut:"Alt+Down"}]}),s.ActionRegistration.registerActionExtension({actionId:"sources.decrement-css-by-ten",category:"SOURCES",title:de(le.decrementCssUnitBy,{PH1:10}),bindings:[{shortcut:"Alt+PageDown"}]}),s.ActionRegistration.registerActionExtension({actionId:"sources.reveal-in-navigator-sidebar",category:"SOURCES",title:de(le.revealActiveFileInSidebar),loadActionDelegate:async()=>new((await pe()).SourcesPanel.ActionDelegate),contextTypes:()=>Se((e=>[e.SourcesView.SourcesView]))}),s.ActionRegistration.registerActionExtension({actionId:"sources.toggle-navigator-sidebar",category:"SOURCES",title:de(le.toggleNavigatorSidebar),loadActionDelegate:async()=>new((await pe()).SourcesPanel.ActionDelegate),contextTypes:()=>Se((e=>[e.SourcesView.SourcesView])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+y",keybindSets:["devToolsDefault"]},{platform:"mac",shortcut:"Meta+Shift+y",keybindSets:["devToolsDefault"]},{platform:"windows,linux",shortcut:"Ctrl+b",keybindSets:["vsCode"]},{platform:"windows,linux",shortcut:"Meta+b",keybindSets:["vsCode"]}]}),s.ActionRegistration.registerActionExtension({actionId:"sources.toggle-debugger-sidebar",category:"SOURCES",title:de(le.toggleDebuggerSidebar),loadActionDelegate:async()=>new((await pe()).SourcesPanel.ActionDelegate),contextTypes:()=>Se((e=>[e.SourcesView.SourcesView])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+h"},{platform:"mac",shortcut:"Meta+Shift+h"}]}),e.Settings.registerSettingExtension({settingName:"navigator-group-by-folder",settingType:"boolean",defaultValue:!0}),e.Settings.registerSettingExtension({settingName:"navigator-group-by-authored",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:de(le.searchInAnonymousAndContent),settingName:"search-in-anonymous-and-content-scripts",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:de(le.searchInAnonymousAndContent)},{value:!1,title:de(le.doNotSearchInAnonymousAndContent)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:de(le.automaticallyRevealFilesIn),settingName:"auto-reveal-in-navigator",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:de(le.automaticallyRevealFilesIn)},{value:!1,title:de(le.doNotAutomaticallyRevealFilesIn)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:de(le.javaScriptSourceMaps),settingName:"js-source-maps-enabled",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:de(le.enableJavaScriptSourceMaps)},{value:!1,title:de(le.disableJavaScriptSourceMaps)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:de(le.tabMovesFocus),settingName:"text-editor-tab-moves-focus",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:de(le.enableTabMovesFocus)},{value:!1,title:de(le.disableTabMovesFocus)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:de(le.detectIndentation),settingName:"text-editor-auto-detect-indent",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:de(le.detectIndentation)},{value:!1,title:de(le.doNotDetectIndentation)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:de(le.autocompletion),settingName:"text-editor-autocompletion",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:de(le.enableAutocompletion)},{value:!1,title:de(le.disableAutocompletion)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:de(le.bracketClosing),settingName:"text-editor-bracket-closing",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:de(le.enableBracketClosing)},{value:!1,title:de(le.disableBracketClosing)}]}),e.Settings.registerSettingExtension({category:"SOURCES",title:de(le.bracketMatching),settingName:"text-editor-bracket-matching",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:de(le.enableBracketMatching)},{value:!1,title:de(le.disableBracketMatching)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:de(le.codeFolding),settingName:"text-editor-code-folding",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:de(le.enableCodeFolding)},{value:!1,title:de(le.disableCodeFolding)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:de(le.showWhitespaceCharacters),settingName:"show-whitespaces-in-editor",settingType:"enum",defaultValue:"original",options:[{title:de(le.doNotShowWhitespaceCharacters),text:de(le.none),value:"none"},{title:de(le.showAllWhitespaceCharacters),text:de(le.all),value:"all"},{title:de(le.showTrailingWhitespaceCharacters),text:de(le.trailing),value:"trailing"}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:de(le.displayVariableValuesInlineWhile),settingName:"inline-variable-values",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:de(le.displayVariableValuesInlineWhile)},{value:!1,title:de(le.doNotDisplayVariableValuesInline)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:de(le.enableAutoFocusOnDebuggerPaused),settingName:"auto-focus-on-debugger-paused-enabled",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:de(le.enableAutoFocusOnDebuggerPaused)},{value:!1,title:de(le.disableAutoFocusOnDebuggerPaused)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:de(le.automaticallyPrettyPrintMinifiedSources),settingName:"auto-pretty-print-minified",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:de(le.automaticallyPrettyPrintMinifiedSources)},{value:!1,title:de(le.doNotAutomaticallyPrettyPrintMinifiedSources)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:de(le.cssSourceMaps),settingName:"css-source-maps-enabled",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:de(le.enableCssSourceMaps)},{value:!1,title:de(le.disableCssSourceMaps)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:de(le.allowScrollingPastEndOfFile),settingName:"allow-scroll-past-eof",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:de(le.allowScrollingPastEndOfFile)},{value:!1,title:de(le.disallowScrollingPastEndOfFile)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Local",title:de(le.wasmAutoStepping),settingName:"wasm-auto-stepping",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:de(le.enableWasmAutoStepping)},{value:!1,title:de(le.disableWasmAutoStepping)}]}),s.ViewManager.registerLocationResolver({name:"navigator-view",category:"SOURCES",loadResolver:async()=>(await pe()).SourcesPanel.SourcesPanel.instance()}),s.ViewManager.registerLocationResolver({name:"sources.sidebar-top",category:"SOURCES",loadResolver:async()=>(await pe()).SourcesPanel.SourcesPanel.instance()}),s.ViewManager.registerLocationResolver({name:"sources.sidebar-bottom",category:"SOURCES",loadResolver:async()=>(await pe()).SourcesPanel.SourcesPanel.instance()}),s.ViewManager.registerLocationResolver({name:"sources.sidebar-tabs",category:"SOURCES",loadResolver:async()=>(await pe()).SourcesPanel.SourcesPanel.instance()}),s.ContextMenu.registerProvider({contextTypes:()=>[n.UISourceCode.UISourceCode,n.UISourceCode.UILocation,i.RemoteObject.RemoteObject,i.NetworkRequest.NetworkRequest,...Se((e=>[e.UISourceCodeFrame.UISourceCodeFrame]))],loadProvider:async()=>(await pe()).SourcesPanel.SourcesPanel.instance(),experiment:void 0}),s.ContextMenu.registerProvider({loadProvider:async()=>(await pe()).WatchExpressionsSidebarPane.WatchExpressionsSidebarPane.instance(),contextTypes:()=>[d.ObjectPropertiesSection.ObjectPropertyTreeElement,...Se((e=>[e.UISourceCodeFrame.UISourceCodeFrame]))],experiment:void 0}),e.Revealer.registerRevealer({contextTypes:()=>[n.UISourceCode.UILocation],destination:e.Revealer.RevealerDestination.SOURCES_PANEL,loadRevealer:async()=>new((await pe()).SourcesPanel.UILocationRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[n.UISourceCode.UILocationRange],destination:e.Revealer.RevealerDestination.SOURCES_PANEL,loadRevealer:async()=>new((await pe()).SourcesPanel.UILocationRangeRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[i.DebuggerModel.Location],destination:e.Revealer.RevealerDestination.SOURCES_PANEL,loadRevealer:async()=>new((await pe()).SourcesPanel.DebuggerLocationRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[n.UISourceCode.UISourceCode],destination:e.Revealer.RevealerDestination.SOURCES_PANEL,loadRevealer:async()=>new((await pe()).SourcesPanel.UISourceCodeRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[i.DebuggerModel.DebuggerPausedDetails],destination:e.Revealer.RevealerDestination.SOURCES_PANEL,loadRevealer:async()=>new((await pe()).SourcesPanel.DebuggerPausedDetailsRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[c.BreakpointManager.BreakpointLocation],destination:e.Revealer.RevealerDestination.SOURCES_PANEL,loadRevealer:async()=>new((await pe()).DebuggerPlugin.BreakpointLocationRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>Se((e=>[e.SearchSourcesView.SearchSources])),destination:void 0,loadRevealer:async()=>new((await pe()).SearchSourcesView.Revealer)}),s.Toolbar.registerToolbarItem({actionId:"sources.add-folder-to-workspace",location:"files-navigator-toolbar",label:de(le.addFolder),loadItem:void 0,order:void 0,separator:void 0}),s.Context.registerListener({contextTypes:()=>[i.DebuggerModel.DebuggerPausedDetails],loadListener:async()=>(await me()).BreakpointsView.BreakpointsSidebarController.instance()}),s.Context.registerListener({contextTypes:()=>[i.DebuggerModel.DebuggerPausedDetails],loadListener:async()=>(await pe()).CallStackSidebarPane.CallStackSidebarPane.instance()}),s.Context.registerListener({contextTypes:()=>[i.DebuggerModel.CallFrame],loadListener:async()=>(await pe()).ScopeChainSidebarPane.ScopeChainSidebarPane.instance()}),s.ContextMenu.registerItem({location:"navigatorMenu/default",actionId:"quick-open.show",order:void 0}),s.ContextMenu.registerItem({location:"mainMenu/default",actionId:"sources.search",order:void 0}),g.FilteredListWidget.registerProvider({prefix:"@",iconName:"symbol",provider:async()=>new((await pe()).OutlineQuickOpen.OutlineQuickOpen),helpTitle:de(le.goToSymbol),titlePrefix:de(le.goTo),titleSuggestion:de(le.symbol)}),g.FilteredListWidget.registerProvider({prefix:":",iconName:"colon",provider:async()=>new((await pe()).GoToLineQuickOpen.GoToLineQuickOpen),helpTitle:de(le.goToLine),titlePrefix:de(le.goTo),titleSuggestion:de(le.line)}),g.FilteredListWidget.registerProvider({prefix:"",iconName:"document",provider:async()=>new((await pe()).OpenFileQuickOpen.OpenFileQuickOpen),helpTitle:de(le.openFile),titlePrefix:de(le.open),titleSuggestion:de(le.file)});const we={sensors:"Sensors",geolocation:"geolocation",timezones:"timezones",locale:"locale",locales:"locales",accelerometer:"accelerometer",deviceOrientation:"device orientation",locations:"Locations",touch:"Touch",devicebased:"Device-based",forceEnabled:"Force enabled",emulateIdleDetectorState:"Emulate Idle Detector state",noIdleEmulation:"No idle emulation",userActiveScreenUnlocked:"User active, screen unlocked",userActiveScreenLocked:"User active, screen locked",userIdleScreenUnlocked:"User idle, screen unlocked",userIdleScreenLocked:"User idle, screen locked",showSensors:"Show Sensors",showLocations:"Show Locations",cpuPressure:"CPU Pressure",noPressureEmulation:"No override",nominal:"Nominal",fair:"Fair",serious:"Serious",critical:"Critical"},ye=o.i18n.registerUIStrings("panels/sensors/sensors-meta.ts",we),he=o.i18n.getLazilyComputedLocalizedString.bind(void 0,ye);let be;async function ve(){return be||(be=await import("../../panels/sensors/sensors.js")),be}s.ViewManager.registerViewExtension({location:"drawer-view",commandPrompt:he(we.showSensors),title:he(we.sensors),id:"sensors",persistence:"closeable",order:100,loadView:async()=>new((await ve()).SensorsView.SensorsView),tags:[he(we.geolocation),he(we.timezones),he(we.locale),he(we.locales),he(we.accelerometer),he(we.deviceOrientation)]}),s.ViewManager.registerViewExtension({location:"settings-view",id:"emulation-locations",commandPrompt:he(we.showLocations),title:he(we.locations),order:40,loadView:async()=>new((await ve()).LocationsSettingsTab.LocationsSettingsTab),settings:["emulation.locations"],iconName:"location-on"}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"emulation.locations",settingType:"array",defaultValue:[{title:"Berlin",lat:52.520007,long:13.404954,timezoneId:"Europe/Berlin",locale:"de-DE"},{title:"London",lat:51.507351,long:-.127758,timezoneId:"Europe/London",locale:"en-GB"},{title:"Moscow",lat:55.755826,long:37.6173,timezoneId:"Europe/Moscow",locale:"ru-RU"},{title:"Mountain View",lat:37.386052,long:-122.083851,timezoneId:"America/Los_Angeles",locale:"en-US"},{title:"Mumbai",lat:19.075984,long:72.877656,timezoneId:"Asia/Kolkata",locale:"mr-IN"},{title:"San Francisco",lat:37.774929,long:-122.419416,timezoneId:"America/Los_Angeles",locale:"en-US"},{title:"Shanghai",lat:31.230416,long:121.473701,timezoneId:"Asia/Shanghai",locale:"zh-Hans-CN"},{title:"Sรฃo Paulo",lat:-23.55052,long:-46.633309,timezoneId:"America/Sao_Paulo",locale:"pt-BR"},{title:"Tokyo",lat:35.689487,long:139.691706,timezoneId:"Asia/Tokyo",locale:"ja-JP"}]}),e.Settings.registerSettingExtension({title:he(we.cpuPressure),reloadRequired:!0,settingName:"emulation.cpu-pressure",settingType:"enum",defaultValue:"none",options:[{value:"none",title:he(we.noPressureEmulation),text:he(we.noPressureEmulation)},{value:"nominal",title:he(we.nominal),text:he(we.nominal)},{value:"fair",title:he(we.fair),text:he(we.fair)},{value:"serious",title:he(we.serious),text:he(we.serious)},{value:"critical",title:he(we.critical),text:he(we.critical)}]}),e.Settings.registerSettingExtension({title:he(we.touch),reloadRequired:!0,settingName:"emulation.touch",settingType:"enum",defaultValue:"none",options:[{value:"none",title:he(we.devicebased),text:he(we.devicebased)},{value:"force",title:he(we.forceEnabled),text:he(we.forceEnabled)}]}),e.Settings.registerSettingExtension({title:he(we.emulateIdleDetectorState),settingName:"emulation.idle-detection",settingType:"enum",defaultValue:"none",options:[{value:"none",title:he(we.noIdleEmulation),text:he(we.noIdleEmulation)},{value:'{"isUserActive":true,"isScreenUnlocked":true}',title:he(we.userActiveScreenUnlocked),text:he(we.userActiveScreenUnlocked)},{value:'{"isUserActive":true,"isScreenUnlocked":false}',title:he(we.userActiveScreenLocked),text:he(we.userActiveScreenLocked)},{value:'{"isUserActive":false,"isScreenUnlocked":true}',title:he(we.userIdleScreenUnlocked),text:he(we.userIdleScreenUnlocked)},{value:'{"isUserActive":false,"isScreenUnlocked":false}',title:he(we.userIdleScreenLocked),text:he(we.userIdleScreenLocked)}]});const fe={performance:"Performance",showPerformance:"Show Performance",record:"Record",stop:"Stop",recordAndReload:"Record and reload",saveProfile:"Save profileโ€ฆ",loadProfile:"Load profileโ€ฆ",previousFrame:"Previous frame",nextFrame:"Next frame",showRecentTimelineSessions:"Show recent timeline sessions",previousRecording:"Previous recording",nextRecording:"Next recording",hideChromeFrameInLayersView:"Hide `chrome` frame in Layers view"},Ee=o.i18n.registerUIStrings("panels/timeline/timeline-meta.ts",fe),xe=o.i18n.getLazilyComputedLocalizedString.bind(void 0,Ee);let Te;async function Ae(){return Te||(Te=await import("../../panels/timeline/timeline.js")),Te}function Ce(e){return void 0===Te?[]:e(Te)}s.ViewManager.registerViewExtension({location:"panel",id:"timeline",title:xe(fe.performance),commandPrompt:xe(fe.showPerformance),order:50,loadView:async()=>(await Ae()).TimelinePanel.TimelinePanel.instance()}),s.ActionRegistration.registerActionExtension({actionId:"timeline.toggle-recording",category:"PERFORMANCE",iconClass:"record-start",toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,contextTypes:()=>Ce((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await Ae()).TimelinePanel.ActionDelegate),options:[{value:!0,title:xe(fe.record)},{value:!1,title:xe(fe.stop)}],bindings:[{platform:"windows,linux",shortcut:"Ctrl+E"},{platform:"mac",shortcut:"Meta+E"}]}),s.ActionRegistration.registerActionExtension({actionId:"timeline.record-reload",iconClass:"refresh",contextTypes:()=>Ce((e=>[e.TimelinePanel.TimelinePanel])),category:"PERFORMANCE",title:xe(fe.recordAndReload),loadActionDelegate:async()=>new((await Ae()).TimelinePanel.ActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+E"},{platform:"mac",shortcut:"Meta+Shift+E"}],experiment:"!react-native-specific-ui"}),s.ActionRegistration.registerActionExtension({category:"PERFORMANCE",actionId:"timeline.save-to-file",contextTypes:()=>Ce((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await Ae()).TimelinePanel.ActionDelegate),title:xe(fe.saveProfile),bindings:[{platform:"windows,linux",shortcut:"Ctrl+S"},{platform:"mac",shortcut:"Meta+S"}]}),s.ActionRegistration.registerActionExtension({category:"PERFORMANCE",actionId:"timeline.load-from-file",contextTypes:()=>Ce((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await Ae()).TimelinePanel.ActionDelegate),title:xe(fe.loadProfile),bindings:[{platform:"windows,linux",shortcut:"Ctrl+O"},{platform:"mac",shortcut:"Meta+O"}]}),s.ActionRegistration.registerActionExtension({actionId:"timeline.jump-to-previous-frame",category:"PERFORMANCE",title:xe(fe.previousFrame),contextTypes:()=>Ce((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await Ae()).TimelinePanel.ActionDelegate),bindings:[{shortcut:"["}]}),s.ActionRegistration.registerActionExtension({actionId:"timeline.jump-to-next-frame",category:"PERFORMANCE",title:xe(fe.nextFrame),contextTypes:()=>Ce((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await Ae()).TimelinePanel.ActionDelegate),bindings:[{shortcut:"]"}]}),s.ActionRegistration.registerActionExtension({actionId:"timeline.show-history",loadActionDelegate:async()=>new((await Ae()).TimelinePanel.ActionDelegate),category:"PERFORMANCE",title:xe(fe.showRecentTimelineSessions),contextTypes:()=>Ce((e=>[e.TimelinePanel.TimelinePanel])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+H"},{platform:"mac",shortcut:"Meta+Y"}]}),s.ActionRegistration.registerActionExtension({actionId:"timeline.previous-recording",category:"PERFORMANCE",loadActionDelegate:async()=>new((await Ae()).TimelinePanel.ActionDelegate),title:xe(fe.previousRecording),contextTypes:()=>Ce((e=>[e.TimelinePanel.TimelinePanel])),bindings:[{platform:"windows,linux",shortcut:"Alt+Left"},{platform:"mac",shortcut:"Meta+Left"}]}),s.ActionRegistration.registerActionExtension({actionId:"timeline.next-recording",category:"PERFORMANCE",loadActionDelegate:async()=>new((await Ae()).TimelinePanel.ActionDelegate),title:xe(fe.nextRecording),contextTypes:()=>Ce((e=>[e.TimelinePanel.TimelinePanel])),bindings:[{platform:"windows,linux",shortcut:"Alt+Right"},{platform:"mac",shortcut:"Meta+Right"}]}),e.Settings.registerSettingExtension({category:"PERFORMANCE",storageType:"Synced",title:xe(fe.hideChromeFrameInLayersView),settingName:"frame-viewer-hide-chrome-window",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({category:"PERFORMANCE",storageType:"Synced",settingName:"annotations-hidden",settingType:"boolean",defaultValue:!1}),e.Linkifier.registerLinkifier({contextTypes:()=>Ce((e=>[e.CLSLinkifier.CLSRect])),loadLinkifier:async()=>(await Ae()).CLSLinkifier.Linkifier.instance()}),s.ContextMenu.registerItem({location:"timelineMenu/open",actionId:"timeline.load-from-file",order:10}),s.ContextMenu.registerItem({location:"timelineMenu/open",actionId:"timeline.save-to-file",order:15}),e.Revealer.registerRevealer({contextTypes:()=>[i.TraceObject.TraceObject],destination:e.Revealer.RevealerDestination.TIMELINE_PANEL,loadRevealer:async()=>new((await Ae()).TimelinePanel.TraceRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[i.TraceObject.RevealableEvent],destination:e.Revealer.RevealerDestination.TIMELINE_PANEL,loadRevealer:async()=>new((await Ae()).TimelinePanel.EventRevealer)});const Re={flamechartSelectedNavigation:"Flamechart navigation:",modern:"Modern",classic:"Classic",liveMemoryAllocationAnnotations:"Live memory allocation annotations",showLiveMemoryAllocation:"Show live memory allocation annotations",hideLiveMemoryAllocation:"Hide live memory allocation annotations",collectGarbage:"Collect garbage"},ke=o.i18n.registerUIStrings("ui/legacy/components/perf_ui/perf_ui-meta.ts",Re),Pe=o.i18n.getLazilyComputedLocalizedString.bind(void 0,ke);let De;s.ActionRegistration.registerActionExtension({actionId:"components.collect-garbage",category:"PERFORMANCE",title:Pe(Re.collectGarbage),iconClass:"mop",loadActionDelegate:async()=>new((await async function(){return De||(De=await import("../../ui/legacy/components/perf_ui/perf_ui.js")),De}()).GCActionDelegate.GCActionDelegate)}),e.Settings.registerSettingExtension({category:"PERFORMANCE",storageType:"Synced",title:Pe(Re.flamechartSelectedNavigation),settingName:"flamechart-selected-navigation",settingType:"enum",defaultValue:"classic",options:[{title:Pe(Re.modern),text:Pe(Re.modern),value:"modern"},{title:Pe(Re.classic),text:Pe(Re.classic),value:"classic"}]}),e.Settings.registerSettingExtension({category:"MEMORY",experiment:"live-heap-profile",title:Pe(Re.liveMemoryAllocationAnnotations),settingName:"memory-live-heap-profile",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:Pe(Re.showLiveMemoryAllocation)},{value:!1,title:Pe(Re.hideLiveMemoryAllocation)}]});const Ne={openFile:"Open file",runCommand:"Run command"},Ie=o.i18n.registerUIStrings("ui/legacy/components/quick_open/quick_open-meta.ts",Ne),Ve=o.i18n.getLazilyComputedLocalizedString.bind(void 0,Ie);let Le;async function Me(){return Le||(Le=await import("../../ui/legacy/components/quick_open/quick_open.js")),Le}s.ActionRegistration.registerActionExtension({actionId:"quick-open.show-command-menu",category:"GLOBAL",title:Ve(Ne.runCommand),loadActionDelegate:async()=>new((await Me()).CommandMenu.ShowActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+P",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+Shift+P",keybindSets:["devToolsDefault","vsCode"]},{shortcut:"F1",keybindSets:["vsCode"]}]}),s.ActionRegistration.registerActionExtension({actionId:"quick-open.show",category:"GLOBAL",title:Ve(Ne.openFile),loadActionDelegate:async()=>new((await Me()).QuickOpen.ShowActionDelegate),order:100,bindings:[{platform:"mac",shortcut:"Meta+P",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+O",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+P",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+O",keybindSets:["devToolsDefault","vsCode"]}]}),s.ContextMenu.registerItem({location:"mainMenu/default",actionId:"quick-open.show-command-menu",order:void 0}),s.ContextMenu.registerItem({location:"mainMenu/default",actionId:"quick-open.show",order:void 0});const Oe={defaultIndentation:"Default indentation:",setIndentationToSpaces:"Set indentation to 2 spaces",Spaces:"2 spaces",setIndentationToFSpaces:"Set indentation to 4 spaces",fSpaces:"4 spaces",setIndentationToESpaces:"Set indentation to 8 spaces",eSpaces:"8 spaces",setIndentationToTabCharacter:"Set indentation to tab character",tabCharacter:"Tab character"},Fe=o.i18n.registerUIStrings("ui/legacy/components/source_frame/source_frame-meta.ts",Oe),Ue=o.i18n.getLazilyComputedLocalizedString.bind(void 0,Fe);e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:Ue(Oe.defaultIndentation),settingName:"text-editor-indent",settingType:"enum",defaultValue:" ",options:[{title:Ue(Oe.setIndentationToSpaces),text:Ue(Oe.Spaces),value:" "},{title:Ue(Oe.setIndentationToFSpaces),text:Ue(Oe.fSpaces),value:" "},{title:Ue(Oe.setIndentationToESpaces),text:Ue(Oe.eSpaces),value:" "},{title:Ue(Oe.setIndentationToTabCharacter),text:Ue(Oe.tabCharacter),value:"\t"}]}),new u.MainImpl.MainImpl; +import*as e from"../../core/common/common.js";import*as t from"../../core/host/host.js";import*as o from"../../core/i18n/i18n.js";import*as i from"../../core/root/root.js";import*as n from"../../core/sdk/sdk.js";import*as a from"../../models/workspace/workspace.js";import*as s from"../../ui/legacy/components/utils/utils.js";import*as r from"../../ui/legacy/legacy.js";import"../../Images/Images.js";import*as l from"../../ui/components/legacy_wrapper/legacy_wrapper.js";import*as c from"../../models/breakpoints/breakpoints.js";import*as d from"../../ui/legacy/components/object_ui/object_ui.js";import*as g from"../../ui/legacy/components/quick_open/quick_open.js";import*as u from"../main/main.js";const p={focusDebuggee:"Focus page",toggleDrawer:"Toggle drawer",nextPanel:"Next panel",previousPanel:"Previous panel",reloadDevtools:"Reload DevTools",restoreLastDockPosition:"Restore last dock position",zoomIn:"Zoom in",zoomOut:"Zoom out",resetZoomLevel:"Reset zoom level",searchInPanel:"Search in panel",cancelSearch:"Cancel search",findNextResult:"Find next result",findPreviousResult:"Find previous result",theme:"Theme:",switchToBrowserPreferredTheme:"Switch to browser's preferred theme",autoTheme:"Auto",switchToLightTheme:"Switch to light theme",lightCapital:"Light",switchToDarkTheme:"Switch to dark theme",darkCapital:"Dark",darkLower:"dark",lightLower:"light",panelLayout:"Panel layout:",useHorizontalPanelLayout:"Use horizontal panel layout",horizontal:"horizontal",useVerticalPanelLayout:"Use vertical panel layout",vertical:"vertical",useAutomaticPanelLayout:"Use automatic panel layout",auto:"auto",enableCtrlShortcutToSwitchPanels:"Enable Ctrl + 1-9 shortcut to switch panels",enableShortcutToSwitchPanels:"Enable โŒ˜ + 1-9 shortcut to switch panels",right:"Right",dockToRight:"Dock to right",bottom:"Bottom",dockToBottom:"Dock to bottom",left:"Left",dockToLeft:"Dock to left",undocked:"Undocked",undockIntoSeparateWindow:"Undock into separate window",devtoolsDefault:"DevTools (Default)",language:"Language:",browserLanguage:"Browser UI language",enableSync:"Enable settings sync",searchAsYouTypeSetting:"Search as you type",searchAsYouTypeCommand:"Enable search as you type",searchOnEnterCommand:"Disable search as you type (press Enter to search)",matchChromeColorScheme:"Match Chrome color scheme",matchChromeColorSchemeDocumentation:"Match DevTools colors to your customized Chrome theme (when enabled)",matchChromeColorSchemeCommand:"Match Chrome color scheme",dontMatchChromeColorSchemeCommand:"Don't match Chrome color scheme"},m=o.i18n.registerUIStrings("entrypoints/main/main-meta.ts",p),S=o.i18n.getLazilyComputedLocalizedString.bind(void 0,m);let w,y;async function h(){return w||(w=await import("../main/main.js")),w}function v(){return!t.InspectorFrontendHost.InspectorFrontendHostInstance.isHostedMode()}function b(e){return()=>o.i18n.getLocalizedLanguageRegion(e,o.DevToolsLocale.DevToolsLocale.instance())}r.ActionRegistration.registerActionExtension({category:"DRAWER",actionId:"inspector-main.focus-debuggee",loadActionDelegate:async()=>new((await async function(){return y||(y=await import("../inspector_main/inspector_main.js")),y}()).InspectorMain.FocusDebuggeeActionDelegate),order:100,title:S(p.focusDebuggee)}),r.ActionRegistration.registerActionExtension({category:"DRAWER",actionId:"main.toggle-drawer",loadActionDelegate:async()=>new r.InspectorView.ActionDelegate,order:101,title:S(p.toggleDrawer),bindings:[{shortcut:"Esc"}]}),r.ActionRegistration.registerActionExtension({actionId:"main.next-tab",category:"GLOBAL",title:S(p.nextPanel),loadActionDelegate:async()=>new r.InspectorView.ActionDelegate,bindings:[{platform:"windows,linux",shortcut:"Ctrl+]"},{platform:"mac",shortcut:"Meta+]"}]}),r.ActionRegistration.registerActionExtension({actionId:"main.previous-tab",category:"GLOBAL",title:S(p.previousPanel),loadActionDelegate:async()=>new r.InspectorView.ActionDelegate,bindings:[{platform:"windows,linux",shortcut:"Ctrl+["},{platform:"mac",shortcut:"Meta+["}]}),r.ActionRegistration.registerActionExtension({actionId:"main.debug-reload",category:"GLOBAL",title:S(p.reloadDevtools),loadActionDelegate:async()=>new((await h()).MainImpl.ReloadActionDelegate),bindings:[{shortcut:"Alt+R"}]}),r.ActionRegistration.registerActionExtension({category:"GLOBAL",experiment:"!react-native-specific-ui",title:S(p.restoreLastDockPosition),actionId:"main.toggle-dock",loadActionDelegate:async()=>new r.DockController.ToggleDockActionDelegate,bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+D"},{platform:"mac",shortcut:"Meta+Shift+D"}]}),r.ActionRegistration.registerActionExtension({actionId:"main.zoom-in",category:"GLOBAL",title:S(p.zoomIn),loadActionDelegate:async()=>new((await h()).MainImpl.ZoomActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Plus",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+Shift+Plus"},{platform:"windows,linux",shortcut:"Ctrl+NumpadPlus"},{platform:"windows,linux",shortcut:"Ctrl+Shift+NumpadPlus"},{platform:"mac",shortcut:"Meta+Plus",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+Shift+Plus"},{platform:"mac",shortcut:"Meta+NumpadPlus"},{platform:"mac",shortcut:"Meta+Shift+NumpadPlus"}],condition:v}),r.ActionRegistration.registerActionExtension({actionId:"main.zoom-out",category:"GLOBAL",title:S(p.zoomOut),loadActionDelegate:async()=>new((await h()).MainImpl.ZoomActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Minus",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+Shift+Minus"},{platform:"windows,linux",shortcut:"Ctrl+NumpadMinus"},{platform:"windows,linux",shortcut:"Ctrl+Shift+NumpadMinus"},{platform:"mac",shortcut:"Meta+Minus",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+Shift+Minus"},{platform:"mac",shortcut:"Meta+NumpadMinus"},{platform:"mac",shortcut:"Meta+Shift+NumpadMinus"}],condition:v}),r.ActionRegistration.registerActionExtension({actionId:"main.zoom-reset",category:"GLOBAL",title:S(p.resetZoomLevel),loadActionDelegate:async()=>new((await h()).MainImpl.ZoomActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+0"},{platform:"windows,linux",shortcut:"Ctrl+Numpad0"},{platform:"mac",shortcut:"Meta+Numpad0"},{platform:"mac",shortcut:"Meta+0"}],condition:v}),r.ActionRegistration.registerActionExtension({actionId:"main.search-in-panel.find",category:"GLOBAL",title:S(p.searchInPanel),loadActionDelegate:async()=>new((await h()).MainImpl.SearchActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+F",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+F",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"F3"}]}),r.ActionRegistration.registerActionExtension({actionId:"main.search-in-panel.cancel",category:"GLOBAL",title:S(p.cancelSearch),loadActionDelegate:async()=>new((await h()).MainImpl.SearchActionDelegate),order:10,bindings:[{shortcut:"Esc"}]}),r.ActionRegistration.registerActionExtension({actionId:"main.search-in-panel.find-next",category:"GLOBAL",title:S(p.findNextResult),loadActionDelegate:async()=>new((await h()).MainImpl.SearchActionDelegate),bindings:[{platform:"mac",shortcut:"Meta+G",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+G"},{platform:"windows,linux",shortcut:"F3",keybindSets:["devToolsDefault","vsCode"]}]}),r.ActionRegistration.registerActionExtension({actionId:"main.search-in-panel.find-previous",category:"GLOBAL",title:S(p.findPreviousResult),loadActionDelegate:async()=>new((await h()).MainImpl.SearchActionDelegate),bindings:[{platform:"mac",shortcut:"Meta+Shift+G",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+Shift+G"},{platform:"windows,linux",shortcut:"Shift+F3",keybindSets:["devToolsDefault","vsCode"]}]}),e.Settings.registerSettingExtension({category:"APPEARANCE",storageType:"Synced",title:S(p.theme),settingName:"ui-theme",settingType:"enum",defaultValue:"systemPreferred",reloadRequired:!1,options:[{title:S(p.switchToBrowserPreferredTheme),text:S(p.autoTheme),value:"systemPreferred"},{title:S(p.switchToLightTheme),text:S(p.lightCapital),value:"default"},{title:S(p.switchToDarkTheme),text:S(p.darkCapital),value:"dark"}],tags:[S(p.darkLower),S(p.lightLower)]}),e.Settings.registerSettingExtension({category:"APPEARANCE",storageType:"Synced",title:S(p.matchChromeColorScheme),settingName:"chrome-theme-colors",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:S(p.matchChromeColorSchemeCommand)},{value:!1,title:S(p.dontMatchChromeColorSchemeCommand)}],reloadRequired:!0,learnMore:{url:"https://goo.gle/devtools-customize-theme",tooltip:S(p.matchChromeColorSchemeDocumentation)}}),e.Settings.registerSettingExtension({category:"APPEARANCE",storageType:"Synced",title:S(p.panelLayout),settingName:"sidebar-position",settingType:"enum",defaultValue:"auto",options:[{title:S(p.useHorizontalPanelLayout),text:S(p.horizontal),value:"bottom"},{title:S(p.useVerticalPanelLayout),text:S(p.vertical),value:"right"},{title:S(p.useAutomaticPanelLayout),text:S(p.auto),value:"auto"}]}),e.Settings.registerSettingExtension({category:"APPEARANCE",storageType:"Synced",settingName:"language",settingType:"enum",title:S(p.language),defaultValue:"en-US",options:[{value:"browserLanguage",title:S(p.browserLanguage),text:S(p.browserLanguage)},...o.i18n.getAllSupportedDevToolsLocales().sort().map((e=>{return{value:t=e,title:b(t),text:b(t)};var t}))],reloadRequired:!0}),e.Settings.registerSettingExtension({category:"APPEARANCE",storageType:"Synced",title:"mac"===t.Platform.platform()?S(p.enableShortcutToSwitchPanels):S(p.enableCtrlShortcutToSwitchPanels),settingName:"shortcut-panel-switch",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({category:"GLOBAL",experiment:"!react-native-specific-ui",settingName:"currentDockState",settingType:"enum",defaultValue:"right",options:[{value:"right",text:S(p.right),title:S(p.dockToRight)},{value:"bottom",text:S(p.bottom),title:S(p.dockToBottom)},{value:"left",text:S(p.left),title:S(p.dockToLeft)},{value:"undocked",text:S(p.undocked),title:S(p.undockIntoSeparateWindow)}]}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"active-keybind-set",settingType:"enum",defaultValue:"devToolsDefault",options:[{value:"devToolsDefault",title:S(p.devtoolsDefault),text:S(p.devtoolsDefault)},{value:"vsCode",title:o.i18n.lockedLazyString("Visual Studio Code"),text:o.i18n.lockedLazyString("Visual Studio Code")}]}),e.Settings.registerSettingExtension({category:"SYNC",settingName:"sync-preferences",settingType:"boolean",title:S(p.enableSync),defaultValue:!1,reloadRequired:!0}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"user-shortcuts",settingType:"array",defaultValue:[]}),e.Settings.registerSettingExtension({category:"GLOBAL",storageType:"Local",title:S(p.searchAsYouTypeSetting),settingName:"search-as-you-type",settingType:"boolean",order:3,defaultValue:!0,options:[{value:!0,title:S(p.searchAsYouTypeCommand)},{value:!1,title:S(p.searchOnEnterCommand)}]}),r.ViewManager.registerLocationResolver({name:"drawer-view",category:"DRAWER",loadResolver:async()=>r.InspectorView.InspectorView.instance()}),r.ViewManager.registerLocationResolver({name:"drawer-sidebar",category:"DRAWER_SIDEBAR",loadResolver:async()=>r.InspectorView.InspectorView.instance()}),r.ViewManager.registerLocationResolver({name:"panel",category:"PANEL",loadResolver:async()=>r.InspectorView.InspectorView.instance()}),r.ContextMenu.registerProvider({contextTypes:()=>[a.UISourceCode.UISourceCode,n.Resource.Resource,n.NetworkRequest.NetworkRequest],loadProvider:async()=>new s.Linkifier.ContentProviderContextMenuProvider,experiment:void 0}),r.ContextMenu.registerProvider({contextTypes:()=>[Node],loadProvider:async()=>new r.XLink.ContextMenuProvider,experiment:void 0}),r.ContextMenu.registerProvider({contextTypes:()=>[Node],loadProvider:async()=>new s.Linkifier.LinkContextMenuProvider,experiment:void 0}),r.Toolbar.registerToolbarItem({separator:!0,location:"main-toolbar-left",order:100}),r.Toolbar.registerToolbarItem({separator:!0,order:97,location:"main-toolbar-right"}),r.Toolbar.registerToolbarItem({loadItem:async()=>(await h()).MainImpl.SettingsButtonProvider.instance(),order:99,location:"main-toolbar-right"}),r.Toolbar.registerToolbarItem({loadItem:async()=>(await h()).MainImpl.MainMenuItem.instance(),order:100,location:"main-toolbar-right"}),r.Toolbar.registerToolbarItem({loadItem:async()=>r.DockController.CloseButtonProvider.instance(),order:101,location:"main-toolbar-right"}),e.AppProvider.registerAppProvider({loadAppProvider:async()=>(await h()).SimpleApp.SimpleAppProvider.instance(),order:10});const f={rendering:"Rendering",showRendering:"Show Rendering",paint:"paint",layout:"layout",fps:"fps",cssMediaType:"CSS media type",cssMediaFeature:"CSS media feature",visionDeficiency:"vision deficiency",colorVisionDeficiency:"color vision deficiency",reloadPage:"Reload page",hardReloadPage:"Hard reload page",forceAdBlocking:"Force ad blocking on this site",blockAds:"Block ads on this site",showAds:"Show ads on this site, if allowed",autoOpenDevTools:"Auto-open DevTools for popups",doNotAutoOpen:"Do not auto-open DevTools for popups",disablePaused:"Disable paused state overlay",toggleCssPrefersColorSchemeMedia:"Toggle CSS media feature prefers-color-scheme"},x=o.i18n.registerUIStrings("entrypoints/inspector_main/inspector_main-meta.ts",f),E=o.i18n.getLazilyComputedLocalizedString.bind(void 0,x);let T;async function A(){return T||(T=await import("../inspector_main/inspector_main.js")),T}r.ViewManager.registerViewExtension({location:"drawer-view",id:"rendering",title:E(f.rendering),commandPrompt:E(f.showRendering),persistence:"closeable",experiment:"!react-native-specific-ui",order:50,loadView:async()=>new((await A()).RenderingOptions.RenderingOptionsView),tags:[E(f.paint),E(f.layout),E(f.fps),E(f.cssMediaType),E(f.cssMediaFeature),E(f.visionDeficiency),E(f.colorVisionDeficiency)]}),r.ActionRegistration.registerActionExtension({category:"NAVIGATION",actionId:"inspector-main.reload",loadActionDelegate:async()=>new((await A()).InspectorMain.ReloadActionDelegate),iconClass:"refresh",title:E(f.reloadPage),bindings:[{platform:"windows,linux",shortcut:"Ctrl+R"},{platform:"windows,linux",shortcut:"F5"},{platform:"mac",shortcut:"Meta+R"}]}),r.ActionRegistration.registerActionExtension({category:"NAVIGATION",actionId:"inspector-main.hard-reload",loadActionDelegate:async()=>new((await A()).InspectorMain.ReloadActionDelegate),title:E(f.hardReloadPage),bindings:[{platform:"windows,linux",shortcut:"Shift+Ctrl+R"},{platform:"windows,linux",shortcut:"Shift+F5"},{platform:"windows,linux",shortcut:"Ctrl+F5"},{platform:"windows,linux",shortcut:"Ctrl+Shift+F5"},{platform:"mac",shortcut:"Shift+Meta+R"}]}),r.ActionRegistration.registerActionExtension({actionId:"rendering.toggle-prefers-color-scheme",category:"RENDERING",experiment:"!react-native-specific-ui",title:E(f.toggleCssPrefersColorSchemeMedia),loadActionDelegate:async()=>new((await A()).RenderingOptions.ReloadActionDelegate)}),e.Settings.registerSettingExtension({category:"",title:E(f.forceAdBlocking),settingName:"network.ad-blocking-enabled",settingType:"boolean",storageType:"Session",defaultValue:!1,options:[{value:!0,title:E(f.blockAds)},{value:!1,title:E(f.showAds)}]}),e.Settings.registerSettingExtension({category:"GLOBAL",storageType:"Synced",title:E(f.autoOpenDevTools),settingName:"auto-attach-to-created-pages",settingType:"boolean",order:2,defaultValue:!1,options:[{value:!0,title:E(f.autoOpenDevTools)},{value:!1,title:E(f.doNotAutoOpen)}]}),e.Settings.registerSettingExtension({category:"APPEARANCE",storageType:"Synced",title:E(f.disablePaused),settingName:"disable-paused-state-overlay",settingType:"boolean",defaultValue:!1}),r.Toolbar.registerToolbarItem({loadItem:async()=>(await A()).InspectorMain.NodeIndicator.instance(),order:2,location:"main-toolbar-left"}),r.Toolbar.registerToolbarItem({loadItem:async()=>(await A()).OutermostTargetSelector.OutermostTargetSelector.instance(),order:98,location:"main-toolbar-right"});const C={preserveLogUponNavigation:"Preserve log upon navigation",doNotPreserveLogUponNavigation:"Do not preserve log upon navigation",pauseOnExceptions:"Pause on exceptions",doNotPauseOnExceptions:"Do not pause on exceptions",disableJavascript:"Disable JavaScript",enableJavascript:"Enable JavaScript",disableAsyncStackTraces:"Disable async stack traces",doNotCaptureAsyncStackTraces:"Do not capture async stack traces",captureAsyncStackTraces:"Capture async stack traces",showRulersOnHover:"Show rulers on hover",doNotShowRulersOnHover:"Do not show rulers on hover",showAreaNames:"Show area names",showGridNamedAreas:"Show grid named areas",doNotShowGridNamedAreas:"Do not show grid named areas",showTrackSizes:"Show track sizes",showGridTrackSizes:"Show grid track sizes",doNotShowGridTrackSizes:"Do not show grid track sizes",extendGridLines:"Extend grid lines",doNotExtendGridLines:"Do not extend grid lines",showLineLabels:"Show line labels",hideLineLabels:"Hide line labels",showLineNumbers:"Show line numbers",showLineNames:"Show line names",showPaintFlashingRectangles:"Show paint flashing rectangles",hidePaintFlashingRectangles:"Hide paint flashing rectangles",showLayoutShiftRegions:"Show layout shift regions",hideLayoutShiftRegions:"Hide layout shift regions",highlightAdFrames:"Highlight ad frames",doNotHighlightAdFrames:"Do not highlight ad frames",showLayerBorders:"Show layer borders",hideLayerBorders:"Hide layer borders",showFramesPerSecondFpsMeter:"Show frames per second (FPS) meter",hideFramesPerSecondFpsMeter:"Hide frames per second (FPS) meter",showScrollPerformanceBottlenecks:"Show scroll performance bottlenecks",hideScrollPerformanceBottlenecks:"Hide scroll performance bottlenecks",emulateAFocusedPage:"Emulate a focused page",doNotEmulateAFocusedPage:"Do not emulate a focused page",doNotEmulateCssMediaType:"Do not emulate CSS media type",noEmulation:"No emulation",emulateCssPrintMediaType:"Emulate CSS print media type",print:"print",emulateCssScreenMediaType:"Emulate CSS screen media type",screen:"screen",query:"query",emulateCssMediaType:"Emulate CSS media type",doNotEmulateCss:"Do not emulate CSS {PH1}",emulateCss:"Emulate CSS {PH1}",emulateCssMediaFeature:"Emulate CSS media feature {PH1}",doNotEmulateAnyVisionDeficiency:"Do not emulate any vision deficiency",emulateBlurredVision:"Emulate blurred vision",emulateReducedContrast:"Emulate reduced contrast",blurredVision:"Blurred vision",reducedContrast:"Reduced contrast",emulateProtanopia:"Emulate protanopia (no red)",protanopia:"Protanopia (no red)",emulateDeuteranopia:"Emulate deuteranopia (no green)",deuteranopia:"Deuteranopia (no green)",emulateTritanopia:"Emulate tritanopia (no blue)",tritanopia:"Tritanopia (no blue)",emulateAchromatopsia:"Emulate achromatopsia (no color)",achromatopsia:"Achromatopsia (no color)",emulateVisionDeficiencies:"Emulate vision deficiencies",disableLocalFonts:"Disable local fonts",enableLocalFonts:"Enable local fonts",disableAvifFormat:"Disable `AVIF` format",enableAvifFormat:"Enable `AVIF` format",disableWebpFormat:"Disable `WebP` format",enableWebpFormat:"Enable `WebP` format",customFormatters:"Custom formatters",networkRequestBlocking:"Network request blocking",enableNetworkRequestBlocking:"Enable network request blocking",disableNetworkRequestBlocking:"Disable network request blocking",enableCache:"Enable cache",disableCache:"Disable cache while DevTools is open",emulateAutoDarkMode:"Emulate auto dark mode",enableRemoteFileLoading:"Allow `DevTools` to load resources, such as source maps, from remote file paths. Disabled by default for security reasons.",networkCacheExplanation:"Disabling the network cache will simulate a network experience similar to a first time visitor."},R=o.i18n.registerUIStrings("core/sdk/sdk-meta.ts",C),k=o.i18n.getLazilyComputedLocalizedString.bind(void 0,R);e.Settings.registerSettingExtension({storageType:"Synced",settingName:"skip-stack-frames-pattern",settingType:"regex",defaultValue:""}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"skip-content-scripts",settingType:"boolean",defaultValue:!0}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"automatically-ignore-list-known-third-party-scripts",settingType:"boolean",defaultValue:!0}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"skip-anonymous-scripts",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"enable-ignore-listing",settingType:"boolean",defaultValue:!0}),e.Settings.registerSettingExtension({category:"CONSOLE",storageType:"Synced",title:k(C.preserveLogUponNavigation),settingName:"preserve-console-log",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:k(C.preserveLogUponNavigation)},{value:!1,title:k(C.doNotPreserveLogUponNavigation)}]}),e.Settings.registerSettingExtension({category:"DEBUGGER",settingName:"pause-on-exception-enabled",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:k(C.pauseOnExceptions)},{value:!1,title:k(C.doNotPauseOnExceptions)}]}),e.Settings.registerSettingExtension({settingName:"pause-on-caught-exception",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({settingName:"pause-on-uncaught-exception",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({category:"DEBUGGER",experiment:"!react-native-specific-ui",title:k(C.disableJavascript),settingName:"java-script-disabled",settingType:"boolean",storageType:"Session",order:1,defaultValue:!1,options:[{value:!0,title:k(C.disableJavascript)},{value:!1,title:k(C.enableJavascript)}]}),e.Settings.registerSettingExtension({category:"DEBUGGER",title:k(C.disableAsyncStackTraces),settingName:"disable-async-stack-traces",settingType:"boolean",defaultValue:!1,order:2,options:[{value:!0,title:k(C.doNotCaptureAsyncStackTraces)},{value:!1,title:k(C.captureAsyncStackTraces)}]}),e.Settings.registerSettingExtension({category:"DEBUGGER",settingName:"breakpoints-active",settingType:"boolean",storageType:"Session",defaultValue:!0}),e.Settings.registerSettingExtension({category:"ELEMENTS",experiment:"!react-native-specific-ui",storageType:"Synced",title:k(C.showRulersOnHover),settingName:"show-metrics-rulers",settingType:"boolean",options:[{value:!0,title:k(C.showRulersOnHover)},{value:!1,title:k(C.doNotShowRulersOnHover)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"GRID",experiment:"!react-native-specific-ui",storageType:"Synced",title:k(C.showAreaNames),settingName:"show-grid-areas",settingType:"boolean",options:[{value:!0,title:k(C.showGridNamedAreas)},{value:!1,title:k(C.doNotShowGridNamedAreas)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"GRID",experiment:"!react-native-specific-ui",storageType:"Synced",title:k(C.showTrackSizes),settingName:"show-grid-track-sizes",settingType:"boolean",options:[{value:!0,title:k(C.showGridTrackSizes)},{value:!1,title:k(C.doNotShowGridTrackSizes)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"GRID",experiment:"!react-native-specific-ui",storageType:"Synced",title:k(C.extendGridLines),settingName:"extend-grid-lines",settingType:"boolean",options:[{value:!0,title:k(C.extendGridLines)},{value:!1,title:k(C.doNotExtendGridLines)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"GRID",experiment:"!react-native-specific-ui",storageType:"Synced",title:k(C.showLineLabels),settingName:"show-grid-line-labels",settingType:"enum",options:[{title:k(C.hideLineLabels),text:k(C.hideLineLabels),value:"none"},{title:k(C.showLineNumbers),text:k(C.showLineNumbers),value:"lineNumbers"},{title:k(C.showLineNames),text:k(C.showLineNames),value:"lineNames"}],defaultValue:"lineNumbers"}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"show-paint-rects",settingType:"boolean",storageType:"Session",options:[{value:!0,title:k(C.showPaintFlashingRectangles)},{value:!1,title:k(C.hidePaintFlashingRectangles)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"show-layout-shift-regions",settingType:"boolean",storageType:"Session",options:[{value:!0,title:k(C.showLayoutShiftRegions)},{value:!1,title:k(C.hideLayoutShiftRegions)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"show-ad-highlights",settingType:"boolean",storageType:"Session",options:[{value:!0,title:k(C.highlightAdFrames)},{value:!1,title:k(C.doNotHighlightAdFrames)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"show-debug-borders",settingType:"boolean",storageType:"Session",options:[{value:!0,title:k(C.showLayerBorders)},{value:!1,title:k(C.hideLayerBorders)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"show-fps-counter",settingType:"boolean",storageType:"Session",options:[{value:!0,title:k(C.showFramesPerSecondFpsMeter)},{value:!1,title:k(C.hideFramesPerSecondFpsMeter)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"show-scroll-bottleneck-rects",settingType:"boolean",storageType:"Session",options:[{value:!0,title:k(C.showScrollPerformanceBottlenecks)},{value:!1,title:k(C.hideScrollPerformanceBottlenecks)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",title:k(C.emulateAFocusedPage),settingName:"emulate-page-focus",settingType:"boolean",storageType:"Local",defaultValue:!1,options:[{value:!0,title:k(C.emulateAFocusedPage)},{value:!1,title:k(C.doNotEmulateAFocusedPage)}]}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"emulated-css-media",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:k(C.doNotEmulateCssMediaType),text:k(C.noEmulation),value:""},{title:k(C.emulateCssPrintMediaType),text:k(C.print),value:"print"},{title:k(C.emulateCssScreenMediaType),text:k(C.screen),value:"screen"}],tags:[k(C.query)],title:k(C.emulateCssMediaType)}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"emulated-css-media-feature-prefers-color-scheme",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:k(C.doNotEmulateCss,{PH1:"prefers-color-scheme"}),text:k(C.noEmulation),value:""},{title:k(C.emulateCss,{PH1:"prefers-color-scheme: light"}),text:o.i18n.lockedLazyString("prefers-color-scheme: light"),value:"light"},{title:k(C.emulateCss,{PH1:"prefers-color-scheme: dark"}),text:o.i18n.lockedLazyString("prefers-color-scheme: dark"),value:"dark"}],tags:[k(C.query)],title:k(C.emulateCssMediaFeature,{PH1:"prefers-color-scheme"})}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"emulated-css-media-feature-forced-colors",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:k(C.doNotEmulateCss,{PH1:"forced-colors"}),text:k(C.noEmulation),value:""},{title:k(C.emulateCss,{PH1:"forced-colors: active"}),text:o.i18n.lockedLazyString("forced-colors: active"),value:"active"},{title:k(C.emulateCss,{PH1:"forced-colors: none"}),text:o.i18n.lockedLazyString("forced-colors: none"),value:"none"}],tags:[k(C.query)],title:k(C.emulateCssMediaFeature,{PH1:"forced-colors"})}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"emulated-css-media-feature-prefers-reduced-motion",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:k(C.doNotEmulateCss,{PH1:"prefers-reduced-motion"}),text:k(C.noEmulation),value:""},{title:k(C.emulateCss,{PH1:"prefers-reduced-motion: reduce"}),text:o.i18n.lockedLazyString("prefers-reduced-motion: reduce"),value:"reduce"}],tags:[k(C.query)],title:k(C.emulateCssMediaFeature,{PH1:"prefers-reduced-motion"})}),e.Settings.registerSettingExtension({settingName:"emulated-css-media-feature-prefers-contrast",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:k(C.doNotEmulateCss,{PH1:"prefers-contrast"}),text:k(C.noEmulation),value:""},{title:k(C.emulateCss,{PH1:"prefers-contrast: more"}),text:o.i18n.lockedLazyString("prefers-contrast: more"),value:"more"},{title:k(C.emulateCss,{PH1:"prefers-contrast: less"}),text:o.i18n.lockedLazyString("prefers-contrast: less"),value:"less"},{title:k(C.emulateCss,{PH1:"prefers-contrast: custom"}),text:o.i18n.lockedLazyString("prefers-contrast: custom"),value:"custom"}],tags:[k(C.query)],title:k(C.emulateCssMediaFeature,{PH1:"prefers-contrast"})}),e.Settings.registerSettingExtension({settingName:"emulated-css-media-feature-prefers-reduced-data",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:k(C.doNotEmulateCss,{PH1:"prefers-reduced-data"}),text:k(C.noEmulation),value:""},{title:k(C.emulateCss,{PH1:"prefers-reduced-data: reduce"}),text:o.i18n.lockedLazyString("prefers-reduced-data: reduce"),value:"reduce"}],title:k(C.emulateCssMediaFeature,{PH1:"prefers-reduced-data"})}),e.Settings.registerSettingExtension({settingName:"emulated-css-media-feature-prefers-reduced-transparency",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:k(C.doNotEmulateCss,{PH1:"prefers-reduced-transparency"}),text:k(C.noEmulation),value:""},{title:k(C.emulateCss,{PH1:"prefers-reduced-transparency: reduce"}),text:o.i18n.lockedLazyString("prefers-reduced-transparency: reduce"),value:"reduce"}],title:k(C.emulateCssMediaFeature,{PH1:"prefers-reduced-transparency"})}),e.Settings.registerSettingExtension({settingName:"emulated-css-media-feature-color-gamut",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:k(C.doNotEmulateCss,{PH1:"color-gamut"}),text:k(C.noEmulation),value:""},{title:k(C.emulateCss,{PH1:"color-gamut: srgb"}),text:o.i18n.lockedLazyString("color-gamut: srgb"),value:"srgb"},{title:k(C.emulateCss,{PH1:"color-gamut: p3"}),text:o.i18n.lockedLazyString("color-gamut: p3"),value:"p3"},{title:k(C.emulateCss,{PH1:"color-gamut: rec2020"}),text:o.i18n.lockedLazyString("color-gamut: rec2020"),value:"rec2020"}],title:k(C.emulateCssMediaFeature,{PH1:"color-gamut"})}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"emulated-vision-deficiency",settingType:"enum",storageType:"Session",defaultValue:"none",options:[{title:k(C.doNotEmulateAnyVisionDeficiency),text:k(C.noEmulation),value:"none"},{title:k(C.emulateBlurredVision),text:k(C.blurredVision),value:"blurredVision"},{title:k(C.emulateReducedContrast),text:k(C.reducedContrast),value:"reducedContrast"},{title:k(C.emulateProtanopia),text:k(C.protanopia),value:"protanopia"},{title:k(C.emulateDeuteranopia),text:k(C.deuteranopia),value:"deuteranopia"},{title:k(C.emulateTritanopia),text:k(C.tritanopia),value:"tritanopia"},{title:k(C.emulateAchromatopsia),text:k(C.achromatopsia),value:"achromatopsia"}],tags:[k(C.query)],title:k(C.emulateVisionDeficiencies)}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"local-fonts-disabled",settingType:"boolean",storageType:"Session",options:[{value:!0,title:k(C.disableLocalFonts)},{value:!1,title:k(C.enableLocalFonts)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"avif-format-disabled",settingType:"boolean",storageType:"Session",options:[{value:!0,title:k(C.disableAvifFormat)},{value:!1,title:k(C.enableAvifFormat)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"webp-format-disabled",settingType:"boolean",storageType:"Session",options:[{value:!0,title:k(C.disableWebpFormat)},{value:!1,title:k(C.enableWebpFormat)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"CONSOLE",title:k(C.customFormatters),settingName:"custom-formatters",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({category:"",title:k(C.networkRequestBlocking),settingName:"request-blocking-enabled",settingType:"boolean",storageType:"Session",defaultValue:!1,options:[{value:!0,title:k(C.enableNetworkRequestBlocking)},{value:!1,title:k(C.disableNetworkRequestBlocking)}]}),e.Settings.registerSettingExtension({category:"NETWORK",experiment:"!react-native-specific-ui",title:k(C.disableCache),settingName:"cache-disabled",settingType:"boolean",order:0,defaultValue:!1,userActionCondition:"hasOtherClients",options:[{value:!0,title:k(C.disableCache)},{value:!1,title:k(C.enableCache)}],learnMore:{tooltip:k(C.networkCacheExplanation)}}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",title:k(C.emulateAutoDarkMode),settingName:"emulate-auto-dark-mode",settingType:"boolean",storageType:"Session",defaultValue:!1}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:k(C.enableRemoteFileLoading),settingName:"network.enable-remote-file-loading",settingType:"boolean",defaultValue:!1});const P={preserveLog:"Preserve log",preserve:"preserve",clear:"clear",reset:"reset",preserveLogOnPageReload:"Preserve log on page reload / navigation",doNotPreserveLogOnPageReload:"Do not preserve log on page reload / navigation",recordNetworkLog:"Record network log"},D=o.i18n.registerUIStrings("models/logs/logs-meta.ts",P),N=o.i18n.getLazilyComputedLocalizedString.bind(void 0,D);e.Settings.registerSettingExtension({category:"NETWORK",title:N(P.preserveLog),settingName:"network-log.preserve-log",settingType:"boolean",defaultValue:!1,tags:[N(P.preserve),N(P.clear),N(P.reset)],options:[{value:!0,title:N(P.preserveLogOnPageReload)},{value:!1,title:N(P.doNotPreserveLogOnPageReload)}]}),e.Settings.registerSettingExtension({category:"NETWORK",title:N(P.recordNetworkLog),settingName:"network-log.record-log",settingType:"boolean",defaultValue:!0,storageType:"Session"});const I={workspace:"Workspace",showWorkspace:"Show Workspace settings",enableLocalOverrides:"Enable Local Overrides",interception:"interception",override:"override",network:"network",rewrite:"rewrite",request:"request",enableOverrideNetworkRequests:"Enable override network requests",disableOverrideNetworkRequests:"Disable override network requests",enableAutomaticWorkspaceFolders:"Enable automatic workspace folders"},V=o.i18n.registerUIStrings("models/persistence/persistence-meta.ts",I),L=o.i18n.getLazilyComputedLocalizedString.bind(void 0,V);let M;async function O(){return M||(M=await import("../../models/persistence/persistence.js")),M}r.ViewManager.registerViewExtension({location:"settings-view",id:"workspace",title:L(I.workspace),commandPrompt:L(I.showWorkspace),order:1,loadView:async()=>new((await O()).WorkspaceSettingsTab.WorkspaceSettingsTab),iconName:"folder"}),e.Settings.registerSettingExtension({category:"PERSISTENCE",title:L(I.enableAutomaticWorkspaceFolders),settingName:"persistence-automatic-workspace-folders",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({category:"PERSISTENCE",title:L(I.enableLocalOverrides),settingName:"persistence-network-overrides-enabled",settingType:"boolean",defaultValue:!1,tags:[L(I.interception),L(I.override),L(I.network),L(I.rewrite),L(I.request)],options:[{value:!0,title:L(I.enableOverrideNetworkRequests)},{value:!1,title:L(I.disableOverrideNetworkRequests)}]}),r.ContextMenu.registerProvider({contextTypes:()=>[a.UISourceCode.UISourceCode,n.Resource.Resource,n.NetworkRequest.NetworkRequest],loadProvider:async()=>new((await O()).PersistenceActions.ContextMenuProvider),experiment:void 0});const F={showEventListenerBreakpoints:"Show Event Listener Breakpoints",eventListenerBreakpoints:"Event Listener Breakpoints",showCspViolationBreakpoints:"Show CSP Violation Breakpoints",cspViolationBreakpoints:"CSP Violation Breakpoints",showXhrfetchBreakpoints:"Show XHR/fetch Breakpoints",xhrfetchBreakpoints:"XHR/fetch Breakpoints",showDomBreakpoints:"Show DOM Breakpoints",domBreakpoints:"DOM Breakpoints",showGlobalListeners:"Show Global Listeners",globalListeners:"Global Listeners",page:"Page",showPage:"Show Page",overrides:"Overrides",showOverrides:"Show Overrides",contentScripts:"Content scripts",showContentScripts:"Show Content scripts",refreshGlobalListeners:"Refresh global listeners"},U=o.i18n.registerUIStrings("panels/browser_debugger/browser_debugger-meta.ts",F),B=o.i18n.getLazilyComputedLocalizedString.bind(void 0,U);let G,z;async function W(){return G||(G=await import("../../panels/browser_debugger/browser_debugger.js")),G}async function H(){return z||(z=await import("../../panels/sources/sources.js")),z}r.ViewManager.registerViewExtension({loadView:async()=>(await W()).EventListenerBreakpointsSidebarPane.EventListenerBreakpointsSidebarPane.instance(),id:"sources.event-listener-breakpoints",location:"sources.sidebar-bottom",commandPrompt:B(F.showEventListenerBreakpoints),title:B(F.eventListenerBreakpoints),order:9,persistence:"permanent"}),r.ViewManager.registerViewExtension({loadView:async()=>new((await W()).CSPViolationBreakpointsSidebarPane.CSPViolationBreakpointsSidebarPane),id:"sources.csp-violation-breakpoints",location:"sources.sidebar-bottom",commandPrompt:B(F.showCspViolationBreakpoints),title:B(F.cspViolationBreakpoints),order:10,persistence:"permanent"}),r.ViewManager.registerViewExtension({loadView:async()=>(await W()).XHRBreakpointsSidebarPane.XHRBreakpointsSidebarPane.instance(),id:"sources.xhr-breakpoints",location:"sources.sidebar-bottom",commandPrompt:B(F.showXhrfetchBreakpoints),title:B(F.xhrfetchBreakpoints),order:5,persistence:"permanent",hasToolbar:!0}),r.ViewManager.registerViewExtension({loadView:async()=>(await W()).DOMBreakpointsSidebarPane.DOMBreakpointsSidebarPane.instance(),id:"sources.dom-breakpoints",location:"sources.sidebar-bottom",commandPrompt:B(F.showDomBreakpoints),title:B(F.domBreakpoints),order:7,persistence:"permanent"}),r.ViewManager.registerViewExtension({loadView:async()=>new((await W()).ObjectEventListenersSidebarPane.ObjectEventListenersSidebarPane),id:"sources.global-listeners",location:"sources.sidebar-bottom",commandPrompt:B(F.showGlobalListeners),title:B(F.globalListeners),order:8,persistence:"permanent",hasToolbar:!0}),r.ViewManager.registerViewExtension({loadView:async()=>(await W()).DOMBreakpointsSidebarPane.DOMBreakpointsSidebarPane.instance(),id:"elements.dom-breakpoints",location:"elements-sidebar",commandPrompt:B(F.showDomBreakpoints),title:B(F.domBreakpoints),order:6,persistence:"permanent"}),r.ViewManager.registerViewExtension({location:"navigator-view",id:"navigator-network",title:B(F.page),commandPrompt:B(F.showPage),order:2,persistence:"permanent",loadView:async()=>(await H()).SourcesNavigator.NetworkNavigatorView.instance()}),r.ViewManager.registerViewExtension({location:"navigator-view",id:"navigator-overrides",title:B(F.overrides),commandPrompt:B(F.showOverrides),order:4,persistence:"permanent",loadView:async()=>(await H()).SourcesNavigator.OverridesNavigatorView.instance()}),r.ViewManager.registerViewExtension({location:"navigator-view",id:"navigator-content-scripts",title:B(F.contentScripts),commandPrompt:B(F.showContentScripts),order:5,persistence:"permanent",condition:()=>"/bundled/worker_app.html"!==i.Runtime.getPathName(),loadView:async()=>new((await H()).SourcesNavigator.ContentScriptsNavigatorView)}),r.ActionRegistration.registerActionExtension({category:"DEBUGGER",actionId:"browser-debugger.refresh-global-event-listeners",loadActionDelegate:async()=>new((await W()).ObjectEventListenersSidebarPane.ActionDelegate),title:B(F.refreshGlobalListeners),iconClass:"refresh",contextTypes:()=>void 0===G?[]:(e=>[e.ObjectEventListenersSidebarPane.ObjectEventListenersSidebarPane])(G)}),r.ContextMenu.registerProvider({contextTypes:()=>[n.DOMModel.DOMNode],loadProvider:async()=>new((await W()).DOMBreakpointsSidebarPane.ContextMenuProvider),experiment:void 0}),r.Context.registerListener({contextTypes:()=>[n.DebuggerModel.DebuggerPausedDetails],loadListener:async()=>(await W()).XHRBreakpointsSidebarPane.XHRBreakpointsSidebarPane.instance()}),r.Context.registerListener({contextTypes:()=>[n.DebuggerModel.DebuggerPausedDetails],loadListener:async()=>(await W()).DOMBreakpointsSidebarPane.DOMBreakpointsSidebarPane.instance()});const j={throttling:"Throttling",showThrottling:"Show Throttling",goOffline:"Go offline",device:"device",throttlingTag:"throttling",enableSlowGThrottling:"Enable slow `3G` throttling",enableFastGThrottling:"Enable fast `3G` throttling",goOnline:"Go online"},q=o.i18n.registerUIStrings("panels/mobile_throttling/mobile_throttling-meta.ts",j),_=o.i18n.getLazilyComputedLocalizedString.bind(void 0,q);let J;async function K(){return J||(J=await import("../../panels/mobile_throttling/mobile_throttling.js")),J}r.ViewManager.registerViewExtension({location:"settings-view",id:"throttling-conditions",title:_(j.throttling),commandPrompt:_(j.showThrottling),order:35,loadView:async()=>new((await K()).ThrottlingSettingsTab.ThrottlingSettingsTab),settings:["custom-network-conditions","calibrated-cpu-throttling"],iconName:"performance"}),r.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-offline",category:"NETWORK",experiment:"!react-native-specific-ui",title:_(j.goOffline),loadActionDelegate:async()=>new((await K()).ThrottlingManager.ActionDelegate),tags:[_(j.device),_(j.throttlingTag)]}),r.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-low-end-mobile",category:"NETWORK",experiment:"!react-native-specific-ui",title:_(j.enableSlowGThrottling),loadActionDelegate:async()=>new((await K()).ThrottlingManager.ActionDelegate),tags:[_(j.device),_(j.throttlingTag)]}),r.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-mid-tier-mobile",category:"NETWORK",experiment:"!react-native-specific-ui",title:_(j.enableFastGThrottling),loadActionDelegate:async()=>new((await K()).ThrottlingManager.ActionDelegate),tags:[_(j.device),_(j.throttlingTag)]}),r.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-online",category:"NETWORK",experiment:"!react-native-specific-ui",title:_(j.goOnline),loadActionDelegate:async()=>new((await K()).ThrottlingManager.ActionDelegate),tags:[_(j.device),_(j.throttlingTag)]}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"custom-network-conditions",settingType:"array",defaultValue:[]});const Q={protocolMonitor:"Protocol monitor",showProtocolMonitor:"Show Protocol monitor"},X=o.i18n.registerUIStrings("panels/protocol_monitor/protocol_monitor-meta.ts",Q),Y=o.i18n.getLazilyComputedLocalizedString.bind(void 0,X);let Z;r.ViewManager.registerViewExtension({location:"drawer-view",id:"protocol-monitor",title:Y(Q.protocolMonitor),commandPrompt:Y(Q.showProtocolMonitor),order:100,persistence:"closeable",loadView:async()=>new((await async function(){return Z||(Z=await import("../../panels/protocol_monitor/protocol_monitor.js")),Z}()).ProtocolMonitor.ProtocolMonitorImpl),experiment:"protocol-monitor"});const $={devices:"Devices",showDevices:"Show Devices"},ee=o.i18n.registerUIStrings("panels/settings/emulation/emulation-meta.ts",$),te=o.i18n.getLazilyComputedLocalizedString.bind(void 0,ee);let oe;r.ViewManager.registerViewExtension({location:"settings-view",commandPrompt:te($.showDevices),title:te($.devices),order:30,loadView:async()=>new((await async function(){return oe||(oe=await import("../../panels/settings/emulation/emulation.js")),oe}()).DevicesSettingsTab.DevicesSettingsTab),id:"devices",settings:["standard-emulated-device-list","custom-emulated-device-list"],iconName:"devices"});const ie={shortcuts:"Shortcuts",preferences:"Preferences",experiments:"Experiments",ignoreList:"Ignore list",showShortcuts:"Show Shortcuts",showPreferences:"Show Preferences",showExperiments:"Show Experiments",showIgnoreList:"Show Ignore list",settings:"Settings",documentation:"Documentation",aiInnovations:"AI innovations",showAiInnovations:"Show AI innovations"},ne=o.i18n.registerUIStrings("panels/settings/settings-meta.ts",ie),ae=o.i18n.getLazilyComputedLocalizedString.bind(void 0,ne);let se;async function re(){return se||(se=await import("../../panels/settings/settings.js")),se}r.ViewManager.registerViewExtension({location:"settings-view",id:"preferences",title:ae(ie.preferences),commandPrompt:ae(ie.showPreferences),order:0,loadView:async()=>new((await re()).SettingsScreen.GenericSettingsTab),iconName:"gear"}),r.ViewManager.registerViewExtension({location:"settings-view",id:"chrome-ai",title:ae(ie.aiInnovations),commandPrompt:ae(ie.showAiInnovations),order:2,async loadView(){const e=await re();return l.LegacyWrapper.legacyWrapper(r.Widget.VBox,new e.AISettingsTab.AISettingsTab)},iconName:"button-magic",settings:["console-insights-enabled"],condition:e=>(e?.aidaAvailability?.enabled&&(e?.devToolsConsoleInsights?.enabled||e?.devToolsFreestyler?.enabled))??!1}),r.ViewManager.registerViewExtension({location:"settings-view",id:"experiments",title:ae(ie.experiments),commandPrompt:ae(ie.showExperiments),order:3,experiment:"*",loadView:async()=>new((await re()).SettingsScreen.ExperimentsSettingsTab),iconName:"experiment"}),r.ViewManager.registerViewExtension({location:"settings-view",id:"blackbox",title:ae(ie.ignoreList),commandPrompt:ae(ie.showIgnoreList),order:4,loadView:async()=>new((await re()).FrameworkIgnoreListSettingsTab.FrameworkIgnoreListSettingsTab),iconName:"clear-list"}),r.ViewManager.registerViewExtension({location:"settings-view",id:"keybinds",title:ae(ie.shortcuts),commandPrompt:ae(ie.showShortcuts),order:100,loadView:async()=>new((await re()).KeybindsSettingsTab.KeybindsSettingsTab),iconName:"keyboard"}),r.ActionRegistration.registerActionExtension({category:"SETTINGS",actionId:"settings.show",title:ae(ie.settings),loadActionDelegate:async()=>new((await re()).SettingsScreen.ActionDelegate),iconClass:"gear",bindings:[{shortcut:"F1",keybindSets:["devToolsDefault"]},{shortcut:"Shift+?"},{platform:"windows,linux",shortcut:"Ctrl+,",keybindSets:["vsCode"]},{platform:"mac",shortcut:"Meta+,",keybindSets:["vsCode"]}]}),r.ActionRegistration.registerActionExtension({category:"SETTINGS",actionId:"settings.documentation",title:ae(ie.documentation),loadActionDelegate:async()=>new((await re()).SettingsScreen.ActionDelegate)}),r.ActionRegistration.registerActionExtension({category:"SETTINGS",actionId:"settings.shortcuts",title:ae(ie.showShortcuts),loadActionDelegate:async()=>new((await re()).SettingsScreen.ActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+K Ctrl+S",keybindSets:["vsCode"]},{platform:"mac",shortcut:"Meta+K Meta+S",keybindSets:["vsCode"]}]}),r.ViewManager.registerLocationResolver({name:"settings-view",category:"SETTINGS",loadResolver:async()=>(await re()).SettingsScreen.SettingsScreen.instance()}),e.Revealer.registerRevealer({contextTypes:()=>[e.Settings.Setting,i.Runtime.Experiment],destination:void 0,loadRevealer:async()=>new((await re()).SettingsScreen.Revealer)}),r.ContextMenu.registerItem({location:"mainMenu/footer",actionId:"settings.shortcuts",order:void 0}),r.ContextMenu.registerItem({location:"mainMenuHelp/default",actionId:"settings.documentation",order:void 0});const le={showSources:"Show Sources",sources:"Sources",showWorkspace:"Show Workspace",workspace:"Workspace",showSnippets:"Show Snippets",snippets:"Snippets",showSearch:"Show Search",search:"Search",showQuickSource:"Show Quick source",quickSource:"Quick source",showThreads:"Show Threads",threads:"Threads",showScope:"Show Scope",scope:"Scope",showWatch:"Show Watch",watch:"Watch",showBreakpoints:"Show Breakpoints",breakpoints:"Breakpoints",pauseScriptExecution:"Pause script execution",resumeScriptExecution:"Resume script execution",stepOverNextFunctionCall:"Step over next function call",stepIntoNextFunctionCall:"Step into next function call",step:"Step",stepOutOfCurrentFunction:"Step out of current function",runSnippet:"Run snippet",deactivateBreakpoints:"Deactivate breakpoints",activateBreakpoints:"Activate breakpoints",addSelectedTextToWatches:"Add selected text to watches",evaluateSelectedTextInConsole:"Evaluate selected text in console",switchFile:"Switch file",rename:"Rename",closeAll:"Close all",jumpToPreviousEditingLocation:"Jump to previous editing location",jumpToNextEditingLocation:"Jump to next editing location",closeTheActiveTab:"Close the active tab",goToLine:"Go to line",goToAFunctionDeclarationruleSet:"Go to a function declaration/rule set",toggleBreakpoint:"Toggle breakpoint",toggleBreakpointEnabled:"Toggle breakpoint enabled",toggleBreakpointInputWindow:"Toggle breakpoint input window",save:"Save",saveAll:"Save all",createNewSnippet:"Create new snippet",addFolderToWorkspace:"Add folder to workspace",addFolder:"Add folder",previousCallFrame:"Previous call frame",nextCallFrame:"Next call frame",incrementCssUnitBy:"Increment CSS unit by {PH1}",decrementCssUnitBy:"Decrement CSS unit by {PH1}",searchInAnonymousAndContent:"Search in anonymous and content scripts",doNotSearchInAnonymousAndContent:"Do not search in anonymous and content scripts",automaticallyRevealFilesIn:"Automatically reveal files in sidebar",doNotAutomaticallyRevealFilesIn:"Do not automatically reveal files in sidebar",javaScriptSourceMaps:"JavaScript source maps",enableJavaScriptSourceMaps:"Enable JavaScript source maps",disableJavaScriptSourceMaps:"Disable JavaScript source maps",tabMovesFocus:"Tab moves focus",enableTabMovesFocus:"Enable tab moves focus",disableTabMovesFocus:"Disable tab moves focus",detectIndentation:"Detect indentation",doNotDetectIndentation:"Do not detect indentation",automaticallyPrettyPrintMinifiedSources:"Automatically pretty print minified sources",doNotAutomaticallyPrettyPrintMinifiedSources:"Do not automatically pretty print minified sources",autocompletion:"Autocompletion",enableAutocompletion:"Enable autocompletion",disableAutocompletion:"Disable autocompletion",bracketClosing:"Auto closing brackets",enableBracketClosing:"Enable auto closing brackets",disableBracketClosing:"Disable auto closing brackets",bracketMatching:"Bracket matching",enableBracketMatching:"Enable bracket matching",disableBracketMatching:"Disable bracket matching",codeFolding:"Code folding",enableCodeFolding:"Enable code folding",disableCodeFolding:"Disable code folding",showWhitespaceCharacters:"Show whitespace characters:",doNotShowWhitespaceCharacters:"Do not show whitespace characters",none:"None",showAllWhitespaceCharacters:"Show all whitespace characters",all:"All",showTrailingWhitespaceCharacters:"Show trailing whitespace characters",trailing:"Trailing",displayVariableValuesInlineWhile:"Display variable values inline while debugging",doNotDisplayVariableValuesInline:"Do not display variable values inline while debugging",cssSourceMaps:"CSS source maps",enableCssSourceMaps:"Enable CSS source maps",disableCssSourceMaps:"Disable CSS source maps",allowScrollingPastEndOfFile:"Allow scrolling past end of file",disallowScrollingPastEndOfFile:"Disallow scrolling past end of file",wasmAutoStepping:"When debugging Wasm with debug information, do not pause on wasm bytecode if possible",enableWasmAutoStepping:"Enable Wasm auto-stepping",disableWasmAutoStepping:"Disable Wasm auto-stepping",goTo:"Go to",line:"Line",symbol:"Symbol",goToSymbol:"Go to symbol",open:"Open",file:"File",openFile:"Open file",disableAutoFocusOnDebuggerPaused:"Do not focus Sources panel when triggering a breakpoint",enableAutoFocusOnDebuggerPaused:"Focus Sources panel when triggering a breakpoint",revealActiveFileInSidebar:"Reveal active file in navigator sidebar",toggleNavigatorSidebar:"Toggle navigator sidebar",toggleDebuggerSidebar:"Toggle debugger sidebar",nextEditorTab:"Next editor",previousEditorTab:"Previous editor"},ce=o.i18n.registerUIStrings("panels/sources/sources-meta.ts",le),de=o.i18n.getLazilyComputedLocalizedString.bind(void 0,ce);let ge,ue;async function pe(){return ge||(ge=await import("../../panels/sources/sources.js")),ge}async function me(){return ue||(ue=await import("../../panels/sources/components/components.js")),ue}function Se(e){return void 0===ge?[]:e(ge)}r.ViewManager.registerViewExtension({location:"panel",id:"sources",commandPrompt:de(le.showSources),title:de(le.sources),order:30,loadView:async()=>(await pe()).SourcesPanel.SourcesPanel.instance()}),r.ViewManager.registerViewExtension({location:"navigator-view",id:"navigator-files",commandPrompt:de(le.showWorkspace),title:de(le.workspace),order:3,persistence:"permanent",loadView:async()=>new((await pe()).SourcesNavigator.FilesNavigatorView),condition:i.Runtime.conditions.notSourcesHideAddFolder}),r.ViewManager.registerViewExtension({location:"navigator-view",id:"navigator-snippets",commandPrompt:de(le.showSnippets),title:de(le.snippets),order:6,persistence:"permanent",loadView:async()=>new((await pe()).SourcesNavigator.SnippetsNavigatorView)}),r.ViewManager.registerViewExtension({location:"drawer-view",id:"sources.search-sources-tab",commandPrompt:de(le.showSearch),title:de(le.search),order:7,persistence:"closeable",loadView:async()=>new((await pe()).SearchSourcesView.SearchSourcesView)}),r.ViewManager.registerViewExtension({location:"drawer-view",id:"sources.quick",commandPrompt:de(le.showQuickSource),title:de(le.quickSource),persistence:"closeable",order:1e3,loadView:async()=>new((await pe()).SourcesPanel.QuickSourceView)}),r.ViewManager.registerViewExtension({id:"sources.threads",commandPrompt:de(le.showThreads),title:de(le.threads),persistence:"permanent",loadView:async()=>new((await pe()).ThreadsSidebarPane.ThreadsSidebarPane)}),r.ViewManager.registerViewExtension({id:"sources.scope-chain",commandPrompt:de(le.showScope),title:de(le.scope),persistence:"permanent",loadView:async()=>(await pe()).ScopeChainSidebarPane.ScopeChainSidebarPane.instance()}),r.ViewManager.registerViewExtension({id:"sources.watch",commandPrompt:de(le.showWatch),title:de(le.watch),persistence:"permanent",loadView:async()=>(await pe()).WatchExpressionsSidebarPane.WatchExpressionsSidebarPane.instance(),hasToolbar:!0}),r.ViewManager.registerViewExtension({id:"sources.js-breakpoints",commandPrompt:de(le.showBreakpoints),title:de(le.breakpoints),persistence:"permanent",loadView:async()=>(await me()).BreakpointsView.BreakpointsView.instance().wrapper}),r.ActionRegistration.registerActionExtension({category:"DEBUGGER",actionId:"debugger.toggle-pause",iconClass:"pause",toggleable:!0,toggledIconClass:"resume",loadActionDelegate:async()=>new((await pe()).SourcesPanel.RevealingActionDelegate),contextTypes:()=>Se((e=>[e.SourcesView.SourcesView,r.ShortcutRegistry.ForwardedShortcut])),options:[{value:!0,title:de(le.pauseScriptExecution)},{value:!1,title:de(le.resumeScriptExecution)}],bindings:[{shortcut:"F8",keybindSets:["devToolsDefault"]},{platform:"windows,linux",shortcut:"Ctrl+\\"},{shortcut:"F5",keybindSets:["vsCode"]},{shortcut:"Shift+F5",keybindSets:["vsCode"]},{platform:"mac",shortcut:"Meta+\\"}]}),r.ActionRegistration.registerActionExtension({category:"DEBUGGER",actionId:"debugger.step-over",loadActionDelegate:async()=>new((await pe()).SourcesPanel.ActionDelegate),title:de(le.stepOverNextFunctionCall),iconClass:"step-over",contextTypes:()=>[n.DebuggerModel.DebuggerPausedDetails],bindings:[{shortcut:"F10",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+'"},{platform:"mac",shortcut:"Meta+'"}]}),r.ActionRegistration.registerActionExtension({category:"DEBUGGER",actionId:"debugger.step-into",loadActionDelegate:async()=>new((await pe()).SourcesPanel.ActionDelegate),title:de(le.stepIntoNextFunctionCall),iconClass:"step-into",contextTypes:()=>[n.DebuggerModel.DebuggerPausedDetails],bindings:[{shortcut:"F11",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+;"},{platform:"mac",shortcut:"Meta+;"}]}),r.ActionRegistration.registerActionExtension({category:"DEBUGGER",actionId:"debugger.step",loadActionDelegate:async()=>new((await pe()).SourcesPanel.ActionDelegate),title:de(le.step),iconClass:"step",contextTypes:()=>[n.DebuggerModel.DebuggerPausedDetails],bindings:[{shortcut:"F9",keybindSets:["devToolsDefault"]}]}),r.ActionRegistration.registerActionExtension({category:"DEBUGGER",actionId:"debugger.step-out",loadActionDelegate:async()=>new((await pe()).SourcesPanel.ActionDelegate),title:de(le.stepOutOfCurrentFunction),iconClass:"step-out",contextTypes:()=>[n.DebuggerModel.DebuggerPausedDetails],bindings:[{shortcut:"Shift+F11",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Shift+Ctrl+;"},{platform:"mac",shortcut:"Shift+Meta+;"}]}),r.ActionRegistration.registerActionExtension({actionId:"debugger.run-snippet",category:"DEBUGGER",loadActionDelegate:async()=>new((await pe()).SourcesPanel.ActionDelegate),title:de(le.runSnippet),iconClass:"play",contextTypes:()=>Se((e=>[e.SourcesView.SourcesView])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Enter"},{platform:"mac",shortcut:"Meta+Enter"}]}),r.ActionRegistration.registerActionExtension({category:"DEBUGGER",actionId:"debugger.toggle-breakpoints-active",iconClass:"breakpoint-crossed",toggledIconClass:"breakpoint-crossed-filled",toggleable:!0,loadActionDelegate:async()=>new((await pe()).SourcesPanel.ActionDelegate),contextTypes:()=>Se((e=>[e.SourcesView.SourcesView])),options:[{value:!0,title:de(le.deactivateBreakpoints)},{value:!1,title:de(le.activateBreakpoints)}],bindings:[{platform:"windows,linux",shortcut:"Ctrl+F8"},{platform:"mac",shortcut:"Meta+F8"}]}),r.ActionRegistration.registerActionExtension({actionId:"sources.add-to-watch",loadActionDelegate:async()=>(await pe()).WatchExpressionsSidebarPane.WatchExpressionsSidebarPane.instance(),category:"DEBUGGER",title:de(le.addSelectedTextToWatches),contextTypes:()=>Se((e=>[e.UISourceCodeFrame.UISourceCodeFrame])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+A"},{platform:"mac",shortcut:"Meta+Shift+A"}]}),r.ActionRegistration.registerActionExtension({actionId:"debugger.evaluate-selection",category:"DEBUGGER",loadActionDelegate:async()=>new((await pe()).SourcesPanel.ActionDelegate),title:de(le.evaluateSelectedTextInConsole),contextTypes:()=>Se((e=>[e.UISourceCodeFrame.UISourceCodeFrame])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+E"},{platform:"mac",shortcut:"Meta+Shift+E"}]}),r.ActionRegistration.registerActionExtension({actionId:"sources.switch-file",category:"SOURCES",title:de(le.switchFile),loadActionDelegate:async()=>new((await pe()).SourcesView.SwitchFileActionDelegate),contextTypes:()=>Se((e=>[e.SourcesView.SourcesView])),bindings:[{shortcut:"Alt+O"}]}),r.ActionRegistration.registerActionExtension({actionId:"sources.rename",category:"SOURCES",title:de(le.rename),bindings:[{platform:"windows,linux",shortcut:"F2"},{platform:"mac",shortcut:"Enter"}]}),r.ActionRegistration.registerActionExtension({category:"SOURCES",actionId:"sources.close-all",loadActionDelegate:async()=>new((await pe()).SourcesView.ActionDelegate),title:de(le.closeAll),bindings:[{platform:"windows,linux",shortcut:"Ctrl+K W",keybindSets:["vsCode"]},{platform:"mac",shortcut:"Meta+K W",keybindSets:["vsCode"]}]}),r.ActionRegistration.registerActionExtension({actionId:"sources.jump-to-previous-location",category:"SOURCES",title:de(le.jumpToPreviousEditingLocation),loadActionDelegate:async()=>new((await pe()).SourcesView.ActionDelegate),contextTypes:()=>Se((e=>[e.SourcesView.SourcesView])),bindings:[{shortcut:"Alt+Minus"}]}),r.ActionRegistration.registerActionExtension({actionId:"sources.jump-to-next-location",category:"SOURCES",title:de(le.jumpToNextEditingLocation),loadActionDelegate:async()=>new((await pe()).SourcesView.ActionDelegate),contextTypes:()=>Se((e=>[e.SourcesView.SourcesView])),bindings:[{shortcut:"Alt+Plus"}]}),r.ActionRegistration.registerActionExtension({actionId:"sources.close-editor-tab",category:"SOURCES",title:de(le.closeTheActiveTab),loadActionDelegate:async()=>new((await pe()).SourcesView.ActionDelegate),contextTypes:()=>Se((e=>[e.SourcesView.SourcesView])),bindings:[{shortcut:"Alt+w"},{shortcut:"Ctrl+W",keybindSets:["vsCode"]},{platform:"windows",shortcut:"Ctrl+F4",keybindSets:["vsCode"]}]}),r.ActionRegistration.registerActionExtension({actionId:"sources.next-editor-tab",category:"SOURCES",title:de(le.nextEditorTab),loadActionDelegate:async()=>new((await pe()).SourcesView.ActionDelegate),contextTypes:()=>Se((e=>[e.SourcesView.SourcesView])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+PageDown",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+PageDown",keybindSets:["devToolsDefault","vsCode"]}]}),r.ActionRegistration.registerActionExtension({actionId:"sources.previous-editor-tab",category:"SOURCES",title:de(le.previousEditorTab),loadActionDelegate:async()=>new((await pe()).SourcesView.ActionDelegate),contextTypes:()=>Se((e=>[e.SourcesView.SourcesView])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+PageUp",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+PageUp",keybindSets:["devToolsDefault","vsCode"]}]}),r.ActionRegistration.registerActionExtension({actionId:"sources.go-to-line",category:"SOURCES",title:de(le.goToLine),loadActionDelegate:async()=>new((await pe()).SourcesView.ActionDelegate),contextTypes:()=>Se((e=>[e.SourcesView.SourcesView])),bindings:[{shortcut:"Ctrl+g",keybindSets:["devToolsDefault","vsCode"]}]}),r.ActionRegistration.registerActionExtension({actionId:"sources.go-to-member",category:"SOURCES",title:de(le.goToAFunctionDeclarationruleSet),loadActionDelegate:async()=>new((await pe()).SourcesView.ActionDelegate),contextTypes:()=>Se((e=>[e.SourcesView.SourcesView])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+o",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+Shift+o",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+T",keybindSets:["vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+T",keybindSets:["vsCode"]},{shortcut:"F12",keybindSets:["vsCode"]}]}),r.ActionRegistration.registerActionExtension({actionId:"debugger.toggle-breakpoint",category:"DEBUGGER",title:de(le.toggleBreakpoint),bindings:[{platform:"windows,linux",shortcut:"Ctrl+b",keybindSets:["devToolsDefault"]},{platform:"mac",shortcut:"Meta+b",keybindSets:["devToolsDefault"]},{shortcut:"F9",keybindSets:["vsCode"]}]}),r.ActionRegistration.registerActionExtension({actionId:"debugger.toggle-breakpoint-enabled",category:"DEBUGGER",title:de(le.toggleBreakpointEnabled),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+b"},{platform:"mac",shortcut:"Meta+Shift+b"}]}),r.ActionRegistration.registerActionExtension({actionId:"debugger.breakpoint-input-window",category:"DEBUGGER",title:de(le.toggleBreakpointInputWindow),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Alt+b"},{platform:"mac",shortcut:"Meta+Alt+b"}]}),r.ActionRegistration.registerActionExtension({actionId:"sources.save",category:"SOURCES",title:de(le.save),loadActionDelegate:async()=>new((await pe()).SourcesView.ActionDelegate),contextTypes:()=>Se((e=>[e.SourcesView.SourcesView])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+s",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+s",keybindSets:["devToolsDefault","vsCode"]}]}),r.ActionRegistration.registerActionExtension({actionId:"sources.save-all",category:"SOURCES",title:de(le.saveAll),loadActionDelegate:async()=>new((await pe()).SourcesView.ActionDelegate),contextTypes:()=>Se((e=>[e.SourcesView.SourcesView])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+s"},{platform:"mac",shortcut:"Meta+Alt+s"},{platform:"windows,linux",shortcut:"Ctrl+K S",keybindSets:["vsCode"]},{platform:"mac",shortcut:"Meta+Alt+S",keybindSets:["vsCode"]}]}),r.ActionRegistration.registerActionExtension({category:"SOURCES",actionId:"sources.create-snippet",loadActionDelegate:async()=>new((await pe()).SourcesNavigator.ActionDelegate),title:de(le.createNewSnippet)}),t.InspectorFrontendHost.InspectorFrontendHostInstance.isHostedMode()||r.ActionRegistration.registerActionExtension({category:"SOURCES",actionId:"sources.add-folder-to-workspace",loadActionDelegate:async()=>new((await pe()).SourcesNavigator.ActionDelegate),iconClass:"plus",title:de(le.addFolderToWorkspace)}),r.ActionRegistration.registerActionExtension({category:"DEBUGGER",actionId:"debugger.previous-call-frame",loadActionDelegate:async()=>new((await pe()).CallStackSidebarPane.ActionDelegate),title:de(le.previousCallFrame),contextTypes:()=>[n.DebuggerModel.DebuggerPausedDetails],bindings:[{shortcut:"Ctrl+,"}]}),r.ActionRegistration.registerActionExtension({category:"DEBUGGER",actionId:"debugger.next-call-frame",loadActionDelegate:async()=>new((await pe()).CallStackSidebarPane.ActionDelegate),title:de(le.nextCallFrame),contextTypes:()=>[n.DebuggerModel.DebuggerPausedDetails],bindings:[{shortcut:"Ctrl+."}]}),r.ActionRegistration.registerActionExtension({actionId:"sources.search",title:de(le.search),loadActionDelegate:async()=>new((await pe()).SearchSourcesView.ActionDelegate),category:"SOURCES",bindings:[{platform:"mac",shortcut:"Meta+Alt+F",keybindSets:["devToolsDefault"]},{platform:"windows,linux",shortcut:"Ctrl+Shift+F",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+Shift+J",keybindSets:["vsCode"]},{platform:"mac",shortcut:"Meta+Shift+F",keybindSets:["vsCode"]},{platform:"mac",shortcut:"Meta+Shift+J",keybindSets:["vsCode"]}]}),r.ActionRegistration.registerActionExtension({actionId:"sources.increment-css",category:"SOURCES",title:de(le.incrementCssUnitBy,{PH1:1}),bindings:[{shortcut:"Alt+Up"}]}),r.ActionRegistration.registerActionExtension({actionId:"sources.increment-css-by-ten",title:de(le.incrementCssUnitBy,{PH1:10}),category:"SOURCES",bindings:[{shortcut:"Alt+PageUp"}]}),r.ActionRegistration.registerActionExtension({actionId:"sources.decrement-css",category:"SOURCES",title:de(le.decrementCssUnitBy,{PH1:1}),bindings:[{shortcut:"Alt+Down"}]}),r.ActionRegistration.registerActionExtension({actionId:"sources.decrement-css-by-ten",category:"SOURCES",title:de(le.decrementCssUnitBy,{PH1:10}),bindings:[{shortcut:"Alt+PageDown"}]}),r.ActionRegistration.registerActionExtension({actionId:"sources.reveal-in-navigator-sidebar",category:"SOURCES",title:de(le.revealActiveFileInSidebar),loadActionDelegate:async()=>new((await pe()).SourcesPanel.ActionDelegate),contextTypes:()=>Se((e=>[e.SourcesView.SourcesView]))}),r.ActionRegistration.registerActionExtension({actionId:"sources.toggle-navigator-sidebar",category:"SOURCES",title:de(le.toggleNavigatorSidebar),loadActionDelegate:async()=>new((await pe()).SourcesPanel.ActionDelegate),contextTypes:()=>Se((e=>[e.SourcesView.SourcesView])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+y",keybindSets:["devToolsDefault"]},{platform:"mac",shortcut:"Meta+Shift+y",keybindSets:["devToolsDefault"]},{platform:"windows,linux",shortcut:"Ctrl+b",keybindSets:["vsCode"]},{platform:"windows,linux",shortcut:"Meta+b",keybindSets:["vsCode"]}]}),r.ActionRegistration.registerActionExtension({actionId:"sources.toggle-debugger-sidebar",category:"SOURCES",title:de(le.toggleDebuggerSidebar),loadActionDelegate:async()=>new((await pe()).SourcesPanel.ActionDelegate),contextTypes:()=>Se((e=>[e.SourcesView.SourcesView])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+h"},{platform:"mac",shortcut:"Meta+Shift+h"}]}),e.Settings.registerSettingExtension({settingName:"navigator-group-by-folder",settingType:"boolean",defaultValue:!0}),e.Settings.registerSettingExtension({settingName:"navigator-group-by-authored",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:de(le.searchInAnonymousAndContent),settingName:"search-in-anonymous-and-content-scripts",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:de(le.searchInAnonymousAndContent)},{value:!1,title:de(le.doNotSearchInAnonymousAndContent)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:de(le.automaticallyRevealFilesIn),settingName:"auto-reveal-in-navigator",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:de(le.automaticallyRevealFilesIn)},{value:!1,title:de(le.doNotAutomaticallyRevealFilesIn)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:de(le.javaScriptSourceMaps),settingName:"js-source-maps-enabled",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:de(le.enableJavaScriptSourceMaps)},{value:!1,title:de(le.disableJavaScriptSourceMaps)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:de(le.tabMovesFocus),settingName:"text-editor-tab-moves-focus",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:de(le.enableTabMovesFocus)},{value:!1,title:de(le.disableTabMovesFocus)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:de(le.detectIndentation),settingName:"text-editor-auto-detect-indent",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:de(le.detectIndentation)},{value:!1,title:de(le.doNotDetectIndentation)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:de(le.autocompletion),settingName:"text-editor-autocompletion",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:de(le.enableAutocompletion)},{value:!1,title:de(le.disableAutocompletion)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:de(le.bracketClosing),settingName:"text-editor-bracket-closing",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:de(le.enableBracketClosing)},{value:!1,title:de(le.disableBracketClosing)}]}),e.Settings.registerSettingExtension({category:"SOURCES",title:de(le.bracketMatching),settingName:"text-editor-bracket-matching",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:de(le.enableBracketMatching)},{value:!1,title:de(le.disableBracketMatching)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:de(le.codeFolding),settingName:"text-editor-code-folding",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:de(le.enableCodeFolding)},{value:!1,title:de(le.disableCodeFolding)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:de(le.showWhitespaceCharacters),settingName:"show-whitespaces-in-editor",settingType:"enum",defaultValue:"original",options:[{title:de(le.doNotShowWhitespaceCharacters),text:de(le.none),value:"none"},{title:de(le.showAllWhitespaceCharacters),text:de(le.all),value:"all"},{title:de(le.showTrailingWhitespaceCharacters),text:de(le.trailing),value:"trailing"}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:de(le.displayVariableValuesInlineWhile),settingName:"inline-variable-values",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:de(le.displayVariableValuesInlineWhile)},{value:!1,title:de(le.doNotDisplayVariableValuesInline)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:de(le.enableAutoFocusOnDebuggerPaused),settingName:"auto-focus-on-debugger-paused-enabled",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:de(le.enableAutoFocusOnDebuggerPaused)},{value:!1,title:de(le.disableAutoFocusOnDebuggerPaused)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:de(le.automaticallyPrettyPrintMinifiedSources),settingName:"auto-pretty-print-minified",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:de(le.automaticallyPrettyPrintMinifiedSources)},{value:!1,title:de(le.doNotAutomaticallyPrettyPrintMinifiedSources)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:de(le.cssSourceMaps),settingName:"css-source-maps-enabled",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:de(le.enableCssSourceMaps)},{value:!1,title:de(le.disableCssSourceMaps)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:de(le.allowScrollingPastEndOfFile),settingName:"allow-scroll-past-eof",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:de(le.allowScrollingPastEndOfFile)},{value:!1,title:de(le.disallowScrollingPastEndOfFile)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Local",title:de(le.wasmAutoStepping),settingName:"wasm-auto-stepping",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:de(le.enableWasmAutoStepping)},{value:!1,title:de(le.disableWasmAutoStepping)}]}),r.ViewManager.registerLocationResolver({name:"navigator-view",category:"SOURCES",loadResolver:async()=>(await pe()).SourcesPanel.SourcesPanel.instance()}),r.ViewManager.registerLocationResolver({name:"sources.sidebar-top",category:"SOURCES",loadResolver:async()=>(await pe()).SourcesPanel.SourcesPanel.instance()}),r.ViewManager.registerLocationResolver({name:"sources.sidebar-bottom",category:"SOURCES",loadResolver:async()=>(await pe()).SourcesPanel.SourcesPanel.instance()}),r.ViewManager.registerLocationResolver({name:"sources.sidebar-tabs",category:"SOURCES",loadResolver:async()=>(await pe()).SourcesPanel.SourcesPanel.instance()}),r.ContextMenu.registerProvider({contextTypes:()=>[a.UISourceCode.UISourceCode,a.UISourceCode.UILocation,n.RemoteObject.RemoteObject,n.NetworkRequest.NetworkRequest,...Se((e=>[e.UISourceCodeFrame.UISourceCodeFrame]))],loadProvider:async()=>(await pe()).SourcesPanel.SourcesPanel.instance(),experiment:void 0}),r.ContextMenu.registerProvider({loadProvider:async()=>(await pe()).WatchExpressionsSidebarPane.WatchExpressionsSidebarPane.instance(),contextTypes:()=>[d.ObjectPropertiesSection.ObjectPropertyTreeElement,...Se((e=>[e.UISourceCodeFrame.UISourceCodeFrame]))],experiment:void 0}),e.Revealer.registerRevealer({contextTypes:()=>[a.UISourceCode.UILocation],destination:e.Revealer.RevealerDestination.SOURCES_PANEL,loadRevealer:async()=>new((await pe()).SourcesPanel.UILocationRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[a.UISourceCode.UILocationRange],destination:e.Revealer.RevealerDestination.SOURCES_PANEL,loadRevealer:async()=>new((await pe()).SourcesPanel.UILocationRangeRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[n.DebuggerModel.Location],destination:e.Revealer.RevealerDestination.SOURCES_PANEL,loadRevealer:async()=>new((await pe()).SourcesPanel.DebuggerLocationRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[a.UISourceCode.UISourceCode],destination:e.Revealer.RevealerDestination.SOURCES_PANEL,loadRevealer:async()=>new((await pe()).SourcesPanel.UISourceCodeRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[n.DebuggerModel.DebuggerPausedDetails],destination:e.Revealer.RevealerDestination.SOURCES_PANEL,loadRevealer:async()=>new((await pe()).SourcesPanel.DebuggerPausedDetailsRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[c.BreakpointManager.BreakpointLocation],destination:e.Revealer.RevealerDestination.SOURCES_PANEL,loadRevealer:async()=>new((await pe()).DebuggerPlugin.BreakpointLocationRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>Se((e=>[e.SearchSourcesView.SearchSources])),destination:void 0,loadRevealer:async()=>new((await pe()).SearchSourcesView.Revealer)}),r.Toolbar.registerToolbarItem({actionId:"sources.add-folder-to-workspace",location:"files-navigator-toolbar",label:de(le.addFolder),loadItem:void 0,order:void 0,separator:void 0}),r.Context.registerListener({contextTypes:()=>[n.DebuggerModel.DebuggerPausedDetails],loadListener:async()=>(await me()).BreakpointsView.BreakpointsSidebarController.instance()}),r.Context.registerListener({contextTypes:()=>[n.DebuggerModel.DebuggerPausedDetails],loadListener:async()=>(await pe()).CallStackSidebarPane.CallStackSidebarPane.instance()}),r.Context.registerListener({contextTypes:()=>[n.DebuggerModel.CallFrame],loadListener:async()=>(await pe()).ScopeChainSidebarPane.ScopeChainSidebarPane.instance()}),r.ContextMenu.registerItem({location:"navigatorMenu/default",actionId:"quick-open.show",order:void 0}),r.ContextMenu.registerItem({location:"mainMenu/default",actionId:"sources.search",order:void 0}),g.FilteredListWidget.registerProvider({prefix:"@",iconName:"symbol",provider:async()=>new((await pe()).OutlineQuickOpen.OutlineQuickOpen),helpTitle:de(le.goToSymbol),titlePrefix:de(le.goTo),titleSuggestion:de(le.symbol)}),g.FilteredListWidget.registerProvider({prefix:":",iconName:"colon",provider:async()=>new((await pe()).GoToLineQuickOpen.GoToLineQuickOpen),helpTitle:de(le.goToLine),titlePrefix:de(le.goTo),titleSuggestion:de(le.line)}),g.FilteredListWidget.registerProvider({prefix:"",iconName:"document",provider:async()=>new((await pe()).OpenFileQuickOpen.OpenFileQuickOpen),helpTitle:de(le.openFile),titlePrefix:de(le.open),titleSuggestion:de(le.file)});const we={sensors:"Sensors",geolocation:"geolocation",timezones:"timezones",locale:"locale",locales:"locales",accelerometer:"accelerometer",deviceOrientation:"device orientation",locations:"Locations",touch:"Touch",devicebased:"Device-based",forceEnabled:"Force enabled",emulateIdleDetectorState:"Emulate Idle Detector state",noIdleEmulation:"No idle emulation",userActiveScreenUnlocked:"User active, screen unlocked",userActiveScreenLocked:"User active, screen locked",userIdleScreenUnlocked:"User idle, screen unlocked",userIdleScreenLocked:"User idle, screen locked",showSensors:"Show Sensors",showLocations:"Show Locations",cpuPressure:"CPU Pressure",noPressureEmulation:"No override",nominal:"Nominal",fair:"Fair",serious:"Serious",critical:"Critical"},ye=o.i18n.registerUIStrings("panels/sensors/sensors-meta.ts",we),he=o.i18n.getLazilyComputedLocalizedString.bind(void 0,ye);let ve;async function be(){return ve||(ve=await import("../../panels/sensors/sensors.js")),ve}r.ViewManager.registerViewExtension({location:"drawer-view",commandPrompt:he(we.showSensors),title:he(we.sensors),id:"sensors",persistence:"closeable",order:100,loadView:async()=>new((await be()).SensorsView.SensorsView),tags:[he(we.geolocation),he(we.timezones),he(we.locale),he(we.locales),he(we.accelerometer),he(we.deviceOrientation)]}),r.ViewManager.registerViewExtension({location:"settings-view",id:"emulation-locations",commandPrompt:he(we.showLocations),title:he(we.locations),order:40,loadView:async()=>new((await be()).LocationsSettingsTab.LocationsSettingsTab),settings:["emulation.locations"],iconName:"location-on"}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"emulation.locations",settingType:"array",defaultValue:[{title:"Berlin",lat:52.520007,long:13.404954,timezoneId:"Europe/Berlin",locale:"de-DE"},{title:"London",lat:51.507351,long:-.127758,timezoneId:"Europe/London",locale:"en-GB"},{title:"Moscow",lat:55.755826,long:37.6173,timezoneId:"Europe/Moscow",locale:"ru-RU"},{title:"Mountain View",lat:37.386052,long:-122.083851,timezoneId:"America/Los_Angeles",locale:"en-US"},{title:"Mumbai",lat:19.075984,long:72.877656,timezoneId:"Asia/Kolkata",locale:"mr-IN"},{title:"San Francisco",lat:37.774929,long:-122.419416,timezoneId:"America/Los_Angeles",locale:"en-US"},{title:"Shanghai",lat:31.230416,long:121.473701,timezoneId:"Asia/Shanghai",locale:"zh-Hans-CN"},{title:"Sรฃo Paulo",lat:-23.55052,long:-46.633309,timezoneId:"America/Sao_Paulo",locale:"pt-BR"},{title:"Tokyo",lat:35.689487,long:139.691706,timezoneId:"Asia/Tokyo",locale:"ja-JP"}]}),e.Settings.registerSettingExtension({title:he(we.cpuPressure),reloadRequired:!0,settingName:"emulation.cpu-pressure",settingType:"enum",defaultValue:"none",options:[{value:"none",title:he(we.noPressureEmulation),text:he(we.noPressureEmulation)},{value:"nominal",title:he(we.nominal),text:he(we.nominal)},{value:"fair",title:he(we.fair),text:he(we.fair)},{value:"serious",title:he(we.serious),text:he(we.serious)},{value:"critical",title:he(we.critical),text:he(we.critical)}]}),e.Settings.registerSettingExtension({title:he(we.touch),reloadRequired:!0,settingName:"emulation.touch",settingType:"enum",defaultValue:"none",options:[{value:"none",title:he(we.devicebased),text:he(we.devicebased)},{value:"force",title:he(we.forceEnabled),text:he(we.forceEnabled)}]}),e.Settings.registerSettingExtension({title:he(we.emulateIdleDetectorState),settingName:"emulation.idle-detection",settingType:"enum",defaultValue:"none",options:[{value:"none",title:he(we.noIdleEmulation),text:he(we.noIdleEmulation)},{value:'{"isUserActive":true,"isScreenUnlocked":true}',title:he(we.userActiveScreenUnlocked),text:he(we.userActiveScreenUnlocked)},{value:'{"isUserActive":true,"isScreenUnlocked":false}',title:he(we.userActiveScreenLocked),text:he(we.userActiveScreenLocked)},{value:'{"isUserActive":false,"isScreenUnlocked":true}',title:he(we.userIdleScreenUnlocked),text:he(we.userIdleScreenUnlocked)},{value:'{"isUserActive":false,"isScreenUnlocked":false}',title:he(we.userIdleScreenLocked),text:he(we.userIdleScreenLocked)}]});const fe={performance:"Performance",showPerformance:"Show Performance",record:"Record",stop:"Stop",recordAndReload:"Record and reload",saveProfile:"Save profileโ€ฆ",loadProfile:"Load profileโ€ฆ",previousFrame:"Previous frame",nextFrame:"Next frame",showRecentTimelineSessions:"Show recent timeline sessions",previousRecording:"Previous recording",nextRecording:"Next recording",hideChromeFrameInLayersView:"Hide `chrome` frame in Layers view"},xe=o.i18n.registerUIStrings("panels/timeline/timeline-meta.ts",fe),Ee=o.i18n.getLazilyComputedLocalizedString.bind(void 0,xe);let Te;async function Ae(){return Te||(Te=await import("../../panels/timeline/timeline.js")),Te}function Ce(e){return void 0===Te?[]:e(Te)}r.ViewManager.registerViewExtension({location:"panel",id:"timeline",title:Ee(fe.performance),commandPrompt:Ee(fe.showPerformance),order:50,loadView:async()=>(await Ae()).TimelinePanel.TimelinePanel.instance()}),r.ActionRegistration.registerActionExtension({actionId:"timeline.toggle-recording",category:"PERFORMANCE",iconClass:"record-start",toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,contextTypes:()=>Ce((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await Ae()).TimelinePanel.ActionDelegate),options:[{value:!0,title:Ee(fe.record)},{value:!1,title:Ee(fe.stop)}],bindings:[{platform:"windows,linux",shortcut:"Ctrl+E"},{platform:"mac",shortcut:"Meta+E"}]}),r.ActionRegistration.registerActionExtension({actionId:"timeline.record-reload",iconClass:"refresh",contextTypes:()=>Ce((e=>[e.TimelinePanel.TimelinePanel])),category:"PERFORMANCE",title:Ee(fe.recordAndReload),loadActionDelegate:async()=>new((await Ae()).TimelinePanel.ActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+E"},{platform:"mac",shortcut:"Meta+Shift+E"}],experiment:"!react-native-specific-ui"}),r.ActionRegistration.registerActionExtension({category:"PERFORMANCE",actionId:"timeline.save-to-file",contextTypes:()=>Ce((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await Ae()).TimelinePanel.ActionDelegate),title:Ee(fe.saveProfile),bindings:[{platform:"windows,linux",shortcut:"Ctrl+S"},{platform:"mac",shortcut:"Meta+S"}]}),r.ActionRegistration.registerActionExtension({category:"PERFORMANCE",actionId:"timeline.load-from-file",contextTypes:()=>Ce((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await Ae()).TimelinePanel.ActionDelegate),title:Ee(fe.loadProfile),bindings:[{platform:"windows,linux",shortcut:"Ctrl+O"},{platform:"mac",shortcut:"Meta+O"}]}),r.ActionRegistration.registerActionExtension({actionId:"timeline.jump-to-previous-frame",category:"PERFORMANCE",title:Ee(fe.previousFrame),contextTypes:()=>Ce((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await Ae()).TimelinePanel.ActionDelegate),bindings:[{shortcut:"["}]}),r.ActionRegistration.registerActionExtension({actionId:"timeline.jump-to-next-frame",category:"PERFORMANCE",title:Ee(fe.nextFrame),contextTypes:()=>Ce((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await Ae()).TimelinePanel.ActionDelegate),bindings:[{shortcut:"]"}]}),r.ActionRegistration.registerActionExtension({actionId:"timeline.show-history",loadActionDelegate:async()=>new((await Ae()).TimelinePanel.ActionDelegate),category:"PERFORMANCE",title:Ee(fe.showRecentTimelineSessions),contextTypes:()=>Ce((e=>[e.TimelinePanel.TimelinePanel])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+H"},{platform:"mac",shortcut:"Meta+Y"}]}),r.ActionRegistration.registerActionExtension({actionId:"timeline.previous-recording",category:"PERFORMANCE",loadActionDelegate:async()=>new((await Ae()).TimelinePanel.ActionDelegate),title:Ee(fe.previousRecording),contextTypes:()=>Ce((e=>[e.TimelinePanel.TimelinePanel])),bindings:[{platform:"windows,linux",shortcut:"Alt+Left"},{platform:"mac",shortcut:"Meta+Left"}]}),r.ActionRegistration.registerActionExtension({actionId:"timeline.next-recording",category:"PERFORMANCE",loadActionDelegate:async()=>new((await Ae()).TimelinePanel.ActionDelegate),title:Ee(fe.nextRecording),contextTypes:()=>Ce((e=>[e.TimelinePanel.TimelinePanel])),bindings:[{platform:"windows,linux",shortcut:"Alt+Right"},{platform:"mac",shortcut:"Meta+Right"}]}),e.Settings.registerSettingExtension({category:"PERFORMANCE",storageType:"Synced",title:Ee(fe.hideChromeFrameInLayersView),settingName:"frame-viewer-hide-chrome-window",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({category:"PERFORMANCE",storageType:"Synced",settingName:"annotations-hidden",settingType:"boolean",defaultValue:!1}),e.Linkifier.registerLinkifier({contextTypes:()=>Ce((e=>[e.CLSLinkifier.CLSRect])),loadLinkifier:async()=>(await Ae()).CLSLinkifier.Linkifier.instance()}),r.ContextMenu.registerItem({location:"timelineMenu/open",actionId:"timeline.load-from-file",order:10}),r.ContextMenu.registerItem({location:"timelineMenu/open",actionId:"timeline.save-to-file",order:15}),e.Revealer.registerRevealer({contextTypes:()=>[n.TraceObject.TraceObject],destination:e.Revealer.RevealerDestination.TIMELINE_PANEL,loadRevealer:async()=>new((await Ae()).TimelinePanel.TraceRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[n.TraceObject.RevealableEvent],destination:e.Revealer.RevealerDestination.TIMELINE_PANEL,loadRevealer:async()=>new((await Ae()).TimelinePanel.EventRevealer)});const Re={flamechartSelectedNavigation:"Flamechart navigation:",modern:"Modern",classic:"Classic",liveMemoryAllocationAnnotations:"Live memory allocation annotations",showLiveMemoryAllocation:"Show live memory allocation annotations",hideLiveMemoryAllocation:"Hide live memory allocation annotations",collectGarbage:"Collect garbage"},ke=o.i18n.registerUIStrings("ui/legacy/components/perf_ui/perf_ui-meta.ts",Re),Pe=o.i18n.getLazilyComputedLocalizedString.bind(void 0,ke);let De;r.ActionRegistration.registerActionExtension({actionId:"components.collect-garbage",category:"PERFORMANCE",title:Pe(Re.collectGarbage),iconClass:"mop",loadActionDelegate:async()=>new((await async function(){return De||(De=await import("../../ui/legacy/components/perf_ui/perf_ui.js")),De}()).GCActionDelegate.GCActionDelegate)}),e.Settings.registerSettingExtension({category:"PERFORMANCE",storageType:"Synced",title:Pe(Re.flamechartSelectedNavigation),settingName:"flamechart-selected-navigation",settingType:"enum",defaultValue:"classic",options:[{title:Pe(Re.modern),text:Pe(Re.modern),value:"modern"},{title:Pe(Re.classic),text:Pe(Re.classic),value:"classic"}]}),e.Settings.registerSettingExtension({category:"MEMORY",experiment:"live-heap-profile",title:Pe(Re.liveMemoryAllocationAnnotations),settingName:"memory-live-heap-profile",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:Pe(Re.showLiveMemoryAllocation)},{value:!1,title:Pe(Re.hideLiveMemoryAllocation)}]});const Ne={openFile:"Open file",runCommand:"Run command"},Ie=o.i18n.registerUIStrings("ui/legacy/components/quick_open/quick_open-meta.ts",Ne),Ve=o.i18n.getLazilyComputedLocalizedString.bind(void 0,Ie);let Le;async function Me(){return Le||(Le=await import("../../ui/legacy/components/quick_open/quick_open.js")),Le}r.ActionRegistration.registerActionExtension({actionId:"quick-open.show-command-menu",category:"GLOBAL",title:Ve(Ne.runCommand),loadActionDelegate:async()=>new((await Me()).CommandMenu.ShowActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+P",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+Shift+P",keybindSets:["devToolsDefault","vsCode"]},{shortcut:"F1",keybindSets:["vsCode"]}]}),r.ActionRegistration.registerActionExtension({actionId:"quick-open.show",category:"GLOBAL",title:Ve(Ne.openFile),loadActionDelegate:async()=>new((await Me()).QuickOpen.ShowActionDelegate),order:100,bindings:[{platform:"mac",shortcut:"Meta+P",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+O",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+P",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+O",keybindSets:["devToolsDefault","vsCode"]}]}),r.ContextMenu.registerItem({location:"mainMenu/default",actionId:"quick-open.show-command-menu",order:void 0}),r.ContextMenu.registerItem({location:"mainMenu/default",actionId:"quick-open.show",order:void 0});const Oe={defaultIndentation:"Default indentation:",setIndentationToSpaces:"Set indentation to 2 spaces",Spaces:"2 spaces",setIndentationToFSpaces:"Set indentation to 4 spaces",fSpaces:"4 spaces",setIndentationToESpaces:"Set indentation to 8 spaces",eSpaces:"8 spaces",setIndentationToTabCharacter:"Set indentation to tab character",tabCharacter:"Tab character"},Fe=o.i18n.registerUIStrings("ui/legacy/components/source_frame/source_frame-meta.ts",Oe),Ue=o.i18n.getLazilyComputedLocalizedString.bind(void 0,Fe);e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:Ue(Oe.defaultIndentation),settingName:"text-editor-indent",settingType:"enum",defaultValue:" ",options:[{title:Ue(Oe.setIndentationToSpaces),text:Ue(Oe.Spaces),value:" "},{title:Ue(Oe.setIndentationToFSpaces),text:Ue(Oe.fSpaces),value:" "},{title:Ue(Oe.setIndentationToESpaces),text:Ue(Oe.eSpaces),value:" "},{title:Ue(Oe.setIndentationToTabCharacter),text:Ue(Oe.tabCharacter),value:"\t"}]}),new u.MainImpl.MainImpl; diff --git a/packages/debugger-frontend/dist/third-party/front_end/entrypoints/rn_fusebox/rn_fusebox.js b/packages/debugger-frontend/dist/third-party/front_end/entrypoints/rn_fusebox/rn_fusebox.js index cf66298b4e99..e4ad0d10d4cc 100644 --- a/packages/debugger-frontend/dist/third-party/front_end/entrypoints/rn_fusebox/rn_fusebox.js +++ b/packages/debugger-frontend/dist/third-party/front_end/entrypoints/rn_fusebox/rn_fusebox.js @@ -1,4 +1,4 @@ -import"../shell/shell.js";import*as e from"../../core/common/common.js";import*as t from"../../core/i18n/i18n.js";import*as o from"../../core/root/root.js";import*as i from"../../ui/legacy/legacy.js";import*as n from"../../core/sdk/sdk.js";import*as a from"../../models/issues_manager/issues_manager.js";import*as r from"../../models/extensions/extensions.js";import*as s from"../../models/workspace/workspace.js";import*as l from"../../panels/network/forward/forward.js";import*as c from"../../core/host/host.js";import*as d from"../../core/rn_experiments/rn_experiments.js";import*as g from"../main/main.js";import*as m from"../../ui/lit/lit.js";import*as u from"../../ui/visual_logging/visual_logging.js";const p={toggleDeviceToolbar:"Toggle device toolbar",captureScreenshot:"Capture screenshot",captureFullSizeScreenshot:"Capture full size screenshot",captureNodeScreenshot:"Capture node screenshot",showMediaQueries:"Show media queries",device:"device",hideMediaQueries:"Hide media queries",showRulers:"Show rulers in the Device Mode toolbar",hideRulers:"Hide rulers in the Device Mode toolbar",showDeviceFrame:"Show device frame",hideDeviceFrame:"Hide device frame"},w=t.i18n.registerUIStrings("panels/emulation/emulation-meta.ts",p),v=t.i18n.getLazilyComputedLocalizedString.bind(void 0,w);let h;async function y(){return h||(h=await import("../../panels/emulation/emulation.js")),h}i.ActionRegistration.registerActionExtension({category:"MOBILE",actionId:"emulation.toggle-device-mode",toggleable:!0,loadActionDelegate:async()=>new((await y()).DeviceModeWrapper.ActionDelegate),condition:o.Runtime.conditions.canDock,title:v(p.toggleDeviceToolbar),iconClass:"devices",bindings:[{platform:"windows,linux",shortcut:"Shift+Ctrl+M"},{platform:"mac",shortcut:"Shift+Meta+M"}]}),i.ActionRegistration.registerActionExtension({actionId:"emulation.capture-screenshot",category:"SCREENSHOT",loadActionDelegate:async()=>new((await y()).DeviceModeWrapper.ActionDelegate),condition:o.Runtime.conditions.canDock,title:v(p.captureScreenshot)}),i.ActionRegistration.registerActionExtension({actionId:"emulation.capture-full-height-screenshot",category:"SCREENSHOT",loadActionDelegate:async()=>new((await y()).DeviceModeWrapper.ActionDelegate),condition:o.Runtime.conditions.canDock,title:v(p.captureFullSizeScreenshot)}),i.ActionRegistration.registerActionExtension({actionId:"emulation.capture-node-screenshot",category:"SCREENSHOT",loadActionDelegate:async()=>new((await y()).DeviceModeWrapper.ActionDelegate),condition:o.Runtime.conditions.canDock,title:v(p.captureNodeScreenshot)}),e.Settings.registerSettingExtension({category:"MOBILE",settingName:"show-media-query-inspector",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:v(p.showMediaQueries)},{value:!1,title:v(p.hideMediaQueries)}],tags:[v(p.device)]}),e.Settings.registerSettingExtension({category:"MOBILE",settingName:"emulation.show-rulers",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:v(p.showRulers)},{value:!1,title:v(p.hideRulers)}],tags:[v(p.device)]}),e.Settings.registerSettingExtension({category:"MOBILE",settingName:"emulation.show-device-outline",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:v(p.showDeviceFrame)},{value:!1,title:v(p.hideDeviceFrame)}],tags:[v(p.device)]}),i.Toolbar.registerToolbarItem({actionId:"emulation.toggle-device-mode",condition:o.Runtime.conditions.canDock,location:"main-toolbar-left",order:1,loadItem:void 0,separator:void 0}),e.AppProvider.registerAppProvider({loadAppProvider:async()=>(await y()).AdvancedApp.AdvancedAppProvider.instance(),condition:o.Runtime.conditions.canDock,order:0}),i.ContextMenu.registerItem({location:"deviceModeMenu/save",order:12,actionId:"emulation.capture-screenshot"}),i.ContextMenu.registerItem({location:"deviceModeMenu/save",order:13,actionId:"emulation.capture-full-height-screenshot"});const R={sensors:"Sensors",geolocation:"geolocation",timezones:"timezones",locale:"locale",locales:"locales",accelerometer:"accelerometer",deviceOrientation:"device orientation",locations:"Locations",touch:"Touch",devicebased:"Device-based",forceEnabled:"Force enabled",emulateIdleDetectorState:"Emulate Idle Detector state",noIdleEmulation:"No idle emulation",userActiveScreenUnlocked:"User active, screen unlocked",userActiveScreenLocked:"User active, screen locked",userIdleScreenUnlocked:"User idle, screen unlocked",userIdleScreenLocked:"User idle, screen locked",showSensors:"Show Sensors",showLocations:"Show Locations",cpuPressure:"CPU Pressure",noPressureEmulation:"No override",nominal:"Nominal",fair:"Fair",serious:"Serious",critical:"Critical"},f=t.i18n.registerUIStrings("panels/sensors/sensors-meta.ts",R),b=t.i18n.getLazilyComputedLocalizedString.bind(void 0,f);let k;async function S(){return k||(k=await import("../../panels/sensors/sensors.js")),k}i.ViewManager.registerViewExtension({location:"drawer-view",commandPrompt:b(R.showSensors),title:b(R.sensors),id:"sensors",persistence:"closeable",order:100,loadView:async()=>new((await S()).SensorsView.SensorsView),tags:[b(R.geolocation),b(R.timezones),b(R.locale),b(R.locales),b(R.accelerometer),b(R.deviceOrientation)]}),i.ViewManager.registerViewExtension({location:"settings-view",id:"emulation-locations",commandPrompt:b(R.showLocations),title:b(R.locations),order:40,loadView:async()=>new((await S()).LocationsSettingsTab.LocationsSettingsTab),settings:["emulation.locations"],iconName:"location-on"}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"emulation.locations",settingType:"array",defaultValue:[{title:"Berlin",lat:52.520007,long:13.404954,timezoneId:"Europe/Berlin",locale:"de-DE"},{title:"London",lat:51.507351,long:-.127758,timezoneId:"Europe/London",locale:"en-GB"},{title:"Moscow",lat:55.755826,long:37.6173,timezoneId:"Europe/Moscow",locale:"ru-RU"},{title:"Mountain View",lat:37.386052,long:-122.083851,timezoneId:"America/Los_Angeles",locale:"en-US"},{title:"Mumbai",lat:19.075984,long:72.877656,timezoneId:"Asia/Kolkata",locale:"mr-IN"},{title:"San Francisco",lat:37.774929,long:-122.419416,timezoneId:"America/Los_Angeles",locale:"en-US"},{title:"Shanghai",lat:31.230416,long:121.473701,timezoneId:"Asia/Shanghai",locale:"zh-Hans-CN"},{title:"Sรฃo Paulo",lat:-23.55052,long:-46.633309,timezoneId:"America/Sao_Paulo",locale:"pt-BR"},{title:"Tokyo",lat:35.689487,long:139.691706,timezoneId:"Asia/Tokyo",locale:"ja-JP"}]}),e.Settings.registerSettingExtension({title:b(R.cpuPressure),reloadRequired:!0,settingName:"emulation.cpu-pressure",settingType:"enum",defaultValue:"none",options:[{value:"none",title:b(R.noPressureEmulation),text:b(R.noPressureEmulation)},{value:"nominal",title:b(R.nominal),text:b(R.nominal)},{value:"fair",title:b(R.fair),text:b(R.fair)},{value:"serious",title:b(R.serious),text:b(R.serious)},{value:"critical",title:b(R.critical),text:b(R.critical)}]}),e.Settings.registerSettingExtension({title:b(R.touch),reloadRequired:!0,settingName:"emulation.touch",settingType:"enum",defaultValue:"none",options:[{value:"none",title:b(R.devicebased),text:b(R.devicebased)},{value:"force",title:b(R.forceEnabled),text:b(R.forceEnabled)}]}),e.Settings.registerSettingExtension({title:b(R.emulateIdleDetectorState),settingName:"emulation.idle-detection",settingType:"enum",defaultValue:"none",options:[{value:"none",title:b(R.noIdleEmulation),text:b(R.noIdleEmulation)},{value:'{"isUserActive":true,"isScreenUnlocked":true}',title:b(R.userActiveScreenUnlocked),text:b(R.userActiveScreenUnlocked)},{value:'{"isUserActive":true,"isScreenUnlocked":false}',title:b(R.userActiveScreenLocked),text:b(R.userActiveScreenLocked)},{value:'{"isUserActive":false,"isScreenUnlocked":true}',title:b(R.userIdleScreenUnlocked),text:b(R.userIdleScreenUnlocked)},{value:'{"isUserActive":false,"isScreenUnlocked":false}',title:b(R.userIdleScreenLocked),text:b(R.userIdleScreenLocked)}]});const T={developerResources:"Developer resources",showDeveloperResources:"Show Developer resources"},E=t.i18n.registerUIStrings("panels/developer_resources/developer_resources-meta.ts",T),A=t.i18n.getLazilyComputedLocalizedString.bind(void 0,E);let N;async function P(){return N||(N=await import("../../panels/developer_resources/developer_resources.js")),N}i.ViewManager.registerViewExtension({location:"drawer-view",id:"developer-resources",title:A(T.developerResources),commandPrompt:A(T.showDeveloperResources),order:100,persistence:"closeable",loadView:async()=>new((await P()).DeveloperResourcesView.DeveloperResourcesView)}),e.Revealer.registerRevealer({contextTypes:()=>[n.PageResourceLoader.ResourceKey],destination:e.Revealer.RevealerDestination.DEVELOPER_RESOURCES_PANEL,loadRevealer:async()=>new((await P()).DeveloperResourcesView.DeveloperResourcesRevealer)});const x={rendering:"Rendering",showRendering:"Show Rendering",paint:"paint",layout:"layout",fps:"fps",cssMediaType:"CSS media type",cssMediaFeature:"CSS media feature",visionDeficiency:"vision deficiency",colorVisionDeficiency:"color vision deficiency",reloadPage:"Reload page",hardReloadPage:"Hard reload page",forceAdBlocking:"Force ad blocking on this site",blockAds:"Block ads on this site",showAds:"Show ads on this site, if allowed",autoOpenDevTools:"Auto-open DevTools for popups",doNotAutoOpen:"Do not auto-open DevTools for popups",disablePaused:"Disable paused state overlay",toggleCssPrefersColorSchemeMedia:"Toggle CSS media feature prefers-color-scheme"},I=t.i18n.registerUIStrings("entrypoints/inspector_main/inspector_main-meta.ts",x),M=t.i18n.getLazilyComputedLocalizedString.bind(void 0,I);let D;async function L(){return D||(D=await import("../inspector_main/inspector_main.js")),D}i.ViewManager.registerViewExtension({location:"drawer-view",id:"rendering",title:M(x.rendering),commandPrompt:M(x.showRendering),persistence:"closeable",order:50,loadView:async()=>new((await L()).RenderingOptions.RenderingOptionsView),tags:[M(x.paint),M(x.layout),M(x.fps),M(x.cssMediaType),M(x.cssMediaFeature),M(x.visionDeficiency),M(x.colorVisionDeficiency)]}),i.ActionRegistration.registerActionExtension({category:"NAVIGATION",actionId:"inspector-main.reload",loadActionDelegate:async()=>new((await L()).InspectorMain.ReloadActionDelegate),iconClass:"refresh",title:M(x.reloadPage),bindings:[{platform:"windows,linux",shortcut:"Ctrl+R"},{platform:"windows,linux",shortcut:"F5"},{platform:"mac",shortcut:"Meta+R"}]}),i.ActionRegistration.registerActionExtension({category:"NAVIGATION",actionId:"inspector-main.hard-reload",loadActionDelegate:async()=>new((await L()).InspectorMain.ReloadActionDelegate),title:M(x.hardReloadPage),bindings:[{platform:"windows,linux",shortcut:"Shift+Ctrl+R"},{platform:"windows,linux",shortcut:"Shift+F5"},{platform:"windows,linux",shortcut:"Ctrl+F5"},{platform:"windows,linux",shortcut:"Ctrl+Shift+F5"},{platform:"mac",shortcut:"Shift+Meta+R"}]}),i.ActionRegistration.registerActionExtension({actionId:"rendering.toggle-prefers-color-scheme",category:"RENDERING",title:M(x.toggleCssPrefersColorSchemeMedia),loadActionDelegate:async()=>new((await L()).RenderingOptions.ReloadActionDelegate)}),e.Settings.registerSettingExtension({category:"",title:M(x.forceAdBlocking),settingName:"network.ad-blocking-enabled",settingType:"boolean",storageType:"Session",defaultValue:!1,options:[{value:!0,title:M(x.blockAds)},{value:!1,title:M(x.showAds)}]}),e.Settings.registerSettingExtension({category:"GLOBAL",storageType:"Synced",title:M(x.autoOpenDevTools),settingName:"auto-attach-to-created-pages",settingType:"boolean",order:2,defaultValue:!1,options:[{value:!0,title:M(x.autoOpenDevTools)},{value:!1,title:M(x.doNotAutoOpen)}]}),e.Settings.registerSettingExtension({category:"APPEARANCE",storageType:"Synced",title:M(x.disablePaused),settingName:"disable-paused-state-overlay",settingType:"boolean",defaultValue:!1}),i.Toolbar.registerToolbarItem({loadItem:async()=>(await L()).InspectorMain.NodeIndicator.instance(),order:2,location:"main-toolbar-left"}),i.Toolbar.registerToolbarItem({loadItem:async()=>(await L()).OutermostTargetSelector.OutermostTargetSelector.instance(),order:98,location:"main-toolbar-right"});const V={issues:"Issues",showIssues:"Show Issues"},C=t.i18n.registerUIStrings("panels/issues/issues-meta.ts",V),F=t.i18n.getLazilyComputedLocalizedString.bind(void 0,C);let U;async function O(){return U||(U=await import("../../panels/issues/issues.js")),U}i.ViewManager.registerViewExtension({location:"drawer-view",id:"issues-pane",title:F(V.issues),commandPrompt:F(V.showIssues),order:100,persistence:"closeable",loadView:async()=>new((await O()).IssuesPane.IssuesPane)}),e.Revealer.registerRevealer({contextTypes:()=>[a.Issue.Issue],destination:e.Revealer.RevealerDestination.ISSUES_VIEW,loadRevealer:async()=>new((await O()).IssueRevealer.IssueRevealer)});const _={throttling:"Throttling",showThrottling:"Show Throttling",goOffline:"Go offline",device:"device",throttlingTag:"throttling",enableSlowGThrottling:"Enable slow `3G` throttling",enableFastGThrottling:"Enable fast `3G` throttling",goOnline:"Go online"},z=t.i18n.registerUIStrings("panels/mobile_throttling/mobile_throttling-meta.ts",_),B=t.i18n.getLazilyComputedLocalizedString.bind(void 0,z);let W;async function q(){return W||(W=await import("../../panels/mobile_throttling/mobile_throttling.js")),W}i.ViewManager.registerViewExtension({location:"settings-view",id:"throttling-conditions",title:B(_.throttling),commandPrompt:B(_.showThrottling),order:35,loadView:async()=>new((await q()).ThrottlingSettingsTab.ThrottlingSettingsTab),settings:["custom-network-conditions","calibrated-cpu-throttling"],iconName:"performance"}),i.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-offline",category:"NETWORK",title:B(_.goOffline),loadActionDelegate:async()=>new((await q()).ThrottlingManager.ActionDelegate),tags:[B(_.device),B(_.throttlingTag)]}),i.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-low-end-mobile",category:"NETWORK",title:B(_.enableSlowGThrottling),loadActionDelegate:async()=>new((await q()).ThrottlingManager.ActionDelegate),tags:[B(_.device),B(_.throttlingTag)]}),i.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-mid-tier-mobile",category:"NETWORK",title:B(_.enableFastGThrottling),loadActionDelegate:async()=>new((await q()).ThrottlingManager.ActionDelegate),tags:[B(_.device),B(_.throttlingTag)]}),i.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-online",category:"NETWORK",title:B(_.goOnline),loadActionDelegate:async()=>new((await q()).ThrottlingManager.ActionDelegate),tags:[B(_.device),B(_.throttlingTag)]}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"custom-network-conditions",settingType:"array",defaultValue:[]});const j={showNetwork:"Show Network",network:"Network",networkExpoUnstable:"Expo Network",showNetworkRequestBlocking:"Show Network request blocking",networkRequestBlocking:"Network request blocking",showNetworkConditions:"Show Network conditions",networkConditions:"Network conditions",diskCache:"disk cache",networkThrottling:"network throttling",showSearch:"Show Search",search:"Search",recordNetworkLog:"Record network log",stopRecordingNetworkLog:"Stop recording network log",hideRequestDetails:"Hide request details",colorcodeResourceTypes:"Color-code resource types",colorCode:"color code",resourceType:"resource type",colorCodeByResourceType:"Color code by resource type",useDefaultColors:"Use default colors",groupNetworkLogByFrame:"Group network log by frame",netWork:"network",frame:"frame",group:"group",groupNetworkLogItemsByFrame:"Group network log items by frame",dontGroupNetworkLogItemsByFrame:"Don't group network log items by frame",clear:"Clear network log",addNetworkRequestBlockingPattern:"Add network request blocking pattern",removeAllNetworkRequestBlockingPatterns:"Remove all network request blocking patterns",allowToGenerateHarWithSensitiveData:"Allow to generate `HAR` with sensitive data",dontAllowToGenerateHarWithSensitiveData:"Don't allow to generate `HAR` with sensitive data",allowToGenerateHarWithSensitiveDataDocumentation:"By default generated HAR logs are sanitized and don't include `Cookie`, `Set-Cookie`, or `Authorization` HTTP headers. When this setting is enabled, options to export/copy HAR with sensitive data are provided."},H=t.i18n.registerUIStrings("panels/network/network-meta.ts",j),G=t.i18n.getLazilyComputedLocalizedString.bind(void 0,H),K=t.i18n.getLocalizedString.bind(void 0,H);let Q;async function Y(){return Q||(Q=await import("../../panels/network/network.js")),Q}function $(e){return void 0===Q?[]:e(Q)}i.ViewManager.registerViewExtension({location:"panel",id:"network",commandPrompt:G(j.showNetwork),title:()=>o.Runtime.conditions.reactNativeExpoNetworkPanel()?K(j.networkExpoUnstable):K(j.network),order:40,loadView:async()=>(await Y()).NetworkPanel.NetworkPanel.instance()}),i.ViewManager.registerViewExtension({location:"drawer-view",id:"network.blocked-urls",commandPrompt:G(j.showNetworkRequestBlocking),title:G(j.networkRequestBlocking),persistence:"closeable",order:60,loadView:async()=>new((await Y()).BlockedURLsPane.BlockedURLsPane)}),i.ViewManager.registerViewExtension({location:"drawer-view",id:"network.config",commandPrompt:G(j.showNetworkConditions),title:G(j.networkConditions),persistence:"closeable",order:40,tags:[G(j.diskCache),G(j.networkThrottling),t.i18n.lockedLazyString("useragent"),t.i18n.lockedLazyString("user agent"),t.i18n.lockedLazyString("user-agent")],loadView:async()=>(await Y()).NetworkConfigView.NetworkConfigView.instance()}),i.ViewManager.registerViewExtension({location:"network-sidebar",id:"network.search-network-tab",commandPrompt:G(j.showSearch),title:G(j.search),persistence:"permanent",loadView:async()=>(await Y()).NetworkPanel.SearchNetworkView.instance()}),i.ActionRegistration.registerActionExtension({actionId:"network.toggle-recording",category:"NETWORK",iconClass:"record-start",toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,contextTypes:()=>$((e=>[e.NetworkPanel.NetworkPanel])),loadActionDelegate:async()=>new((await Y()).NetworkPanel.ActionDelegate),options:[{value:!0,title:G(j.recordNetworkLog)},{value:!1,title:G(j.stopRecordingNetworkLog)}],bindings:[{shortcut:"Ctrl+E",platform:"windows,linux"},{shortcut:"Meta+E",platform:"mac"}]}),i.ActionRegistration.registerActionExtension({actionId:"network.clear",category:"NETWORK",title:G(j.clear),iconClass:"clear",loadActionDelegate:async()=>new((await Y()).NetworkPanel.ActionDelegate),contextTypes:()=>$((e=>[e.NetworkPanel.NetworkPanel])),bindings:[{shortcut:"Ctrl+L"},{shortcut:"Meta+K",platform:"mac"}]}),i.ActionRegistration.registerActionExtension({actionId:"network.hide-request-details",category:"NETWORK",title:G(j.hideRequestDetails),contextTypes:()=>$((e=>[e.NetworkPanel.NetworkPanel])),loadActionDelegate:async()=>new((await Y()).NetworkPanel.ActionDelegate),bindings:[{shortcut:"Esc"}]}),i.ActionRegistration.registerActionExtension({actionId:"network.search",category:"NETWORK",title:G(j.search),contextTypes:()=>$((e=>[e.NetworkPanel.NetworkPanel])),loadActionDelegate:async()=>new((await Y()).NetworkPanel.ActionDelegate),bindings:[{platform:"mac",shortcut:"Meta+F",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+F",keybindSets:["devToolsDefault","vsCode"]}]}),i.ActionRegistration.registerActionExtension({actionId:"network.add-network-request-blocking-pattern",category:"NETWORK",title:G(j.addNetworkRequestBlockingPattern),iconClass:"plus",contextTypes:()=>$((e=>[e.BlockedURLsPane.BlockedURLsPane])),loadActionDelegate:async()=>new((await Y()).BlockedURLsPane.ActionDelegate)}),i.ActionRegistration.registerActionExtension({actionId:"network.remove-all-network-request-blocking-patterns",category:"NETWORK",title:G(j.removeAllNetworkRequestBlockingPatterns),iconClass:"clear",contextTypes:()=>$((e=>[e.BlockedURLsPane.BlockedURLsPane])),loadActionDelegate:async()=>new((await Y()).BlockedURLsPane.ActionDelegate)}),e.Settings.registerSettingExtension({category:"NETWORK",storageType:"Synced",title:G(j.allowToGenerateHarWithSensitiveData),settingName:"network.show-options-to-generate-har-with-sensitive-data",settingType:"boolean",defaultValue:!1,tags:[t.i18n.lockedLazyString("HAR")],options:[{value:!0,title:G(j.allowToGenerateHarWithSensitiveData)},{value:!1,title:G(j.dontAllowToGenerateHarWithSensitiveData)}],learnMore:{url:"https://goo.gle/devtools-export-hars",tooltip:G(j.allowToGenerateHarWithSensitiveDataDocumentation)}}),e.Settings.registerSettingExtension({category:"NETWORK",storageType:"Synced",title:G(j.colorcodeResourceTypes),settingName:"network-color-code-resource-types",settingType:"boolean",defaultValue:!1,tags:[G(j.colorCode),G(j.resourceType)],options:[{value:!0,title:G(j.colorCodeByResourceType)},{value:!1,title:G(j.useDefaultColors)}]}),e.Settings.registerSettingExtension({category:"NETWORK",storageType:"Synced",title:G(j.groupNetworkLogByFrame),settingName:"network.group-by-frame",settingType:"boolean",defaultValue:!1,tags:[G(j.netWork),G(j.frame),G(j.group)],options:[{value:!0,title:G(j.groupNetworkLogItemsByFrame)},{value:!1,title:G(j.dontGroupNetworkLogItemsByFrame)}]}),i.ViewManager.registerLocationResolver({name:"network-sidebar",category:"NETWORK",loadResolver:async()=>(await Y()).NetworkPanel.NetworkPanel.instance()}),i.ContextMenu.registerProvider({contextTypes:()=>[n.NetworkRequest.NetworkRequest,n.Resource.Resource,s.UISourceCode.UISourceCode,n.TraceObject.RevealableNetworkRequest],loadProvider:async()=>(await Y()).NetworkPanel.NetworkPanel.instance(),experiment:void 0}),e.Revealer.registerRevealer({contextTypes:()=>[n.NetworkRequest.NetworkRequest],destination:e.Revealer.RevealerDestination.NETWORK_PANEL,loadRevealer:async()=>new((await Y()).NetworkPanel.RequestRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[l.UIRequestLocation.UIRequestLocation],destination:void 0,loadRevealer:async()=>new((await Y()).NetworkPanel.RequestLocationRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[l.NetworkRequestId.NetworkRequestId],destination:e.Revealer.RevealerDestination.NETWORK_PANEL,loadRevealer:async()=>new((await Y()).NetworkPanel.RequestIdRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[l.UIFilter.UIRequestFilter,r.ExtensionServer.RevealableNetworkRequestFilter],destination:e.Revealer.RevealerDestination.NETWORK_PANEL,loadRevealer:async()=>new((await Y()).NetworkPanel.NetworkLogWithFilterRevealer)});const J={title:"Components โš›",command:"Show React DevTools Components panel"},X=t.i18n.registerUIStrings("panels/react_devtools/react_devtools_components-meta.ts",J),Z=t.i18n.getLazilyComputedLocalizedString.bind(void 0,X);let ee;i.ViewManager.registerViewExtension({location:"panel",id:"react-devtools-components",title:Z(J.title),commandPrompt:Z(J.command),persistence:"permanent",order:1e3,loadView:async()=>new((await async function(){return ee||(ee=await import("../../panels/react_devtools/react_devtools.js")),ee}()).ReactDevToolsComponentsView.ReactDevToolsComponentsViewImpl)});const te={title:"Profiler โš›",command:"Show React DevTools Profiler panel"},oe=t.i18n.registerUIStrings("panels/react_devtools/react_devtools_profiler-meta.ts",te),ie=t.i18n.getLazilyComputedLocalizedString.bind(void 0,oe);let ne;i.ViewManager.registerViewExtension({location:"panel",id:"react-devtools-profiler",title:ie(te.title),commandPrompt:ie(te.command),persistence:"permanent",order:1e3,loadView:async()=>new((await async function(){return ne||(ne=await import("../../panels/react_devtools/react_devtools.js")),ne}()).ReactDevToolsProfilerView.ReactDevToolsProfilerViewImpl)});const ae={rnWelcome:"Welcome",showRnWelcome:"Show React Native Welcome panel",debuggerBrandName:"React Native DevTools"},re=t.i18n.registerUIStrings("panels/rn_welcome/rn_welcome-meta.ts",ae),se=t.i18n.getLazilyComputedLocalizedString.bind(void 0,re);let le;i.ViewManager.registerViewExtension({location:"panel",id:"rn-welcome",title:se(ae.rnWelcome),commandPrompt:se(ae.showRnWelcome),order:-10,persistence:"permanent",loadView:async()=>(await async function(){return le||(le=await import("../../panels/rn_welcome/rn_welcome.js")),le}()).RNWelcome.RNWelcomeImpl.instance({debuggerBrandName:se(ae.debuggerBrandName),showDocs:!0}),experiment:"react-native-specific-ui"});const ce={performance:"Performance",showPerformance:"Show Performance",record:"Record",stop:"Stop",recordAndReload:"Record and reload",saveProfile:"Save profileโ€ฆ",loadProfile:"Load profileโ€ฆ",previousFrame:"Previous frame",nextFrame:"Next frame",showRecentTimelineSessions:"Show recent timeline sessions",previousRecording:"Previous recording",nextRecording:"Next recording",hideChromeFrameInLayersView:"Hide `chrome` frame in Layers view"},de=t.i18n.registerUIStrings("panels/timeline/timeline-meta.ts",ce),ge=t.i18n.getLazilyComputedLocalizedString.bind(void 0,de);let me;async function ue(){return me||(me=await import("../../panels/timeline/timeline.js")),me}function pe(e){return void 0===me?[]:e(me)}i.ViewManager.registerViewExtension({location:"panel",id:"timeline",title:ge(ce.performance),commandPrompt:ge(ce.showPerformance),order:50,loadView:async()=>(await ue()).TimelinePanel.TimelinePanel.instance()}),i.ActionRegistration.registerActionExtension({actionId:"timeline.toggle-recording",category:"PERFORMANCE",iconClass:"record-start",toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,contextTypes:()=>pe((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await ue()).TimelinePanel.ActionDelegate),options:[{value:!0,title:ge(ce.record)},{value:!1,title:ge(ce.stop)}],bindings:[{platform:"windows,linux",shortcut:"Ctrl+E"},{platform:"mac",shortcut:"Meta+E"}]}),i.ActionRegistration.registerActionExtension({actionId:"timeline.record-reload",iconClass:"refresh",contextTypes:()=>pe((e=>[e.TimelinePanel.TimelinePanel])),category:"PERFORMANCE",title:ge(ce.recordAndReload),loadActionDelegate:async()=>new((await ue()).TimelinePanel.ActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+E"},{platform:"mac",shortcut:"Meta+Shift+E"}],experiment:"!react-native-specific-ui"}),i.ActionRegistration.registerActionExtension({category:"PERFORMANCE",actionId:"timeline.save-to-file",contextTypes:()=>pe((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await ue()).TimelinePanel.ActionDelegate),title:ge(ce.saveProfile),bindings:[{platform:"windows,linux",shortcut:"Ctrl+S"},{platform:"mac",shortcut:"Meta+S"}]}),i.ActionRegistration.registerActionExtension({category:"PERFORMANCE",actionId:"timeline.load-from-file",contextTypes:()=>pe((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await ue()).TimelinePanel.ActionDelegate),title:ge(ce.loadProfile),bindings:[{platform:"windows,linux",shortcut:"Ctrl+O"},{platform:"mac",shortcut:"Meta+O"}]}),i.ActionRegistration.registerActionExtension({actionId:"timeline.jump-to-previous-frame",category:"PERFORMANCE",title:ge(ce.previousFrame),contextTypes:()=>pe((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await ue()).TimelinePanel.ActionDelegate),bindings:[{shortcut:"["}]}),i.ActionRegistration.registerActionExtension({actionId:"timeline.jump-to-next-frame",category:"PERFORMANCE",title:ge(ce.nextFrame),contextTypes:()=>pe((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await ue()).TimelinePanel.ActionDelegate),bindings:[{shortcut:"]"}]}),i.ActionRegistration.registerActionExtension({actionId:"timeline.show-history",loadActionDelegate:async()=>new((await ue()).TimelinePanel.ActionDelegate),category:"PERFORMANCE",title:ge(ce.showRecentTimelineSessions),contextTypes:()=>pe((e=>[e.TimelinePanel.TimelinePanel])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+H"},{platform:"mac",shortcut:"Meta+Y"}]}),i.ActionRegistration.registerActionExtension({actionId:"timeline.previous-recording",category:"PERFORMANCE",loadActionDelegate:async()=>new((await ue()).TimelinePanel.ActionDelegate),title:ge(ce.previousRecording),contextTypes:()=>pe((e=>[e.TimelinePanel.TimelinePanel])),bindings:[{platform:"windows,linux",shortcut:"Alt+Left"},{platform:"mac",shortcut:"Meta+Left"}]}),i.ActionRegistration.registerActionExtension({actionId:"timeline.next-recording",category:"PERFORMANCE",loadActionDelegate:async()=>new((await ue()).TimelinePanel.ActionDelegate),title:ge(ce.nextRecording),contextTypes:()=>pe((e=>[e.TimelinePanel.TimelinePanel])),bindings:[{platform:"windows,linux",shortcut:"Alt+Right"},{platform:"mac",shortcut:"Meta+Right"}]}),e.Settings.registerSettingExtension({category:"PERFORMANCE",storageType:"Synced",title:ge(ce.hideChromeFrameInLayersView),settingName:"frame-viewer-hide-chrome-window",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({category:"PERFORMANCE",storageType:"Synced",settingName:"annotations-hidden",settingType:"boolean",defaultValue:!1}),e.Linkifier.registerLinkifier({contextTypes:()=>pe((e=>[e.CLSLinkifier.CLSRect])),loadLinkifier:async()=>(await ue()).CLSLinkifier.Linkifier.instance()}),i.ContextMenu.registerItem({location:"timelineMenu/open",actionId:"timeline.load-from-file",order:10}),i.ContextMenu.registerItem({location:"timelineMenu/open",actionId:"timeline.save-to-file",order:15}),e.Revealer.registerRevealer({contextTypes:()=>[n.TraceObject.TraceObject],destination:e.Revealer.RevealerDestination.TIMELINE_PANEL,loadRevealer:async()=>new((await ue()).TimelinePanel.TraceRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[n.TraceObject.RevealableEvent],destination:e.Revealer.RevealerDestination.TIMELINE_PANEL,loadRevealer:async()=>new((await ue()).TimelinePanel.EventRevealer)});class we{static#e;#t;#o;#i;constructor(){}static instance(){return this.#e||(this.#e=new we),this.#e}setAppInfo(e,t){this.#t=e,this.#o=t,this.#n()}setSuffix(e){this.#i=e,this.#n()}#n(){const e=[];this.#t&&e.push(this.#t),this.#o&&e.push(`(${this.#o})`),this.#i&&e.push(this.#i),navigator.userAgent.includes("Electron")&&navigator.userAgent.includes("Macintosh")||e.push("- React Native DevTools"),document.title=e.join(" ")}}const{html:ve,render:he}=m,ye={networkInspectionUnavailable:"Network inspection is unavailable",performanceProfilingUnavailable:"Performance profiling is unavailable",multiHostFeatureUnavailableTitle:"Feature is unavailable",reloadRequiredForTimelineFramesMessage:"Frame timings and screenshots are now available in the Performance panel. Please reload to enable.",multiHostFeatureDisabledDetail:"This feature is disabled as the app or framework has registered multiple React Native hosts, which is not currently supported."},Re=t.i18n.registerUIStrings("entrypoints/rn_fusebox/FuseboxFeatureObserver.ts",ye),fe=t.i18n.getLocalizedString.bind(void 0,Re),be=new Set(["network","timeline"]);const ke={connectionStatusDisconnectedTooltip:"Debugging connection was closed",connectionStatusDisconnectedLabel:"Reconnect DevTools"},Se=t.i18n.registerUIStrings("entrypoints/rn_fusebox/FuseboxReconnectDeviceButton.ts",ke),Te=t.i18n.getLazilyComputedLocalizedString.bind(void 0,Se);let Ee;class Ae extends n.TargetManager.Observer{#a=new i.Toolbar.ToolbarButton("");constructor(){super(),this.#a.setVisible(!1),this.#a.setGlyph("refresh"),this.#a.addEventListener("Click",this.#r.bind(this)),n.TargetManager.TargetManager.instance().observeTargets(this,{scoped:!0})}static instance(){return Ee||(Ee=new Ae),Ee}targetAdded(e){this.#s(e)}targetRemoved(e){this.#s(e)}#s(e){const t=n.TargetManager.TargetManager.instance().rootTarget();this.#a.setTitle(Te(ke.connectionStatusDisconnectedTooltip)()),this.#a.setText(Te(ke.connectionStatusDisconnectedLabel)()),this.#a.setVisible(!t),t||this.#l(e)}#l(t){e.Settings.Settings.instance().moduleSetting("preserve-console-log").get()||t.model(n.ConsoleModel.ConsoleModel)?.addMessage(new n.ConsoleModel.ConsoleMessage(t.model(n.RuntimeModel.RuntimeModel),"recommendation","info","[React Native] Console messages are currently cleared upon DevTools disconnection. You can preserve logs in settings: ",{type:n.ConsoleModel.FrontendMessageType.System,context:"fusebox_preserve_log_rec"}))}#r(){window.location.reload()}item(){return this.#a}}c.rnPerfMetrics.registerPerfMetricsGlobalPostMessageHandler(),c.rnPerfMetrics.registerGlobalErrorReporting(),c.rnPerfMetrics.setLaunchId(o.Runtime.Runtime.queryParam("launchId")),c.rnPerfMetrics.setAppId(o.Runtime.Runtime.queryParam("appId")),c.rnPerfMetrics.setTelemetryInfo(JSON.parse(o.Runtime.Runtime.queryParam("telemetryInfo")||"{}")),c.rnPerfMetrics.entryPointLoadingStarted("rn_fusebox");const Ne={networkTitle:"React Native",showReactNative:"Show React Native",sendFeedback:"[FB-only] Send feedback"},Pe=t.i18n.registerUIStrings("entrypoints/rn_fusebox/rn_fusebox.ts",Ne),xe=t.i18n.getLazilyComputedLocalizedString.bind(void 0,Pe);let Ie;if(i.ViewManager.maybeRemoveViewExtension("network.blocked-urls"),i.ViewManager.maybeRemoveViewExtension("network.config"),i.ViewManager.maybeRemoveViewExtension("coverage"),i.ViewManager.maybeRemoveViewExtension("linear-memory-inspector"),i.ViewManager.maybeRemoveViewExtension("rendering"),i.ViewManager.maybeRemoveViewExtension("issues-pane"),i.ViewManager.maybeRemoveViewExtension("sensors"),i.ViewManager.maybeRemoveViewExtension("devices"),i.ViewManager.maybeRemoveViewExtension("emulation-locations"),i.ViewManager.maybeRemoveViewExtension("throttling-conditions"),d.RNExperimentsImpl.setIsReactNativeEntryPoint(!0),d.RNExperimentsImpl.Instance.enableExperimentsByDefault(["js-heap-profiler-enable","react-native-specific-ui"]),document.addEventListener("visibilitychange",(()=>{c.rnPerfMetrics.browserVisibilityChanged(document.visibilityState)})),n.SDKModel.SDKModel.register(n.ReactNativeApplicationModel.ReactNativeApplicationModel,{capabilities:0,autostart:!0,early:!0}),i.ViewManager.registerViewExtension({location:"navigator-view",id:"navigator-network",title:xe(Ne.networkTitle),commandPrompt:xe(Ne.showReactNative),order:2,persistence:"permanent",loadView:async()=>(await async function(){return Ie||(Ie=await import("../../panels/sources/sources.js")),Ie}()).SourcesNavigator.NetworkNavigatorView.instance()}),self.runtime=o.Runtime.Runtime.instance({forceNew:!0}),new g.MainImpl.MainImpl,globalThis.FB_ONLY__reactNativeFeedbackLink){const e=globalThis.FB_ONLY__reactNativeFeedbackLink,t="react-native-send-feedback",o={handleAction:(o,i)=>i===t&&(c.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(e),!0)};i.ActionRegistration.registerActionExtension({category:"GLOBAL",actionId:t,title:xe(Ne.sendFeedback),loadActionDelegate:async()=>o,iconClass:"bug"}),i.Toolbar.registerToolbarItem({location:"main-toolbar-right",actionId:t,label:xe(Ne.sendFeedback)})}i.Toolbar.registerToolbarItem({location:"main-toolbar-right",loadItem:async()=>Ae.instance()}),new class{constructor(e){e.observeModels(n.ReactNativeApplicationModel.ReactNativeApplicationModel,this)}modelAdded(e){e.ensureEnabled(),e.addEventListener("MetadataUpdated",this.#c,this)}modelRemoved(e){e.removeEventListener("MetadataUpdated",this.#c,this)}#c(e){const{appDisplayName:t,deviceName:o}=e.data;we.instance().setAppInfo(t,o)}}(n.TargetManager.TargetManager.instance()),new class{#d=!1;constructor(e){e.observeModels(n.ReactNativeApplicationModel.ReactNativeApplicationModel,this)}modelAdded(e){e.ensureEnabled(),e.addEventListener("MetadataUpdated",this.#c,this),e.addEventListener("SystemStateChanged",this.#g,this)}modelRemoved(e){e.removeEventListener("MetadataUpdated",this.#c,this),e.removeEventListener("SystemStateChanged",this.#g,this)}#c(e){const{unstable_isProfilingBuild:t,unstable_networkInspectionEnabled:i,unstable_frameRecordingEnabled:n}=e.data;t&&(we.instance().setSuffix("[PROFILING]"),this.#m()),i||o.Runtime.conditions.reactNativeExpoNetworkPanel()||this.#u(),n&&this.#p()}#g(e){const{isSingleHost:t}=e.data;t||this.#w()}#m(){i.InspectorView.InspectorView.instance().closeDrawer();const e=i.ViewManager.ViewManager.instance(),t=e.resolveLocation("panel"),o=e.resolveLocation("drawer-view");Promise.all([t,o]).then((([e,t])=>{i.ViewManager.getRegisteredViewExtensions().forEach((o=>{if("drawer-view"===o.location())t?.removeView(o);else switch(o.viewId()){case"console":case"heap-profiler":case"live-heap-profile":case"sources":case"network":case"react-devtools-components":case"react-devtools-profiler":e?.removeView(o)}}))}))}#u(){const e=i.ViewManager.ViewManager.instance();e.resolveLocation("panel").then((t=>{t?.removeView(e.view("network"))}))}async#p(){o.Runtime.experiments.isEnabled(o.Runtime.RNExperimentName.ENABLE_TIMELINE_FRAMES)||(o.Runtime.experiments.setEnabled(o.Runtime.RNExperimentName.ENABLE_TIMELINE_FRAMES,!0),i.InspectorView?.InspectorView?.instance()?.displayReloadRequiredWarning(fe(ye.reloadRequiredForTimelineFramesMessage)))}#w(){if(this.#d)return;const e=n.TargetManager.TargetManager.instance();for(const t of e.targets())t.networkAgent().invoke_disable();this.#v();const t=i.InspectorView.InspectorView.instance(),o=new Set,a=(e,t)=>{const o=fe("network"===t?ye.networkInspectionUnavailable:"timeline"===t?ye.performanceProfilingUnavailable:ye.multiHostFeatureUnavailableTitle);for(const t of e.element.children){const e=t;e.style.opacity="0.5",e.style.pointerEvents="none",e.setAttribute("inert",""),e.setAttribute("aria-hidden","true")}const i=document.createElement("div");he(ve` +import"../shell/shell.js";import*as e from"../../core/common/common.js";import*as t from"../../core/i18n/i18n.js";import*as i from"../../core/root/root.js";import*as o from"../../ui/legacy/legacy.js";import*as n from"../../core/sdk/sdk.js";import*as a from"../../models/issues_manager/issues_manager.js";import*as r from"../../models/extensions/extensions.js";import*as s from"../../models/workspace/workspace.js";import*as l from"../../panels/network/forward/forward.js";import*as c from"../../core/host/host.js";import*as d from"../../core/rn_experiments/rn_experiments.js";import*as g from"../main/main.js";import*as m from"../../ui/lit/lit.js";import*as u from"../../ui/visual_logging/visual_logging.js";const p={toggleDeviceToolbar:"Toggle device toolbar",captureScreenshot:"Capture screenshot",captureFullSizeScreenshot:"Capture full size screenshot",captureNodeScreenshot:"Capture node screenshot",showMediaQueries:"Show media queries",device:"device",hideMediaQueries:"Hide media queries",showRulers:"Show rulers in the Device Mode toolbar",hideRulers:"Hide rulers in the Device Mode toolbar",showDeviceFrame:"Show device frame",hideDeviceFrame:"Hide device frame"},w=t.i18n.registerUIStrings("panels/emulation/emulation-meta.ts",p),v=t.i18n.getLazilyComputedLocalizedString.bind(void 0,w);let h;async function y(){return h||(h=await import("../../panels/emulation/emulation.js")),h}o.ActionRegistration.registerActionExtension({category:"MOBILE",experiment:"!react-native-specific-ui",actionId:"emulation.toggle-device-mode",toggleable:!0,loadActionDelegate:async()=>new((await y()).DeviceModeWrapper.ActionDelegate),condition:i.Runtime.conditions.canDock,title:v(p.toggleDeviceToolbar),iconClass:"devices",bindings:[{platform:"windows,linux",shortcut:"Shift+Ctrl+M"},{platform:"mac",shortcut:"Shift+Meta+M"}]}),o.ActionRegistration.registerActionExtension({actionId:"emulation.capture-screenshot",category:"SCREENSHOT",loadActionDelegate:async()=>new((await y()).DeviceModeWrapper.ActionDelegate),title:v(p.captureScreenshot)}),o.ActionRegistration.registerActionExtension({actionId:"emulation.capture-full-height-screenshot",category:"SCREENSHOT",experiment:"!react-native-specific-ui",loadActionDelegate:async()=>new((await y()).DeviceModeWrapper.ActionDelegate),condition:i.Runtime.conditions.canDock,title:v(p.captureFullSizeScreenshot)}),o.ActionRegistration.registerActionExtension({actionId:"emulation.capture-node-screenshot",category:"SCREENSHOT",experiment:"!react-native-specific-ui",loadActionDelegate:async()=>new((await y()).DeviceModeWrapper.ActionDelegate),condition:i.Runtime.conditions.canDock,title:v(p.captureNodeScreenshot)}),e.Settings.registerSettingExtension({category:"MOBILE",experiment:"!react-native-specific-ui",settingName:"show-media-query-inspector",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:v(p.showMediaQueries)},{value:!1,title:v(p.hideMediaQueries)}],tags:[v(p.device)]}),e.Settings.registerSettingExtension({category:"MOBILE",experiment:"!react-native-specific-ui",settingName:"emulation.show-rulers",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:v(p.showRulers)},{value:!1,title:v(p.hideRulers)}],tags:[v(p.device)]}),e.Settings.registerSettingExtension({category:"MOBILE",experiment:"!react-native-specific-ui",settingName:"emulation.show-device-outline",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:v(p.showDeviceFrame)},{value:!1,title:v(p.hideDeviceFrame)}],tags:[v(p.device)]}),o.Toolbar.registerToolbarItem({actionId:"emulation.toggle-device-mode",condition:i.Runtime.conditions.canDock,location:"main-toolbar-left",order:1,loadItem:void 0,separator:void 0}),e.AppProvider.registerAppProvider({loadAppProvider:async()=>(await y()).AdvancedApp.AdvancedAppProvider.instance(),condition:i.Runtime.conditions.canDock,order:0}),o.ContextMenu.registerItem({location:"deviceModeMenu/save",order:12,actionId:"emulation.capture-screenshot"}),o.ContextMenu.registerItem({location:"deviceModeMenu/save",order:13,actionId:"emulation.capture-full-height-screenshot"});const R={sensors:"Sensors",geolocation:"geolocation",timezones:"timezones",locale:"locale",locales:"locales",accelerometer:"accelerometer",deviceOrientation:"device orientation",locations:"Locations",touch:"Touch",devicebased:"Device-based",forceEnabled:"Force enabled",emulateIdleDetectorState:"Emulate Idle Detector state",noIdleEmulation:"No idle emulation",userActiveScreenUnlocked:"User active, screen unlocked",userActiveScreenLocked:"User active, screen locked",userIdleScreenUnlocked:"User idle, screen unlocked",userIdleScreenLocked:"User idle, screen locked",showSensors:"Show Sensors",showLocations:"Show Locations",cpuPressure:"CPU Pressure",noPressureEmulation:"No override",nominal:"Nominal",fair:"Fair",serious:"Serious",critical:"Critical"},f=t.i18n.registerUIStrings("panels/sensors/sensors-meta.ts",R),b=t.i18n.getLazilyComputedLocalizedString.bind(void 0,f);let k;async function S(){return k||(k=await import("../../panels/sensors/sensors.js")),k}o.ViewManager.registerViewExtension({location:"drawer-view",commandPrompt:b(R.showSensors),title:b(R.sensors),id:"sensors",persistence:"closeable",order:100,loadView:async()=>new((await S()).SensorsView.SensorsView),tags:[b(R.geolocation),b(R.timezones),b(R.locale),b(R.locales),b(R.accelerometer),b(R.deviceOrientation)]}),o.ViewManager.registerViewExtension({location:"settings-view",id:"emulation-locations",commandPrompt:b(R.showLocations),title:b(R.locations),order:40,loadView:async()=>new((await S()).LocationsSettingsTab.LocationsSettingsTab),settings:["emulation.locations"],iconName:"location-on"}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"emulation.locations",settingType:"array",defaultValue:[{title:"Berlin",lat:52.520007,long:13.404954,timezoneId:"Europe/Berlin",locale:"de-DE"},{title:"London",lat:51.507351,long:-.127758,timezoneId:"Europe/London",locale:"en-GB"},{title:"Moscow",lat:55.755826,long:37.6173,timezoneId:"Europe/Moscow",locale:"ru-RU"},{title:"Mountain View",lat:37.386052,long:-122.083851,timezoneId:"America/Los_Angeles",locale:"en-US"},{title:"Mumbai",lat:19.075984,long:72.877656,timezoneId:"Asia/Kolkata",locale:"mr-IN"},{title:"San Francisco",lat:37.774929,long:-122.419416,timezoneId:"America/Los_Angeles",locale:"en-US"},{title:"Shanghai",lat:31.230416,long:121.473701,timezoneId:"Asia/Shanghai",locale:"zh-Hans-CN"},{title:"Sรฃo Paulo",lat:-23.55052,long:-46.633309,timezoneId:"America/Sao_Paulo",locale:"pt-BR"},{title:"Tokyo",lat:35.689487,long:139.691706,timezoneId:"Asia/Tokyo",locale:"ja-JP"}]}),e.Settings.registerSettingExtension({title:b(R.cpuPressure),reloadRequired:!0,settingName:"emulation.cpu-pressure",settingType:"enum",defaultValue:"none",options:[{value:"none",title:b(R.noPressureEmulation),text:b(R.noPressureEmulation)},{value:"nominal",title:b(R.nominal),text:b(R.nominal)},{value:"fair",title:b(R.fair),text:b(R.fair)},{value:"serious",title:b(R.serious),text:b(R.serious)},{value:"critical",title:b(R.critical),text:b(R.critical)}]}),e.Settings.registerSettingExtension({title:b(R.touch),reloadRequired:!0,settingName:"emulation.touch",settingType:"enum",defaultValue:"none",options:[{value:"none",title:b(R.devicebased),text:b(R.devicebased)},{value:"force",title:b(R.forceEnabled),text:b(R.forceEnabled)}]}),e.Settings.registerSettingExtension({title:b(R.emulateIdleDetectorState),settingName:"emulation.idle-detection",settingType:"enum",defaultValue:"none",options:[{value:"none",title:b(R.noIdleEmulation),text:b(R.noIdleEmulation)},{value:'{"isUserActive":true,"isScreenUnlocked":true}',title:b(R.userActiveScreenUnlocked),text:b(R.userActiveScreenUnlocked)},{value:'{"isUserActive":true,"isScreenUnlocked":false}',title:b(R.userActiveScreenLocked),text:b(R.userActiveScreenLocked)},{value:'{"isUserActive":false,"isScreenUnlocked":true}',title:b(R.userIdleScreenUnlocked),text:b(R.userIdleScreenUnlocked)},{value:'{"isUserActive":false,"isScreenUnlocked":false}',title:b(R.userIdleScreenLocked),text:b(R.userIdleScreenLocked)}]});const T={developerResources:"Developer resources",showDeveloperResources:"Show Developer resources"},E=t.i18n.registerUIStrings("panels/developer_resources/developer_resources-meta.ts",T),A=t.i18n.getLazilyComputedLocalizedString.bind(void 0,E);let N;async function x(){return N||(N=await import("../../panels/developer_resources/developer_resources.js")),N}o.ViewManager.registerViewExtension({location:"drawer-view",id:"developer-resources",title:A(T.developerResources),commandPrompt:A(T.showDeveloperResources),order:100,persistence:"closeable",loadView:async()=>new((await x()).DeveloperResourcesView.DeveloperResourcesView)}),e.Revealer.registerRevealer({contextTypes:()=>[n.PageResourceLoader.ResourceKey],destination:e.Revealer.RevealerDestination.DEVELOPER_RESOURCES_PANEL,loadRevealer:async()=>new((await x()).DeveloperResourcesView.DeveloperResourcesRevealer)});const P={rendering:"Rendering",showRendering:"Show Rendering",paint:"paint",layout:"layout",fps:"fps",cssMediaType:"CSS media type",cssMediaFeature:"CSS media feature",visionDeficiency:"vision deficiency",colorVisionDeficiency:"color vision deficiency",reloadPage:"Reload page",hardReloadPage:"Hard reload page",forceAdBlocking:"Force ad blocking on this site",blockAds:"Block ads on this site",showAds:"Show ads on this site, if allowed",autoOpenDevTools:"Auto-open DevTools for popups",doNotAutoOpen:"Do not auto-open DevTools for popups",disablePaused:"Disable paused state overlay",toggleCssPrefersColorSchemeMedia:"Toggle CSS media feature prefers-color-scheme"},I=t.i18n.registerUIStrings("entrypoints/inspector_main/inspector_main-meta.ts",P),M=t.i18n.getLazilyComputedLocalizedString.bind(void 0,I);let D;async function L(){return D||(D=await import("../inspector_main/inspector_main.js")),D}o.ViewManager.registerViewExtension({location:"drawer-view",id:"rendering",title:M(P.rendering),commandPrompt:M(P.showRendering),persistence:"closeable",experiment:"!react-native-specific-ui",order:50,loadView:async()=>new((await L()).RenderingOptions.RenderingOptionsView),tags:[M(P.paint),M(P.layout),M(P.fps),M(P.cssMediaType),M(P.cssMediaFeature),M(P.visionDeficiency),M(P.colorVisionDeficiency)]}),o.ActionRegistration.registerActionExtension({category:"NAVIGATION",actionId:"inspector-main.reload",loadActionDelegate:async()=>new((await L()).InspectorMain.ReloadActionDelegate),iconClass:"refresh",title:M(P.reloadPage),bindings:[{platform:"windows,linux",shortcut:"Ctrl+R"},{platform:"windows,linux",shortcut:"F5"},{platform:"mac",shortcut:"Meta+R"}]}),o.ActionRegistration.registerActionExtension({category:"NAVIGATION",actionId:"inspector-main.hard-reload",loadActionDelegate:async()=>new((await L()).InspectorMain.ReloadActionDelegate),title:M(P.hardReloadPage),bindings:[{platform:"windows,linux",shortcut:"Shift+Ctrl+R"},{platform:"windows,linux",shortcut:"Shift+F5"},{platform:"windows,linux",shortcut:"Ctrl+F5"},{platform:"windows,linux",shortcut:"Ctrl+Shift+F5"},{platform:"mac",shortcut:"Shift+Meta+R"}]}),o.ActionRegistration.registerActionExtension({actionId:"rendering.toggle-prefers-color-scheme",category:"RENDERING",experiment:"!react-native-specific-ui",title:M(P.toggleCssPrefersColorSchemeMedia),loadActionDelegate:async()=>new((await L()).RenderingOptions.ReloadActionDelegate)}),e.Settings.registerSettingExtension({category:"",title:M(P.forceAdBlocking),settingName:"network.ad-blocking-enabled",settingType:"boolean",storageType:"Session",defaultValue:!1,options:[{value:!0,title:M(P.blockAds)},{value:!1,title:M(P.showAds)}]}),e.Settings.registerSettingExtension({category:"GLOBAL",storageType:"Synced",title:M(P.autoOpenDevTools),settingName:"auto-attach-to-created-pages",settingType:"boolean",order:2,defaultValue:!1,options:[{value:!0,title:M(P.autoOpenDevTools)},{value:!1,title:M(P.doNotAutoOpen)}]}),e.Settings.registerSettingExtension({category:"APPEARANCE",storageType:"Synced",title:M(P.disablePaused),settingName:"disable-paused-state-overlay",settingType:"boolean",defaultValue:!1}),o.Toolbar.registerToolbarItem({loadItem:async()=>(await L()).InspectorMain.NodeIndicator.instance(),order:2,location:"main-toolbar-left"}),o.Toolbar.registerToolbarItem({loadItem:async()=>(await L()).OutermostTargetSelector.OutermostTargetSelector.instance(),order:98,location:"main-toolbar-right"});const V={issues:"Issues",showIssues:"Show Issues"},C=t.i18n.registerUIStrings("panels/issues/issues-meta.ts",V),F=t.i18n.getLazilyComputedLocalizedString.bind(void 0,C);let U;async function O(){return U||(U=await import("../../panels/issues/issues.js")),U}o.ViewManager.registerViewExtension({location:"drawer-view",id:"issues-pane",title:F(V.issues),commandPrompt:F(V.showIssues),order:100,persistence:"closeable",loadView:async()=>new((await O()).IssuesPane.IssuesPane)}),e.Revealer.registerRevealer({contextTypes:()=>[a.Issue.Issue],destination:e.Revealer.RevealerDestination.ISSUES_VIEW,loadRevealer:async()=>new((await O()).IssueRevealer.IssueRevealer)});const _={throttling:"Throttling",showThrottling:"Show Throttling",goOffline:"Go offline",device:"device",throttlingTag:"throttling",enableSlowGThrottling:"Enable slow `3G` throttling",enableFastGThrottling:"Enable fast `3G` throttling",goOnline:"Go online"},z=t.i18n.registerUIStrings("panels/mobile_throttling/mobile_throttling-meta.ts",_),B=t.i18n.getLazilyComputedLocalizedString.bind(void 0,z);let W;async function q(){return W||(W=await import("../../panels/mobile_throttling/mobile_throttling.js")),W}o.ViewManager.registerViewExtension({location:"settings-view",id:"throttling-conditions",title:B(_.throttling),commandPrompt:B(_.showThrottling),order:35,loadView:async()=>new((await q()).ThrottlingSettingsTab.ThrottlingSettingsTab),settings:["custom-network-conditions","calibrated-cpu-throttling"],iconName:"performance"}),o.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-offline",category:"NETWORK",experiment:"!react-native-specific-ui",title:B(_.goOffline),loadActionDelegate:async()=>new((await q()).ThrottlingManager.ActionDelegate),tags:[B(_.device),B(_.throttlingTag)]}),o.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-low-end-mobile",category:"NETWORK",experiment:"!react-native-specific-ui",title:B(_.enableSlowGThrottling),loadActionDelegate:async()=>new((await q()).ThrottlingManager.ActionDelegate),tags:[B(_.device),B(_.throttlingTag)]}),o.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-mid-tier-mobile",category:"NETWORK",experiment:"!react-native-specific-ui",title:B(_.enableFastGThrottling),loadActionDelegate:async()=>new((await q()).ThrottlingManager.ActionDelegate),tags:[B(_.device),B(_.throttlingTag)]}),o.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-online",category:"NETWORK",experiment:"!react-native-specific-ui",title:B(_.goOnline),loadActionDelegate:async()=>new((await q()).ThrottlingManager.ActionDelegate),tags:[B(_.device),B(_.throttlingTag)]}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"custom-network-conditions",settingType:"array",defaultValue:[]});const j={showNetwork:"Show Network",network:"Network",networkExpoUnstable:"Expo Network",showNetworkRequestBlocking:"Show Network request blocking",networkRequestBlocking:"Network request blocking",showNetworkConditions:"Show Network conditions",networkConditions:"Network conditions",diskCache:"disk cache",networkThrottling:"network throttling",showSearch:"Show Search",search:"Search",recordNetworkLog:"Record network log",stopRecordingNetworkLog:"Stop recording network log",hideRequestDetails:"Hide request details",colorcodeResourceTypes:"Color-code resource types",colorCode:"color code",resourceType:"resource type",colorCodeByResourceType:"Color code by resource type",useDefaultColors:"Use default colors",groupNetworkLogByFrame:"Group network log by frame",netWork:"network",frame:"frame",group:"group",groupNetworkLogItemsByFrame:"Group network log items by frame",dontGroupNetworkLogItemsByFrame:"Don't group network log items by frame",clear:"Clear network log",addNetworkRequestBlockingPattern:"Add network request blocking pattern",removeAllNetworkRequestBlockingPatterns:"Remove all network request blocking patterns",allowToGenerateHarWithSensitiveData:"Allow to generate `HAR` with sensitive data",dontAllowToGenerateHarWithSensitiveData:"Don't allow to generate `HAR` with sensitive data",allowToGenerateHarWithSensitiveDataDocumentation:"By default generated HAR logs are sanitized and don't include `Cookie`, `Set-Cookie`, or `Authorization` HTTP headers. When this setting is enabled, options to export/copy HAR with sensitive data are provided."},H=t.i18n.registerUIStrings("panels/network/network-meta.ts",j),G=t.i18n.getLazilyComputedLocalizedString.bind(void 0,H),K=t.i18n.getLocalizedString.bind(void 0,H);let Q;async function Y(){return Q||(Q=await import("../../panels/network/network.js")),Q}function $(e){return void 0===Q?[]:e(Q)}o.ViewManager.registerViewExtension({location:"panel",id:"network",commandPrompt:G(j.showNetwork),title:()=>i.Runtime.conditions.reactNativeExpoNetworkPanel()?K(j.networkExpoUnstable):K(j.network),order:40,loadView:async()=>(await Y()).NetworkPanel.NetworkPanel.instance()}),o.ViewManager.registerViewExtension({location:"drawer-view",id:"network.blocked-urls",commandPrompt:G(j.showNetworkRequestBlocking),title:G(j.networkRequestBlocking),persistence:"closeable",order:60,loadView:async()=>new((await Y()).BlockedURLsPane.BlockedURLsPane)}),o.ViewManager.registerViewExtension({location:"drawer-view",id:"network.config",commandPrompt:G(j.showNetworkConditions),title:G(j.networkConditions),persistence:"closeable",order:40,tags:[G(j.diskCache),G(j.networkThrottling),t.i18n.lockedLazyString("useragent"),t.i18n.lockedLazyString("user agent"),t.i18n.lockedLazyString("user-agent")],loadView:async()=>(await Y()).NetworkConfigView.NetworkConfigView.instance()}),o.ViewManager.registerViewExtension({location:"network-sidebar",id:"network.search-network-tab",commandPrompt:G(j.showSearch),title:G(j.search),persistence:"permanent",loadView:async()=>(await Y()).NetworkPanel.SearchNetworkView.instance()}),o.ActionRegistration.registerActionExtension({actionId:"network.toggle-recording",category:"NETWORK",iconClass:"record-start",toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,contextTypes:()=>$((e=>[e.NetworkPanel.NetworkPanel])),loadActionDelegate:async()=>new((await Y()).NetworkPanel.ActionDelegate),options:[{value:!0,title:G(j.recordNetworkLog)},{value:!1,title:G(j.stopRecordingNetworkLog)}],bindings:[{shortcut:"Ctrl+E",platform:"windows,linux"},{shortcut:"Meta+E",platform:"mac"}]}),o.ActionRegistration.registerActionExtension({actionId:"network.clear",category:"NETWORK",title:G(j.clear),iconClass:"clear",loadActionDelegate:async()=>new((await Y()).NetworkPanel.ActionDelegate),contextTypes:()=>$((e=>[e.NetworkPanel.NetworkPanel])),bindings:[{shortcut:"Ctrl+L"},{shortcut:"Meta+K",platform:"mac"}]}),o.ActionRegistration.registerActionExtension({actionId:"network.hide-request-details",category:"NETWORK",title:G(j.hideRequestDetails),contextTypes:()=>$((e=>[e.NetworkPanel.NetworkPanel])),loadActionDelegate:async()=>new((await Y()).NetworkPanel.ActionDelegate),bindings:[{shortcut:"Esc"}]}),o.ActionRegistration.registerActionExtension({actionId:"network.search",category:"NETWORK",title:G(j.search),contextTypes:()=>$((e=>[e.NetworkPanel.NetworkPanel])),loadActionDelegate:async()=>new((await Y()).NetworkPanel.ActionDelegate),bindings:[{platform:"mac",shortcut:"Meta+F",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+F",keybindSets:["devToolsDefault","vsCode"]}]}),o.ActionRegistration.registerActionExtension({actionId:"network.add-network-request-blocking-pattern",category:"NETWORK",title:G(j.addNetworkRequestBlockingPattern),iconClass:"plus",contextTypes:()=>$((e=>[e.BlockedURLsPane.BlockedURLsPane])),loadActionDelegate:async()=>new((await Y()).BlockedURLsPane.ActionDelegate)}),o.ActionRegistration.registerActionExtension({actionId:"network.remove-all-network-request-blocking-patterns",category:"NETWORK",title:G(j.removeAllNetworkRequestBlockingPatterns),iconClass:"clear",contextTypes:()=>$((e=>[e.BlockedURLsPane.BlockedURLsPane])),loadActionDelegate:async()=>new((await Y()).BlockedURLsPane.ActionDelegate)}),e.Settings.registerSettingExtension({category:"NETWORK",storageType:"Synced",title:G(j.allowToGenerateHarWithSensitiveData),settingName:"network.show-options-to-generate-har-with-sensitive-data",settingType:"boolean",defaultValue:!1,tags:[t.i18n.lockedLazyString("HAR")],options:[{value:!0,title:G(j.allowToGenerateHarWithSensitiveData)},{value:!1,title:G(j.dontAllowToGenerateHarWithSensitiveData)}],learnMore:{url:"https://goo.gle/devtools-export-hars",tooltip:G(j.allowToGenerateHarWithSensitiveDataDocumentation)}}),e.Settings.registerSettingExtension({category:"NETWORK",storageType:"Synced",title:G(j.colorcodeResourceTypes),settingName:"network-color-code-resource-types",settingType:"boolean",defaultValue:!1,tags:[G(j.colorCode),G(j.resourceType)],options:[{value:!0,title:G(j.colorCodeByResourceType)},{value:!1,title:G(j.useDefaultColors)}]}),e.Settings.registerSettingExtension({category:"NETWORK",storageType:"Synced",title:G(j.groupNetworkLogByFrame),settingName:"network.group-by-frame",settingType:"boolean",defaultValue:!1,tags:[G(j.netWork),G(j.frame),G(j.group)],options:[{value:!0,title:G(j.groupNetworkLogItemsByFrame)},{value:!1,title:G(j.dontGroupNetworkLogItemsByFrame)}]}),o.ViewManager.registerLocationResolver({name:"network-sidebar",category:"NETWORK",loadResolver:async()=>(await Y()).NetworkPanel.NetworkPanel.instance()}),o.ContextMenu.registerProvider({contextTypes:()=>[n.NetworkRequest.NetworkRequest,n.Resource.Resource,s.UISourceCode.UISourceCode,n.TraceObject.RevealableNetworkRequest],loadProvider:async()=>(await Y()).NetworkPanel.NetworkPanel.instance(),experiment:void 0}),e.Revealer.registerRevealer({contextTypes:()=>[n.NetworkRequest.NetworkRequest],destination:e.Revealer.RevealerDestination.NETWORK_PANEL,loadRevealer:async()=>new((await Y()).NetworkPanel.RequestRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[l.UIRequestLocation.UIRequestLocation],destination:void 0,loadRevealer:async()=>new((await Y()).NetworkPanel.RequestLocationRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[l.NetworkRequestId.NetworkRequestId],destination:e.Revealer.RevealerDestination.NETWORK_PANEL,loadRevealer:async()=>new((await Y()).NetworkPanel.RequestIdRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[l.UIFilter.UIRequestFilter,r.ExtensionServer.RevealableNetworkRequestFilter],destination:e.Revealer.RevealerDestination.NETWORK_PANEL,loadRevealer:async()=>new((await Y()).NetworkPanel.NetworkLogWithFilterRevealer)});const J={title:"Components โš›",command:"Show React DevTools Components panel"},X=t.i18n.registerUIStrings("panels/react_devtools/react_devtools_components-meta.ts",J),Z=t.i18n.getLazilyComputedLocalizedString.bind(void 0,X);let ee;o.ViewManager.registerViewExtension({location:"panel",id:"react-devtools-components",title:Z(J.title),commandPrompt:Z(J.command),persistence:"permanent",order:1e3,loadView:async()=>new((await async function(){return ee||(ee=await import("../../panels/react_devtools/react_devtools.js")),ee}()).ReactDevToolsComponentsView.ReactDevToolsComponentsViewImpl)});const te={title:"Profiler โš›",command:"Show React DevTools Profiler panel"},ie=t.i18n.registerUIStrings("panels/react_devtools/react_devtools_profiler-meta.ts",te),oe=t.i18n.getLazilyComputedLocalizedString.bind(void 0,ie);let ne;o.ViewManager.registerViewExtension({location:"panel",id:"react-devtools-profiler",title:oe(te.title),commandPrompt:oe(te.command),persistence:"permanent",order:1e3,loadView:async()=>new((await async function(){return ne||(ne=await import("../../panels/react_devtools/react_devtools.js")),ne}()).ReactDevToolsProfilerView.ReactDevToolsProfilerViewImpl)});const ae={rnWelcome:"Welcome",showRnWelcome:"Show React Native Welcome panel",debuggerBrandName:"React Native DevTools"},re=t.i18n.registerUIStrings("panels/rn_welcome/rn_welcome-meta.ts",ae),se=t.i18n.getLazilyComputedLocalizedString.bind(void 0,re);let le;o.ViewManager.registerViewExtension({location:"panel",id:"rn-welcome",title:se(ae.rnWelcome),commandPrompt:se(ae.showRnWelcome),order:-10,persistence:"permanent",loadView:async()=>(await async function(){return le||(le=await import("../../panels/rn_welcome/rn_welcome.js")),le}()).RNWelcome.RNWelcomeImpl.instance({debuggerBrandName:se(ae.debuggerBrandName),showDocs:!0}),experiment:"react-native-specific-ui"});const ce={performance:"Performance",showPerformance:"Show Performance",record:"Record",stop:"Stop",recordAndReload:"Record and reload",saveProfile:"Save profileโ€ฆ",loadProfile:"Load profileโ€ฆ",previousFrame:"Previous frame",nextFrame:"Next frame",showRecentTimelineSessions:"Show recent timeline sessions",previousRecording:"Previous recording",nextRecording:"Next recording",hideChromeFrameInLayersView:"Hide `chrome` frame in Layers view"},de=t.i18n.registerUIStrings("panels/timeline/timeline-meta.ts",ce),ge=t.i18n.getLazilyComputedLocalizedString.bind(void 0,de);let me;async function ue(){return me||(me=await import("../../panels/timeline/timeline.js")),me}function pe(e){return void 0===me?[]:e(me)}o.ViewManager.registerViewExtension({location:"panel",id:"timeline",title:ge(ce.performance),commandPrompt:ge(ce.showPerformance),order:50,loadView:async()=>(await ue()).TimelinePanel.TimelinePanel.instance()}),o.ActionRegistration.registerActionExtension({actionId:"timeline.toggle-recording",category:"PERFORMANCE",iconClass:"record-start",toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,contextTypes:()=>pe((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await ue()).TimelinePanel.ActionDelegate),options:[{value:!0,title:ge(ce.record)},{value:!1,title:ge(ce.stop)}],bindings:[{platform:"windows,linux",shortcut:"Ctrl+E"},{platform:"mac",shortcut:"Meta+E"}]}),o.ActionRegistration.registerActionExtension({actionId:"timeline.record-reload",iconClass:"refresh",contextTypes:()=>pe((e=>[e.TimelinePanel.TimelinePanel])),category:"PERFORMANCE",title:ge(ce.recordAndReload),loadActionDelegate:async()=>new((await ue()).TimelinePanel.ActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+E"},{platform:"mac",shortcut:"Meta+Shift+E"}],experiment:"!react-native-specific-ui"}),o.ActionRegistration.registerActionExtension({category:"PERFORMANCE",actionId:"timeline.save-to-file",contextTypes:()=>pe((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await ue()).TimelinePanel.ActionDelegate),title:ge(ce.saveProfile),bindings:[{platform:"windows,linux",shortcut:"Ctrl+S"},{platform:"mac",shortcut:"Meta+S"}]}),o.ActionRegistration.registerActionExtension({category:"PERFORMANCE",actionId:"timeline.load-from-file",contextTypes:()=>pe((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await ue()).TimelinePanel.ActionDelegate),title:ge(ce.loadProfile),bindings:[{platform:"windows,linux",shortcut:"Ctrl+O"},{platform:"mac",shortcut:"Meta+O"}]}),o.ActionRegistration.registerActionExtension({actionId:"timeline.jump-to-previous-frame",category:"PERFORMANCE",title:ge(ce.previousFrame),contextTypes:()=>pe((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await ue()).TimelinePanel.ActionDelegate),bindings:[{shortcut:"["}]}),o.ActionRegistration.registerActionExtension({actionId:"timeline.jump-to-next-frame",category:"PERFORMANCE",title:ge(ce.nextFrame),contextTypes:()=>pe((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await ue()).TimelinePanel.ActionDelegate),bindings:[{shortcut:"]"}]}),o.ActionRegistration.registerActionExtension({actionId:"timeline.show-history",loadActionDelegate:async()=>new((await ue()).TimelinePanel.ActionDelegate),category:"PERFORMANCE",title:ge(ce.showRecentTimelineSessions),contextTypes:()=>pe((e=>[e.TimelinePanel.TimelinePanel])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+H"},{platform:"mac",shortcut:"Meta+Y"}]}),o.ActionRegistration.registerActionExtension({actionId:"timeline.previous-recording",category:"PERFORMANCE",loadActionDelegate:async()=>new((await ue()).TimelinePanel.ActionDelegate),title:ge(ce.previousRecording),contextTypes:()=>pe((e=>[e.TimelinePanel.TimelinePanel])),bindings:[{platform:"windows,linux",shortcut:"Alt+Left"},{platform:"mac",shortcut:"Meta+Left"}]}),o.ActionRegistration.registerActionExtension({actionId:"timeline.next-recording",category:"PERFORMANCE",loadActionDelegate:async()=>new((await ue()).TimelinePanel.ActionDelegate),title:ge(ce.nextRecording),contextTypes:()=>pe((e=>[e.TimelinePanel.TimelinePanel])),bindings:[{platform:"windows,linux",shortcut:"Alt+Right"},{platform:"mac",shortcut:"Meta+Right"}]}),e.Settings.registerSettingExtension({category:"PERFORMANCE",storageType:"Synced",title:ge(ce.hideChromeFrameInLayersView),settingName:"frame-viewer-hide-chrome-window",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({category:"PERFORMANCE",storageType:"Synced",settingName:"annotations-hidden",settingType:"boolean",defaultValue:!1}),e.Linkifier.registerLinkifier({contextTypes:()=>pe((e=>[e.CLSLinkifier.CLSRect])),loadLinkifier:async()=>(await ue()).CLSLinkifier.Linkifier.instance()}),o.ContextMenu.registerItem({location:"timelineMenu/open",actionId:"timeline.load-from-file",order:10}),o.ContextMenu.registerItem({location:"timelineMenu/open",actionId:"timeline.save-to-file",order:15}),e.Revealer.registerRevealer({contextTypes:()=>[n.TraceObject.TraceObject],destination:e.Revealer.RevealerDestination.TIMELINE_PANEL,loadRevealer:async()=>new((await ue()).TimelinePanel.TraceRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[n.TraceObject.RevealableEvent],destination:e.Revealer.RevealerDestination.TIMELINE_PANEL,loadRevealer:async()=>new((await ue()).TimelinePanel.EventRevealer)});class we{static#e;#t;#i;#o;constructor(){}static instance(){return this.#e||(this.#e=new we),this.#e}setAppInfo(e,t){this.#t=e,this.#i=t,this.#n()}setSuffix(e){this.#o=e,this.#n()}#n(){const e=[];this.#t&&e.push(this.#t),this.#i&&e.push(`(${this.#i})`),this.#o&&e.push(this.#o),navigator.userAgent.includes("Electron")&&navigator.userAgent.includes("Macintosh")||e.push("- React Native DevTools"),document.title=e.join(" ")}}const{html:ve,render:he}=m,ye={networkInspectionUnavailable:"Network inspection is unavailable",performanceProfilingUnavailable:"Performance profiling is unavailable",multiHostFeatureUnavailableTitle:"Feature is unavailable",reloadRequiredForTimelineFramesMessage:"Frame timings and screenshots are now available in the Performance panel. Please reload to enable.",multiHostFeatureDisabledDetail:"This feature is disabled as the app or framework has registered multiple React Native hosts, which is not currently supported."},Re=t.i18n.registerUIStrings("entrypoints/rn_fusebox/FuseboxFeatureObserver.ts",ye),fe=t.i18n.getLocalizedString.bind(void 0,Re),be=new Set(["network","timeline"]);const ke={connectionStatusDisconnectedTooltip:"Debugging connection was closed",connectionStatusDisconnectedLabel:"Reconnect DevTools"},Se=t.i18n.registerUIStrings("entrypoints/rn_fusebox/FuseboxReconnectDeviceButton.ts",ke),Te=t.i18n.getLazilyComputedLocalizedString.bind(void 0,Se);let Ee;class Ae extends n.TargetManager.Observer{#a=new o.Toolbar.ToolbarButton("");constructor(){super(),this.#a.setVisible(!1),this.#a.setGlyph("refresh"),this.#a.addEventListener("Click",this.#r.bind(this)),n.TargetManager.TargetManager.instance().observeTargets(this,{scoped:!0})}static instance(){return Ee||(Ee=new Ae),Ee}targetAdded(e){this.#s(e)}targetRemoved(e){this.#s(e)}#s(e){const t=n.TargetManager.TargetManager.instance().rootTarget();this.#a.setTitle(Te(ke.connectionStatusDisconnectedTooltip)()),this.#a.setText(Te(ke.connectionStatusDisconnectedLabel)()),this.#a.setVisible(!t),t||this.#l(e)}#l(t){e.Settings.Settings.instance().moduleSetting("preserve-console-log").get()||t.model(n.ConsoleModel.ConsoleModel)?.addMessage(new n.ConsoleModel.ConsoleMessage(t.model(n.RuntimeModel.RuntimeModel),"recommendation","info","[React Native] Console messages are currently cleared upon DevTools disconnection. You can preserve logs in settings: ",{type:n.ConsoleModel.FrontendMessageType.System,context:"fusebox_preserve_log_rec"}))}#r(){window.location.reload()}item(){return this.#a}}c.rnPerfMetrics.registerPerfMetricsGlobalPostMessageHandler(),c.rnPerfMetrics.registerGlobalErrorReporting(),c.rnPerfMetrics.setLaunchId(i.Runtime.Runtime.queryParam("launchId")),c.rnPerfMetrics.setAppId(i.Runtime.Runtime.queryParam("appId")),c.rnPerfMetrics.setTelemetryInfo(JSON.parse(i.Runtime.Runtime.queryParam("telemetryInfo")||"{}")),c.rnPerfMetrics.entryPointLoadingStarted("rn_fusebox");const Ne={networkTitle:"React Native",showReactNative:"Show React Native",sendFeedback:"[FB-only] Send feedback"},xe=t.i18n.registerUIStrings("entrypoints/rn_fusebox/rn_fusebox.ts",Ne),Pe=t.i18n.getLazilyComputedLocalizedString.bind(void 0,xe);let Ie;if(o.ViewManager.maybeRemoveViewExtension("network.blocked-urls"),o.ViewManager.maybeRemoveViewExtension("network.config"),o.ViewManager.maybeRemoveViewExtension("coverage"),o.ViewManager.maybeRemoveViewExtension("linear-memory-inspector"),o.ViewManager.maybeRemoveViewExtension("rendering"),o.ViewManager.maybeRemoveViewExtension("issues-pane"),o.ViewManager.maybeRemoveViewExtension("sensors"),o.ViewManager.maybeRemoveViewExtension("devices"),o.ViewManager.maybeRemoveViewExtension("emulation-locations"),o.ViewManager.maybeRemoveViewExtension("throttling-conditions"),d.RNExperimentsImpl.setIsReactNativeEntryPoint(!0),d.RNExperimentsImpl.Instance.enableExperimentsByDefault(["js-heap-profiler-enable","react-native-specific-ui"]),document.addEventListener("visibilitychange",(()=>{c.rnPerfMetrics.browserVisibilityChanged(document.visibilityState)})),n.SDKModel.SDKModel.register(n.ReactNativeApplicationModel.ReactNativeApplicationModel,{capabilities:0,autostart:!0,early:!0}),o.ViewManager.registerViewExtension({location:"navigator-view",id:"navigator-network",title:Pe(Ne.networkTitle),commandPrompt:Pe(Ne.showReactNative),order:2,persistence:"permanent",loadView:async()=>(await async function(){return Ie||(Ie=await import("../../panels/sources/sources.js")),Ie}()).SourcesNavigator.NetworkNavigatorView.instance()}),self.runtime=i.Runtime.Runtime.instance({forceNew:!0}),new g.MainImpl.MainImpl,globalThis.FB_ONLY__reactNativeFeedbackLink){const e=globalThis.FB_ONLY__reactNativeFeedbackLink,t="react-native-send-feedback",i={handleAction:(i,o)=>o===t&&(c.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(e),!0)};o.ActionRegistration.registerActionExtension({category:"GLOBAL",actionId:t,title:Pe(Ne.sendFeedback),loadActionDelegate:async()=>i,iconClass:"bug"}),o.Toolbar.registerToolbarItem({location:"main-toolbar-right",actionId:t,label:Pe(Ne.sendFeedback)})}o.Toolbar.registerToolbarItem({location:"main-toolbar-right",loadItem:async()=>Ae.instance()}),new class{constructor(e){e.observeModels(n.ReactNativeApplicationModel.ReactNativeApplicationModel,this)}modelAdded(e){e.ensureEnabled(),e.addEventListener("MetadataUpdated",this.#c,this)}modelRemoved(e){e.removeEventListener("MetadataUpdated",this.#c,this)}#c(e){const{appDisplayName:t,deviceName:i}=e.data;we.instance().setAppInfo(t,i)}}(n.TargetManager.TargetManager.instance()),new class{#d=!1;constructor(e){e.observeModels(n.ReactNativeApplicationModel.ReactNativeApplicationModel,this)}modelAdded(e){e.ensureEnabled(),e.addEventListener("MetadataUpdated",this.#c,this),e.addEventListener("SystemStateChanged",this.#g,this)}modelRemoved(e){e.removeEventListener("MetadataUpdated",this.#c,this),e.removeEventListener("SystemStateChanged",this.#g,this)}#c(e){const{unstable_isProfilingBuild:t,unstable_networkInspectionEnabled:o,unstable_frameRecordingEnabled:n}=e.data;t&&(we.instance().setSuffix("[PROFILING]"),this.#m()),o||i.Runtime.conditions.reactNativeExpoNetworkPanel()||this.#u(),n&&this.#p()}#g(e){const{isSingleHost:t}=e.data;t||this.#w()}#m(){o.InspectorView.InspectorView.instance().closeDrawer();const e=o.ViewManager.ViewManager.instance(),t=e.resolveLocation("panel"),i=e.resolveLocation("drawer-view");Promise.all([t,i]).then((([e,t])=>{o.ViewManager.getRegisteredViewExtensions().forEach((i=>{if("drawer-view"===i.location())t?.removeView(i);else switch(i.viewId()){case"console":case"heap-profiler":case"live-heap-profile":case"sources":case"network":case"react-devtools-components":case"react-devtools-profiler":e?.removeView(i)}}))}))}#u(){const e=o.ViewManager.ViewManager.instance();e.resolveLocation("panel").then((t=>{t?.removeView(e.view("network"))}))}async#p(){i.Runtime.experiments.isEnabled(i.Runtime.RNExperimentName.ENABLE_TIMELINE_FRAMES)||(i.Runtime.experiments.setEnabled(i.Runtime.RNExperimentName.ENABLE_TIMELINE_FRAMES,!0),o.InspectorView?.InspectorView?.instance()?.displayReloadRequiredWarning(fe(ye.reloadRequiredForTimelineFramesMessage)))}#w(){if(this.#d)return;const e=n.TargetManager.TargetManager.instance();for(const t of e.targets())t.networkAgent().invoke_disable();this.#v();const t=o.InspectorView.InspectorView.instance(),i=new Set,a=(e,t)=>{const i=fe("network"===t?ye.networkInspectionUnavailable:"timeline"===t?ye.performanceProfilingUnavailable:ye.multiHostFeatureUnavailableTitle);for(const t of e.element.children){const e=t;e.style.opacity="0.5",e.style.pointerEvents="none",e.setAttribute("inert",""),e.setAttribute("aria-hidden","true")}const o=document.createElement("div");he(ve`
-
${o}
+
${i}
${fe(ye.multiHostFeatureDisabledDetail)} See discussions/954.
- `,i,{host:this}),e.element.insertBefore(i,e.element.firstChild)};t.tabbedPane.addEventListener(i.TabbedPane.Events.TabSelected,(e=>{const i=e.data.tabId;be.has(i)&&!o.has(i)&&(o.add(i),t.panel(i).then((e=>{e&&a(e,i)})))}));const r=t.tabbedPane.selectedTabId;r&&be.has(r)&&(o.add(r),t.panel(r).then((e=>{e&&a(e,r)}))),this.#d=!0}async#v(){const e=i.InspectorView.InspectorView.instance();try{const t=await e.panel("network");t&&"toggleRecord"in t&&t.toggleRecord(!1)}catch{}}}(n.TargetManager.TargetManager.instance()),c.rnPerfMetrics.entryPointLoadingFinished("rn_fusebox"); + `,o,{host:this}),e.element.insertBefore(o,e.element.firstChild)};t.tabbedPane.addEventListener(o.TabbedPane.Events.TabSelected,(e=>{const o=e.data.tabId;be.has(o)&&!i.has(o)&&(i.add(o),t.panel(o).then((e=>{e&&a(e,o)})))}));const r=t.tabbedPane.selectedTabId;r&&be.has(r)&&(i.add(r),t.panel(r).then((e=>{e&&a(e,r)}))),this.#d=!0}async#v(){const e=o.InspectorView.InspectorView.instance();try{const t=await e.panel("network");t&&"toggleRecord"in t&&t.toggleRecord(!1)}catch{}}}(n.TargetManager.TargetManager.instance()),c.rnPerfMetrics.entryPointLoadingFinished("rn_fusebox"); diff --git a/packages/debugger-frontend/dist/third-party/front_end/entrypoints/shell/shell.js b/packages/debugger-frontend/dist/third-party/front_end/entrypoints/shell/shell.js index 68702b8a00fc..6a33b360c305 100644 --- a/packages/debugger-frontend/dist/third-party/front_end/entrypoints/shell/shell.js +++ b/packages/debugger-frontend/dist/third-party/front_end/entrypoints/shell/shell.js @@ -1 +1 @@ -import"../../Images/Images.js";import"../../core/dom_extension/dom_extension.js";import*as e from"../../core/common/common.js";import*as t from"../../core/host/host.js";import*as o from"../../core/i18n/i18n.js";import*as i from"../../core/root/root.js";import*as a from"../../core/sdk/sdk.js";import*as n from"../../models/breakpoints/breakpoints.js";import*as s from"../../models/workspace/workspace.js";import*as r from"../../ui/legacy/components/object_ui/object_ui.js";import*as l from"../../ui/legacy/components/quick_open/quick_open.js";import*as c from"../../ui/legacy/legacy.js";import*as g from"../../ui/components/legacy_wrapper/legacy_wrapper.js";import*as d from"../../ui/legacy/components/utils/utils.js";import*as u from"../../panels/console/console.js";import"../main/main.js";navigator.userAgent.includes("Chrome")||alert("DevTools is only supported in Chrome, Edge and other Blink-based browsers.\n\nOpen this page in a compatible browser to continue.");const p={showSources:"Show Sources",sources:"Sources",showWorkspace:"Show Workspace",workspace:"Workspace",showSnippets:"Show Snippets",snippets:"Snippets",showSearch:"Show Search",search:"Search",showQuickSource:"Show Quick source",quickSource:"Quick source",showThreads:"Show Threads",threads:"Threads",showScope:"Show Scope",scope:"Scope",showWatch:"Show Watch",watch:"Watch",showBreakpoints:"Show Breakpoints",breakpoints:"Breakpoints",pauseScriptExecution:"Pause script execution",resumeScriptExecution:"Resume script execution",stepOverNextFunctionCall:"Step over next function call",stepIntoNextFunctionCall:"Step into next function call",step:"Step",stepOutOfCurrentFunction:"Step out of current function",runSnippet:"Run snippet",deactivateBreakpoints:"Deactivate breakpoints",activateBreakpoints:"Activate breakpoints",addSelectedTextToWatches:"Add selected text to watches",evaluateSelectedTextInConsole:"Evaluate selected text in console",switchFile:"Switch file",rename:"Rename",closeAll:"Close all",jumpToPreviousEditingLocation:"Jump to previous editing location",jumpToNextEditingLocation:"Jump to next editing location",closeTheActiveTab:"Close the active tab",goToLine:"Go to line",goToAFunctionDeclarationruleSet:"Go to a function declaration/rule set",toggleBreakpoint:"Toggle breakpoint",toggleBreakpointEnabled:"Toggle breakpoint enabled",toggleBreakpointInputWindow:"Toggle breakpoint input window",save:"Save",saveAll:"Save all",createNewSnippet:"Create new snippet",addFolderToWorkspace:"Add folder to workspace",addFolder:"Add folder",previousCallFrame:"Previous call frame",nextCallFrame:"Next call frame",incrementCssUnitBy:"Increment CSS unit by {PH1}",decrementCssUnitBy:"Decrement CSS unit by {PH1}",searchInAnonymousAndContent:"Search in anonymous and content scripts",doNotSearchInAnonymousAndContent:"Do not search in anonymous and content scripts",automaticallyRevealFilesIn:"Automatically reveal files in sidebar",doNotAutomaticallyRevealFilesIn:"Do not automatically reveal files in sidebar",javaScriptSourceMaps:"JavaScript source maps",enableJavaScriptSourceMaps:"Enable JavaScript source maps",disableJavaScriptSourceMaps:"Disable JavaScript source maps",tabMovesFocus:"Tab moves focus",enableTabMovesFocus:"Enable tab moves focus",disableTabMovesFocus:"Disable tab moves focus",detectIndentation:"Detect indentation",doNotDetectIndentation:"Do not detect indentation",automaticallyPrettyPrintMinifiedSources:"Automatically pretty print minified sources",doNotAutomaticallyPrettyPrintMinifiedSources:"Do not automatically pretty print minified sources",autocompletion:"Autocompletion",enableAutocompletion:"Enable autocompletion",disableAutocompletion:"Disable autocompletion",bracketClosing:"Auto closing brackets",enableBracketClosing:"Enable auto closing brackets",disableBracketClosing:"Disable auto closing brackets",bracketMatching:"Bracket matching",enableBracketMatching:"Enable bracket matching",disableBracketMatching:"Disable bracket matching",codeFolding:"Code folding",enableCodeFolding:"Enable code folding",disableCodeFolding:"Disable code folding",showWhitespaceCharacters:"Show whitespace characters:",doNotShowWhitespaceCharacters:"Do not show whitespace characters",none:"None",showAllWhitespaceCharacters:"Show all whitespace characters",all:"All",showTrailingWhitespaceCharacters:"Show trailing whitespace characters",trailing:"Trailing",displayVariableValuesInlineWhile:"Display variable values inline while debugging",doNotDisplayVariableValuesInline:"Do not display variable values inline while debugging",cssSourceMaps:"CSS source maps",enableCssSourceMaps:"Enable CSS source maps",disableCssSourceMaps:"Disable CSS source maps",allowScrollingPastEndOfFile:"Allow scrolling past end of file",disallowScrollingPastEndOfFile:"Disallow scrolling past end of file",wasmAutoStepping:"When debugging Wasm with debug information, do not pause on wasm bytecode if possible",enableWasmAutoStepping:"Enable Wasm auto-stepping",disableWasmAutoStepping:"Disable Wasm auto-stepping",goTo:"Go to",line:"Line",symbol:"Symbol",goToSymbol:"Go to symbol",open:"Open",file:"File",openFile:"Open file",disableAutoFocusOnDebuggerPaused:"Do not focus Sources panel when triggering a breakpoint",enableAutoFocusOnDebuggerPaused:"Focus Sources panel when triggering a breakpoint",revealActiveFileInSidebar:"Reveal active file in navigator sidebar",toggleNavigatorSidebar:"Toggle navigator sidebar",toggleDebuggerSidebar:"Toggle debugger sidebar",nextEditorTab:"Next editor",previousEditorTab:"Previous editor"},m=o.i18n.registerUIStrings("panels/sources/sources-meta.ts",p),S=o.i18n.getLazilyComputedLocalizedString.bind(void 0,m);let y,w,h;async function v(){return y||(y=await import("../../panels/sources/sources.js")),y}async function b(){return w||(w=await import("../../panels/sources/components/components.js")),w}function f(e){return void 0===y?[]:e(y)}c.ViewManager.registerViewExtension({location:"panel",id:"sources",commandPrompt:S(p.showSources),title:S(p.sources),order:30,loadView:async()=>(await v()).SourcesPanel.SourcesPanel.instance()}),c.ViewManager.registerViewExtension({location:"navigator-view",id:"navigator-files",commandPrompt:S(p.showWorkspace),title:S(p.workspace),order:3,persistence:"permanent",loadView:async()=>new((await v()).SourcesNavigator.FilesNavigatorView),condition:i.Runtime.conditions.notSourcesHideAddFolder}),c.ViewManager.registerViewExtension({location:"navigator-view",id:"navigator-snippets",commandPrompt:S(p.showSnippets),title:S(p.snippets),order:6,persistence:"permanent",loadView:async()=>new((await v()).SourcesNavigator.SnippetsNavigatorView)}),c.ViewManager.registerViewExtension({location:"drawer-view",id:"sources.search-sources-tab",commandPrompt:S(p.showSearch),title:S(p.search),order:7,persistence:"closeable",loadView:async()=>new((await v()).SearchSourcesView.SearchSourcesView)}),c.ViewManager.registerViewExtension({location:"drawer-view",id:"sources.quick",commandPrompt:S(p.showQuickSource),title:S(p.quickSource),persistence:"closeable",order:1e3,loadView:async()=>new((await v()).SourcesPanel.QuickSourceView)}),c.ViewManager.registerViewExtension({id:"sources.threads",commandPrompt:S(p.showThreads),title:S(p.threads),persistence:"permanent",loadView:async()=>new((await v()).ThreadsSidebarPane.ThreadsSidebarPane)}),c.ViewManager.registerViewExtension({id:"sources.scope-chain",commandPrompt:S(p.showScope),title:S(p.scope),persistence:"permanent",loadView:async()=>(await v()).ScopeChainSidebarPane.ScopeChainSidebarPane.instance()}),c.ViewManager.registerViewExtension({id:"sources.watch",commandPrompt:S(p.showWatch),title:S(p.watch),persistence:"permanent",loadView:async()=>(await v()).WatchExpressionsSidebarPane.WatchExpressionsSidebarPane.instance(),hasToolbar:!0}),c.ViewManager.registerViewExtension({id:"sources.js-breakpoints",commandPrompt:S(p.showBreakpoints),title:S(p.breakpoints),persistence:"permanent",loadView:async()=>(await b()).BreakpointsView.BreakpointsView.instance().wrapper}),c.ActionRegistration.registerActionExtension({category:"DEBUGGER",actionId:"debugger.toggle-pause",iconClass:"pause",toggleable:!0,toggledIconClass:"resume",loadActionDelegate:async()=>new((await v()).SourcesPanel.RevealingActionDelegate),contextTypes:()=>f((e=>[e.SourcesView.SourcesView,c.ShortcutRegistry.ForwardedShortcut])),options:[{value:!0,title:S(p.pauseScriptExecution)},{value:!1,title:S(p.resumeScriptExecution)}],bindings:[{shortcut:"F8",keybindSets:["devToolsDefault"]},{platform:"windows,linux",shortcut:"Ctrl+\\"},{shortcut:"F5",keybindSets:["vsCode"]},{shortcut:"Shift+F5",keybindSets:["vsCode"]},{platform:"mac",shortcut:"Meta+\\"}]}),c.ActionRegistration.registerActionExtension({category:"DEBUGGER",actionId:"debugger.step-over",loadActionDelegate:async()=>new((await v()).SourcesPanel.ActionDelegate),title:S(p.stepOverNextFunctionCall),iconClass:"step-over",contextTypes:()=>[a.DebuggerModel.DebuggerPausedDetails],bindings:[{shortcut:"F10",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+'"},{platform:"mac",shortcut:"Meta+'"}]}),c.ActionRegistration.registerActionExtension({category:"DEBUGGER",actionId:"debugger.step-into",loadActionDelegate:async()=>new((await v()).SourcesPanel.ActionDelegate),title:S(p.stepIntoNextFunctionCall),iconClass:"step-into",contextTypes:()=>[a.DebuggerModel.DebuggerPausedDetails],bindings:[{shortcut:"F11",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+;"},{platform:"mac",shortcut:"Meta+;"}]}),c.ActionRegistration.registerActionExtension({category:"DEBUGGER",actionId:"debugger.step",loadActionDelegate:async()=>new((await v()).SourcesPanel.ActionDelegate),title:S(p.step),iconClass:"step",contextTypes:()=>[a.DebuggerModel.DebuggerPausedDetails],bindings:[{shortcut:"F9",keybindSets:["devToolsDefault"]}]}),c.ActionRegistration.registerActionExtension({category:"DEBUGGER",actionId:"debugger.step-out",loadActionDelegate:async()=>new((await v()).SourcesPanel.ActionDelegate),title:S(p.stepOutOfCurrentFunction),iconClass:"step-out",contextTypes:()=>[a.DebuggerModel.DebuggerPausedDetails],bindings:[{shortcut:"Shift+F11",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Shift+Ctrl+;"},{platform:"mac",shortcut:"Shift+Meta+;"}]}),c.ActionRegistration.registerActionExtension({actionId:"debugger.run-snippet",category:"DEBUGGER",loadActionDelegate:async()=>new((await v()).SourcesPanel.ActionDelegate),title:S(p.runSnippet),iconClass:"play",contextTypes:()=>f((e=>[e.SourcesView.SourcesView])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Enter"},{platform:"mac",shortcut:"Meta+Enter"}]}),c.ActionRegistration.registerActionExtension({category:"DEBUGGER",actionId:"debugger.toggle-breakpoints-active",iconClass:"breakpoint-crossed",toggledIconClass:"breakpoint-crossed-filled",toggleable:!0,loadActionDelegate:async()=>new((await v()).SourcesPanel.ActionDelegate),contextTypes:()=>f((e=>[e.SourcesView.SourcesView])),options:[{value:!0,title:S(p.deactivateBreakpoints)},{value:!1,title:S(p.activateBreakpoints)}],bindings:[{platform:"windows,linux",shortcut:"Ctrl+F8"},{platform:"mac",shortcut:"Meta+F8"}]}),c.ActionRegistration.registerActionExtension({actionId:"sources.add-to-watch",loadActionDelegate:async()=>(await v()).WatchExpressionsSidebarPane.WatchExpressionsSidebarPane.instance(),category:"DEBUGGER",title:S(p.addSelectedTextToWatches),contextTypes:()=>f((e=>[e.UISourceCodeFrame.UISourceCodeFrame])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+A"},{platform:"mac",shortcut:"Meta+Shift+A"}]}),c.ActionRegistration.registerActionExtension({actionId:"debugger.evaluate-selection",category:"DEBUGGER",loadActionDelegate:async()=>new((await v()).SourcesPanel.ActionDelegate),title:S(p.evaluateSelectedTextInConsole),contextTypes:()=>f((e=>[e.UISourceCodeFrame.UISourceCodeFrame])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+E"},{platform:"mac",shortcut:"Meta+Shift+E"}]}),c.ActionRegistration.registerActionExtension({actionId:"sources.switch-file",category:"SOURCES",title:S(p.switchFile),loadActionDelegate:async()=>new((await v()).SourcesView.SwitchFileActionDelegate),contextTypes:()=>f((e=>[e.SourcesView.SourcesView])),bindings:[{shortcut:"Alt+O"}]}),c.ActionRegistration.registerActionExtension({actionId:"sources.rename",category:"SOURCES",title:S(p.rename),bindings:[{platform:"windows,linux",shortcut:"F2"},{platform:"mac",shortcut:"Enter"}]}),c.ActionRegistration.registerActionExtension({category:"SOURCES",actionId:"sources.close-all",loadActionDelegate:async()=>new((await v()).SourcesView.ActionDelegate),title:S(p.closeAll),bindings:[{platform:"windows,linux",shortcut:"Ctrl+K W",keybindSets:["vsCode"]},{platform:"mac",shortcut:"Meta+K W",keybindSets:["vsCode"]}]}),c.ActionRegistration.registerActionExtension({actionId:"sources.jump-to-previous-location",category:"SOURCES",title:S(p.jumpToPreviousEditingLocation),loadActionDelegate:async()=>new((await v()).SourcesView.ActionDelegate),contextTypes:()=>f((e=>[e.SourcesView.SourcesView])),bindings:[{shortcut:"Alt+Minus"}]}),c.ActionRegistration.registerActionExtension({actionId:"sources.jump-to-next-location",category:"SOURCES",title:S(p.jumpToNextEditingLocation),loadActionDelegate:async()=>new((await v()).SourcesView.ActionDelegate),contextTypes:()=>f((e=>[e.SourcesView.SourcesView])),bindings:[{shortcut:"Alt+Plus"}]}),c.ActionRegistration.registerActionExtension({actionId:"sources.close-editor-tab",category:"SOURCES",title:S(p.closeTheActiveTab),loadActionDelegate:async()=>new((await v()).SourcesView.ActionDelegate),contextTypes:()=>f((e=>[e.SourcesView.SourcesView])),bindings:[{shortcut:"Alt+w"},{shortcut:"Ctrl+W",keybindSets:["vsCode"]},{platform:"windows",shortcut:"Ctrl+F4",keybindSets:["vsCode"]}]}),c.ActionRegistration.registerActionExtension({actionId:"sources.next-editor-tab",category:"SOURCES",title:S(p.nextEditorTab),loadActionDelegate:async()=>new((await v()).SourcesView.ActionDelegate),contextTypes:()=>f((e=>[e.SourcesView.SourcesView])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+PageDown",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+PageDown",keybindSets:["devToolsDefault","vsCode"]}]}),c.ActionRegistration.registerActionExtension({actionId:"sources.previous-editor-tab",category:"SOURCES",title:S(p.previousEditorTab),loadActionDelegate:async()=>new((await v()).SourcesView.ActionDelegate),contextTypes:()=>f((e=>[e.SourcesView.SourcesView])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+PageUp",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+PageUp",keybindSets:["devToolsDefault","vsCode"]}]}),c.ActionRegistration.registerActionExtension({actionId:"sources.go-to-line",category:"SOURCES",title:S(p.goToLine),loadActionDelegate:async()=>new((await v()).SourcesView.ActionDelegate),contextTypes:()=>f((e=>[e.SourcesView.SourcesView])),bindings:[{shortcut:"Ctrl+g",keybindSets:["devToolsDefault","vsCode"]}]}),c.ActionRegistration.registerActionExtension({actionId:"sources.go-to-member",category:"SOURCES",title:S(p.goToAFunctionDeclarationruleSet),loadActionDelegate:async()=>new((await v()).SourcesView.ActionDelegate),contextTypes:()=>f((e=>[e.SourcesView.SourcesView])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+o",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+Shift+o",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+T",keybindSets:["vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+T",keybindSets:["vsCode"]},{shortcut:"F12",keybindSets:["vsCode"]}]}),c.ActionRegistration.registerActionExtension({actionId:"debugger.toggle-breakpoint",category:"DEBUGGER",title:S(p.toggleBreakpoint),bindings:[{platform:"windows,linux",shortcut:"Ctrl+b",keybindSets:["devToolsDefault"]},{platform:"mac",shortcut:"Meta+b",keybindSets:["devToolsDefault"]},{shortcut:"F9",keybindSets:["vsCode"]}]}),c.ActionRegistration.registerActionExtension({actionId:"debugger.toggle-breakpoint-enabled",category:"DEBUGGER",title:S(p.toggleBreakpointEnabled),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+b"},{platform:"mac",shortcut:"Meta+Shift+b"}]}),c.ActionRegistration.registerActionExtension({actionId:"debugger.breakpoint-input-window",category:"DEBUGGER",title:S(p.toggleBreakpointInputWindow),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Alt+b"},{platform:"mac",shortcut:"Meta+Alt+b"}]}),c.ActionRegistration.registerActionExtension({actionId:"sources.save",category:"SOURCES",title:S(p.save),loadActionDelegate:async()=>new((await v()).SourcesView.ActionDelegate),contextTypes:()=>f((e=>[e.SourcesView.SourcesView])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+s",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+s",keybindSets:["devToolsDefault","vsCode"]}]}),c.ActionRegistration.registerActionExtension({actionId:"sources.save-all",category:"SOURCES",title:S(p.saveAll),loadActionDelegate:async()=>new((await v()).SourcesView.ActionDelegate),contextTypes:()=>f((e=>[e.SourcesView.SourcesView])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+s"},{platform:"mac",shortcut:"Meta+Alt+s"},{platform:"windows,linux",shortcut:"Ctrl+K S",keybindSets:["vsCode"]},{platform:"mac",shortcut:"Meta+Alt+S",keybindSets:["vsCode"]}]}),c.ActionRegistration.registerActionExtension({category:"SOURCES",actionId:"sources.create-snippet",loadActionDelegate:async()=>new((await v()).SourcesNavigator.ActionDelegate),title:S(p.createNewSnippet)}),t.InspectorFrontendHost.InspectorFrontendHostInstance.isHostedMode()||c.ActionRegistration.registerActionExtension({category:"SOURCES",actionId:"sources.add-folder-to-workspace",loadActionDelegate:async()=>new((await v()).SourcesNavigator.ActionDelegate),iconClass:"plus",title:S(p.addFolderToWorkspace)}),c.ActionRegistration.registerActionExtension({category:"DEBUGGER",actionId:"debugger.previous-call-frame",loadActionDelegate:async()=>new((await v()).CallStackSidebarPane.ActionDelegate),title:S(p.previousCallFrame),contextTypes:()=>[a.DebuggerModel.DebuggerPausedDetails],bindings:[{shortcut:"Ctrl+,"}]}),c.ActionRegistration.registerActionExtension({category:"DEBUGGER",actionId:"debugger.next-call-frame",loadActionDelegate:async()=>new((await v()).CallStackSidebarPane.ActionDelegate),title:S(p.nextCallFrame),contextTypes:()=>[a.DebuggerModel.DebuggerPausedDetails],bindings:[{shortcut:"Ctrl+."}]}),c.ActionRegistration.registerActionExtension({actionId:"sources.search",title:S(p.search),loadActionDelegate:async()=>new((await v()).SearchSourcesView.ActionDelegate),category:"SOURCES",bindings:[{platform:"mac",shortcut:"Meta+Alt+F",keybindSets:["devToolsDefault"]},{platform:"windows,linux",shortcut:"Ctrl+Shift+F",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+Shift+J",keybindSets:["vsCode"]},{platform:"mac",shortcut:"Meta+Shift+F",keybindSets:["vsCode"]},{platform:"mac",shortcut:"Meta+Shift+J",keybindSets:["vsCode"]}]}),c.ActionRegistration.registerActionExtension({actionId:"sources.increment-css",category:"SOURCES",title:S(p.incrementCssUnitBy,{PH1:1}),bindings:[{shortcut:"Alt+Up"}]}),c.ActionRegistration.registerActionExtension({actionId:"sources.increment-css-by-ten",title:S(p.incrementCssUnitBy,{PH1:10}),category:"SOURCES",bindings:[{shortcut:"Alt+PageUp"}]}),c.ActionRegistration.registerActionExtension({actionId:"sources.decrement-css",category:"SOURCES",title:S(p.decrementCssUnitBy,{PH1:1}),bindings:[{shortcut:"Alt+Down"}]}),c.ActionRegistration.registerActionExtension({actionId:"sources.decrement-css-by-ten",category:"SOURCES",title:S(p.decrementCssUnitBy,{PH1:10}),bindings:[{shortcut:"Alt+PageDown"}]}),c.ActionRegistration.registerActionExtension({actionId:"sources.reveal-in-navigator-sidebar",category:"SOURCES",title:S(p.revealActiveFileInSidebar),loadActionDelegate:async()=>new((await v()).SourcesPanel.ActionDelegate),contextTypes:()=>f((e=>[e.SourcesView.SourcesView]))}),c.ActionRegistration.registerActionExtension({actionId:"sources.toggle-navigator-sidebar",category:"SOURCES",title:S(p.toggleNavigatorSidebar),loadActionDelegate:async()=>new((await v()).SourcesPanel.ActionDelegate),contextTypes:()=>f((e=>[e.SourcesView.SourcesView])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+y",keybindSets:["devToolsDefault"]},{platform:"mac",shortcut:"Meta+Shift+y",keybindSets:["devToolsDefault"]},{platform:"windows,linux",shortcut:"Ctrl+b",keybindSets:["vsCode"]},{platform:"windows,linux",shortcut:"Meta+b",keybindSets:["vsCode"]}]}),c.ActionRegistration.registerActionExtension({actionId:"sources.toggle-debugger-sidebar",category:"SOURCES",title:S(p.toggleDebuggerSidebar),loadActionDelegate:async()=>new((await v()).SourcesPanel.ActionDelegate),contextTypes:()=>f((e=>[e.SourcesView.SourcesView])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+h"},{platform:"mac",shortcut:"Meta+Shift+h"}]}),e.Settings.registerSettingExtension({settingName:"navigator-group-by-folder",settingType:"boolean",defaultValue:!0}),e.Settings.registerSettingExtension({settingName:"navigator-group-by-authored",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:S(p.searchInAnonymousAndContent),settingName:"search-in-anonymous-and-content-scripts",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:S(p.searchInAnonymousAndContent)},{value:!1,title:S(p.doNotSearchInAnonymousAndContent)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:S(p.automaticallyRevealFilesIn),settingName:"auto-reveal-in-navigator",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:S(p.automaticallyRevealFilesIn)},{value:!1,title:S(p.doNotAutomaticallyRevealFilesIn)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:S(p.javaScriptSourceMaps),settingName:"js-source-maps-enabled",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:S(p.enableJavaScriptSourceMaps)},{value:!1,title:S(p.disableJavaScriptSourceMaps)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:S(p.tabMovesFocus),settingName:"text-editor-tab-moves-focus",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:S(p.enableTabMovesFocus)},{value:!1,title:S(p.disableTabMovesFocus)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:S(p.detectIndentation),settingName:"text-editor-auto-detect-indent",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:S(p.detectIndentation)},{value:!1,title:S(p.doNotDetectIndentation)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:S(p.autocompletion),settingName:"text-editor-autocompletion",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:S(p.enableAutocompletion)},{value:!1,title:S(p.disableAutocompletion)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:S(p.bracketClosing),settingName:"text-editor-bracket-closing",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:S(p.enableBracketClosing)},{value:!1,title:S(p.disableBracketClosing)}]}),e.Settings.registerSettingExtension({category:"SOURCES",title:S(p.bracketMatching),settingName:"text-editor-bracket-matching",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:S(p.enableBracketMatching)},{value:!1,title:S(p.disableBracketMatching)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:S(p.codeFolding),settingName:"text-editor-code-folding",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:S(p.enableCodeFolding)},{value:!1,title:S(p.disableCodeFolding)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:S(p.showWhitespaceCharacters),settingName:"show-whitespaces-in-editor",settingType:"enum",defaultValue:"original",options:[{title:S(p.doNotShowWhitespaceCharacters),text:S(p.none),value:"none"},{title:S(p.showAllWhitespaceCharacters),text:S(p.all),value:"all"},{title:S(p.showTrailingWhitespaceCharacters),text:S(p.trailing),value:"trailing"}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:S(p.displayVariableValuesInlineWhile),settingName:"inline-variable-values",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:S(p.displayVariableValuesInlineWhile)},{value:!1,title:S(p.doNotDisplayVariableValuesInline)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:S(p.enableAutoFocusOnDebuggerPaused),settingName:"auto-focus-on-debugger-paused-enabled",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:S(p.enableAutoFocusOnDebuggerPaused)},{value:!1,title:S(p.disableAutoFocusOnDebuggerPaused)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:S(p.automaticallyPrettyPrintMinifiedSources),settingName:"auto-pretty-print-minified",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:S(p.automaticallyPrettyPrintMinifiedSources)},{value:!1,title:S(p.doNotAutomaticallyPrettyPrintMinifiedSources)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:S(p.cssSourceMaps),settingName:"css-source-maps-enabled",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:S(p.enableCssSourceMaps)},{value:!1,title:S(p.disableCssSourceMaps)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:S(p.allowScrollingPastEndOfFile),settingName:"allow-scroll-past-eof",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:S(p.allowScrollingPastEndOfFile)},{value:!1,title:S(p.disallowScrollingPastEndOfFile)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Local",title:S(p.wasmAutoStepping),settingName:"wasm-auto-stepping",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:S(p.enableWasmAutoStepping)},{value:!1,title:S(p.disableWasmAutoStepping)}]}),c.ViewManager.registerLocationResolver({name:"navigator-view",category:"SOURCES",loadResolver:async()=>(await v()).SourcesPanel.SourcesPanel.instance()}),c.ViewManager.registerLocationResolver({name:"sources.sidebar-top",category:"SOURCES",loadResolver:async()=>(await v()).SourcesPanel.SourcesPanel.instance()}),c.ViewManager.registerLocationResolver({name:"sources.sidebar-bottom",category:"SOURCES",loadResolver:async()=>(await v()).SourcesPanel.SourcesPanel.instance()}),c.ViewManager.registerLocationResolver({name:"sources.sidebar-tabs",category:"SOURCES",loadResolver:async()=>(await v()).SourcesPanel.SourcesPanel.instance()}),c.ContextMenu.registerProvider({contextTypes:()=>[s.UISourceCode.UISourceCode,s.UISourceCode.UILocation,a.RemoteObject.RemoteObject,a.NetworkRequest.NetworkRequest,...f((e=>[e.UISourceCodeFrame.UISourceCodeFrame]))],loadProvider:async()=>(await v()).SourcesPanel.SourcesPanel.instance(),experiment:void 0}),c.ContextMenu.registerProvider({loadProvider:async()=>(await v()).WatchExpressionsSidebarPane.WatchExpressionsSidebarPane.instance(),contextTypes:()=>[r.ObjectPropertiesSection.ObjectPropertyTreeElement,...f((e=>[e.UISourceCodeFrame.UISourceCodeFrame]))],experiment:void 0}),e.Revealer.registerRevealer({contextTypes:()=>[s.UISourceCode.UILocation],destination:e.Revealer.RevealerDestination.SOURCES_PANEL,loadRevealer:async()=>new((await v()).SourcesPanel.UILocationRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[s.UISourceCode.UILocationRange],destination:e.Revealer.RevealerDestination.SOURCES_PANEL,loadRevealer:async()=>new((await v()).SourcesPanel.UILocationRangeRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[a.DebuggerModel.Location],destination:e.Revealer.RevealerDestination.SOURCES_PANEL,loadRevealer:async()=>new((await v()).SourcesPanel.DebuggerLocationRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[s.UISourceCode.UISourceCode],destination:e.Revealer.RevealerDestination.SOURCES_PANEL,loadRevealer:async()=>new((await v()).SourcesPanel.UISourceCodeRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[a.DebuggerModel.DebuggerPausedDetails],destination:e.Revealer.RevealerDestination.SOURCES_PANEL,loadRevealer:async()=>new((await v()).SourcesPanel.DebuggerPausedDetailsRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[n.BreakpointManager.BreakpointLocation],destination:e.Revealer.RevealerDestination.SOURCES_PANEL,loadRevealer:async()=>new((await v()).DebuggerPlugin.BreakpointLocationRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>f((e=>[e.SearchSourcesView.SearchSources])),destination:void 0,loadRevealer:async()=>new((await v()).SearchSourcesView.Revealer)}),c.Toolbar.registerToolbarItem({actionId:"sources.add-folder-to-workspace",location:"files-navigator-toolbar",label:S(p.addFolder),loadItem:void 0,order:void 0,separator:void 0}),c.Context.registerListener({contextTypes:()=>[a.DebuggerModel.DebuggerPausedDetails],loadListener:async()=>(await b()).BreakpointsView.BreakpointsSidebarController.instance()}),c.Context.registerListener({contextTypes:()=>[a.DebuggerModel.DebuggerPausedDetails],loadListener:async()=>(await v()).CallStackSidebarPane.CallStackSidebarPane.instance()}),c.Context.registerListener({contextTypes:()=>[a.DebuggerModel.CallFrame],loadListener:async()=>(await v()).ScopeChainSidebarPane.ScopeChainSidebarPane.instance()}),c.ContextMenu.registerItem({location:"navigatorMenu/default",actionId:"quick-open.show",order:void 0}),c.ContextMenu.registerItem({location:"mainMenu/default",actionId:"sources.search",order:void 0}),l.FilteredListWidget.registerProvider({prefix:"@",iconName:"symbol",provider:async()=>new((await v()).OutlineQuickOpen.OutlineQuickOpen),helpTitle:S(p.goToSymbol),titlePrefix:S(p.goTo),titleSuggestion:S(p.symbol)}),l.FilteredListWidget.registerProvider({prefix:":",iconName:"colon",provider:async()=>new((await v()).GoToLineQuickOpen.GoToLineQuickOpen),helpTitle:S(p.goToLine),titlePrefix:S(p.goTo),titleSuggestion:S(p.line)}),l.FilteredListWidget.registerProvider({prefix:"",iconName:"document",provider:async()=>new((await v()).OpenFileQuickOpen.OpenFileQuickOpen),helpTitle:S(p.openFile),titlePrefix:S(p.open),titleSuggestion:S(p.file)});const A={memory:"Memory",liveHeapProfile:"Live Heap Profile",startRecordingHeapAllocations:"Start recording heap allocations",stopRecordingHeapAllocations:"Stop recording heap allocations",startRecordingHeapAllocationsAndReload:"Start recording heap allocations and reload the page",startStopRecording:"Start/stop recording",showMemory:"Show Memory",showLiveHeapProfile:"Show Live Heap Profile",clearAllProfiles:"Clear all profiles",saveProfile:"Save profileโ€ฆ",loadProfile:"Load profileโ€ฆ",deleteProfile:"Delete profile"},C=o.i18n.registerUIStrings("panels/profiler/profiler-meta.ts",A),x=o.i18n.getLazilyComputedLocalizedString.bind(void 0,C);async function E(){return h||(h=await import("../../panels/profiler/profiler.js")),h}function T(e){return void 0===h?[]:e(h)}c.ViewManager.registerViewExtension({location:"panel",id:"heap-profiler",commandPrompt:x(A.showMemory),title:x(A.memory),order:60,loadView:async()=>(await E()).HeapProfilerPanel.HeapProfilerPanel.instance(),experiment:"js-heap-profiler-enable"}),c.ViewManager.registerViewExtension({location:"drawer-view",id:"live-heap-profile",commandPrompt:x(A.showLiveHeapProfile),title:x(A.liveHeapProfile),persistence:"closeable",order:100,loadView:async()=>(await E()).LiveHeapProfileView.LiveHeapProfileView.instance(),experiment:"live-heap-profile"}),c.ActionRegistration.registerActionExtension({actionId:"live-heap-profile.toggle-recording",iconClass:"record-start",toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,loadActionDelegate:async()=>new((await E()).LiveHeapProfileView.ActionDelegate),category:"MEMORY",experiment:"live-heap-profile",options:[{value:!0,title:x(A.startRecordingHeapAllocations)},{value:!1,title:x(A.stopRecordingHeapAllocations)}]}),c.ActionRegistration.registerActionExtension({actionId:"live-heap-profile.start-with-reload",iconClass:"refresh",loadActionDelegate:async()=>new((await E()).LiveHeapProfileView.ActionDelegate),category:"MEMORY",experiment:"live-heap-profile",title:x(A.startRecordingHeapAllocationsAndReload)}),c.ActionRegistration.registerActionExtension({actionId:"profiler.heap-toggle-recording",category:"MEMORY",iconClass:"record-start",title:x(A.startStopRecording),toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,contextTypes:()=>T((e=>[e.HeapProfilerPanel.HeapProfilerPanel])),loadActionDelegate:async()=>(await E()).HeapProfilerPanel.HeapProfilerPanel.instance(),bindings:[{platform:"windows,linux",shortcut:"Ctrl+E"},{platform:"mac",shortcut:"Meta+E"}]}),c.ActionRegistration.registerActionExtension({actionId:"profiler.clear-all",category:"MEMORY",iconClass:"clear",contextTypes:()=>T((e=>[e.ProfilesPanel.ProfilesPanel])),loadActionDelegate:async()=>new((await E()).ProfilesPanel.ActionDelegate),title:x(A.clearAllProfiles)}),c.ActionRegistration.registerActionExtension({actionId:"profiler.load-from-file",category:"MEMORY",iconClass:"import",contextTypes:()=>T((e=>[e.ProfilesPanel.ProfilesPanel])),loadActionDelegate:async()=>new((await E()).ProfilesPanel.ActionDelegate),title:x(A.loadProfile),bindings:[{platform:"windows,linux",shortcut:"Ctrl+O"},{platform:"mac",shortcut:"Meta+O"}]}),c.ActionRegistration.registerActionExtension({actionId:"profiler.save-to-file",category:"MEMORY",iconClass:"download",contextTypes:()=>T((e=>[e.ProfileHeader.ProfileHeader])),loadActionDelegate:async()=>new((await E()).ProfilesPanel.ActionDelegate),title:x(A.saveProfile),bindings:[{platform:"windows,linux",shortcut:"Ctrl+S"},{platform:"mac",shortcut:"Meta+S"}]}),c.ActionRegistration.registerActionExtension({actionId:"profiler.delete-profile",category:"MEMORY",iconClass:"download",contextTypes:()=>T((e=>[e.ProfileHeader.ProfileHeader])),loadActionDelegate:async()=>new((await E()).ProfilesPanel.ActionDelegate),title:x(A.deleteProfile)}),c.ContextMenu.registerProvider({contextTypes:()=>[a.RemoteObject.RemoteObject],loadProvider:async()=>(await E()).HeapProfilerPanel.HeapProfilerPanel.instance(),experiment:void 0}),c.ContextMenu.registerItem({location:"profilerMenu/default",actionId:"profiler.save-to-file",order:10}),c.ContextMenu.registerItem({location:"profilerMenu/default",actionId:"profiler.delete-profile",order:11});const R={console:"Console",showConsole:"Show Console",toggleConsole:"Toggle Console",clearConsole:"Clear console",clearConsoleHistory:"Clear console history",hideNetworkMessages:"Hide network messages",showNetworkMessages:"Show network messages",selectedContextOnly:"Selected context only",onlyShowMessagesFromTheCurrent:"Only show messages from the current context (`top`, `iframe`, `worker`, extension)",showMessagesFromAllContexts:"Show messages from all contexts",logXmlhttprequests:"Log XMLHttpRequests",timestamps:"Timestamps",showTimestamps:"Show timestamps",hideTimestamps:"Hide timestamps",autocompleteFromHistory:"Autocomplete from history",doNotAutocompleteFromHistory:"Do not autocomplete from history",autocompleteOnEnter:"Accept autocomplete suggestion on Enter",doNotAutocompleteOnEnter:"Do not accept autocomplete suggestion on Enter",groupSimilarMessagesInConsole:"Group similar messages in console",doNotGroupSimilarMessagesIn:"Do not group similar messages in console",showCorsErrorsInConsole:"Show `CORS` errors in console",doNotShowCorsErrorsIn:"Do not show `CORS` errors in console",evaluateTriggersUserActivation:"Treat code evaluation as user action",treatEvaluationAsUserActivation:"Treat evaluation as user activation",doNotTreatEvaluationAsUser:"Do not treat evaluation as user activation",expandConsoleTraceMessagesByDefault:"Automatically expand `console.trace()` messages",collapseConsoleTraceMessagesByDefault:"Do not automatically expand `console.trace()` messages"},D=o.i18n.registerUIStrings("panels/console/console-meta.ts",R),P=o.i18n.getLazilyComputedLocalizedString.bind(void 0,D);let k;async function I(){return k||(k=await import("../../panels/console/console.js")),k}c.ViewManager.registerViewExtension({location:"panel",id:"console",title:P(R.console),commandPrompt:P(R.showConsole),order:20,loadView:async()=>(await I()).ConsolePanel.ConsolePanel.instance()}),c.ViewManager.registerViewExtension({location:"drawer-view",id:"console-view",title:P(R.console),commandPrompt:P(R.showConsole),persistence:"permanent",order:0,loadView:async()=>(await I()).ConsolePanel.WrapperView.instance()}),c.ActionRegistration.registerActionExtension({actionId:"console.toggle",category:"CONSOLE",title:P(R.toggleConsole),loadActionDelegate:async()=>new((await I()).ConsoleView.ActionDelegate),bindings:[{shortcut:"Ctrl+`",keybindSets:["devToolsDefault","vsCode"]}]}),c.ActionRegistration.registerActionExtension({actionId:"console.clear",category:"CONSOLE",title:P(R.clearConsole),iconClass:"clear",loadActionDelegate:async()=>new((await I()).ConsoleView.ActionDelegate),contextTypes:()=>void 0===k?[]:(e=>[e.ConsoleView.ConsoleView])(k),bindings:[{shortcut:"Ctrl+L"},{shortcut:"Meta+K",platform:"mac"}]}),c.ActionRegistration.registerActionExtension({actionId:"console.clear.history",category:"CONSOLE",title:P(R.clearConsoleHistory),loadActionDelegate:async()=>new((await I()).ConsoleView.ActionDelegate)}),e.Settings.registerSettingExtension({category:"CONSOLE",storageType:"Synced",title:P(R.hideNetworkMessages),settingName:"hide-network-messages",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:P(R.hideNetworkMessages)},{value:!1,title:P(R.showNetworkMessages)}]}),e.Settings.registerSettingExtension({category:"CONSOLE",storageType:"Synced",title:P(R.selectedContextOnly),settingName:"selected-context-filter-enabled",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:P(R.onlyShowMessagesFromTheCurrent)},{value:!1,title:P(R.showMessagesFromAllContexts)}]}),e.Settings.registerSettingExtension({category:"CONSOLE",storageType:"Synced",title:P(R.logXmlhttprequests),settingName:"monitoring-xhr-enabled",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({category:"CONSOLE",storageType:"Synced",title:P(R.timestamps),settingName:"console-timestamps-enabled",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:P(R.showTimestamps)},{value:!1,title:P(R.hideTimestamps)}]}),e.Settings.registerSettingExtension({category:"CONSOLE",title:P(R.autocompleteFromHistory),settingName:"console-history-autocomplete",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:P(R.autocompleteFromHistory)},{value:!1,title:P(R.doNotAutocompleteFromHistory)}]}),e.Settings.registerSettingExtension({category:"CONSOLE",storageType:"Synced",title:P(R.autocompleteOnEnter),settingName:"console-autocomplete-on-enter",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:P(R.autocompleteOnEnter)},{value:!1,title:P(R.doNotAutocompleteOnEnter)}]}),e.Settings.registerSettingExtension({category:"CONSOLE",storageType:"Synced",title:P(R.groupSimilarMessagesInConsole),settingName:"console-group-similar",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:P(R.groupSimilarMessagesInConsole)},{value:!1,title:P(R.doNotGroupSimilarMessagesIn)}]}),e.Settings.registerSettingExtension({category:"CONSOLE",title:P(R.showCorsErrorsInConsole),settingName:"console-shows-cors-errors",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:P(R.showCorsErrorsInConsole)},{value:!1,title:P(R.doNotShowCorsErrorsIn)}]}),e.Settings.registerSettingExtension({category:"CONSOLE",storageType:"Synced",title:P(R.evaluateTriggersUserActivation),settingName:"console-user-activation-eval",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:P(R.treatEvaluationAsUserActivation)},{value:!1,title:P(R.doNotTreatEvaluationAsUser)}]}),e.Settings.registerSettingExtension({category:"CONSOLE",storageType:"Synced",title:P(R.expandConsoleTraceMessagesByDefault),settingName:"console-trace-expand",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:P(R.expandConsoleTraceMessagesByDefault)},{value:!1,title:P(R.collapseConsoleTraceMessagesByDefault)}]}),e.Revealer.registerRevealer({contextTypes:()=>[e.Console.Console],destination:void 0,loadRevealer:async()=>new((await I()).ConsolePanel.ConsoleRevealer)});const N={coverage:"Coverage",showCoverage:"Show Coverage",instrumentCoverage:"Instrument coverage",stopInstrumentingCoverageAndShow:"Stop instrumenting coverage and show results",startInstrumentingCoverageAnd:"Start instrumenting coverage and reload page",clearCoverage:"Clear coverage",exportCoverage:"Export coverage"},V=o.i18n.registerUIStrings("panels/coverage/coverage-meta.ts",N),L=o.i18n.getLazilyComputedLocalizedString.bind(void 0,V);let M,O;async function F(){return M||(M=await import("../../panels/coverage/coverage.js")),M}function U(e){return void 0===M?[]:e(M)}c.ViewManager.registerViewExtension({location:"drawer-view",id:"coverage",title:L(N.coverage),commandPrompt:L(N.showCoverage),persistence:"closeable",order:100,loadView:async()=>(await F()).CoverageView.CoverageView.instance()}),c.ActionRegistration.registerActionExtension({actionId:"coverage.toggle-recording",iconClass:"record-start",toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,loadActionDelegate:async()=>new((await F()).CoverageView.ActionDelegate),category:"PERFORMANCE",options:[{value:!0,title:L(N.instrumentCoverage)},{value:!1,title:L(N.stopInstrumentingCoverageAndShow)}]}),c.ActionRegistration.registerActionExtension({actionId:"coverage.start-with-reload",iconClass:"refresh",loadActionDelegate:async()=>new((await F()).CoverageView.ActionDelegate),category:"PERFORMANCE",title:L(N.startInstrumentingCoverageAnd)}),c.ActionRegistration.registerActionExtension({actionId:"coverage.clear",iconClass:"clear",category:"PERFORMANCE",title:L(N.clearCoverage),loadActionDelegate:async()=>new((await F()).CoverageView.ActionDelegate),contextTypes:()=>U((e=>[e.CoverageView.CoverageView]))}),c.ActionRegistration.registerActionExtension({actionId:"coverage.export",iconClass:"download",category:"PERFORMANCE",title:L(N.exportCoverage),loadActionDelegate:async()=>new((await F()).CoverageView.ActionDelegate),contextTypes:()=>U((e=>[e.CoverageView.CoverageView]))});const G={changes:"Changes",showChanges:"Show Changes",revertAllChangesToCurrentFile:"Revert all changes to current file",copyAllChangesFromCurrentFile:"Copy all changes from current file"},B=o.i18n.registerUIStrings("panels/changes/changes-meta.ts",G),H=o.i18n.getLazilyComputedLocalizedString.bind(void 0,B);async function W(){return O||(O=await import("../../panels/changes/changes.js")),O}function z(e){return void 0===O?[]:e(O)}c.ViewManager.registerViewExtension({location:"drawer-view",id:"changes.changes",title:H(G.changes),commandPrompt:H(G.showChanges),persistence:"closeable",loadView:async()=>new((await W()).ChangesView.ChangesView)}),c.ActionRegistration.registerActionExtension({actionId:"changes.revert",category:"CHANGES",title:H(G.revertAllChangesToCurrentFile),iconClass:"undo",loadActionDelegate:async()=>new((await W()).ChangesView.ActionDelegate),contextTypes:()=>z((e=>[e.ChangesView.ChangesView]))}),c.ActionRegistration.registerActionExtension({actionId:"changes.copy",category:"CHANGES",title:H(G.copyAllChangesFromCurrentFile),iconClass:"copy",loadActionDelegate:async()=>new((await W()).ChangesView.ActionDelegate),contextTypes:()=>z((e=>[e.ChangesView.ChangesView]))});const j={memoryInspector:"Memory inspector",showMemoryInspector:"Show Memory inspector"},q=o.i18n.registerUIStrings("panels/linear_memory_inspector/linear_memory_inspector-meta.ts",j),_=o.i18n.getLazilyComputedLocalizedString.bind(void 0,q);let J;async function Y(){return J||(J=await import("../../panels/linear_memory_inspector/linear_memory_inspector.js")),J}c.ViewManager.registerViewExtension({location:"drawer-view",id:"linear-memory-inspector",title:_(j.memoryInspector),commandPrompt:_(j.showMemoryInspector),order:100,persistence:"closeable",loadView:async()=>(await Y()).LinearMemoryInspectorPane.LinearMemoryInspectorPane.instance()}),c.ContextMenu.registerProvider({loadProvider:async()=>(await Y()).LinearMemoryInspectorController.LinearMemoryInspectorController.instance(),experiment:void 0,contextTypes:()=>[r.ObjectPropertiesSection.ObjectPropertyTreeElement]}),e.Revealer.registerRevealer({contextTypes:()=>[a.RemoteObject.LinearMemoryInspectable],destination:e.Revealer.RevealerDestination.MEMORY_INSPECTOR_PANEL,loadRevealer:async()=>(await Y()).LinearMemoryInspectorController.LinearMemoryInspectorController.instance()});const Q={devices:"Devices",showDevices:"Show Devices"},K=o.i18n.registerUIStrings("panels/settings/emulation/emulation-meta.ts",Q),Z=o.i18n.getLazilyComputedLocalizedString.bind(void 0,K);let X;c.ViewManager.registerViewExtension({location:"settings-view",commandPrompt:Z(Q.showDevices),title:Z(Q.devices),order:30,loadView:async()=>new((await async function(){return X||(X=await import("../../panels/settings/emulation/emulation.js")),X}()).DevicesSettingsTab.DevicesSettingsTab),id:"devices",settings:["standard-emulated-device-list","custom-emulated-device-list"],iconName:"devices"});const $={shortcuts:"Shortcuts",preferences:"Preferences",experiments:"Experiments",ignoreList:"Ignore list",showShortcuts:"Show Shortcuts",showPreferences:"Show Preferences",showExperiments:"Show Experiments",showIgnoreList:"Show Ignore list",settings:"Settings",documentation:"Documentation",aiInnovations:"AI innovations",showAiInnovations:"Show AI innovations"},ee=o.i18n.registerUIStrings("panels/settings/settings-meta.ts",$),te=o.i18n.getLazilyComputedLocalizedString.bind(void 0,ee);let oe;async function ie(){return oe||(oe=await import("../../panels/settings/settings.js")),oe}c.ViewManager.registerViewExtension({location:"settings-view",id:"preferences",title:te($.preferences),commandPrompt:te($.showPreferences),order:0,loadView:async()=>new((await ie()).SettingsScreen.GenericSettingsTab),iconName:"gear"}),c.ViewManager.registerViewExtension({location:"settings-view",id:"chrome-ai",title:te($.aiInnovations),commandPrompt:te($.showAiInnovations),order:2,async loadView(){const e=await ie();return g.LegacyWrapper.legacyWrapper(c.Widget.VBox,new e.AISettingsTab.AISettingsTab)},iconName:"button-magic",settings:["console-insights-enabled"],condition:e=>(e?.aidaAvailability?.enabled&&(e?.devToolsConsoleInsights?.enabled||e?.devToolsFreestyler?.enabled))??!1}),c.ViewManager.registerViewExtension({location:"settings-view",id:"experiments",title:te($.experiments),commandPrompt:te($.showExperiments),order:3,experiment:"*",loadView:async()=>new((await ie()).SettingsScreen.ExperimentsSettingsTab),iconName:"experiment"}),c.ViewManager.registerViewExtension({location:"settings-view",id:"blackbox",title:te($.ignoreList),commandPrompt:te($.showIgnoreList),order:4,loadView:async()=>new((await ie()).FrameworkIgnoreListSettingsTab.FrameworkIgnoreListSettingsTab),iconName:"clear-list"}),c.ViewManager.registerViewExtension({location:"settings-view",id:"keybinds",title:te($.shortcuts),commandPrompt:te($.showShortcuts),order:100,loadView:async()=>new((await ie()).KeybindsSettingsTab.KeybindsSettingsTab),iconName:"keyboard"}),c.ActionRegistration.registerActionExtension({category:"SETTINGS",actionId:"settings.show",title:te($.settings),loadActionDelegate:async()=>new((await ie()).SettingsScreen.ActionDelegate),iconClass:"gear",bindings:[{shortcut:"F1",keybindSets:["devToolsDefault"]},{shortcut:"Shift+?"},{platform:"windows,linux",shortcut:"Ctrl+,",keybindSets:["vsCode"]},{platform:"mac",shortcut:"Meta+,",keybindSets:["vsCode"]}]}),c.ActionRegistration.registerActionExtension({category:"SETTINGS",actionId:"settings.documentation",title:te($.documentation),loadActionDelegate:async()=>new((await ie()).SettingsScreen.ActionDelegate)}),c.ActionRegistration.registerActionExtension({category:"SETTINGS",actionId:"settings.shortcuts",title:te($.showShortcuts),loadActionDelegate:async()=>new((await ie()).SettingsScreen.ActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+K Ctrl+S",keybindSets:["vsCode"]},{platform:"mac",shortcut:"Meta+K Meta+S",keybindSets:["vsCode"]}]}),c.ViewManager.registerLocationResolver({name:"settings-view",category:"SETTINGS",loadResolver:async()=>(await ie()).SettingsScreen.SettingsScreen.instance()}),e.Revealer.registerRevealer({contextTypes:()=>[e.Settings.Setting,i.Runtime.Experiment],destination:void 0,loadRevealer:async()=>new((await ie()).SettingsScreen.Revealer)}),c.ContextMenu.registerItem({location:"mainMenu/footer",actionId:"settings.shortcuts",order:void 0}),c.ContextMenu.registerItem({location:"mainMenuHelp/default",actionId:"settings.documentation",order:void 0});const ae={protocolMonitor:"Protocol monitor",showProtocolMonitor:"Show Protocol monitor"},ne=o.i18n.registerUIStrings("panels/protocol_monitor/protocol_monitor-meta.ts",ae),se=o.i18n.getLazilyComputedLocalizedString.bind(void 0,ne);let re;c.ViewManager.registerViewExtension({location:"drawer-view",id:"protocol-monitor",title:se(ae.protocolMonitor),commandPrompt:se(ae.showProtocolMonitor),order:100,persistence:"closeable",loadView:async()=>new((await async function(){return re||(re=await import("../../panels/protocol_monitor/protocol_monitor.js")),re}()).ProtocolMonitor.ProtocolMonitorImpl),experiment:"protocol-monitor"});const le={workspace:"Workspace",showWorkspace:"Show Workspace settings",enableLocalOverrides:"Enable Local Overrides",interception:"interception",override:"override",network:"network",rewrite:"rewrite",request:"request",enableOverrideNetworkRequests:"Enable override network requests",disableOverrideNetworkRequests:"Disable override network requests",enableAutomaticWorkspaceFolders:"Enable automatic workspace folders"},ce=o.i18n.registerUIStrings("models/persistence/persistence-meta.ts",le),ge=o.i18n.getLazilyComputedLocalizedString.bind(void 0,ce);let de;async function ue(){return de||(de=await import("../../models/persistence/persistence.js")),de}c.ViewManager.registerViewExtension({location:"settings-view",id:"workspace",title:ge(le.workspace),commandPrompt:ge(le.showWorkspace),order:1,loadView:async()=>new((await ue()).WorkspaceSettingsTab.WorkspaceSettingsTab),iconName:"folder"}),e.Settings.registerSettingExtension({category:"PERSISTENCE",title:ge(le.enableAutomaticWorkspaceFolders),settingName:"persistence-automatic-workspace-folders",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({category:"PERSISTENCE",title:ge(le.enableLocalOverrides),settingName:"persistence-network-overrides-enabled",settingType:"boolean",defaultValue:!1,tags:[ge(le.interception),ge(le.override),ge(le.network),ge(le.rewrite),ge(le.request)],options:[{value:!0,title:ge(le.enableOverrideNetworkRequests)},{value:!1,title:ge(le.disableOverrideNetworkRequests)}]}),c.ContextMenu.registerProvider({contextTypes:()=>[s.UISourceCode.UISourceCode,a.Resource.Resource,a.NetworkRequest.NetworkRequest],loadProvider:async()=>new((await ue()).PersistenceActions.ContextMenuProvider),experiment:void 0});const pe={preserveLog:"Preserve log",preserve:"preserve",clear:"clear",reset:"reset",preserveLogOnPageReload:"Preserve log on page reload / navigation",doNotPreserveLogOnPageReload:"Do not preserve log on page reload / navigation",recordNetworkLog:"Record network log"},me=o.i18n.registerUIStrings("models/logs/logs-meta.ts",pe),Se=o.i18n.getLazilyComputedLocalizedString.bind(void 0,me);e.Settings.registerSettingExtension({category:"NETWORK",title:Se(pe.preserveLog),settingName:"network-log.preserve-log",settingType:"boolean",defaultValue:!1,tags:[Se(pe.preserve),Se(pe.clear),Se(pe.reset)],options:[{value:!0,title:Se(pe.preserveLogOnPageReload)},{value:!1,title:Se(pe.doNotPreserveLogOnPageReload)}]}),e.Settings.registerSettingExtension({category:"NETWORK",title:Se(pe.recordNetworkLog),settingName:"network-log.record-log",settingType:"boolean",defaultValue:!0,storageType:"Session"});const ye={focusDebuggee:"Focus page",toggleDrawer:"Toggle drawer",nextPanel:"Next panel",previousPanel:"Previous panel",reloadDevtools:"Reload DevTools",restoreLastDockPosition:"Restore last dock position",zoomIn:"Zoom in",zoomOut:"Zoom out",resetZoomLevel:"Reset zoom level",searchInPanel:"Search in panel",cancelSearch:"Cancel search",findNextResult:"Find next result",findPreviousResult:"Find previous result",theme:"Theme:",switchToBrowserPreferredTheme:"Switch to browser's preferred theme",autoTheme:"Auto",switchToLightTheme:"Switch to light theme",lightCapital:"Light",switchToDarkTheme:"Switch to dark theme",darkCapital:"Dark",darkLower:"dark",lightLower:"light",panelLayout:"Panel layout:",useHorizontalPanelLayout:"Use horizontal panel layout",horizontal:"horizontal",useVerticalPanelLayout:"Use vertical panel layout",vertical:"vertical",useAutomaticPanelLayout:"Use automatic panel layout",auto:"auto",enableCtrlShortcutToSwitchPanels:"Enable Ctrl + 1-9 shortcut to switch panels",enableShortcutToSwitchPanels:"Enable โŒ˜ + 1-9 shortcut to switch panels",right:"Right",dockToRight:"Dock to right",bottom:"Bottom",dockToBottom:"Dock to bottom",left:"Left",dockToLeft:"Dock to left",undocked:"Undocked",undockIntoSeparateWindow:"Undock into separate window",devtoolsDefault:"DevTools (Default)",language:"Language:",browserLanguage:"Browser UI language",enableSync:"Enable settings sync",searchAsYouTypeSetting:"Search as you type",searchAsYouTypeCommand:"Enable search as you type",searchOnEnterCommand:"Disable search as you type (press Enter to search)",matchChromeColorScheme:"Match Chrome color scheme",matchChromeColorSchemeDocumentation:"Match DevTools colors to your customized Chrome theme (when enabled)",matchChromeColorSchemeCommand:"Match Chrome color scheme",dontMatchChromeColorSchemeCommand:"Don't match Chrome color scheme"},we=o.i18n.registerUIStrings("entrypoints/main/main-meta.ts",ye),he=o.i18n.getLazilyComputedLocalizedString.bind(void 0,we);let ve,be;async function fe(){return ve||(ve=await import("../main/main.js")),ve}function Ae(){return!t.InspectorFrontendHost.InspectorFrontendHostInstance.isHostedMode()}function Ce(e){return()=>o.i18n.getLocalizedLanguageRegion(e,o.DevToolsLocale.DevToolsLocale.instance())}c.ActionRegistration.registerActionExtension({category:"DRAWER",actionId:"inspector-main.focus-debuggee",loadActionDelegate:async()=>new((await async function(){return be||(be=await import("../inspector_main/inspector_main.js")),be}()).InspectorMain.FocusDebuggeeActionDelegate),order:100,title:he(ye.focusDebuggee)}),c.ActionRegistration.registerActionExtension({category:"DRAWER",actionId:"main.toggle-drawer",loadActionDelegate:async()=>new c.InspectorView.ActionDelegate,order:101,title:he(ye.toggleDrawer),bindings:[{shortcut:"Esc"}]}),c.ActionRegistration.registerActionExtension({actionId:"main.next-tab",category:"GLOBAL",title:he(ye.nextPanel),loadActionDelegate:async()=>new c.InspectorView.ActionDelegate,bindings:[{platform:"windows,linux",shortcut:"Ctrl+]"},{platform:"mac",shortcut:"Meta+]"}]}),c.ActionRegistration.registerActionExtension({actionId:"main.previous-tab",category:"GLOBAL",title:he(ye.previousPanel),loadActionDelegate:async()=>new c.InspectorView.ActionDelegate,bindings:[{platform:"windows,linux",shortcut:"Ctrl+["},{platform:"mac",shortcut:"Meta+["}]}),c.ActionRegistration.registerActionExtension({actionId:"main.debug-reload",category:"GLOBAL",title:he(ye.reloadDevtools),loadActionDelegate:async()=>new((await fe()).MainImpl.ReloadActionDelegate),bindings:[{shortcut:"Alt+R"}]}),c.ActionRegistration.registerActionExtension({category:"GLOBAL",title:he(ye.restoreLastDockPosition),actionId:"main.toggle-dock",loadActionDelegate:async()=>new c.DockController.ToggleDockActionDelegate,bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+D"},{platform:"mac",shortcut:"Meta+Shift+D"}]}),c.ActionRegistration.registerActionExtension({actionId:"main.zoom-in",category:"GLOBAL",title:he(ye.zoomIn),loadActionDelegate:async()=>new((await fe()).MainImpl.ZoomActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Plus",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+Shift+Plus"},{platform:"windows,linux",shortcut:"Ctrl+NumpadPlus"},{platform:"windows,linux",shortcut:"Ctrl+Shift+NumpadPlus"},{platform:"mac",shortcut:"Meta+Plus",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+Shift+Plus"},{platform:"mac",shortcut:"Meta+NumpadPlus"},{platform:"mac",shortcut:"Meta+Shift+NumpadPlus"}],condition:Ae}),c.ActionRegistration.registerActionExtension({actionId:"main.zoom-out",category:"GLOBAL",title:he(ye.zoomOut),loadActionDelegate:async()=>new((await fe()).MainImpl.ZoomActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Minus",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+Shift+Minus"},{platform:"windows,linux",shortcut:"Ctrl+NumpadMinus"},{platform:"windows,linux",shortcut:"Ctrl+Shift+NumpadMinus"},{platform:"mac",shortcut:"Meta+Minus",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+Shift+Minus"},{platform:"mac",shortcut:"Meta+NumpadMinus"},{platform:"mac",shortcut:"Meta+Shift+NumpadMinus"}],condition:Ae}),c.ActionRegistration.registerActionExtension({actionId:"main.zoom-reset",category:"GLOBAL",title:he(ye.resetZoomLevel),loadActionDelegate:async()=>new((await fe()).MainImpl.ZoomActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+0"},{platform:"windows,linux",shortcut:"Ctrl+Numpad0"},{platform:"mac",shortcut:"Meta+Numpad0"},{platform:"mac",shortcut:"Meta+0"}],condition:Ae}),c.ActionRegistration.registerActionExtension({actionId:"main.search-in-panel.find",category:"GLOBAL",title:he(ye.searchInPanel),loadActionDelegate:async()=>new((await fe()).MainImpl.SearchActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+F",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+F",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"F3"}]}),c.ActionRegistration.registerActionExtension({actionId:"main.search-in-panel.cancel",category:"GLOBAL",title:he(ye.cancelSearch),loadActionDelegate:async()=>new((await fe()).MainImpl.SearchActionDelegate),order:10,bindings:[{shortcut:"Esc"}]}),c.ActionRegistration.registerActionExtension({actionId:"main.search-in-panel.find-next",category:"GLOBAL",title:he(ye.findNextResult),loadActionDelegate:async()=>new((await fe()).MainImpl.SearchActionDelegate),bindings:[{platform:"mac",shortcut:"Meta+G",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+G"},{platform:"windows,linux",shortcut:"F3",keybindSets:["devToolsDefault","vsCode"]}]}),c.ActionRegistration.registerActionExtension({actionId:"main.search-in-panel.find-previous",category:"GLOBAL",title:he(ye.findPreviousResult),loadActionDelegate:async()=>new((await fe()).MainImpl.SearchActionDelegate),bindings:[{platform:"mac",shortcut:"Meta+Shift+G",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+Shift+G"},{platform:"windows,linux",shortcut:"Shift+F3",keybindSets:["devToolsDefault","vsCode"]}]}),e.Settings.registerSettingExtension({category:"APPEARANCE",storageType:"Synced",title:he(ye.theme),settingName:"ui-theme",settingType:"enum",defaultValue:"systemPreferred",reloadRequired:!1,options:[{title:he(ye.switchToBrowserPreferredTheme),text:he(ye.autoTheme),value:"systemPreferred"},{title:he(ye.switchToLightTheme),text:he(ye.lightCapital),value:"default"},{title:he(ye.switchToDarkTheme),text:he(ye.darkCapital),value:"dark"}],tags:[he(ye.darkLower),he(ye.lightLower)]}),e.Settings.registerSettingExtension({category:"APPEARANCE",storageType:"Synced",title:he(ye.matchChromeColorScheme),settingName:"chrome-theme-colors",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:he(ye.matchChromeColorSchemeCommand)},{value:!1,title:he(ye.dontMatchChromeColorSchemeCommand)}],reloadRequired:!0,learnMore:{url:"https://goo.gle/devtools-customize-theme",tooltip:he(ye.matchChromeColorSchemeDocumentation)}}),e.Settings.registerSettingExtension({category:"APPEARANCE",storageType:"Synced",title:he(ye.panelLayout),settingName:"sidebar-position",settingType:"enum",defaultValue:"auto",options:[{title:he(ye.useHorizontalPanelLayout),text:he(ye.horizontal),value:"bottom"},{title:he(ye.useVerticalPanelLayout),text:he(ye.vertical),value:"right"},{title:he(ye.useAutomaticPanelLayout),text:he(ye.auto),value:"auto"}]}),e.Settings.registerSettingExtension({category:"APPEARANCE",storageType:"Synced",settingName:"language",settingType:"enum",title:he(ye.language),defaultValue:"en-US",options:[{value:"browserLanguage",title:he(ye.browserLanguage),text:he(ye.browserLanguage)},...o.i18n.getAllSupportedDevToolsLocales().sort().map((e=>{return{value:t=e,title:Ce(t),text:Ce(t)};var t}))],reloadRequired:!0}),e.Settings.registerSettingExtension({category:"APPEARANCE",storageType:"Synced",title:"mac"===t.Platform.platform()?he(ye.enableShortcutToSwitchPanels):he(ye.enableCtrlShortcutToSwitchPanels),settingName:"shortcut-panel-switch",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({category:"GLOBAL",settingName:"currentDockState",settingType:"enum",defaultValue:"right",options:[{value:"right",text:he(ye.right),title:he(ye.dockToRight)},{value:"bottom",text:he(ye.bottom),title:he(ye.dockToBottom)},{value:"left",text:he(ye.left),title:he(ye.dockToLeft)},{value:"undocked",text:he(ye.undocked),title:he(ye.undockIntoSeparateWindow)}]}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"active-keybind-set",settingType:"enum",defaultValue:"devToolsDefault",options:[{value:"devToolsDefault",title:he(ye.devtoolsDefault),text:he(ye.devtoolsDefault)},{value:"vsCode",title:o.i18n.lockedLazyString("Visual Studio Code"),text:o.i18n.lockedLazyString("Visual Studio Code")}]}),e.Settings.registerSettingExtension({category:"SYNC",settingName:"sync-preferences",settingType:"boolean",title:he(ye.enableSync),defaultValue:!1,reloadRequired:!0}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"user-shortcuts",settingType:"array",defaultValue:[]}),e.Settings.registerSettingExtension({category:"GLOBAL",storageType:"Local",title:he(ye.searchAsYouTypeSetting),settingName:"search-as-you-type",settingType:"boolean",order:3,defaultValue:!0,options:[{value:!0,title:he(ye.searchAsYouTypeCommand)},{value:!1,title:he(ye.searchOnEnterCommand)}]}),c.ViewManager.registerLocationResolver({name:"drawer-view",category:"DRAWER",loadResolver:async()=>c.InspectorView.InspectorView.instance()}),c.ViewManager.registerLocationResolver({name:"drawer-sidebar",category:"DRAWER_SIDEBAR",loadResolver:async()=>c.InspectorView.InspectorView.instance()}),c.ViewManager.registerLocationResolver({name:"panel",category:"PANEL",loadResolver:async()=>c.InspectorView.InspectorView.instance()}),c.ContextMenu.registerProvider({contextTypes:()=>[s.UISourceCode.UISourceCode,a.Resource.Resource,a.NetworkRequest.NetworkRequest],loadProvider:async()=>new d.Linkifier.ContentProviderContextMenuProvider,experiment:void 0}),c.ContextMenu.registerProvider({contextTypes:()=>[Node],loadProvider:async()=>new c.XLink.ContextMenuProvider,experiment:void 0}),c.ContextMenu.registerProvider({contextTypes:()=>[Node],loadProvider:async()=>new d.Linkifier.LinkContextMenuProvider,experiment:void 0}),c.Toolbar.registerToolbarItem({separator:!0,location:"main-toolbar-left",order:100}),c.Toolbar.registerToolbarItem({separator:!0,order:97,location:"main-toolbar-right"}),c.Toolbar.registerToolbarItem({loadItem:async()=>(await fe()).MainImpl.SettingsButtonProvider.instance(),order:99,location:"main-toolbar-right"}),c.Toolbar.registerToolbarItem({loadItem:async()=>(await fe()).MainImpl.MainMenuItem.instance(),order:100,location:"main-toolbar-right"}),c.Toolbar.registerToolbarItem({loadItem:async()=>c.DockController.CloseButtonProvider.instance(),order:101,location:"main-toolbar-right"}),e.AppProvider.registerAppProvider({loadAppProvider:async()=>(await fe()).SimpleApp.SimpleAppProvider.instance(),order:10});const xe={flamechartSelectedNavigation:"Flamechart navigation:",modern:"Modern",classic:"Classic",liveMemoryAllocationAnnotations:"Live memory allocation annotations",showLiveMemoryAllocation:"Show live memory allocation annotations",hideLiveMemoryAllocation:"Hide live memory allocation annotations",collectGarbage:"Collect garbage"},Ee=o.i18n.registerUIStrings("ui/legacy/components/perf_ui/perf_ui-meta.ts",xe),Te=o.i18n.getLazilyComputedLocalizedString.bind(void 0,Ee);let Re;c.ActionRegistration.registerActionExtension({actionId:"components.collect-garbage",category:"PERFORMANCE",title:Te(xe.collectGarbage),iconClass:"mop",loadActionDelegate:async()=>new((await async function(){return Re||(Re=await import("../../ui/legacy/components/perf_ui/perf_ui.js")),Re}()).GCActionDelegate.GCActionDelegate)}),e.Settings.registerSettingExtension({category:"PERFORMANCE",storageType:"Synced",title:Te(xe.flamechartSelectedNavigation),settingName:"flamechart-selected-navigation",settingType:"enum",defaultValue:"classic",options:[{title:Te(xe.modern),text:Te(xe.modern),value:"modern"},{title:Te(xe.classic),text:Te(xe.classic),value:"classic"}]}),e.Settings.registerSettingExtension({category:"MEMORY",experiment:"live-heap-profile",title:Te(xe.liveMemoryAllocationAnnotations),settingName:"memory-live-heap-profile",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:Te(xe.showLiveMemoryAllocation)},{value:!1,title:Te(xe.hideLiveMemoryAllocation)}]});const De={openFile:"Open file",runCommand:"Run command"},Pe=o.i18n.registerUIStrings("ui/legacy/components/quick_open/quick_open-meta.ts",De),ke=o.i18n.getLazilyComputedLocalizedString.bind(void 0,Pe);let Ie;async function Ne(){return Ie||(Ie=await import("../../ui/legacy/components/quick_open/quick_open.js")),Ie}c.ActionRegistration.registerActionExtension({actionId:"quick-open.show-command-menu",category:"GLOBAL",title:ke(De.runCommand),loadActionDelegate:async()=>new((await Ne()).CommandMenu.ShowActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+P",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+Shift+P",keybindSets:["devToolsDefault","vsCode"]},{shortcut:"F1",keybindSets:["vsCode"]}]}),c.ActionRegistration.registerActionExtension({actionId:"quick-open.show",category:"GLOBAL",title:ke(De.openFile),loadActionDelegate:async()=>new((await Ne()).QuickOpen.ShowActionDelegate),order:100,bindings:[{platform:"mac",shortcut:"Meta+P",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+O",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+P",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+O",keybindSets:["devToolsDefault","vsCode"]}]}),c.ContextMenu.registerItem({location:"mainMenu/default",actionId:"quick-open.show-command-menu",order:void 0}),c.ContextMenu.registerItem({location:"mainMenu/default",actionId:"quick-open.show",order:void 0});const Ve={preserveLogUponNavigation:"Preserve log upon navigation",doNotPreserveLogUponNavigation:"Do not preserve log upon navigation",pauseOnExceptions:"Pause on exceptions",doNotPauseOnExceptions:"Do not pause on exceptions",disableJavascript:"Disable JavaScript",enableJavascript:"Enable JavaScript",disableAsyncStackTraces:"Disable async stack traces",doNotCaptureAsyncStackTraces:"Do not capture async stack traces",captureAsyncStackTraces:"Capture async stack traces",showRulersOnHover:"Show rulers on hover",doNotShowRulersOnHover:"Do not show rulers on hover",showAreaNames:"Show area names",showGridNamedAreas:"Show grid named areas",doNotShowGridNamedAreas:"Do not show grid named areas",showTrackSizes:"Show track sizes",showGridTrackSizes:"Show grid track sizes",doNotShowGridTrackSizes:"Do not show grid track sizes",extendGridLines:"Extend grid lines",doNotExtendGridLines:"Do not extend grid lines",showLineLabels:"Show line labels",hideLineLabels:"Hide line labels",showLineNumbers:"Show line numbers",showLineNames:"Show line names",showPaintFlashingRectangles:"Show paint flashing rectangles",hidePaintFlashingRectangles:"Hide paint flashing rectangles",showLayoutShiftRegions:"Show layout shift regions",hideLayoutShiftRegions:"Hide layout shift regions",highlightAdFrames:"Highlight ad frames",doNotHighlightAdFrames:"Do not highlight ad frames",showLayerBorders:"Show layer borders",hideLayerBorders:"Hide layer borders",showFramesPerSecondFpsMeter:"Show frames per second (FPS) meter",hideFramesPerSecondFpsMeter:"Hide frames per second (FPS) meter",showScrollPerformanceBottlenecks:"Show scroll performance bottlenecks",hideScrollPerformanceBottlenecks:"Hide scroll performance bottlenecks",emulateAFocusedPage:"Emulate a focused page",doNotEmulateAFocusedPage:"Do not emulate a focused page",doNotEmulateCssMediaType:"Do not emulate CSS media type",noEmulation:"No emulation",emulateCssPrintMediaType:"Emulate CSS print media type",print:"print",emulateCssScreenMediaType:"Emulate CSS screen media type",screen:"screen",query:"query",emulateCssMediaType:"Emulate CSS media type",doNotEmulateCss:"Do not emulate CSS {PH1}",emulateCss:"Emulate CSS {PH1}",emulateCssMediaFeature:"Emulate CSS media feature {PH1}",doNotEmulateAnyVisionDeficiency:"Do not emulate any vision deficiency",emulateBlurredVision:"Emulate blurred vision",emulateReducedContrast:"Emulate reduced contrast",blurredVision:"Blurred vision",reducedContrast:"Reduced contrast",emulateProtanopia:"Emulate protanopia (no red)",protanopia:"Protanopia (no red)",emulateDeuteranopia:"Emulate deuteranopia (no green)",deuteranopia:"Deuteranopia (no green)",emulateTritanopia:"Emulate tritanopia (no blue)",tritanopia:"Tritanopia (no blue)",emulateAchromatopsia:"Emulate achromatopsia (no color)",achromatopsia:"Achromatopsia (no color)",emulateVisionDeficiencies:"Emulate vision deficiencies",disableLocalFonts:"Disable local fonts",enableLocalFonts:"Enable local fonts",disableAvifFormat:"Disable `AVIF` format",enableAvifFormat:"Enable `AVIF` format",disableWebpFormat:"Disable `WebP` format",enableWebpFormat:"Enable `WebP` format",customFormatters:"Custom formatters",networkRequestBlocking:"Network request blocking",enableNetworkRequestBlocking:"Enable network request blocking",disableNetworkRequestBlocking:"Disable network request blocking",enableCache:"Enable cache",disableCache:"Disable cache while DevTools is open",emulateAutoDarkMode:"Emulate auto dark mode",enableRemoteFileLoading:"Allow `DevTools` to load resources, such as source maps, from remote file paths. Disabled by default for security reasons.",networkCacheExplanation:"Disabling the network cache will simulate a network experience similar to a first time visitor."},Le=o.i18n.registerUIStrings("core/sdk/sdk-meta.ts",Ve),Me=o.i18n.getLazilyComputedLocalizedString.bind(void 0,Le);e.Settings.registerSettingExtension({storageType:"Synced",settingName:"skip-stack-frames-pattern",settingType:"regex",defaultValue:""}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"skip-content-scripts",settingType:"boolean",defaultValue:!0}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"automatically-ignore-list-known-third-party-scripts",settingType:"boolean",defaultValue:!0}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"skip-anonymous-scripts",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"enable-ignore-listing",settingType:"boolean",defaultValue:!0}),e.Settings.registerSettingExtension({category:"CONSOLE",storageType:"Synced",title:Me(Ve.preserveLogUponNavigation),settingName:"preserve-console-log",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:Me(Ve.preserveLogUponNavigation)},{value:!1,title:Me(Ve.doNotPreserveLogUponNavigation)}]}),e.Settings.registerSettingExtension({category:"DEBUGGER",settingName:"pause-on-exception-enabled",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:Me(Ve.pauseOnExceptions)},{value:!1,title:Me(Ve.doNotPauseOnExceptions)}]}),e.Settings.registerSettingExtension({settingName:"pause-on-caught-exception",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({settingName:"pause-on-uncaught-exception",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({category:"DEBUGGER",title:Me(Ve.disableJavascript),settingName:"java-script-disabled",settingType:"boolean",storageType:"Session",order:1,defaultValue:!1,options:[{value:!0,title:Me(Ve.disableJavascript)},{value:!1,title:Me(Ve.enableJavascript)}]}),e.Settings.registerSettingExtension({category:"DEBUGGER",title:Me(Ve.disableAsyncStackTraces),settingName:"disable-async-stack-traces",settingType:"boolean",defaultValue:!1,order:2,options:[{value:!0,title:Me(Ve.doNotCaptureAsyncStackTraces)},{value:!1,title:Me(Ve.captureAsyncStackTraces)}]}),e.Settings.registerSettingExtension({category:"DEBUGGER",settingName:"breakpoints-active",settingType:"boolean",storageType:"Session",defaultValue:!0}),e.Settings.registerSettingExtension({category:"ELEMENTS",storageType:"Synced",title:Me(Ve.showRulersOnHover),settingName:"show-metrics-rulers",settingType:"boolean",options:[{value:!0,title:Me(Ve.showRulersOnHover)},{value:!1,title:Me(Ve.doNotShowRulersOnHover)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"GRID",storageType:"Synced",title:Me(Ve.showAreaNames),settingName:"show-grid-areas",settingType:"boolean",options:[{value:!0,title:Me(Ve.showGridNamedAreas)},{value:!1,title:Me(Ve.doNotShowGridNamedAreas)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"GRID",storageType:"Synced",title:Me(Ve.showTrackSizes),settingName:"show-grid-track-sizes",settingType:"boolean",options:[{value:!0,title:Me(Ve.showGridTrackSizes)},{value:!1,title:Me(Ve.doNotShowGridTrackSizes)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"GRID",storageType:"Synced",title:Me(Ve.extendGridLines),settingName:"extend-grid-lines",settingType:"boolean",options:[{value:!0,title:Me(Ve.extendGridLines)},{value:!1,title:Me(Ve.doNotExtendGridLines)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"GRID",storageType:"Synced",title:Me(Ve.showLineLabels),settingName:"show-grid-line-labels",settingType:"enum",options:[{title:Me(Ve.hideLineLabels),text:Me(Ve.hideLineLabels),value:"none"},{title:Me(Ve.showLineNumbers),text:Me(Ve.showLineNumbers),value:"lineNumbers"},{title:Me(Ve.showLineNames),text:Me(Ve.showLineNames),value:"lineNames"}],defaultValue:"lineNumbers"}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"show-paint-rects",settingType:"boolean",storageType:"Session",options:[{value:!0,title:Me(Ve.showPaintFlashingRectangles)},{value:!1,title:Me(Ve.hidePaintFlashingRectangles)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"show-layout-shift-regions",settingType:"boolean",storageType:"Session",options:[{value:!0,title:Me(Ve.showLayoutShiftRegions)},{value:!1,title:Me(Ve.hideLayoutShiftRegions)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"show-ad-highlights",settingType:"boolean",storageType:"Session",options:[{value:!0,title:Me(Ve.highlightAdFrames)},{value:!1,title:Me(Ve.doNotHighlightAdFrames)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"show-debug-borders",settingType:"boolean",storageType:"Session",options:[{value:!0,title:Me(Ve.showLayerBorders)},{value:!1,title:Me(Ve.hideLayerBorders)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"show-fps-counter",settingType:"boolean",storageType:"Session",options:[{value:!0,title:Me(Ve.showFramesPerSecondFpsMeter)},{value:!1,title:Me(Ve.hideFramesPerSecondFpsMeter)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"show-scroll-bottleneck-rects",settingType:"boolean",storageType:"Session",options:[{value:!0,title:Me(Ve.showScrollPerformanceBottlenecks)},{value:!1,title:Me(Ve.hideScrollPerformanceBottlenecks)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",title:Me(Ve.emulateAFocusedPage),settingName:"emulate-page-focus",settingType:"boolean",storageType:"Local",defaultValue:!1,options:[{value:!0,title:Me(Ve.emulateAFocusedPage)},{value:!1,title:Me(Ve.doNotEmulateAFocusedPage)}]}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"emulated-css-media",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:Me(Ve.doNotEmulateCssMediaType),text:Me(Ve.noEmulation),value:""},{title:Me(Ve.emulateCssPrintMediaType),text:Me(Ve.print),value:"print"},{title:Me(Ve.emulateCssScreenMediaType),text:Me(Ve.screen),value:"screen"}],tags:[Me(Ve.query)],title:Me(Ve.emulateCssMediaType)}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"emulated-css-media-feature-prefers-color-scheme",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:Me(Ve.doNotEmulateCss,{PH1:"prefers-color-scheme"}),text:Me(Ve.noEmulation),value:""},{title:Me(Ve.emulateCss,{PH1:"prefers-color-scheme: light"}),text:o.i18n.lockedLazyString("prefers-color-scheme: light"),value:"light"},{title:Me(Ve.emulateCss,{PH1:"prefers-color-scheme: dark"}),text:o.i18n.lockedLazyString("prefers-color-scheme: dark"),value:"dark"}],tags:[Me(Ve.query)],title:Me(Ve.emulateCssMediaFeature,{PH1:"prefers-color-scheme"})}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"emulated-css-media-feature-forced-colors",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:Me(Ve.doNotEmulateCss,{PH1:"forced-colors"}),text:Me(Ve.noEmulation),value:""},{title:Me(Ve.emulateCss,{PH1:"forced-colors: active"}),text:o.i18n.lockedLazyString("forced-colors: active"),value:"active"},{title:Me(Ve.emulateCss,{PH1:"forced-colors: none"}),text:o.i18n.lockedLazyString("forced-colors: none"),value:"none"}],tags:[Me(Ve.query)],title:Me(Ve.emulateCssMediaFeature,{PH1:"forced-colors"})}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"emulated-css-media-feature-prefers-reduced-motion",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:Me(Ve.doNotEmulateCss,{PH1:"prefers-reduced-motion"}),text:Me(Ve.noEmulation),value:""},{title:Me(Ve.emulateCss,{PH1:"prefers-reduced-motion: reduce"}),text:o.i18n.lockedLazyString("prefers-reduced-motion: reduce"),value:"reduce"}],tags:[Me(Ve.query)],title:Me(Ve.emulateCssMediaFeature,{PH1:"prefers-reduced-motion"})}),e.Settings.registerSettingExtension({settingName:"emulated-css-media-feature-prefers-contrast",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:Me(Ve.doNotEmulateCss,{PH1:"prefers-contrast"}),text:Me(Ve.noEmulation),value:""},{title:Me(Ve.emulateCss,{PH1:"prefers-contrast: more"}),text:o.i18n.lockedLazyString("prefers-contrast: more"),value:"more"},{title:Me(Ve.emulateCss,{PH1:"prefers-contrast: less"}),text:o.i18n.lockedLazyString("prefers-contrast: less"),value:"less"},{title:Me(Ve.emulateCss,{PH1:"prefers-contrast: custom"}),text:o.i18n.lockedLazyString("prefers-contrast: custom"),value:"custom"}],tags:[Me(Ve.query)],title:Me(Ve.emulateCssMediaFeature,{PH1:"prefers-contrast"})}),e.Settings.registerSettingExtension({settingName:"emulated-css-media-feature-prefers-reduced-data",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:Me(Ve.doNotEmulateCss,{PH1:"prefers-reduced-data"}),text:Me(Ve.noEmulation),value:""},{title:Me(Ve.emulateCss,{PH1:"prefers-reduced-data: reduce"}),text:o.i18n.lockedLazyString("prefers-reduced-data: reduce"),value:"reduce"}],title:Me(Ve.emulateCssMediaFeature,{PH1:"prefers-reduced-data"})}),e.Settings.registerSettingExtension({settingName:"emulated-css-media-feature-prefers-reduced-transparency",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:Me(Ve.doNotEmulateCss,{PH1:"prefers-reduced-transparency"}),text:Me(Ve.noEmulation),value:""},{title:Me(Ve.emulateCss,{PH1:"prefers-reduced-transparency: reduce"}),text:o.i18n.lockedLazyString("prefers-reduced-transparency: reduce"),value:"reduce"}],title:Me(Ve.emulateCssMediaFeature,{PH1:"prefers-reduced-transparency"})}),e.Settings.registerSettingExtension({settingName:"emulated-css-media-feature-color-gamut",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:Me(Ve.doNotEmulateCss,{PH1:"color-gamut"}),text:Me(Ve.noEmulation),value:""},{title:Me(Ve.emulateCss,{PH1:"color-gamut: srgb"}),text:o.i18n.lockedLazyString("color-gamut: srgb"),value:"srgb"},{title:Me(Ve.emulateCss,{PH1:"color-gamut: p3"}),text:o.i18n.lockedLazyString("color-gamut: p3"),value:"p3"},{title:Me(Ve.emulateCss,{PH1:"color-gamut: rec2020"}),text:o.i18n.lockedLazyString("color-gamut: rec2020"),value:"rec2020"}],title:Me(Ve.emulateCssMediaFeature,{PH1:"color-gamut"})}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"emulated-vision-deficiency",settingType:"enum",storageType:"Session",defaultValue:"none",options:[{title:Me(Ve.doNotEmulateAnyVisionDeficiency),text:Me(Ve.noEmulation),value:"none"},{title:Me(Ve.emulateBlurredVision),text:Me(Ve.blurredVision),value:"blurredVision"},{title:Me(Ve.emulateReducedContrast),text:Me(Ve.reducedContrast),value:"reducedContrast"},{title:Me(Ve.emulateProtanopia),text:Me(Ve.protanopia),value:"protanopia"},{title:Me(Ve.emulateDeuteranopia),text:Me(Ve.deuteranopia),value:"deuteranopia"},{title:Me(Ve.emulateTritanopia),text:Me(Ve.tritanopia),value:"tritanopia"},{title:Me(Ve.emulateAchromatopsia),text:Me(Ve.achromatopsia),value:"achromatopsia"}],tags:[Me(Ve.query)],title:Me(Ve.emulateVisionDeficiencies)}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"local-fonts-disabled",settingType:"boolean",storageType:"Session",options:[{value:!0,title:Me(Ve.disableLocalFonts)},{value:!1,title:Me(Ve.enableLocalFonts)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"avif-format-disabled",settingType:"boolean",storageType:"Session",options:[{value:!0,title:Me(Ve.disableAvifFormat)},{value:!1,title:Me(Ve.enableAvifFormat)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",settingName:"webp-format-disabled",settingType:"boolean",storageType:"Session",options:[{value:!0,title:Me(Ve.disableWebpFormat)},{value:!1,title:Me(Ve.enableWebpFormat)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"CONSOLE",title:Me(Ve.customFormatters),settingName:"custom-formatters",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({category:"",title:Me(Ve.networkRequestBlocking),settingName:"request-blocking-enabled",settingType:"boolean",storageType:"Session",defaultValue:!1,options:[{value:!0,title:Me(Ve.enableNetworkRequestBlocking)},{value:!1,title:Me(Ve.disableNetworkRequestBlocking)}]}),e.Settings.registerSettingExtension({category:"NETWORK",title:Me(Ve.disableCache),settingName:"cache-disabled",settingType:"boolean",order:0,defaultValue:!1,userActionCondition:"hasOtherClients",options:[{value:!0,title:Me(Ve.disableCache)},{value:!1,title:Me(Ve.enableCache)}],learnMore:{tooltip:Me(Ve.networkCacheExplanation)}}),e.Settings.registerSettingExtension({category:"RENDERING",title:Me(Ve.emulateAutoDarkMode),settingName:"emulate-auto-dark-mode",settingType:"boolean",storageType:"Session",defaultValue:!1}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:Me(Ve.enableRemoteFileLoading),settingName:"network.enable-remote-file-loading",settingType:"boolean",defaultValue:!1});const Oe={defaultIndentation:"Default indentation:",setIndentationToSpaces:"Set indentation to 2 spaces",Spaces:"2 spaces",setIndentationToFSpaces:"Set indentation to 4 spaces",fSpaces:"4 spaces",setIndentationToESpaces:"Set indentation to 8 spaces",eSpaces:"8 spaces",setIndentationToTabCharacter:"Set indentation to tab character",tabCharacter:"Tab character"},Fe=o.i18n.registerUIStrings("ui/legacy/components/source_frame/source_frame-meta.ts",Oe),Ue=o.i18n.getLazilyComputedLocalizedString.bind(void 0,Fe);let Ge,Be;e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:Ue(Oe.defaultIndentation),settingName:"text-editor-indent",settingType:"enum",defaultValue:" ",options:[{title:Ue(Oe.setIndentationToSpaces),text:Ue(Oe.Spaces),value:" "},{title:Ue(Oe.setIndentationToFSpaces),text:Ue(Oe.fSpaces),value:" "},{title:Ue(Oe.setIndentationToESpaces),text:Ue(Oe.eSpaces),value:" "},{title:Ue(Oe.setIndentationToTabCharacter),text:Ue(Oe.tabCharacter),value:"\t"}]}),c.Toolbar.registerToolbarItem({loadItem:async()=>(await async function(){return Ge||(Ge=await import("../../panels/console_counters/console_counters.js")),Ge}()).WarningErrorCounter.WarningErrorCounter.instance(),order:1,location:"main-toolbar-right"}),c.UIUtils.registerRenderer({contextTypes:()=>[a.RemoteObject.RemoteObject],loadRenderer:async()=>(await async function(){return Be||(Be=await import("../../ui/legacy/components/object_ui/object_ui.js")),Be}()).ObjectPropertiesSection.Renderer.instance()});const He={explainThisError:"Understand this error",explainThisWarning:"Understand this warning",explainThisMessage:"Understand this message",enableConsoleInsights:"Understand console messages with AI",wrongLocale:"To use this feature, set your language preference to English in DevTools settings.",geoRestricted:"This feature is unavailable in your region.",policyRestricted:"This setting is managed by your administrator."},We=o.i18n.registerUIStrings("panels/explain/explain-meta.ts",He),ze=o.i18n.getLazilyComputedLocalizedString.bind(void 0,We),je=o.i18n.getLocalizedString.bind(void 0,We),qe=[{actionId:"explain.console-message.hover",title:ze(He.explainThisMessage),contextTypes:()=>[u.ConsoleViewMessage.ConsoleViewMessage]},{actionId:"explain.console-message.context.error",title:ze(He.explainThisError),contextTypes:()=>[]},{actionId:"explain.console-message.context.warning",title:ze(He.explainThisWarning),contextTypes:()=>[]},{actionId:"explain.console-message.context.other",title:ze(He.explainThisMessage),contextTypes:()=>[]}];function _e(e){return!0===e?.aidaAvailability?.blockedByEnterprisePolicy}function Je(e){return!0===(e?.aidaAvailability?.enabled&&e?.devToolsConsoleInsights?.enabled)}e.Settings.registerSettingExtension({category:"AI",settingName:"console-insights-enabled",settingType:"boolean",title:ze(He.enableConsoleInsights),defaultValue:!1,reloadRequired:!1,condition:e=>Je(e),disabledCondition:e=>{const t=[];return function(e){return!0===e?.aidaAvailability?.blockedByGeo}(e)&&t.push(je(He.geoRestricted)),_e(e)&&t.push(je(He.policyRestricted)),o.DevToolsLocale.DevToolsLocale.instance().locale.startsWith("en-")||t.push(je(He.wrongLocale)),t.length>0?{disabled:!0,reasons:t}:{disabled:!1}}});for(const e of qe)c.ActionRegistration.registerActionExtension({...e,category:"CONSOLE",loadActionDelegate:async()=>new((await import("../../panels/explain/explain.js")).ActionDelegate),condition:e=>Je(e)&&!_e(e)});const Ye={aiAssistance:"AI assistance",showAiAssistance:"Show AI assistance",enableAiAssistance:"Enable AI assistance",askAi:"Ask AI",wrongLocale:"To use this feature, set your language preference to English in DevTools settings.",geoRestricted:"This feature is unavailable in your region.",policyRestricted:"This setting is managed by your administrator."},Qe=o.i18n.registerUIStrings("panels/ai_assistance/ai_assistance-meta.ts",Ye),Ke=o.i18n.getLocalizedString.bind(void 0,Qe),Ze=o.i18n.getLazilyComputedLocalizedString.bind(void 0,Qe);function Xe(e){return!0===e?.aidaAvailability?.blockedByEnterprisePolicy}let $e;async function et(){return $e||($e=await import("../../panels/ai_assistance/ai_assistance.js")),$e}function tt(e){return!0===(e?.aidaAvailability?.enabled&&e?.devToolsFreestyler?.enabled)}function ot(e){return!0===(e?.aidaAvailability?.enabled&&e?.devToolsAiAssistanceNetworkAgent?.enabled)}function it(e){return!0===(e?.aidaAvailability?.enabled&&e?.devToolsAiAssistancePerformanceAgent?.enabled)}function at(e){return!0===(e?.aidaAvailability?.enabled&&e?.devToolsAiAssistanceFileAgent?.enabled)}function nt(e){return tt(e)||ot(e)||it(e)||at(e)}c.ViewManager.registerViewExtension({location:"drawer-view",id:"freestyler",commandPrompt:Ze(Ye.showAiAssistance),title:Ze(Ye.aiAssistance),order:10,isPreviewFeature:!0,persistence:"closeable",hasToolbar:!1,condition:e=>nt(e)&&!Xe(e),async loadView(){const e=await et();return await e.AiAssistancePanel.instance()}}),e.Settings.registerSettingExtension({category:"AI",settingName:"ai-assistance-enabled",settingType:"boolean",title:Ze(Ye.enableAiAssistance),defaultValue:!1,reloadRequired:!1,condition:nt,disabledCondition:e=>{const t=[];return function(e){return!0===e?.aidaAvailability?.blockedByGeo}(e)&&t.push(Ke(Ye.geoRestricted)),Xe(e)&&t.push(Ke(Ye.policyRestricted)),o.DevToolsLocale.DevToolsLocale.instance().locale.startsWith("en-")||t.push(Ke(Ye.wrongLocale)),t.length>0?{disabled:!0,reasons:t}:{disabled:!1}}}),c.ActionRegistration.registerActionExtension({actionId:"freestyler.elements-floating-button",contextTypes:()=>[],category:"GLOBAL",title:Ze(Ye.askAi),loadActionDelegate:async()=>new((await et()).ActionDelegate),condition:e=>tt(e)&&!Xe(e)}),c.ActionRegistration.registerActionExtension({actionId:"freestyler.element-panel-context",contextTypes:()=>[],category:"GLOBAL",title:Ze(Ye.askAi),loadActionDelegate:async()=>new((await et()).ActionDelegate),condition:e=>tt(e)&&!Xe(e)}),c.ActionRegistration.registerActionExtension({actionId:"drjones.network-floating-button",contextTypes:()=>[],category:"GLOBAL",title:Ze(Ye.askAi),loadActionDelegate:async()=>new((await et()).ActionDelegate),condition:e=>ot(e)&&!Xe(e)}),c.ActionRegistration.registerActionExtension({actionId:"drjones.network-panel-context",contextTypes:()=>[],category:"GLOBAL",title:Ze(Ye.askAi),loadActionDelegate:async()=>new((await et()).ActionDelegate),condition:e=>ot(e)&&!Xe(e)}),c.ActionRegistration.registerActionExtension({actionId:"drjones.performance-panel-context",contextTypes:()=>[],category:"GLOBAL",title:Ze(Ye.askAi),loadActionDelegate:async()=>new((await et()).ActionDelegate),condition:e=>it(e)&&!Xe(e)}),c.ActionRegistration.registerActionExtension({actionId:"drjones.performance-insight-context",contextTypes:()=>[],category:"GLOBAL",title:Ze(Ye.askAi),loadActionDelegate:async()=>new((await et()).ActionDelegate),condition:e=>function(e){return!0===(e?.aidaAvailability?.enabled&&e?.devToolsAiAssistancePerformanceAgent?.enabled&&e?.devToolsAiAssistancePerformanceAgent.insightsEnabled)}(e)&&!Xe(e)}),c.ActionRegistration.registerActionExtension({actionId:"drjones.sources-floating-button",contextTypes:()=>[],category:"GLOBAL",title:Ze(Ye.askAi),loadActionDelegate:async()=>new((await et()).ActionDelegate),condition:e=>at(e)&&!Xe(e)}),c.ActionRegistration.registerActionExtension({actionId:"drjones.sources-panel-context",contextTypes:()=>[],category:"GLOBAL",title:Ze(Ye.askAi),loadActionDelegate:async()=>new((await et()).ActionDelegate),condition:e=>at(e)&&!Xe(e)}); +import"../../Images/Images.js";import"../../core/dom_extension/dom_extension.js";import*as e from"../../core/common/common.js";import*as t from"../../core/host/host.js";import*as o from"../../core/i18n/i18n.js";import*as i from"../../core/root/root.js";import*as a from"../../core/sdk/sdk.js";import*as n from"../../models/breakpoints/breakpoints.js";import*as s from"../../models/workspace/workspace.js";import*as r from"../../ui/legacy/components/object_ui/object_ui.js";import*as l from"../../ui/legacy/components/quick_open/quick_open.js";import*as c from"../../ui/legacy/legacy.js";import*as g from"../../ui/components/legacy_wrapper/legacy_wrapper.js";import*as d from"../../ui/legacy/components/utils/utils.js";import*as u from"../../panels/console/console.js";import"../main/main.js";navigator.userAgent.includes("Chrome")||alert("DevTools is only supported in Chrome, Edge and other Blink-based browsers.\n\nOpen this page in a compatible browser to continue.");const p={showSources:"Show Sources",sources:"Sources",showWorkspace:"Show Workspace",workspace:"Workspace",showSnippets:"Show Snippets",snippets:"Snippets",showSearch:"Show Search",search:"Search",showQuickSource:"Show Quick source",quickSource:"Quick source",showThreads:"Show Threads",threads:"Threads",showScope:"Show Scope",scope:"Scope",showWatch:"Show Watch",watch:"Watch",showBreakpoints:"Show Breakpoints",breakpoints:"Breakpoints",pauseScriptExecution:"Pause script execution",resumeScriptExecution:"Resume script execution",stepOverNextFunctionCall:"Step over next function call",stepIntoNextFunctionCall:"Step into next function call",step:"Step",stepOutOfCurrentFunction:"Step out of current function",runSnippet:"Run snippet",deactivateBreakpoints:"Deactivate breakpoints",activateBreakpoints:"Activate breakpoints",addSelectedTextToWatches:"Add selected text to watches",evaluateSelectedTextInConsole:"Evaluate selected text in console",switchFile:"Switch file",rename:"Rename",closeAll:"Close all",jumpToPreviousEditingLocation:"Jump to previous editing location",jumpToNextEditingLocation:"Jump to next editing location",closeTheActiveTab:"Close the active tab",goToLine:"Go to line",goToAFunctionDeclarationruleSet:"Go to a function declaration/rule set",toggleBreakpoint:"Toggle breakpoint",toggleBreakpointEnabled:"Toggle breakpoint enabled",toggleBreakpointInputWindow:"Toggle breakpoint input window",save:"Save",saveAll:"Save all",createNewSnippet:"Create new snippet",addFolderToWorkspace:"Add folder to workspace",addFolder:"Add folder",previousCallFrame:"Previous call frame",nextCallFrame:"Next call frame",incrementCssUnitBy:"Increment CSS unit by {PH1}",decrementCssUnitBy:"Decrement CSS unit by {PH1}",searchInAnonymousAndContent:"Search in anonymous and content scripts",doNotSearchInAnonymousAndContent:"Do not search in anonymous and content scripts",automaticallyRevealFilesIn:"Automatically reveal files in sidebar",doNotAutomaticallyRevealFilesIn:"Do not automatically reveal files in sidebar",javaScriptSourceMaps:"JavaScript source maps",enableJavaScriptSourceMaps:"Enable JavaScript source maps",disableJavaScriptSourceMaps:"Disable JavaScript source maps",tabMovesFocus:"Tab moves focus",enableTabMovesFocus:"Enable tab moves focus",disableTabMovesFocus:"Disable tab moves focus",detectIndentation:"Detect indentation",doNotDetectIndentation:"Do not detect indentation",automaticallyPrettyPrintMinifiedSources:"Automatically pretty print minified sources",doNotAutomaticallyPrettyPrintMinifiedSources:"Do not automatically pretty print minified sources",autocompletion:"Autocompletion",enableAutocompletion:"Enable autocompletion",disableAutocompletion:"Disable autocompletion",bracketClosing:"Auto closing brackets",enableBracketClosing:"Enable auto closing brackets",disableBracketClosing:"Disable auto closing brackets",bracketMatching:"Bracket matching",enableBracketMatching:"Enable bracket matching",disableBracketMatching:"Disable bracket matching",codeFolding:"Code folding",enableCodeFolding:"Enable code folding",disableCodeFolding:"Disable code folding",showWhitespaceCharacters:"Show whitespace characters:",doNotShowWhitespaceCharacters:"Do not show whitespace characters",none:"None",showAllWhitespaceCharacters:"Show all whitespace characters",all:"All",showTrailingWhitespaceCharacters:"Show trailing whitespace characters",trailing:"Trailing",displayVariableValuesInlineWhile:"Display variable values inline while debugging",doNotDisplayVariableValuesInline:"Do not display variable values inline while debugging",cssSourceMaps:"CSS source maps",enableCssSourceMaps:"Enable CSS source maps",disableCssSourceMaps:"Disable CSS source maps",allowScrollingPastEndOfFile:"Allow scrolling past end of file",disallowScrollingPastEndOfFile:"Disallow scrolling past end of file",wasmAutoStepping:"When debugging Wasm with debug information, do not pause on wasm bytecode if possible",enableWasmAutoStepping:"Enable Wasm auto-stepping",disableWasmAutoStepping:"Disable Wasm auto-stepping",goTo:"Go to",line:"Line",symbol:"Symbol",goToSymbol:"Go to symbol",open:"Open",file:"File",openFile:"Open file",disableAutoFocusOnDebuggerPaused:"Do not focus Sources panel when triggering a breakpoint",enableAutoFocusOnDebuggerPaused:"Focus Sources panel when triggering a breakpoint",revealActiveFileInSidebar:"Reveal active file in navigator sidebar",toggleNavigatorSidebar:"Toggle navigator sidebar",toggleDebuggerSidebar:"Toggle debugger sidebar",nextEditorTab:"Next editor",previousEditorTab:"Previous editor"},m=o.i18n.registerUIStrings("panels/sources/sources-meta.ts",p),S=o.i18n.getLazilyComputedLocalizedString.bind(void 0,m);let y,w,h;async function v(){return y||(y=await import("../../panels/sources/sources.js")),y}async function b(){return w||(w=await import("../../panels/sources/components/components.js")),w}function f(e){return void 0===y?[]:e(y)}c.ViewManager.registerViewExtension({location:"panel",id:"sources",commandPrompt:S(p.showSources),title:S(p.sources),order:30,loadView:async()=>(await v()).SourcesPanel.SourcesPanel.instance()}),c.ViewManager.registerViewExtension({location:"navigator-view",id:"navigator-files",commandPrompt:S(p.showWorkspace),title:S(p.workspace),order:3,persistence:"permanent",loadView:async()=>new((await v()).SourcesNavigator.FilesNavigatorView),condition:i.Runtime.conditions.notSourcesHideAddFolder}),c.ViewManager.registerViewExtension({location:"navigator-view",id:"navigator-snippets",commandPrompt:S(p.showSnippets),title:S(p.snippets),order:6,persistence:"permanent",loadView:async()=>new((await v()).SourcesNavigator.SnippetsNavigatorView)}),c.ViewManager.registerViewExtension({location:"drawer-view",id:"sources.search-sources-tab",commandPrompt:S(p.showSearch),title:S(p.search),order:7,persistence:"closeable",loadView:async()=>new((await v()).SearchSourcesView.SearchSourcesView)}),c.ViewManager.registerViewExtension({location:"drawer-view",id:"sources.quick",commandPrompt:S(p.showQuickSource),title:S(p.quickSource),persistence:"closeable",order:1e3,loadView:async()=>new((await v()).SourcesPanel.QuickSourceView)}),c.ViewManager.registerViewExtension({id:"sources.threads",commandPrompt:S(p.showThreads),title:S(p.threads),persistence:"permanent",loadView:async()=>new((await v()).ThreadsSidebarPane.ThreadsSidebarPane)}),c.ViewManager.registerViewExtension({id:"sources.scope-chain",commandPrompt:S(p.showScope),title:S(p.scope),persistence:"permanent",loadView:async()=>(await v()).ScopeChainSidebarPane.ScopeChainSidebarPane.instance()}),c.ViewManager.registerViewExtension({id:"sources.watch",commandPrompt:S(p.showWatch),title:S(p.watch),persistence:"permanent",loadView:async()=>(await v()).WatchExpressionsSidebarPane.WatchExpressionsSidebarPane.instance(),hasToolbar:!0}),c.ViewManager.registerViewExtension({id:"sources.js-breakpoints",commandPrompt:S(p.showBreakpoints),title:S(p.breakpoints),persistence:"permanent",loadView:async()=>(await b()).BreakpointsView.BreakpointsView.instance().wrapper}),c.ActionRegistration.registerActionExtension({category:"DEBUGGER",actionId:"debugger.toggle-pause",iconClass:"pause",toggleable:!0,toggledIconClass:"resume",loadActionDelegate:async()=>new((await v()).SourcesPanel.RevealingActionDelegate),contextTypes:()=>f((e=>[e.SourcesView.SourcesView,c.ShortcutRegistry.ForwardedShortcut])),options:[{value:!0,title:S(p.pauseScriptExecution)},{value:!1,title:S(p.resumeScriptExecution)}],bindings:[{shortcut:"F8",keybindSets:["devToolsDefault"]},{platform:"windows,linux",shortcut:"Ctrl+\\"},{shortcut:"F5",keybindSets:["vsCode"]},{shortcut:"Shift+F5",keybindSets:["vsCode"]},{platform:"mac",shortcut:"Meta+\\"}]}),c.ActionRegistration.registerActionExtension({category:"DEBUGGER",actionId:"debugger.step-over",loadActionDelegate:async()=>new((await v()).SourcesPanel.ActionDelegate),title:S(p.stepOverNextFunctionCall),iconClass:"step-over",contextTypes:()=>[a.DebuggerModel.DebuggerPausedDetails],bindings:[{shortcut:"F10",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+'"},{platform:"mac",shortcut:"Meta+'"}]}),c.ActionRegistration.registerActionExtension({category:"DEBUGGER",actionId:"debugger.step-into",loadActionDelegate:async()=>new((await v()).SourcesPanel.ActionDelegate),title:S(p.stepIntoNextFunctionCall),iconClass:"step-into",contextTypes:()=>[a.DebuggerModel.DebuggerPausedDetails],bindings:[{shortcut:"F11",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+;"},{platform:"mac",shortcut:"Meta+;"}]}),c.ActionRegistration.registerActionExtension({category:"DEBUGGER",actionId:"debugger.step",loadActionDelegate:async()=>new((await v()).SourcesPanel.ActionDelegate),title:S(p.step),iconClass:"step",contextTypes:()=>[a.DebuggerModel.DebuggerPausedDetails],bindings:[{shortcut:"F9",keybindSets:["devToolsDefault"]}]}),c.ActionRegistration.registerActionExtension({category:"DEBUGGER",actionId:"debugger.step-out",loadActionDelegate:async()=>new((await v()).SourcesPanel.ActionDelegate),title:S(p.stepOutOfCurrentFunction),iconClass:"step-out",contextTypes:()=>[a.DebuggerModel.DebuggerPausedDetails],bindings:[{shortcut:"Shift+F11",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Shift+Ctrl+;"},{platform:"mac",shortcut:"Shift+Meta+;"}]}),c.ActionRegistration.registerActionExtension({actionId:"debugger.run-snippet",category:"DEBUGGER",loadActionDelegate:async()=>new((await v()).SourcesPanel.ActionDelegate),title:S(p.runSnippet),iconClass:"play",contextTypes:()=>f((e=>[e.SourcesView.SourcesView])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Enter"},{platform:"mac",shortcut:"Meta+Enter"}]}),c.ActionRegistration.registerActionExtension({category:"DEBUGGER",actionId:"debugger.toggle-breakpoints-active",iconClass:"breakpoint-crossed",toggledIconClass:"breakpoint-crossed-filled",toggleable:!0,loadActionDelegate:async()=>new((await v()).SourcesPanel.ActionDelegate),contextTypes:()=>f((e=>[e.SourcesView.SourcesView])),options:[{value:!0,title:S(p.deactivateBreakpoints)},{value:!1,title:S(p.activateBreakpoints)}],bindings:[{platform:"windows,linux",shortcut:"Ctrl+F8"},{platform:"mac",shortcut:"Meta+F8"}]}),c.ActionRegistration.registerActionExtension({actionId:"sources.add-to-watch",loadActionDelegate:async()=>(await v()).WatchExpressionsSidebarPane.WatchExpressionsSidebarPane.instance(),category:"DEBUGGER",title:S(p.addSelectedTextToWatches),contextTypes:()=>f((e=>[e.UISourceCodeFrame.UISourceCodeFrame])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+A"},{platform:"mac",shortcut:"Meta+Shift+A"}]}),c.ActionRegistration.registerActionExtension({actionId:"debugger.evaluate-selection",category:"DEBUGGER",loadActionDelegate:async()=>new((await v()).SourcesPanel.ActionDelegate),title:S(p.evaluateSelectedTextInConsole),contextTypes:()=>f((e=>[e.UISourceCodeFrame.UISourceCodeFrame])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+E"},{platform:"mac",shortcut:"Meta+Shift+E"}]}),c.ActionRegistration.registerActionExtension({actionId:"sources.switch-file",category:"SOURCES",title:S(p.switchFile),loadActionDelegate:async()=>new((await v()).SourcesView.SwitchFileActionDelegate),contextTypes:()=>f((e=>[e.SourcesView.SourcesView])),bindings:[{shortcut:"Alt+O"}]}),c.ActionRegistration.registerActionExtension({actionId:"sources.rename",category:"SOURCES",title:S(p.rename),bindings:[{platform:"windows,linux",shortcut:"F2"},{platform:"mac",shortcut:"Enter"}]}),c.ActionRegistration.registerActionExtension({category:"SOURCES",actionId:"sources.close-all",loadActionDelegate:async()=>new((await v()).SourcesView.ActionDelegate),title:S(p.closeAll),bindings:[{platform:"windows,linux",shortcut:"Ctrl+K W",keybindSets:["vsCode"]},{platform:"mac",shortcut:"Meta+K W",keybindSets:["vsCode"]}]}),c.ActionRegistration.registerActionExtension({actionId:"sources.jump-to-previous-location",category:"SOURCES",title:S(p.jumpToPreviousEditingLocation),loadActionDelegate:async()=>new((await v()).SourcesView.ActionDelegate),contextTypes:()=>f((e=>[e.SourcesView.SourcesView])),bindings:[{shortcut:"Alt+Minus"}]}),c.ActionRegistration.registerActionExtension({actionId:"sources.jump-to-next-location",category:"SOURCES",title:S(p.jumpToNextEditingLocation),loadActionDelegate:async()=>new((await v()).SourcesView.ActionDelegate),contextTypes:()=>f((e=>[e.SourcesView.SourcesView])),bindings:[{shortcut:"Alt+Plus"}]}),c.ActionRegistration.registerActionExtension({actionId:"sources.close-editor-tab",category:"SOURCES",title:S(p.closeTheActiveTab),loadActionDelegate:async()=>new((await v()).SourcesView.ActionDelegate),contextTypes:()=>f((e=>[e.SourcesView.SourcesView])),bindings:[{shortcut:"Alt+w"},{shortcut:"Ctrl+W",keybindSets:["vsCode"]},{platform:"windows",shortcut:"Ctrl+F4",keybindSets:["vsCode"]}]}),c.ActionRegistration.registerActionExtension({actionId:"sources.next-editor-tab",category:"SOURCES",title:S(p.nextEditorTab),loadActionDelegate:async()=>new((await v()).SourcesView.ActionDelegate),contextTypes:()=>f((e=>[e.SourcesView.SourcesView])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+PageDown",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+PageDown",keybindSets:["devToolsDefault","vsCode"]}]}),c.ActionRegistration.registerActionExtension({actionId:"sources.previous-editor-tab",category:"SOURCES",title:S(p.previousEditorTab),loadActionDelegate:async()=>new((await v()).SourcesView.ActionDelegate),contextTypes:()=>f((e=>[e.SourcesView.SourcesView])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+PageUp",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+PageUp",keybindSets:["devToolsDefault","vsCode"]}]}),c.ActionRegistration.registerActionExtension({actionId:"sources.go-to-line",category:"SOURCES",title:S(p.goToLine),loadActionDelegate:async()=>new((await v()).SourcesView.ActionDelegate),contextTypes:()=>f((e=>[e.SourcesView.SourcesView])),bindings:[{shortcut:"Ctrl+g",keybindSets:["devToolsDefault","vsCode"]}]}),c.ActionRegistration.registerActionExtension({actionId:"sources.go-to-member",category:"SOURCES",title:S(p.goToAFunctionDeclarationruleSet),loadActionDelegate:async()=>new((await v()).SourcesView.ActionDelegate),contextTypes:()=>f((e=>[e.SourcesView.SourcesView])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+o",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+Shift+o",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+T",keybindSets:["vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+T",keybindSets:["vsCode"]},{shortcut:"F12",keybindSets:["vsCode"]}]}),c.ActionRegistration.registerActionExtension({actionId:"debugger.toggle-breakpoint",category:"DEBUGGER",title:S(p.toggleBreakpoint),bindings:[{platform:"windows,linux",shortcut:"Ctrl+b",keybindSets:["devToolsDefault"]},{platform:"mac",shortcut:"Meta+b",keybindSets:["devToolsDefault"]},{shortcut:"F9",keybindSets:["vsCode"]}]}),c.ActionRegistration.registerActionExtension({actionId:"debugger.toggle-breakpoint-enabled",category:"DEBUGGER",title:S(p.toggleBreakpointEnabled),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+b"},{platform:"mac",shortcut:"Meta+Shift+b"}]}),c.ActionRegistration.registerActionExtension({actionId:"debugger.breakpoint-input-window",category:"DEBUGGER",title:S(p.toggleBreakpointInputWindow),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Alt+b"},{platform:"mac",shortcut:"Meta+Alt+b"}]}),c.ActionRegistration.registerActionExtension({actionId:"sources.save",category:"SOURCES",title:S(p.save),loadActionDelegate:async()=>new((await v()).SourcesView.ActionDelegate),contextTypes:()=>f((e=>[e.SourcesView.SourcesView])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+s",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+s",keybindSets:["devToolsDefault","vsCode"]}]}),c.ActionRegistration.registerActionExtension({actionId:"sources.save-all",category:"SOURCES",title:S(p.saveAll),loadActionDelegate:async()=>new((await v()).SourcesView.ActionDelegate),contextTypes:()=>f((e=>[e.SourcesView.SourcesView])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+s"},{platform:"mac",shortcut:"Meta+Alt+s"},{platform:"windows,linux",shortcut:"Ctrl+K S",keybindSets:["vsCode"]},{platform:"mac",shortcut:"Meta+Alt+S",keybindSets:["vsCode"]}]}),c.ActionRegistration.registerActionExtension({category:"SOURCES",actionId:"sources.create-snippet",loadActionDelegate:async()=>new((await v()).SourcesNavigator.ActionDelegate),title:S(p.createNewSnippet)}),t.InspectorFrontendHost.InspectorFrontendHostInstance.isHostedMode()||c.ActionRegistration.registerActionExtension({category:"SOURCES",actionId:"sources.add-folder-to-workspace",loadActionDelegate:async()=>new((await v()).SourcesNavigator.ActionDelegate),iconClass:"plus",title:S(p.addFolderToWorkspace)}),c.ActionRegistration.registerActionExtension({category:"DEBUGGER",actionId:"debugger.previous-call-frame",loadActionDelegate:async()=>new((await v()).CallStackSidebarPane.ActionDelegate),title:S(p.previousCallFrame),contextTypes:()=>[a.DebuggerModel.DebuggerPausedDetails],bindings:[{shortcut:"Ctrl+,"}]}),c.ActionRegistration.registerActionExtension({category:"DEBUGGER",actionId:"debugger.next-call-frame",loadActionDelegate:async()=>new((await v()).CallStackSidebarPane.ActionDelegate),title:S(p.nextCallFrame),contextTypes:()=>[a.DebuggerModel.DebuggerPausedDetails],bindings:[{shortcut:"Ctrl+."}]}),c.ActionRegistration.registerActionExtension({actionId:"sources.search",title:S(p.search),loadActionDelegate:async()=>new((await v()).SearchSourcesView.ActionDelegate),category:"SOURCES",bindings:[{platform:"mac",shortcut:"Meta+Alt+F",keybindSets:["devToolsDefault"]},{platform:"windows,linux",shortcut:"Ctrl+Shift+F",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+Shift+J",keybindSets:["vsCode"]},{platform:"mac",shortcut:"Meta+Shift+F",keybindSets:["vsCode"]},{platform:"mac",shortcut:"Meta+Shift+J",keybindSets:["vsCode"]}]}),c.ActionRegistration.registerActionExtension({actionId:"sources.increment-css",category:"SOURCES",title:S(p.incrementCssUnitBy,{PH1:1}),bindings:[{shortcut:"Alt+Up"}]}),c.ActionRegistration.registerActionExtension({actionId:"sources.increment-css-by-ten",title:S(p.incrementCssUnitBy,{PH1:10}),category:"SOURCES",bindings:[{shortcut:"Alt+PageUp"}]}),c.ActionRegistration.registerActionExtension({actionId:"sources.decrement-css",category:"SOURCES",title:S(p.decrementCssUnitBy,{PH1:1}),bindings:[{shortcut:"Alt+Down"}]}),c.ActionRegistration.registerActionExtension({actionId:"sources.decrement-css-by-ten",category:"SOURCES",title:S(p.decrementCssUnitBy,{PH1:10}),bindings:[{shortcut:"Alt+PageDown"}]}),c.ActionRegistration.registerActionExtension({actionId:"sources.reveal-in-navigator-sidebar",category:"SOURCES",title:S(p.revealActiveFileInSidebar),loadActionDelegate:async()=>new((await v()).SourcesPanel.ActionDelegate),contextTypes:()=>f((e=>[e.SourcesView.SourcesView]))}),c.ActionRegistration.registerActionExtension({actionId:"sources.toggle-navigator-sidebar",category:"SOURCES",title:S(p.toggleNavigatorSidebar),loadActionDelegate:async()=>new((await v()).SourcesPanel.ActionDelegate),contextTypes:()=>f((e=>[e.SourcesView.SourcesView])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+y",keybindSets:["devToolsDefault"]},{platform:"mac",shortcut:"Meta+Shift+y",keybindSets:["devToolsDefault"]},{platform:"windows,linux",shortcut:"Ctrl+b",keybindSets:["vsCode"]},{platform:"windows,linux",shortcut:"Meta+b",keybindSets:["vsCode"]}]}),c.ActionRegistration.registerActionExtension({actionId:"sources.toggle-debugger-sidebar",category:"SOURCES",title:S(p.toggleDebuggerSidebar),loadActionDelegate:async()=>new((await v()).SourcesPanel.ActionDelegate),contextTypes:()=>f((e=>[e.SourcesView.SourcesView])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+h"},{platform:"mac",shortcut:"Meta+Shift+h"}]}),e.Settings.registerSettingExtension({settingName:"navigator-group-by-folder",settingType:"boolean",defaultValue:!0}),e.Settings.registerSettingExtension({settingName:"navigator-group-by-authored",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:S(p.searchInAnonymousAndContent),settingName:"search-in-anonymous-and-content-scripts",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:S(p.searchInAnonymousAndContent)},{value:!1,title:S(p.doNotSearchInAnonymousAndContent)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:S(p.automaticallyRevealFilesIn),settingName:"auto-reveal-in-navigator",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:S(p.automaticallyRevealFilesIn)},{value:!1,title:S(p.doNotAutomaticallyRevealFilesIn)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:S(p.javaScriptSourceMaps),settingName:"js-source-maps-enabled",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:S(p.enableJavaScriptSourceMaps)},{value:!1,title:S(p.disableJavaScriptSourceMaps)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:S(p.tabMovesFocus),settingName:"text-editor-tab-moves-focus",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:S(p.enableTabMovesFocus)},{value:!1,title:S(p.disableTabMovesFocus)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:S(p.detectIndentation),settingName:"text-editor-auto-detect-indent",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:S(p.detectIndentation)},{value:!1,title:S(p.doNotDetectIndentation)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:S(p.autocompletion),settingName:"text-editor-autocompletion",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:S(p.enableAutocompletion)},{value:!1,title:S(p.disableAutocompletion)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:S(p.bracketClosing),settingName:"text-editor-bracket-closing",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:S(p.enableBracketClosing)},{value:!1,title:S(p.disableBracketClosing)}]}),e.Settings.registerSettingExtension({category:"SOURCES",title:S(p.bracketMatching),settingName:"text-editor-bracket-matching",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:S(p.enableBracketMatching)},{value:!1,title:S(p.disableBracketMatching)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:S(p.codeFolding),settingName:"text-editor-code-folding",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:S(p.enableCodeFolding)},{value:!1,title:S(p.disableCodeFolding)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:S(p.showWhitespaceCharacters),settingName:"show-whitespaces-in-editor",settingType:"enum",defaultValue:"original",options:[{title:S(p.doNotShowWhitespaceCharacters),text:S(p.none),value:"none"},{title:S(p.showAllWhitespaceCharacters),text:S(p.all),value:"all"},{title:S(p.showTrailingWhitespaceCharacters),text:S(p.trailing),value:"trailing"}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:S(p.displayVariableValuesInlineWhile),settingName:"inline-variable-values",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:S(p.displayVariableValuesInlineWhile)},{value:!1,title:S(p.doNotDisplayVariableValuesInline)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:S(p.enableAutoFocusOnDebuggerPaused),settingName:"auto-focus-on-debugger-paused-enabled",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:S(p.enableAutoFocusOnDebuggerPaused)},{value:!1,title:S(p.disableAutoFocusOnDebuggerPaused)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:S(p.automaticallyPrettyPrintMinifiedSources),settingName:"auto-pretty-print-minified",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:S(p.automaticallyPrettyPrintMinifiedSources)},{value:!1,title:S(p.doNotAutomaticallyPrettyPrintMinifiedSources)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:S(p.cssSourceMaps),settingName:"css-source-maps-enabled",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:S(p.enableCssSourceMaps)},{value:!1,title:S(p.disableCssSourceMaps)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:S(p.allowScrollingPastEndOfFile),settingName:"allow-scroll-past-eof",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:S(p.allowScrollingPastEndOfFile)},{value:!1,title:S(p.disallowScrollingPastEndOfFile)}]}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Local",title:S(p.wasmAutoStepping),settingName:"wasm-auto-stepping",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:S(p.enableWasmAutoStepping)},{value:!1,title:S(p.disableWasmAutoStepping)}]}),c.ViewManager.registerLocationResolver({name:"navigator-view",category:"SOURCES",loadResolver:async()=>(await v()).SourcesPanel.SourcesPanel.instance()}),c.ViewManager.registerLocationResolver({name:"sources.sidebar-top",category:"SOURCES",loadResolver:async()=>(await v()).SourcesPanel.SourcesPanel.instance()}),c.ViewManager.registerLocationResolver({name:"sources.sidebar-bottom",category:"SOURCES",loadResolver:async()=>(await v()).SourcesPanel.SourcesPanel.instance()}),c.ViewManager.registerLocationResolver({name:"sources.sidebar-tabs",category:"SOURCES",loadResolver:async()=>(await v()).SourcesPanel.SourcesPanel.instance()}),c.ContextMenu.registerProvider({contextTypes:()=>[s.UISourceCode.UISourceCode,s.UISourceCode.UILocation,a.RemoteObject.RemoteObject,a.NetworkRequest.NetworkRequest,...f((e=>[e.UISourceCodeFrame.UISourceCodeFrame]))],loadProvider:async()=>(await v()).SourcesPanel.SourcesPanel.instance(),experiment:void 0}),c.ContextMenu.registerProvider({loadProvider:async()=>(await v()).WatchExpressionsSidebarPane.WatchExpressionsSidebarPane.instance(),contextTypes:()=>[r.ObjectPropertiesSection.ObjectPropertyTreeElement,...f((e=>[e.UISourceCodeFrame.UISourceCodeFrame]))],experiment:void 0}),e.Revealer.registerRevealer({contextTypes:()=>[s.UISourceCode.UILocation],destination:e.Revealer.RevealerDestination.SOURCES_PANEL,loadRevealer:async()=>new((await v()).SourcesPanel.UILocationRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[s.UISourceCode.UILocationRange],destination:e.Revealer.RevealerDestination.SOURCES_PANEL,loadRevealer:async()=>new((await v()).SourcesPanel.UILocationRangeRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[a.DebuggerModel.Location],destination:e.Revealer.RevealerDestination.SOURCES_PANEL,loadRevealer:async()=>new((await v()).SourcesPanel.DebuggerLocationRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[s.UISourceCode.UISourceCode],destination:e.Revealer.RevealerDestination.SOURCES_PANEL,loadRevealer:async()=>new((await v()).SourcesPanel.UISourceCodeRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[a.DebuggerModel.DebuggerPausedDetails],destination:e.Revealer.RevealerDestination.SOURCES_PANEL,loadRevealer:async()=>new((await v()).SourcesPanel.DebuggerPausedDetailsRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>[n.BreakpointManager.BreakpointLocation],destination:e.Revealer.RevealerDestination.SOURCES_PANEL,loadRevealer:async()=>new((await v()).DebuggerPlugin.BreakpointLocationRevealer)}),e.Revealer.registerRevealer({contextTypes:()=>f((e=>[e.SearchSourcesView.SearchSources])),destination:void 0,loadRevealer:async()=>new((await v()).SearchSourcesView.Revealer)}),c.Toolbar.registerToolbarItem({actionId:"sources.add-folder-to-workspace",location:"files-navigator-toolbar",label:S(p.addFolder),loadItem:void 0,order:void 0,separator:void 0}),c.Context.registerListener({contextTypes:()=>[a.DebuggerModel.DebuggerPausedDetails],loadListener:async()=>(await b()).BreakpointsView.BreakpointsSidebarController.instance()}),c.Context.registerListener({contextTypes:()=>[a.DebuggerModel.DebuggerPausedDetails],loadListener:async()=>(await v()).CallStackSidebarPane.CallStackSidebarPane.instance()}),c.Context.registerListener({contextTypes:()=>[a.DebuggerModel.CallFrame],loadListener:async()=>(await v()).ScopeChainSidebarPane.ScopeChainSidebarPane.instance()}),c.ContextMenu.registerItem({location:"navigatorMenu/default",actionId:"quick-open.show",order:void 0}),c.ContextMenu.registerItem({location:"mainMenu/default",actionId:"sources.search",order:void 0}),l.FilteredListWidget.registerProvider({prefix:"@",iconName:"symbol",provider:async()=>new((await v()).OutlineQuickOpen.OutlineQuickOpen),helpTitle:S(p.goToSymbol),titlePrefix:S(p.goTo),titleSuggestion:S(p.symbol)}),l.FilteredListWidget.registerProvider({prefix:":",iconName:"colon",provider:async()=>new((await v()).GoToLineQuickOpen.GoToLineQuickOpen),helpTitle:S(p.goToLine),titlePrefix:S(p.goTo),titleSuggestion:S(p.line)}),l.FilteredListWidget.registerProvider({prefix:"",iconName:"document",provider:async()=>new((await v()).OpenFileQuickOpen.OpenFileQuickOpen),helpTitle:S(p.openFile),titlePrefix:S(p.open),titleSuggestion:S(p.file)});const A={memory:"Memory",liveHeapProfile:"Live Heap Profile",startRecordingHeapAllocations:"Start recording heap allocations",stopRecordingHeapAllocations:"Stop recording heap allocations",startRecordingHeapAllocationsAndReload:"Start recording heap allocations and reload the page",startStopRecording:"Start/stop recording",showMemory:"Show Memory",showLiveHeapProfile:"Show Live Heap Profile",clearAllProfiles:"Clear all profiles",saveProfile:"Save profileโ€ฆ",loadProfile:"Load profileโ€ฆ",deleteProfile:"Delete profile"},C=o.i18n.registerUIStrings("panels/profiler/profiler-meta.ts",A),x=o.i18n.getLazilyComputedLocalizedString.bind(void 0,C);async function E(){return h||(h=await import("../../panels/profiler/profiler.js")),h}function T(e){return void 0===h?[]:e(h)}c.ViewManager.registerViewExtension({location:"panel",id:"heap-profiler",commandPrompt:x(A.showMemory),title:x(A.memory),order:60,loadView:async()=>(await E()).HeapProfilerPanel.HeapProfilerPanel.instance(),experiment:"js-heap-profiler-enable"}),c.ViewManager.registerViewExtension({location:"drawer-view",id:"live-heap-profile",commandPrompt:x(A.showLiveHeapProfile),title:x(A.liveHeapProfile),persistence:"closeable",order:100,loadView:async()=>(await E()).LiveHeapProfileView.LiveHeapProfileView.instance(),experiment:"live-heap-profile"}),c.ActionRegistration.registerActionExtension({actionId:"live-heap-profile.toggle-recording",iconClass:"record-start",toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,loadActionDelegate:async()=>new((await E()).LiveHeapProfileView.ActionDelegate),category:"MEMORY",experiment:"live-heap-profile",options:[{value:!0,title:x(A.startRecordingHeapAllocations)},{value:!1,title:x(A.stopRecordingHeapAllocations)}]}),c.ActionRegistration.registerActionExtension({actionId:"live-heap-profile.start-with-reload",iconClass:"refresh",loadActionDelegate:async()=>new((await E()).LiveHeapProfileView.ActionDelegate),category:"MEMORY",experiment:"live-heap-profile",title:x(A.startRecordingHeapAllocationsAndReload)}),c.ActionRegistration.registerActionExtension({actionId:"profiler.heap-toggle-recording",category:"MEMORY",iconClass:"record-start",title:x(A.startStopRecording),toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,contextTypes:()=>T((e=>[e.HeapProfilerPanel.HeapProfilerPanel])),loadActionDelegate:async()=>(await E()).HeapProfilerPanel.HeapProfilerPanel.instance(),bindings:[{platform:"windows,linux",shortcut:"Ctrl+E"},{platform:"mac",shortcut:"Meta+E"}]}),c.ActionRegistration.registerActionExtension({actionId:"profiler.clear-all",category:"MEMORY",iconClass:"clear",contextTypes:()=>T((e=>[e.ProfilesPanel.ProfilesPanel])),loadActionDelegate:async()=>new((await E()).ProfilesPanel.ActionDelegate),title:x(A.clearAllProfiles)}),c.ActionRegistration.registerActionExtension({actionId:"profiler.load-from-file",category:"MEMORY",iconClass:"import",contextTypes:()=>T((e=>[e.ProfilesPanel.ProfilesPanel])),loadActionDelegate:async()=>new((await E()).ProfilesPanel.ActionDelegate),title:x(A.loadProfile),bindings:[{platform:"windows,linux",shortcut:"Ctrl+O"},{platform:"mac",shortcut:"Meta+O"}]}),c.ActionRegistration.registerActionExtension({actionId:"profiler.save-to-file",category:"MEMORY",iconClass:"download",contextTypes:()=>T((e=>[e.ProfileHeader.ProfileHeader])),loadActionDelegate:async()=>new((await E()).ProfilesPanel.ActionDelegate),title:x(A.saveProfile),bindings:[{platform:"windows,linux",shortcut:"Ctrl+S"},{platform:"mac",shortcut:"Meta+S"}]}),c.ActionRegistration.registerActionExtension({actionId:"profiler.delete-profile",category:"MEMORY",iconClass:"download",contextTypes:()=>T((e=>[e.ProfileHeader.ProfileHeader])),loadActionDelegate:async()=>new((await E()).ProfilesPanel.ActionDelegate),title:x(A.deleteProfile)}),c.ContextMenu.registerProvider({contextTypes:()=>[a.RemoteObject.RemoteObject],loadProvider:async()=>(await E()).HeapProfilerPanel.HeapProfilerPanel.instance(),experiment:void 0}),c.ContextMenu.registerItem({location:"profilerMenu/default",actionId:"profiler.save-to-file",order:10}),c.ContextMenu.registerItem({location:"profilerMenu/default",actionId:"profiler.delete-profile",order:11});const R={console:"Console",showConsole:"Show Console",toggleConsole:"Toggle Console",clearConsole:"Clear console",clearConsoleHistory:"Clear console history",hideNetworkMessages:"Hide network messages",showNetworkMessages:"Show network messages",selectedContextOnly:"Selected context only",onlyShowMessagesFromTheCurrent:"Only show messages from the current context (`top`, `iframe`, `worker`, extension)",showMessagesFromAllContexts:"Show messages from all contexts",logXmlhttprequests:"Log XMLHttpRequests",timestamps:"Timestamps",showTimestamps:"Show timestamps",hideTimestamps:"Hide timestamps",autocompleteFromHistory:"Autocomplete from history",doNotAutocompleteFromHistory:"Do not autocomplete from history",autocompleteOnEnter:"Accept autocomplete suggestion on Enter",doNotAutocompleteOnEnter:"Do not accept autocomplete suggestion on Enter",groupSimilarMessagesInConsole:"Group similar messages in console",doNotGroupSimilarMessagesIn:"Do not group similar messages in console",showCorsErrorsInConsole:"Show `CORS` errors in console",doNotShowCorsErrorsIn:"Do not show `CORS` errors in console",evaluateTriggersUserActivation:"Treat code evaluation as user action",treatEvaluationAsUserActivation:"Treat evaluation as user activation",doNotTreatEvaluationAsUser:"Do not treat evaluation as user activation",expandConsoleTraceMessagesByDefault:"Automatically expand `console.trace()` messages",collapseConsoleTraceMessagesByDefault:"Do not automatically expand `console.trace()` messages"},D=o.i18n.registerUIStrings("panels/console/console-meta.ts",R),P=o.i18n.getLazilyComputedLocalizedString.bind(void 0,D);let k;async function I(){return k||(k=await import("../../panels/console/console.js")),k}c.ViewManager.registerViewExtension({location:"panel",id:"console",title:P(R.console),commandPrompt:P(R.showConsole),order:20,loadView:async()=>(await I()).ConsolePanel.ConsolePanel.instance()}),c.ViewManager.registerViewExtension({location:"drawer-view",id:"console-view",title:P(R.console),commandPrompt:P(R.showConsole),persistence:"permanent",order:0,loadView:async()=>(await I()).ConsolePanel.WrapperView.instance()}),c.ActionRegistration.registerActionExtension({actionId:"console.toggle",category:"CONSOLE",title:P(R.toggleConsole),loadActionDelegate:async()=>new((await I()).ConsoleView.ActionDelegate),bindings:[{shortcut:"Ctrl+`",keybindSets:["devToolsDefault","vsCode"]}]}),c.ActionRegistration.registerActionExtension({actionId:"console.clear",category:"CONSOLE",title:P(R.clearConsole),iconClass:"clear",loadActionDelegate:async()=>new((await I()).ConsoleView.ActionDelegate),contextTypes:()=>void 0===k?[]:(e=>[e.ConsoleView.ConsoleView])(k),bindings:[{shortcut:"Ctrl+L"},{shortcut:"Meta+K",platform:"mac"}]}),c.ActionRegistration.registerActionExtension({actionId:"console.clear.history",category:"CONSOLE",title:P(R.clearConsoleHistory),loadActionDelegate:async()=>new((await I()).ConsoleView.ActionDelegate)}),e.Settings.registerSettingExtension({category:"CONSOLE",storageType:"Synced",title:P(R.hideNetworkMessages),settingName:"hide-network-messages",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:P(R.hideNetworkMessages)},{value:!1,title:P(R.showNetworkMessages)}]}),e.Settings.registerSettingExtension({category:"CONSOLE",storageType:"Synced",title:P(R.selectedContextOnly),settingName:"selected-context-filter-enabled",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:P(R.onlyShowMessagesFromTheCurrent)},{value:!1,title:P(R.showMessagesFromAllContexts)}]}),e.Settings.registerSettingExtension({category:"CONSOLE",storageType:"Synced",title:P(R.logXmlhttprequests),settingName:"monitoring-xhr-enabled",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({category:"CONSOLE",storageType:"Synced",title:P(R.timestamps),settingName:"console-timestamps-enabled",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:P(R.showTimestamps)},{value:!1,title:P(R.hideTimestamps)}]}),e.Settings.registerSettingExtension({category:"CONSOLE",title:P(R.autocompleteFromHistory),settingName:"console-history-autocomplete",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:P(R.autocompleteFromHistory)},{value:!1,title:P(R.doNotAutocompleteFromHistory)}]}),e.Settings.registerSettingExtension({category:"CONSOLE",storageType:"Synced",title:P(R.autocompleteOnEnter),settingName:"console-autocomplete-on-enter",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:P(R.autocompleteOnEnter)},{value:!1,title:P(R.doNotAutocompleteOnEnter)}]}),e.Settings.registerSettingExtension({category:"CONSOLE",storageType:"Synced",title:P(R.groupSimilarMessagesInConsole),settingName:"console-group-similar",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:P(R.groupSimilarMessagesInConsole)},{value:!1,title:P(R.doNotGroupSimilarMessagesIn)}]}),e.Settings.registerSettingExtension({category:"CONSOLE",title:P(R.showCorsErrorsInConsole),settingName:"console-shows-cors-errors",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:P(R.showCorsErrorsInConsole)},{value:!1,title:P(R.doNotShowCorsErrorsIn)}]}),e.Settings.registerSettingExtension({category:"CONSOLE",storageType:"Synced",title:P(R.evaluateTriggersUserActivation),settingName:"console-user-activation-eval",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:P(R.treatEvaluationAsUserActivation)},{value:!1,title:P(R.doNotTreatEvaluationAsUser)}]}),e.Settings.registerSettingExtension({category:"CONSOLE",storageType:"Synced",title:P(R.expandConsoleTraceMessagesByDefault),settingName:"console-trace-expand",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:P(R.expandConsoleTraceMessagesByDefault)},{value:!1,title:P(R.collapseConsoleTraceMessagesByDefault)}]}),e.Revealer.registerRevealer({contextTypes:()=>[e.Console.Console],destination:void 0,loadRevealer:async()=>new((await I()).ConsolePanel.ConsoleRevealer)});const N={coverage:"Coverage",showCoverage:"Show Coverage",instrumentCoverage:"Instrument coverage",stopInstrumentingCoverageAndShow:"Stop instrumenting coverage and show results",startInstrumentingCoverageAnd:"Start instrumenting coverage and reload page",clearCoverage:"Clear coverage",exportCoverage:"Export coverage"},V=o.i18n.registerUIStrings("panels/coverage/coverage-meta.ts",N),L=o.i18n.getLazilyComputedLocalizedString.bind(void 0,V);let M,O;async function F(){return M||(M=await import("../../panels/coverage/coverage.js")),M}function U(e){return void 0===M?[]:e(M)}c.ViewManager.registerViewExtension({location:"drawer-view",id:"coverage",title:L(N.coverage),commandPrompt:L(N.showCoverage),persistence:"closeable",order:100,loadView:async()=>(await F()).CoverageView.CoverageView.instance()}),c.ActionRegistration.registerActionExtension({actionId:"coverage.toggle-recording",iconClass:"record-start",toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,loadActionDelegate:async()=>new((await F()).CoverageView.ActionDelegate),category:"PERFORMANCE",options:[{value:!0,title:L(N.instrumentCoverage)},{value:!1,title:L(N.stopInstrumentingCoverageAndShow)}]}),c.ActionRegistration.registerActionExtension({actionId:"coverage.start-with-reload",iconClass:"refresh",loadActionDelegate:async()=>new((await F()).CoverageView.ActionDelegate),category:"PERFORMANCE",experiment:"!react-native-specific-ui",title:L(N.startInstrumentingCoverageAnd)}),c.ActionRegistration.registerActionExtension({actionId:"coverage.clear",iconClass:"clear",category:"PERFORMANCE",title:L(N.clearCoverage),loadActionDelegate:async()=>new((await F()).CoverageView.ActionDelegate),contextTypes:()=>U((e=>[e.CoverageView.CoverageView]))}),c.ActionRegistration.registerActionExtension({actionId:"coverage.export",iconClass:"download",category:"PERFORMANCE",title:L(N.exportCoverage),loadActionDelegate:async()=>new((await F()).CoverageView.ActionDelegate),contextTypes:()=>U((e=>[e.CoverageView.CoverageView]))});const G={changes:"Changes",showChanges:"Show Changes",revertAllChangesToCurrentFile:"Revert all changes to current file",copyAllChangesFromCurrentFile:"Copy all changes from current file"},B=o.i18n.registerUIStrings("panels/changes/changes-meta.ts",G),H=o.i18n.getLazilyComputedLocalizedString.bind(void 0,B);async function W(){return O||(O=await import("../../panels/changes/changes.js")),O}function z(e){return void 0===O?[]:e(O)}c.ViewManager.registerViewExtension({location:"drawer-view",id:"changes.changes",title:H(G.changes),commandPrompt:H(G.showChanges),persistence:"closeable",loadView:async()=>new((await W()).ChangesView.ChangesView)}),c.ActionRegistration.registerActionExtension({actionId:"changes.revert",category:"CHANGES",title:H(G.revertAllChangesToCurrentFile),iconClass:"undo",loadActionDelegate:async()=>new((await W()).ChangesView.ActionDelegate),contextTypes:()=>z((e=>[e.ChangesView.ChangesView]))}),c.ActionRegistration.registerActionExtension({actionId:"changes.copy",category:"CHANGES",title:H(G.copyAllChangesFromCurrentFile),iconClass:"copy",loadActionDelegate:async()=>new((await W()).ChangesView.ActionDelegate),contextTypes:()=>z((e=>[e.ChangesView.ChangesView]))});const j={memoryInspector:"Memory inspector",showMemoryInspector:"Show Memory inspector"},q=o.i18n.registerUIStrings("panels/linear_memory_inspector/linear_memory_inspector-meta.ts",j),_=o.i18n.getLazilyComputedLocalizedString.bind(void 0,q);let J;async function Y(){return J||(J=await import("../../panels/linear_memory_inspector/linear_memory_inspector.js")),J}c.ViewManager.registerViewExtension({location:"drawer-view",id:"linear-memory-inspector",title:_(j.memoryInspector),commandPrompt:_(j.showMemoryInspector),order:100,persistence:"closeable",loadView:async()=>(await Y()).LinearMemoryInspectorPane.LinearMemoryInspectorPane.instance()}),c.ContextMenu.registerProvider({loadProvider:async()=>(await Y()).LinearMemoryInspectorController.LinearMemoryInspectorController.instance(),experiment:void 0,contextTypes:()=>[r.ObjectPropertiesSection.ObjectPropertyTreeElement]}),e.Revealer.registerRevealer({contextTypes:()=>[a.RemoteObject.LinearMemoryInspectable],destination:e.Revealer.RevealerDestination.MEMORY_INSPECTOR_PANEL,loadRevealer:async()=>(await Y()).LinearMemoryInspectorController.LinearMemoryInspectorController.instance()});const Q={devices:"Devices",showDevices:"Show Devices"},K=o.i18n.registerUIStrings("panels/settings/emulation/emulation-meta.ts",Q),Z=o.i18n.getLazilyComputedLocalizedString.bind(void 0,K);let X;c.ViewManager.registerViewExtension({location:"settings-view",commandPrompt:Z(Q.showDevices),title:Z(Q.devices),order:30,loadView:async()=>new((await async function(){return X||(X=await import("../../panels/settings/emulation/emulation.js")),X}()).DevicesSettingsTab.DevicesSettingsTab),id:"devices",settings:["standard-emulated-device-list","custom-emulated-device-list"],iconName:"devices"});const $={shortcuts:"Shortcuts",preferences:"Preferences",experiments:"Experiments",ignoreList:"Ignore list",showShortcuts:"Show Shortcuts",showPreferences:"Show Preferences",showExperiments:"Show Experiments",showIgnoreList:"Show Ignore list",settings:"Settings",documentation:"Documentation",aiInnovations:"AI innovations",showAiInnovations:"Show AI innovations"},ee=o.i18n.registerUIStrings("panels/settings/settings-meta.ts",$),te=o.i18n.getLazilyComputedLocalizedString.bind(void 0,ee);let oe;async function ie(){return oe||(oe=await import("../../panels/settings/settings.js")),oe}c.ViewManager.registerViewExtension({location:"settings-view",id:"preferences",title:te($.preferences),commandPrompt:te($.showPreferences),order:0,loadView:async()=>new((await ie()).SettingsScreen.GenericSettingsTab),iconName:"gear"}),c.ViewManager.registerViewExtension({location:"settings-view",id:"chrome-ai",title:te($.aiInnovations),commandPrompt:te($.showAiInnovations),order:2,async loadView(){const e=await ie();return g.LegacyWrapper.legacyWrapper(c.Widget.VBox,new e.AISettingsTab.AISettingsTab)},iconName:"button-magic",settings:["console-insights-enabled"],condition:e=>(e?.aidaAvailability?.enabled&&(e?.devToolsConsoleInsights?.enabled||e?.devToolsFreestyler?.enabled))??!1}),c.ViewManager.registerViewExtension({location:"settings-view",id:"experiments",title:te($.experiments),commandPrompt:te($.showExperiments),order:3,experiment:"*",loadView:async()=>new((await ie()).SettingsScreen.ExperimentsSettingsTab),iconName:"experiment"}),c.ViewManager.registerViewExtension({location:"settings-view",id:"blackbox",title:te($.ignoreList),commandPrompt:te($.showIgnoreList),order:4,loadView:async()=>new((await ie()).FrameworkIgnoreListSettingsTab.FrameworkIgnoreListSettingsTab),iconName:"clear-list"}),c.ViewManager.registerViewExtension({location:"settings-view",id:"keybinds",title:te($.shortcuts),commandPrompt:te($.showShortcuts),order:100,loadView:async()=>new((await ie()).KeybindsSettingsTab.KeybindsSettingsTab),iconName:"keyboard"}),c.ActionRegistration.registerActionExtension({category:"SETTINGS",actionId:"settings.show",title:te($.settings),loadActionDelegate:async()=>new((await ie()).SettingsScreen.ActionDelegate),iconClass:"gear",bindings:[{shortcut:"F1",keybindSets:["devToolsDefault"]},{shortcut:"Shift+?"},{platform:"windows,linux",shortcut:"Ctrl+,",keybindSets:["vsCode"]},{platform:"mac",shortcut:"Meta+,",keybindSets:["vsCode"]}]}),c.ActionRegistration.registerActionExtension({category:"SETTINGS",actionId:"settings.documentation",title:te($.documentation),loadActionDelegate:async()=>new((await ie()).SettingsScreen.ActionDelegate)}),c.ActionRegistration.registerActionExtension({category:"SETTINGS",actionId:"settings.shortcuts",title:te($.showShortcuts),loadActionDelegate:async()=>new((await ie()).SettingsScreen.ActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+K Ctrl+S",keybindSets:["vsCode"]},{platform:"mac",shortcut:"Meta+K Meta+S",keybindSets:["vsCode"]}]}),c.ViewManager.registerLocationResolver({name:"settings-view",category:"SETTINGS",loadResolver:async()=>(await ie()).SettingsScreen.SettingsScreen.instance()}),e.Revealer.registerRevealer({contextTypes:()=>[e.Settings.Setting,i.Runtime.Experiment],destination:void 0,loadRevealer:async()=>new((await ie()).SettingsScreen.Revealer)}),c.ContextMenu.registerItem({location:"mainMenu/footer",actionId:"settings.shortcuts",order:void 0}),c.ContextMenu.registerItem({location:"mainMenuHelp/default",actionId:"settings.documentation",order:void 0});const ae={protocolMonitor:"Protocol monitor",showProtocolMonitor:"Show Protocol monitor"},ne=o.i18n.registerUIStrings("panels/protocol_monitor/protocol_monitor-meta.ts",ae),se=o.i18n.getLazilyComputedLocalizedString.bind(void 0,ne);let re;c.ViewManager.registerViewExtension({location:"drawer-view",id:"protocol-monitor",title:se(ae.protocolMonitor),commandPrompt:se(ae.showProtocolMonitor),order:100,persistence:"closeable",loadView:async()=>new((await async function(){return re||(re=await import("../../panels/protocol_monitor/protocol_monitor.js")),re}()).ProtocolMonitor.ProtocolMonitorImpl),experiment:"protocol-monitor"});const le={workspace:"Workspace",showWorkspace:"Show Workspace settings",enableLocalOverrides:"Enable Local Overrides",interception:"interception",override:"override",network:"network",rewrite:"rewrite",request:"request",enableOverrideNetworkRequests:"Enable override network requests",disableOverrideNetworkRequests:"Disable override network requests",enableAutomaticWorkspaceFolders:"Enable automatic workspace folders"},ce=o.i18n.registerUIStrings("models/persistence/persistence-meta.ts",le),ge=o.i18n.getLazilyComputedLocalizedString.bind(void 0,ce);let de;async function ue(){return de||(de=await import("../../models/persistence/persistence.js")),de}c.ViewManager.registerViewExtension({location:"settings-view",id:"workspace",title:ge(le.workspace),commandPrompt:ge(le.showWorkspace),order:1,loadView:async()=>new((await ue()).WorkspaceSettingsTab.WorkspaceSettingsTab),iconName:"folder"}),e.Settings.registerSettingExtension({category:"PERSISTENCE",title:ge(le.enableAutomaticWorkspaceFolders),settingName:"persistence-automatic-workspace-folders",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({category:"PERSISTENCE",title:ge(le.enableLocalOverrides),settingName:"persistence-network-overrides-enabled",settingType:"boolean",defaultValue:!1,tags:[ge(le.interception),ge(le.override),ge(le.network),ge(le.rewrite),ge(le.request)],options:[{value:!0,title:ge(le.enableOverrideNetworkRequests)},{value:!1,title:ge(le.disableOverrideNetworkRequests)}]}),c.ContextMenu.registerProvider({contextTypes:()=>[s.UISourceCode.UISourceCode,a.Resource.Resource,a.NetworkRequest.NetworkRequest],loadProvider:async()=>new((await ue()).PersistenceActions.ContextMenuProvider),experiment:void 0});const pe={preserveLog:"Preserve log",preserve:"preserve",clear:"clear",reset:"reset",preserveLogOnPageReload:"Preserve log on page reload / navigation",doNotPreserveLogOnPageReload:"Do not preserve log on page reload / navigation",recordNetworkLog:"Record network log"},me=o.i18n.registerUIStrings("models/logs/logs-meta.ts",pe),Se=o.i18n.getLazilyComputedLocalizedString.bind(void 0,me);e.Settings.registerSettingExtension({category:"NETWORK",title:Se(pe.preserveLog),settingName:"network-log.preserve-log",settingType:"boolean",defaultValue:!1,tags:[Se(pe.preserve),Se(pe.clear),Se(pe.reset)],options:[{value:!0,title:Se(pe.preserveLogOnPageReload)},{value:!1,title:Se(pe.doNotPreserveLogOnPageReload)}]}),e.Settings.registerSettingExtension({category:"NETWORK",title:Se(pe.recordNetworkLog),settingName:"network-log.record-log",settingType:"boolean",defaultValue:!0,storageType:"Session"});const ye={focusDebuggee:"Focus page",toggleDrawer:"Toggle drawer",nextPanel:"Next panel",previousPanel:"Previous panel",reloadDevtools:"Reload DevTools",restoreLastDockPosition:"Restore last dock position",zoomIn:"Zoom in",zoomOut:"Zoom out",resetZoomLevel:"Reset zoom level",searchInPanel:"Search in panel",cancelSearch:"Cancel search",findNextResult:"Find next result",findPreviousResult:"Find previous result",theme:"Theme:",switchToBrowserPreferredTheme:"Switch to browser's preferred theme",autoTheme:"Auto",switchToLightTheme:"Switch to light theme",lightCapital:"Light",switchToDarkTheme:"Switch to dark theme",darkCapital:"Dark",darkLower:"dark",lightLower:"light",panelLayout:"Panel layout:",useHorizontalPanelLayout:"Use horizontal panel layout",horizontal:"horizontal",useVerticalPanelLayout:"Use vertical panel layout",vertical:"vertical",useAutomaticPanelLayout:"Use automatic panel layout",auto:"auto",enableCtrlShortcutToSwitchPanels:"Enable Ctrl + 1-9 shortcut to switch panels",enableShortcutToSwitchPanels:"Enable โŒ˜ + 1-9 shortcut to switch panels",right:"Right",dockToRight:"Dock to right",bottom:"Bottom",dockToBottom:"Dock to bottom",left:"Left",dockToLeft:"Dock to left",undocked:"Undocked",undockIntoSeparateWindow:"Undock into separate window",devtoolsDefault:"DevTools (Default)",language:"Language:",browserLanguage:"Browser UI language",enableSync:"Enable settings sync",searchAsYouTypeSetting:"Search as you type",searchAsYouTypeCommand:"Enable search as you type",searchOnEnterCommand:"Disable search as you type (press Enter to search)",matchChromeColorScheme:"Match Chrome color scheme",matchChromeColorSchemeDocumentation:"Match DevTools colors to your customized Chrome theme (when enabled)",matchChromeColorSchemeCommand:"Match Chrome color scheme",dontMatchChromeColorSchemeCommand:"Don't match Chrome color scheme"},we=o.i18n.registerUIStrings("entrypoints/main/main-meta.ts",ye),he=o.i18n.getLazilyComputedLocalizedString.bind(void 0,we);let ve,be;async function fe(){return ve||(ve=await import("../main/main.js")),ve}function Ae(){return!t.InspectorFrontendHost.InspectorFrontendHostInstance.isHostedMode()}function Ce(e){return()=>o.i18n.getLocalizedLanguageRegion(e,o.DevToolsLocale.DevToolsLocale.instance())}c.ActionRegistration.registerActionExtension({category:"DRAWER",actionId:"inspector-main.focus-debuggee",loadActionDelegate:async()=>new((await async function(){return be||(be=await import("../inspector_main/inspector_main.js")),be}()).InspectorMain.FocusDebuggeeActionDelegate),order:100,title:he(ye.focusDebuggee)}),c.ActionRegistration.registerActionExtension({category:"DRAWER",actionId:"main.toggle-drawer",loadActionDelegate:async()=>new c.InspectorView.ActionDelegate,order:101,title:he(ye.toggleDrawer),bindings:[{shortcut:"Esc"}]}),c.ActionRegistration.registerActionExtension({actionId:"main.next-tab",category:"GLOBAL",title:he(ye.nextPanel),loadActionDelegate:async()=>new c.InspectorView.ActionDelegate,bindings:[{platform:"windows,linux",shortcut:"Ctrl+]"},{platform:"mac",shortcut:"Meta+]"}]}),c.ActionRegistration.registerActionExtension({actionId:"main.previous-tab",category:"GLOBAL",title:he(ye.previousPanel),loadActionDelegate:async()=>new c.InspectorView.ActionDelegate,bindings:[{platform:"windows,linux",shortcut:"Ctrl+["},{platform:"mac",shortcut:"Meta+["}]}),c.ActionRegistration.registerActionExtension({actionId:"main.debug-reload",category:"GLOBAL",title:he(ye.reloadDevtools),loadActionDelegate:async()=>new((await fe()).MainImpl.ReloadActionDelegate),bindings:[{shortcut:"Alt+R"}]}),c.ActionRegistration.registerActionExtension({category:"GLOBAL",experiment:"!react-native-specific-ui",title:he(ye.restoreLastDockPosition),actionId:"main.toggle-dock",loadActionDelegate:async()=>new c.DockController.ToggleDockActionDelegate,bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+D"},{platform:"mac",shortcut:"Meta+Shift+D"}]}),c.ActionRegistration.registerActionExtension({actionId:"main.zoom-in",category:"GLOBAL",title:he(ye.zoomIn),loadActionDelegate:async()=>new((await fe()).MainImpl.ZoomActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Plus",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+Shift+Plus"},{platform:"windows,linux",shortcut:"Ctrl+NumpadPlus"},{platform:"windows,linux",shortcut:"Ctrl+Shift+NumpadPlus"},{platform:"mac",shortcut:"Meta+Plus",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+Shift+Plus"},{platform:"mac",shortcut:"Meta+NumpadPlus"},{platform:"mac",shortcut:"Meta+Shift+NumpadPlus"}],condition:Ae}),c.ActionRegistration.registerActionExtension({actionId:"main.zoom-out",category:"GLOBAL",title:he(ye.zoomOut),loadActionDelegate:async()=>new((await fe()).MainImpl.ZoomActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Minus",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+Shift+Minus"},{platform:"windows,linux",shortcut:"Ctrl+NumpadMinus"},{platform:"windows,linux",shortcut:"Ctrl+Shift+NumpadMinus"},{platform:"mac",shortcut:"Meta+Minus",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+Shift+Minus"},{platform:"mac",shortcut:"Meta+NumpadMinus"},{platform:"mac",shortcut:"Meta+Shift+NumpadMinus"}],condition:Ae}),c.ActionRegistration.registerActionExtension({actionId:"main.zoom-reset",category:"GLOBAL",title:he(ye.resetZoomLevel),loadActionDelegate:async()=>new((await fe()).MainImpl.ZoomActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+0"},{platform:"windows,linux",shortcut:"Ctrl+Numpad0"},{platform:"mac",shortcut:"Meta+Numpad0"},{platform:"mac",shortcut:"Meta+0"}],condition:Ae}),c.ActionRegistration.registerActionExtension({actionId:"main.search-in-panel.find",category:"GLOBAL",title:he(ye.searchInPanel),loadActionDelegate:async()=>new((await fe()).MainImpl.SearchActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+F",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+F",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"F3"}]}),c.ActionRegistration.registerActionExtension({actionId:"main.search-in-panel.cancel",category:"GLOBAL",title:he(ye.cancelSearch),loadActionDelegate:async()=>new((await fe()).MainImpl.SearchActionDelegate),order:10,bindings:[{shortcut:"Esc"}]}),c.ActionRegistration.registerActionExtension({actionId:"main.search-in-panel.find-next",category:"GLOBAL",title:he(ye.findNextResult),loadActionDelegate:async()=>new((await fe()).MainImpl.SearchActionDelegate),bindings:[{platform:"mac",shortcut:"Meta+G",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+G"},{platform:"windows,linux",shortcut:"F3",keybindSets:["devToolsDefault","vsCode"]}]}),c.ActionRegistration.registerActionExtension({actionId:"main.search-in-panel.find-previous",category:"GLOBAL",title:he(ye.findPreviousResult),loadActionDelegate:async()=>new((await fe()).MainImpl.SearchActionDelegate),bindings:[{platform:"mac",shortcut:"Meta+Shift+G",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+Shift+G"},{platform:"windows,linux",shortcut:"Shift+F3",keybindSets:["devToolsDefault","vsCode"]}]}),e.Settings.registerSettingExtension({category:"APPEARANCE",storageType:"Synced",title:he(ye.theme),settingName:"ui-theme",settingType:"enum",defaultValue:"systemPreferred",reloadRequired:!1,options:[{title:he(ye.switchToBrowserPreferredTheme),text:he(ye.autoTheme),value:"systemPreferred"},{title:he(ye.switchToLightTheme),text:he(ye.lightCapital),value:"default"},{title:he(ye.switchToDarkTheme),text:he(ye.darkCapital),value:"dark"}],tags:[he(ye.darkLower),he(ye.lightLower)]}),e.Settings.registerSettingExtension({category:"APPEARANCE",storageType:"Synced",title:he(ye.matchChromeColorScheme),settingName:"chrome-theme-colors",settingType:"boolean",defaultValue:!0,options:[{value:!0,title:he(ye.matchChromeColorSchemeCommand)},{value:!1,title:he(ye.dontMatchChromeColorSchemeCommand)}],reloadRequired:!0,learnMore:{url:"https://goo.gle/devtools-customize-theme",tooltip:he(ye.matchChromeColorSchemeDocumentation)}}),e.Settings.registerSettingExtension({category:"APPEARANCE",storageType:"Synced",title:he(ye.panelLayout),settingName:"sidebar-position",settingType:"enum",defaultValue:"auto",options:[{title:he(ye.useHorizontalPanelLayout),text:he(ye.horizontal),value:"bottom"},{title:he(ye.useVerticalPanelLayout),text:he(ye.vertical),value:"right"},{title:he(ye.useAutomaticPanelLayout),text:he(ye.auto),value:"auto"}]}),e.Settings.registerSettingExtension({category:"APPEARANCE",storageType:"Synced",settingName:"language",settingType:"enum",title:he(ye.language),defaultValue:"en-US",options:[{value:"browserLanguage",title:he(ye.browserLanguage),text:he(ye.browserLanguage)},...o.i18n.getAllSupportedDevToolsLocales().sort().map((e=>{return{value:t=e,title:Ce(t),text:Ce(t)};var t}))],reloadRequired:!0}),e.Settings.registerSettingExtension({category:"APPEARANCE",storageType:"Synced",title:"mac"===t.Platform.platform()?he(ye.enableShortcutToSwitchPanels):he(ye.enableCtrlShortcutToSwitchPanels),settingName:"shortcut-panel-switch",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({category:"GLOBAL",experiment:"!react-native-specific-ui",settingName:"currentDockState",settingType:"enum",defaultValue:"right",options:[{value:"right",text:he(ye.right),title:he(ye.dockToRight)},{value:"bottom",text:he(ye.bottom),title:he(ye.dockToBottom)},{value:"left",text:he(ye.left),title:he(ye.dockToLeft)},{value:"undocked",text:he(ye.undocked),title:he(ye.undockIntoSeparateWindow)}]}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"active-keybind-set",settingType:"enum",defaultValue:"devToolsDefault",options:[{value:"devToolsDefault",title:he(ye.devtoolsDefault),text:he(ye.devtoolsDefault)},{value:"vsCode",title:o.i18n.lockedLazyString("Visual Studio Code"),text:o.i18n.lockedLazyString("Visual Studio Code")}]}),e.Settings.registerSettingExtension({category:"SYNC",settingName:"sync-preferences",settingType:"boolean",title:he(ye.enableSync),defaultValue:!1,reloadRequired:!0}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"user-shortcuts",settingType:"array",defaultValue:[]}),e.Settings.registerSettingExtension({category:"GLOBAL",storageType:"Local",title:he(ye.searchAsYouTypeSetting),settingName:"search-as-you-type",settingType:"boolean",order:3,defaultValue:!0,options:[{value:!0,title:he(ye.searchAsYouTypeCommand)},{value:!1,title:he(ye.searchOnEnterCommand)}]}),c.ViewManager.registerLocationResolver({name:"drawer-view",category:"DRAWER",loadResolver:async()=>c.InspectorView.InspectorView.instance()}),c.ViewManager.registerLocationResolver({name:"drawer-sidebar",category:"DRAWER_SIDEBAR",loadResolver:async()=>c.InspectorView.InspectorView.instance()}),c.ViewManager.registerLocationResolver({name:"panel",category:"PANEL",loadResolver:async()=>c.InspectorView.InspectorView.instance()}),c.ContextMenu.registerProvider({contextTypes:()=>[s.UISourceCode.UISourceCode,a.Resource.Resource,a.NetworkRequest.NetworkRequest],loadProvider:async()=>new d.Linkifier.ContentProviderContextMenuProvider,experiment:void 0}),c.ContextMenu.registerProvider({contextTypes:()=>[Node],loadProvider:async()=>new c.XLink.ContextMenuProvider,experiment:void 0}),c.ContextMenu.registerProvider({contextTypes:()=>[Node],loadProvider:async()=>new d.Linkifier.LinkContextMenuProvider,experiment:void 0}),c.Toolbar.registerToolbarItem({separator:!0,location:"main-toolbar-left",order:100}),c.Toolbar.registerToolbarItem({separator:!0,order:97,location:"main-toolbar-right"}),c.Toolbar.registerToolbarItem({loadItem:async()=>(await fe()).MainImpl.SettingsButtonProvider.instance(),order:99,location:"main-toolbar-right"}),c.Toolbar.registerToolbarItem({loadItem:async()=>(await fe()).MainImpl.MainMenuItem.instance(),order:100,location:"main-toolbar-right"}),c.Toolbar.registerToolbarItem({loadItem:async()=>c.DockController.CloseButtonProvider.instance(),order:101,location:"main-toolbar-right"}),e.AppProvider.registerAppProvider({loadAppProvider:async()=>(await fe()).SimpleApp.SimpleAppProvider.instance(),order:10});const xe={flamechartSelectedNavigation:"Flamechart navigation:",modern:"Modern",classic:"Classic",liveMemoryAllocationAnnotations:"Live memory allocation annotations",showLiveMemoryAllocation:"Show live memory allocation annotations",hideLiveMemoryAllocation:"Hide live memory allocation annotations",collectGarbage:"Collect garbage"},Ee=o.i18n.registerUIStrings("ui/legacy/components/perf_ui/perf_ui-meta.ts",xe),Te=o.i18n.getLazilyComputedLocalizedString.bind(void 0,Ee);let Re;c.ActionRegistration.registerActionExtension({actionId:"components.collect-garbage",category:"PERFORMANCE",title:Te(xe.collectGarbage),iconClass:"mop",loadActionDelegate:async()=>new((await async function(){return Re||(Re=await import("../../ui/legacy/components/perf_ui/perf_ui.js")),Re}()).GCActionDelegate.GCActionDelegate)}),e.Settings.registerSettingExtension({category:"PERFORMANCE",storageType:"Synced",title:Te(xe.flamechartSelectedNavigation),settingName:"flamechart-selected-navigation",settingType:"enum",defaultValue:"classic",options:[{title:Te(xe.modern),text:Te(xe.modern),value:"modern"},{title:Te(xe.classic),text:Te(xe.classic),value:"classic"}]}),e.Settings.registerSettingExtension({category:"MEMORY",experiment:"live-heap-profile",title:Te(xe.liveMemoryAllocationAnnotations),settingName:"memory-live-heap-profile",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:Te(xe.showLiveMemoryAllocation)},{value:!1,title:Te(xe.hideLiveMemoryAllocation)}]});const De={openFile:"Open file",runCommand:"Run command"},Pe=o.i18n.registerUIStrings("ui/legacy/components/quick_open/quick_open-meta.ts",De),ke=o.i18n.getLazilyComputedLocalizedString.bind(void 0,Pe);let Ie;async function Ne(){return Ie||(Ie=await import("../../ui/legacy/components/quick_open/quick_open.js")),Ie}c.ActionRegistration.registerActionExtension({actionId:"quick-open.show-command-menu",category:"GLOBAL",title:ke(De.runCommand),loadActionDelegate:async()=>new((await Ne()).CommandMenu.ShowActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+P",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+Shift+P",keybindSets:["devToolsDefault","vsCode"]},{shortcut:"F1",keybindSets:["vsCode"]}]}),c.ActionRegistration.registerActionExtension({actionId:"quick-open.show",category:"GLOBAL",title:ke(De.openFile),loadActionDelegate:async()=>new((await Ne()).QuickOpen.ShowActionDelegate),order:100,bindings:[{platform:"mac",shortcut:"Meta+P",keybindSets:["devToolsDefault","vsCode"]},{platform:"mac",shortcut:"Meta+O",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+P",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+O",keybindSets:["devToolsDefault","vsCode"]}]}),c.ContextMenu.registerItem({location:"mainMenu/default",actionId:"quick-open.show-command-menu",order:void 0}),c.ContextMenu.registerItem({location:"mainMenu/default",actionId:"quick-open.show",order:void 0});const Ve={preserveLogUponNavigation:"Preserve log upon navigation",doNotPreserveLogUponNavigation:"Do not preserve log upon navigation",pauseOnExceptions:"Pause on exceptions",doNotPauseOnExceptions:"Do not pause on exceptions",disableJavascript:"Disable JavaScript",enableJavascript:"Enable JavaScript",disableAsyncStackTraces:"Disable async stack traces",doNotCaptureAsyncStackTraces:"Do not capture async stack traces",captureAsyncStackTraces:"Capture async stack traces",showRulersOnHover:"Show rulers on hover",doNotShowRulersOnHover:"Do not show rulers on hover",showAreaNames:"Show area names",showGridNamedAreas:"Show grid named areas",doNotShowGridNamedAreas:"Do not show grid named areas",showTrackSizes:"Show track sizes",showGridTrackSizes:"Show grid track sizes",doNotShowGridTrackSizes:"Do not show grid track sizes",extendGridLines:"Extend grid lines",doNotExtendGridLines:"Do not extend grid lines",showLineLabels:"Show line labels",hideLineLabels:"Hide line labels",showLineNumbers:"Show line numbers",showLineNames:"Show line names",showPaintFlashingRectangles:"Show paint flashing rectangles",hidePaintFlashingRectangles:"Hide paint flashing rectangles",showLayoutShiftRegions:"Show layout shift regions",hideLayoutShiftRegions:"Hide layout shift regions",highlightAdFrames:"Highlight ad frames",doNotHighlightAdFrames:"Do not highlight ad frames",showLayerBorders:"Show layer borders",hideLayerBorders:"Hide layer borders",showFramesPerSecondFpsMeter:"Show frames per second (FPS) meter",hideFramesPerSecondFpsMeter:"Hide frames per second (FPS) meter",showScrollPerformanceBottlenecks:"Show scroll performance bottlenecks",hideScrollPerformanceBottlenecks:"Hide scroll performance bottlenecks",emulateAFocusedPage:"Emulate a focused page",doNotEmulateAFocusedPage:"Do not emulate a focused page",doNotEmulateCssMediaType:"Do not emulate CSS media type",noEmulation:"No emulation",emulateCssPrintMediaType:"Emulate CSS print media type",print:"print",emulateCssScreenMediaType:"Emulate CSS screen media type",screen:"screen",query:"query",emulateCssMediaType:"Emulate CSS media type",doNotEmulateCss:"Do not emulate CSS {PH1}",emulateCss:"Emulate CSS {PH1}",emulateCssMediaFeature:"Emulate CSS media feature {PH1}",doNotEmulateAnyVisionDeficiency:"Do not emulate any vision deficiency",emulateBlurredVision:"Emulate blurred vision",emulateReducedContrast:"Emulate reduced contrast",blurredVision:"Blurred vision",reducedContrast:"Reduced contrast",emulateProtanopia:"Emulate protanopia (no red)",protanopia:"Protanopia (no red)",emulateDeuteranopia:"Emulate deuteranopia (no green)",deuteranopia:"Deuteranopia (no green)",emulateTritanopia:"Emulate tritanopia (no blue)",tritanopia:"Tritanopia (no blue)",emulateAchromatopsia:"Emulate achromatopsia (no color)",achromatopsia:"Achromatopsia (no color)",emulateVisionDeficiencies:"Emulate vision deficiencies",disableLocalFonts:"Disable local fonts",enableLocalFonts:"Enable local fonts",disableAvifFormat:"Disable `AVIF` format",enableAvifFormat:"Enable `AVIF` format",disableWebpFormat:"Disable `WebP` format",enableWebpFormat:"Enable `WebP` format",customFormatters:"Custom formatters",networkRequestBlocking:"Network request blocking",enableNetworkRequestBlocking:"Enable network request blocking",disableNetworkRequestBlocking:"Disable network request blocking",enableCache:"Enable cache",disableCache:"Disable cache while DevTools is open",emulateAutoDarkMode:"Emulate auto dark mode",enableRemoteFileLoading:"Allow `DevTools` to load resources, such as source maps, from remote file paths. Disabled by default for security reasons.",networkCacheExplanation:"Disabling the network cache will simulate a network experience similar to a first time visitor."},Le=o.i18n.registerUIStrings("core/sdk/sdk-meta.ts",Ve),Me=o.i18n.getLazilyComputedLocalizedString.bind(void 0,Le);e.Settings.registerSettingExtension({storageType:"Synced",settingName:"skip-stack-frames-pattern",settingType:"regex",defaultValue:""}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"skip-content-scripts",settingType:"boolean",defaultValue:!0}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"automatically-ignore-list-known-third-party-scripts",settingType:"boolean",defaultValue:!0}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"skip-anonymous-scripts",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({storageType:"Synced",settingName:"enable-ignore-listing",settingType:"boolean",defaultValue:!0}),e.Settings.registerSettingExtension({category:"CONSOLE",storageType:"Synced",title:Me(Ve.preserveLogUponNavigation),settingName:"preserve-console-log",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:Me(Ve.preserveLogUponNavigation)},{value:!1,title:Me(Ve.doNotPreserveLogUponNavigation)}]}),e.Settings.registerSettingExtension({category:"DEBUGGER",settingName:"pause-on-exception-enabled",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:Me(Ve.pauseOnExceptions)},{value:!1,title:Me(Ve.doNotPauseOnExceptions)}]}),e.Settings.registerSettingExtension({settingName:"pause-on-caught-exception",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({settingName:"pause-on-uncaught-exception",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({category:"DEBUGGER",experiment:"!react-native-specific-ui",title:Me(Ve.disableJavascript),settingName:"java-script-disabled",settingType:"boolean",storageType:"Session",order:1,defaultValue:!1,options:[{value:!0,title:Me(Ve.disableJavascript)},{value:!1,title:Me(Ve.enableJavascript)}]}),e.Settings.registerSettingExtension({category:"DEBUGGER",title:Me(Ve.disableAsyncStackTraces),settingName:"disable-async-stack-traces",settingType:"boolean",defaultValue:!1,order:2,options:[{value:!0,title:Me(Ve.doNotCaptureAsyncStackTraces)},{value:!1,title:Me(Ve.captureAsyncStackTraces)}]}),e.Settings.registerSettingExtension({category:"DEBUGGER",settingName:"breakpoints-active",settingType:"boolean",storageType:"Session",defaultValue:!0}),e.Settings.registerSettingExtension({category:"ELEMENTS",experiment:"!react-native-specific-ui",storageType:"Synced",title:Me(Ve.showRulersOnHover),settingName:"show-metrics-rulers",settingType:"boolean",options:[{value:!0,title:Me(Ve.showRulersOnHover)},{value:!1,title:Me(Ve.doNotShowRulersOnHover)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"GRID",experiment:"!react-native-specific-ui",storageType:"Synced",title:Me(Ve.showAreaNames),settingName:"show-grid-areas",settingType:"boolean",options:[{value:!0,title:Me(Ve.showGridNamedAreas)},{value:!1,title:Me(Ve.doNotShowGridNamedAreas)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"GRID",experiment:"!react-native-specific-ui",storageType:"Synced",title:Me(Ve.showTrackSizes),settingName:"show-grid-track-sizes",settingType:"boolean",options:[{value:!0,title:Me(Ve.showGridTrackSizes)},{value:!1,title:Me(Ve.doNotShowGridTrackSizes)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"GRID",experiment:"!react-native-specific-ui",storageType:"Synced",title:Me(Ve.extendGridLines),settingName:"extend-grid-lines",settingType:"boolean",options:[{value:!0,title:Me(Ve.extendGridLines)},{value:!1,title:Me(Ve.doNotExtendGridLines)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"GRID",experiment:"!react-native-specific-ui",storageType:"Synced",title:Me(Ve.showLineLabels),settingName:"show-grid-line-labels",settingType:"enum",options:[{title:Me(Ve.hideLineLabels),text:Me(Ve.hideLineLabels),value:"none"},{title:Me(Ve.showLineNumbers),text:Me(Ve.showLineNumbers),value:"lineNumbers"},{title:Me(Ve.showLineNames),text:Me(Ve.showLineNames),value:"lineNames"}],defaultValue:"lineNumbers"}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"show-paint-rects",settingType:"boolean",storageType:"Session",options:[{value:!0,title:Me(Ve.showPaintFlashingRectangles)},{value:!1,title:Me(Ve.hidePaintFlashingRectangles)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"show-layout-shift-regions",settingType:"boolean",storageType:"Session",options:[{value:!0,title:Me(Ve.showLayoutShiftRegions)},{value:!1,title:Me(Ve.hideLayoutShiftRegions)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"show-ad-highlights",settingType:"boolean",storageType:"Session",options:[{value:!0,title:Me(Ve.highlightAdFrames)},{value:!1,title:Me(Ve.doNotHighlightAdFrames)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"show-debug-borders",settingType:"boolean",storageType:"Session",options:[{value:!0,title:Me(Ve.showLayerBorders)},{value:!1,title:Me(Ve.hideLayerBorders)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"show-fps-counter",settingType:"boolean",storageType:"Session",options:[{value:!0,title:Me(Ve.showFramesPerSecondFpsMeter)},{value:!1,title:Me(Ve.hideFramesPerSecondFpsMeter)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"show-scroll-bottleneck-rects",settingType:"boolean",storageType:"Session",options:[{value:!0,title:Me(Ve.showScrollPerformanceBottlenecks)},{value:!1,title:Me(Ve.hideScrollPerformanceBottlenecks)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",title:Me(Ve.emulateAFocusedPage),settingName:"emulate-page-focus",settingType:"boolean",storageType:"Local",defaultValue:!1,options:[{value:!0,title:Me(Ve.emulateAFocusedPage)},{value:!1,title:Me(Ve.doNotEmulateAFocusedPage)}]}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"emulated-css-media",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:Me(Ve.doNotEmulateCssMediaType),text:Me(Ve.noEmulation),value:""},{title:Me(Ve.emulateCssPrintMediaType),text:Me(Ve.print),value:"print"},{title:Me(Ve.emulateCssScreenMediaType),text:Me(Ve.screen),value:"screen"}],tags:[Me(Ve.query)],title:Me(Ve.emulateCssMediaType)}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"emulated-css-media-feature-prefers-color-scheme",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:Me(Ve.doNotEmulateCss,{PH1:"prefers-color-scheme"}),text:Me(Ve.noEmulation),value:""},{title:Me(Ve.emulateCss,{PH1:"prefers-color-scheme: light"}),text:o.i18n.lockedLazyString("prefers-color-scheme: light"),value:"light"},{title:Me(Ve.emulateCss,{PH1:"prefers-color-scheme: dark"}),text:o.i18n.lockedLazyString("prefers-color-scheme: dark"),value:"dark"}],tags:[Me(Ve.query)],title:Me(Ve.emulateCssMediaFeature,{PH1:"prefers-color-scheme"})}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"emulated-css-media-feature-forced-colors",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:Me(Ve.doNotEmulateCss,{PH1:"forced-colors"}),text:Me(Ve.noEmulation),value:""},{title:Me(Ve.emulateCss,{PH1:"forced-colors: active"}),text:o.i18n.lockedLazyString("forced-colors: active"),value:"active"},{title:Me(Ve.emulateCss,{PH1:"forced-colors: none"}),text:o.i18n.lockedLazyString("forced-colors: none"),value:"none"}],tags:[Me(Ve.query)],title:Me(Ve.emulateCssMediaFeature,{PH1:"forced-colors"})}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"emulated-css-media-feature-prefers-reduced-motion",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:Me(Ve.doNotEmulateCss,{PH1:"prefers-reduced-motion"}),text:Me(Ve.noEmulation),value:""},{title:Me(Ve.emulateCss,{PH1:"prefers-reduced-motion: reduce"}),text:o.i18n.lockedLazyString("prefers-reduced-motion: reduce"),value:"reduce"}],tags:[Me(Ve.query)],title:Me(Ve.emulateCssMediaFeature,{PH1:"prefers-reduced-motion"})}),e.Settings.registerSettingExtension({settingName:"emulated-css-media-feature-prefers-contrast",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:Me(Ve.doNotEmulateCss,{PH1:"prefers-contrast"}),text:Me(Ve.noEmulation),value:""},{title:Me(Ve.emulateCss,{PH1:"prefers-contrast: more"}),text:o.i18n.lockedLazyString("prefers-contrast: more"),value:"more"},{title:Me(Ve.emulateCss,{PH1:"prefers-contrast: less"}),text:o.i18n.lockedLazyString("prefers-contrast: less"),value:"less"},{title:Me(Ve.emulateCss,{PH1:"prefers-contrast: custom"}),text:o.i18n.lockedLazyString("prefers-contrast: custom"),value:"custom"}],tags:[Me(Ve.query)],title:Me(Ve.emulateCssMediaFeature,{PH1:"prefers-contrast"})}),e.Settings.registerSettingExtension({settingName:"emulated-css-media-feature-prefers-reduced-data",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:Me(Ve.doNotEmulateCss,{PH1:"prefers-reduced-data"}),text:Me(Ve.noEmulation),value:""},{title:Me(Ve.emulateCss,{PH1:"prefers-reduced-data: reduce"}),text:o.i18n.lockedLazyString("prefers-reduced-data: reduce"),value:"reduce"}],title:Me(Ve.emulateCssMediaFeature,{PH1:"prefers-reduced-data"})}),e.Settings.registerSettingExtension({settingName:"emulated-css-media-feature-prefers-reduced-transparency",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:Me(Ve.doNotEmulateCss,{PH1:"prefers-reduced-transparency"}),text:Me(Ve.noEmulation),value:""},{title:Me(Ve.emulateCss,{PH1:"prefers-reduced-transparency: reduce"}),text:o.i18n.lockedLazyString("prefers-reduced-transparency: reduce"),value:"reduce"}],title:Me(Ve.emulateCssMediaFeature,{PH1:"prefers-reduced-transparency"})}),e.Settings.registerSettingExtension({settingName:"emulated-css-media-feature-color-gamut",settingType:"enum",storageType:"Session",defaultValue:"",options:[{title:Me(Ve.doNotEmulateCss,{PH1:"color-gamut"}),text:Me(Ve.noEmulation),value:""},{title:Me(Ve.emulateCss,{PH1:"color-gamut: srgb"}),text:o.i18n.lockedLazyString("color-gamut: srgb"),value:"srgb"},{title:Me(Ve.emulateCss,{PH1:"color-gamut: p3"}),text:o.i18n.lockedLazyString("color-gamut: p3"),value:"p3"},{title:Me(Ve.emulateCss,{PH1:"color-gamut: rec2020"}),text:o.i18n.lockedLazyString("color-gamut: rec2020"),value:"rec2020"}],title:Me(Ve.emulateCssMediaFeature,{PH1:"color-gamut"})}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"emulated-vision-deficiency",settingType:"enum",storageType:"Session",defaultValue:"none",options:[{title:Me(Ve.doNotEmulateAnyVisionDeficiency),text:Me(Ve.noEmulation),value:"none"},{title:Me(Ve.emulateBlurredVision),text:Me(Ve.blurredVision),value:"blurredVision"},{title:Me(Ve.emulateReducedContrast),text:Me(Ve.reducedContrast),value:"reducedContrast"},{title:Me(Ve.emulateProtanopia),text:Me(Ve.protanopia),value:"protanopia"},{title:Me(Ve.emulateDeuteranopia),text:Me(Ve.deuteranopia),value:"deuteranopia"},{title:Me(Ve.emulateTritanopia),text:Me(Ve.tritanopia),value:"tritanopia"},{title:Me(Ve.emulateAchromatopsia),text:Me(Ve.achromatopsia),value:"achromatopsia"}],tags:[Me(Ve.query)],title:Me(Ve.emulateVisionDeficiencies)}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"local-fonts-disabled",settingType:"boolean",storageType:"Session",options:[{value:!0,title:Me(Ve.disableLocalFonts)},{value:!1,title:Me(Ve.enableLocalFonts)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"avif-format-disabled",settingType:"boolean",storageType:"Session",options:[{value:!0,title:Me(Ve.disableAvifFormat)},{value:!1,title:Me(Ve.enableAvifFormat)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",settingName:"webp-format-disabled",settingType:"boolean",storageType:"Session",options:[{value:!0,title:Me(Ve.disableWebpFormat)},{value:!1,title:Me(Ve.enableWebpFormat)}],defaultValue:!1}),e.Settings.registerSettingExtension({category:"CONSOLE",title:Me(Ve.customFormatters),settingName:"custom-formatters",settingType:"boolean",defaultValue:!1}),e.Settings.registerSettingExtension({category:"",title:Me(Ve.networkRequestBlocking),settingName:"request-blocking-enabled",settingType:"boolean",storageType:"Session",defaultValue:!1,options:[{value:!0,title:Me(Ve.enableNetworkRequestBlocking)},{value:!1,title:Me(Ve.disableNetworkRequestBlocking)}]}),e.Settings.registerSettingExtension({category:"NETWORK",experiment:"!react-native-specific-ui",title:Me(Ve.disableCache),settingName:"cache-disabled",settingType:"boolean",order:0,defaultValue:!1,userActionCondition:"hasOtherClients",options:[{value:!0,title:Me(Ve.disableCache)},{value:!1,title:Me(Ve.enableCache)}],learnMore:{tooltip:Me(Ve.networkCacheExplanation)}}),e.Settings.registerSettingExtension({category:"RENDERING",experiment:"!react-native-specific-ui",title:Me(Ve.emulateAutoDarkMode),settingName:"emulate-auto-dark-mode",settingType:"boolean",storageType:"Session",defaultValue:!1}),e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:Me(Ve.enableRemoteFileLoading),settingName:"network.enable-remote-file-loading",settingType:"boolean",defaultValue:!1});const Oe={defaultIndentation:"Default indentation:",setIndentationToSpaces:"Set indentation to 2 spaces",Spaces:"2 spaces",setIndentationToFSpaces:"Set indentation to 4 spaces",fSpaces:"4 spaces",setIndentationToESpaces:"Set indentation to 8 spaces",eSpaces:"8 spaces",setIndentationToTabCharacter:"Set indentation to tab character",tabCharacter:"Tab character"},Fe=o.i18n.registerUIStrings("ui/legacy/components/source_frame/source_frame-meta.ts",Oe),Ue=o.i18n.getLazilyComputedLocalizedString.bind(void 0,Fe);let Ge,Be;e.Settings.registerSettingExtension({category:"SOURCES",storageType:"Synced",title:Ue(Oe.defaultIndentation),settingName:"text-editor-indent",settingType:"enum",defaultValue:" ",options:[{title:Ue(Oe.setIndentationToSpaces),text:Ue(Oe.Spaces),value:" "},{title:Ue(Oe.setIndentationToFSpaces),text:Ue(Oe.fSpaces),value:" "},{title:Ue(Oe.setIndentationToESpaces),text:Ue(Oe.eSpaces),value:" "},{title:Ue(Oe.setIndentationToTabCharacter),text:Ue(Oe.tabCharacter),value:"\t"}]}),c.Toolbar.registerToolbarItem({loadItem:async()=>(await async function(){return Ge||(Ge=await import("../../panels/console_counters/console_counters.js")),Ge}()).WarningErrorCounter.WarningErrorCounter.instance(),order:1,location:"main-toolbar-right"}),c.UIUtils.registerRenderer({contextTypes:()=>[a.RemoteObject.RemoteObject],loadRenderer:async()=>(await async function(){return Be||(Be=await import("../../ui/legacy/components/object_ui/object_ui.js")),Be}()).ObjectPropertiesSection.Renderer.instance()});const He={explainThisError:"Understand this error",explainThisWarning:"Understand this warning",explainThisMessage:"Understand this message",enableConsoleInsights:"Understand console messages with AI",wrongLocale:"To use this feature, set your language preference to English in DevTools settings.",geoRestricted:"This feature is unavailable in your region.",policyRestricted:"This setting is managed by your administrator."},We=o.i18n.registerUIStrings("panels/explain/explain-meta.ts",He),ze=o.i18n.getLazilyComputedLocalizedString.bind(void 0,We),je=o.i18n.getLocalizedString.bind(void 0,We),qe=[{actionId:"explain.console-message.hover",title:ze(He.explainThisMessage),contextTypes:()=>[u.ConsoleViewMessage.ConsoleViewMessage]},{actionId:"explain.console-message.context.error",title:ze(He.explainThisError),contextTypes:()=>[]},{actionId:"explain.console-message.context.warning",title:ze(He.explainThisWarning),contextTypes:()=>[]},{actionId:"explain.console-message.context.other",title:ze(He.explainThisMessage),contextTypes:()=>[]}];function _e(e){return!0===e?.aidaAvailability?.blockedByEnterprisePolicy}function Je(e){return!0===(e?.aidaAvailability?.enabled&&e?.devToolsConsoleInsights?.enabled)}e.Settings.registerSettingExtension({category:"AI",settingName:"console-insights-enabled",settingType:"boolean",title:ze(He.enableConsoleInsights),defaultValue:!1,reloadRequired:!1,condition:e=>Je(e),disabledCondition:e=>{const t=[];return function(e){return!0===e?.aidaAvailability?.blockedByGeo}(e)&&t.push(je(He.geoRestricted)),_e(e)&&t.push(je(He.policyRestricted)),o.DevToolsLocale.DevToolsLocale.instance().locale.startsWith("en-")||t.push(je(He.wrongLocale)),t.length>0?{disabled:!0,reasons:t}:{disabled:!1}}});for(const e of qe)c.ActionRegistration.registerActionExtension({...e,category:"CONSOLE",loadActionDelegate:async()=>new((await import("../../panels/explain/explain.js")).ActionDelegate),condition:e=>Je(e)&&!_e(e)});const Ye={aiAssistance:"AI assistance",showAiAssistance:"Show AI assistance",enableAiAssistance:"Enable AI assistance",askAi:"Ask AI",wrongLocale:"To use this feature, set your language preference to English in DevTools settings.",geoRestricted:"This feature is unavailable in your region.",policyRestricted:"This setting is managed by your administrator."},Qe=o.i18n.registerUIStrings("panels/ai_assistance/ai_assistance-meta.ts",Ye),Ke=o.i18n.getLocalizedString.bind(void 0,Qe),Ze=o.i18n.getLazilyComputedLocalizedString.bind(void 0,Qe);function Xe(e){return!0===e?.aidaAvailability?.blockedByEnterprisePolicy}let $e;async function et(){return $e||($e=await import("../../panels/ai_assistance/ai_assistance.js")),$e}function tt(e){return!0===(e?.aidaAvailability?.enabled&&e?.devToolsFreestyler?.enabled)}function ot(e){return!0===(e?.aidaAvailability?.enabled&&e?.devToolsAiAssistanceNetworkAgent?.enabled)}function it(e){return!0===(e?.aidaAvailability?.enabled&&e?.devToolsAiAssistancePerformanceAgent?.enabled)}function at(e){return!0===(e?.aidaAvailability?.enabled&&e?.devToolsAiAssistanceFileAgent?.enabled)}function nt(e){return tt(e)||ot(e)||it(e)||at(e)}c.ViewManager.registerViewExtension({location:"drawer-view",id:"freestyler",commandPrompt:Ze(Ye.showAiAssistance),title:Ze(Ye.aiAssistance),order:10,isPreviewFeature:!0,persistence:"closeable",hasToolbar:!1,condition:e=>nt(e)&&!Xe(e),async loadView(){const e=await et();return await e.AiAssistancePanel.instance()}}),e.Settings.registerSettingExtension({category:"AI",settingName:"ai-assistance-enabled",settingType:"boolean",title:Ze(Ye.enableAiAssistance),defaultValue:!1,reloadRequired:!1,condition:nt,disabledCondition:e=>{const t=[];return function(e){return!0===e?.aidaAvailability?.blockedByGeo}(e)&&t.push(Ke(Ye.geoRestricted)),Xe(e)&&t.push(Ke(Ye.policyRestricted)),o.DevToolsLocale.DevToolsLocale.instance().locale.startsWith("en-")||t.push(Ke(Ye.wrongLocale)),t.length>0?{disabled:!0,reasons:t}:{disabled:!1}}}),c.ActionRegistration.registerActionExtension({actionId:"freestyler.elements-floating-button",contextTypes:()=>[],category:"GLOBAL",title:Ze(Ye.askAi),loadActionDelegate:async()=>new((await et()).ActionDelegate),condition:e=>tt(e)&&!Xe(e)}),c.ActionRegistration.registerActionExtension({actionId:"freestyler.element-panel-context",contextTypes:()=>[],category:"GLOBAL",title:Ze(Ye.askAi),loadActionDelegate:async()=>new((await et()).ActionDelegate),condition:e=>tt(e)&&!Xe(e)}),c.ActionRegistration.registerActionExtension({actionId:"drjones.network-floating-button",contextTypes:()=>[],category:"GLOBAL",title:Ze(Ye.askAi),loadActionDelegate:async()=>new((await et()).ActionDelegate),condition:e=>ot(e)&&!Xe(e)}),c.ActionRegistration.registerActionExtension({actionId:"drjones.network-panel-context",contextTypes:()=>[],category:"GLOBAL",title:Ze(Ye.askAi),loadActionDelegate:async()=>new((await et()).ActionDelegate),condition:e=>ot(e)&&!Xe(e)}),c.ActionRegistration.registerActionExtension({actionId:"drjones.performance-panel-context",contextTypes:()=>[],category:"GLOBAL",title:Ze(Ye.askAi),loadActionDelegate:async()=>new((await et()).ActionDelegate),condition:e=>it(e)&&!Xe(e)}),c.ActionRegistration.registerActionExtension({actionId:"drjones.performance-insight-context",contextTypes:()=>[],category:"GLOBAL",title:Ze(Ye.askAi),loadActionDelegate:async()=>new((await et()).ActionDelegate),condition:e=>function(e){return!0===(e?.aidaAvailability?.enabled&&e?.devToolsAiAssistancePerformanceAgent?.enabled&&e?.devToolsAiAssistancePerformanceAgent.insightsEnabled)}(e)&&!Xe(e)}),c.ActionRegistration.registerActionExtension({actionId:"drjones.sources-floating-button",contextTypes:()=>[],category:"GLOBAL",title:Ze(Ye.askAi),loadActionDelegate:async()=>new((await et()).ActionDelegate),condition:e=>at(e)&&!Xe(e)}),c.ActionRegistration.registerActionExtension({actionId:"drjones.sources-panel-context",contextTypes:()=>[],category:"GLOBAL",title:Ze(Ye.askAi),loadActionDelegate:async()=>new((await et()).ActionDelegate),condition:e=>at(e)&&!Xe(e)}); diff --git a/packages/debugger-frontend/dist/third-party/front_end/entrypoints/worker_app/worker_app.js b/packages/debugger-frontend/dist/third-party/front_end/entrypoints/worker_app/worker_app.js index 911898053672..b663029f929e 100644 --- a/packages/debugger-frontend/dist/third-party/front_end/entrypoints/worker_app/worker_app.js +++ b/packages/debugger-frontend/dist/third-party/front_end/entrypoints/worker_app/worker_app.js @@ -1 +1 @@ -import"../shell/shell.js";import*as e from"../../core/i18n/i18n.js";import*as t from"../../core/root/root.js";import*as o from"../../core/sdk/sdk.js";import*as i from"../../ui/legacy/legacy.js";import*as n from"../../core/common/common.js";import*as a from"../../models/issues_manager/issues_manager.js";import*as r from"../../models/extensions/extensions.js";import*as s from"../../models/workspace/workspace.js";import*as l from"../../panels/network/forward/forward.js";import*as c from"../../panels/application/preloading/helper/helper.js";import*as g from"../../panels/mobile_throttling/mobile_throttling.js";import*as d from"../../ui/legacy/components/utils/utils.js";import*as w from"../main/main.js";const p={showEventListenerBreakpoints:"Show Event Listener Breakpoints",eventListenerBreakpoints:"Event Listener Breakpoints",showCspViolationBreakpoints:"Show CSP Violation Breakpoints",cspViolationBreakpoints:"CSP Violation Breakpoints",showXhrfetchBreakpoints:"Show XHR/fetch Breakpoints",xhrfetchBreakpoints:"XHR/fetch Breakpoints",showDomBreakpoints:"Show DOM Breakpoints",domBreakpoints:"DOM Breakpoints",showGlobalListeners:"Show Global Listeners",globalListeners:"Global Listeners",page:"Page",showPage:"Show Page",overrides:"Overrides",showOverrides:"Show Overrides",contentScripts:"Content scripts",showContentScripts:"Show Content scripts",refreshGlobalListeners:"Refresh global listeners"},m=e.i18n.registerUIStrings("panels/browser_debugger/browser_debugger-meta.ts",p),u=e.i18n.getLazilyComputedLocalizedString.bind(void 0,m);let R,v;async function h(){return R||(R=await import("../../panels/browser_debugger/browser_debugger.js")),R}async function y(){return v||(v=await import("../../panels/sources/sources.js")),v}i.ViewManager.registerViewExtension({loadView:async()=>(await h()).EventListenerBreakpointsSidebarPane.EventListenerBreakpointsSidebarPane.instance(),id:"sources.event-listener-breakpoints",location:"sources.sidebar-bottom",commandPrompt:u(p.showEventListenerBreakpoints),title:u(p.eventListenerBreakpoints),order:9,persistence:"permanent"}),i.ViewManager.registerViewExtension({loadView:async()=>new((await h()).CSPViolationBreakpointsSidebarPane.CSPViolationBreakpointsSidebarPane),id:"sources.csp-violation-breakpoints",location:"sources.sidebar-bottom",commandPrompt:u(p.showCspViolationBreakpoints),title:u(p.cspViolationBreakpoints),order:10,persistence:"permanent"}),i.ViewManager.registerViewExtension({loadView:async()=>(await h()).XHRBreakpointsSidebarPane.XHRBreakpointsSidebarPane.instance(),id:"sources.xhr-breakpoints",location:"sources.sidebar-bottom",commandPrompt:u(p.showXhrfetchBreakpoints),title:u(p.xhrfetchBreakpoints),order:5,persistence:"permanent",hasToolbar:!0}),i.ViewManager.registerViewExtension({loadView:async()=>(await h()).DOMBreakpointsSidebarPane.DOMBreakpointsSidebarPane.instance(),id:"sources.dom-breakpoints",location:"sources.sidebar-bottom",commandPrompt:u(p.showDomBreakpoints),title:u(p.domBreakpoints),order:7,persistence:"permanent"}),i.ViewManager.registerViewExtension({loadView:async()=>new((await h()).ObjectEventListenersSidebarPane.ObjectEventListenersSidebarPane),id:"sources.global-listeners",location:"sources.sidebar-bottom",commandPrompt:u(p.showGlobalListeners),title:u(p.globalListeners),order:8,persistence:"permanent",hasToolbar:!0}),i.ViewManager.registerViewExtension({loadView:async()=>(await h()).DOMBreakpointsSidebarPane.DOMBreakpointsSidebarPane.instance(),id:"elements.dom-breakpoints",location:"elements-sidebar",commandPrompt:u(p.showDomBreakpoints),title:u(p.domBreakpoints),order:6,persistence:"permanent"}),i.ViewManager.registerViewExtension({location:"navigator-view",id:"navigator-network",title:u(p.page),commandPrompt:u(p.showPage),order:2,persistence:"permanent",loadView:async()=>(await y()).SourcesNavigator.NetworkNavigatorView.instance()}),i.ViewManager.registerViewExtension({location:"navigator-view",id:"navigator-overrides",title:u(p.overrides),commandPrompt:u(p.showOverrides),order:4,persistence:"permanent",loadView:async()=>(await y()).SourcesNavigator.OverridesNavigatorView.instance()}),i.ViewManager.registerViewExtension({location:"navigator-view",id:"navigator-content-scripts",title:u(p.contentScripts),commandPrompt:u(p.showContentScripts),order:5,persistence:"permanent",condition:()=>"/bundled/worker_app.html"!==t.Runtime.getPathName(),loadView:async()=>new((await y()).SourcesNavigator.ContentScriptsNavigatorView)}),i.ActionRegistration.registerActionExtension({category:"DEBUGGER",actionId:"browser-debugger.refresh-global-event-listeners",loadActionDelegate:async()=>new((await h()).ObjectEventListenersSidebarPane.ActionDelegate),title:u(p.refreshGlobalListeners),iconClass:"refresh",contextTypes:()=>void 0===R?[]:(e=>[e.ObjectEventListenersSidebarPane.ObjectEventListenersSidebarPane])(R)}),i.ContextMenu.registerProvider({contextTypes:()=>[o.DOMModel.DOMNode],loadProvider:async()=>new((await h()).DOMBreakpointsSidebarPane.ContextMenuProvider),experiment:void 0}),i.Context.registerListener({contextTypes:()=>[o.DebuggerModel.DebuggerPausedDetails],loadListener:async()=>(await h()).XHRBreakpointsSidebarPane.XHRBreakpointsSidebarPane.instance()}),i.Context.registerListener({contextTypes:()=>[o.DebuggerModel.DebuggerPausedDetails],loadListener:async()=>(await h()).DOMBreakpointsSidebarPane.DOMBreakpointsSidebarPane.instance()});const k={developerResources:"Developer resources",showDeveloperResources:"Show Developer resources"},P=e.i18n.registerUIStrings("panels/developer_resources/developer_resources-meta.ts",k),T=e.i18n.getLazilyComputedLocalizedString.bind(void 0,P);let A;async function E(){return A||(A=await import("../../panels/developer_resources/developer_resources.js")),A}i.ViewManager.registerViewExtension({location:"drawer-view",id:"developer-resources",title:T(k.developerResources),commandPrompt:T(k.showDeveloperResources),order:100,persistence:"closeable",loadView:async()=>new((await E()).DeveloperResourcesView.DeveloperResourcesView)}),n.Revealer.registerRevealer({contextTypes:()=>[o.PageResourceLoader.ResourceKey],destination:n.Revealer.RevealerDestination.DEVELOPER_RESOURCES_PANEL,loadRevealer:async()=>new((await E()).DeveloperResourcesView.DeveloperResourcesRevealer)});const b={issues:"Issues",showIssues:"Show Issues"},S=e.i18n.registerUIStrings("panels/issues/issues-meta.ts",b),f=e.i18n.getLazilyComputedLocalizedString.bind(void 0,S);let N;async function x(){return N||(N=await import("../../panels/issues/issues.js")),N}i.ViewManager.registerViewExtension({location:"drawer-view",id:"issues-pane",title:f(b.issues),commandPrompt:f(b.showIssues),order:100,persistence:"closeable",loadView:async()=>new((await x()).IssuesPane.IssuesPane)}),n.Revealer.registerRevealer({contextTypes:()=>[a.Issue.Issue],destination:n.Revealer.RevealerDestination.ISSUES_VIEW,loadRevealer:async()=>new((await x()).IssueRevealer.IssueRevealer)});const D={resetView:"Reset view",switchToPanMode:"Switch to pan mode",switchToRotateMode:"Switch to rotate mode",zoomIn:"Zoom in",zoomOut:"Zoom out",panOrRotateUp:"Pan or rotate up",panOrRotateDown:"Pan or rotate down",panOrRotateLeft:"Pan or rotate left",panOrRotateRight:"Pan or rotate right"},L=e.i18n.registerUIStrings("panels/layer_viewer/layer_viewer-meta.ts",D),C=e.i18n.getLazilyComputedLocalizedString.bind(void 0,L);i.ActionRegistration.registerActionExtension({actionId:"layers.reset-view",category:"LAYERS",title:C(D.resetView),bindings:[{shortcut:"0"}]}),i.ActionRegistration.registerActionExtension({actionId:"layers.pan-mode",category:"LAYERS",title:C(D.switchToPanMode),bindings:[{shortcut:"x"}]}),i.ActionRegistration.registerActionExtension({actionId:"layers.rotate-mode",category:"LAYERS",title:C(D.switchToRotateMode),bindings:[{shortcut:"v"}]}),i.ActionRegistration.registerActionExtension({actionId:"layers.zoom-in",category:"LAYERS",title:C(D.zoomIn),bindings:[{shortcut:"Shift+Plus"},{shortcut:"NumpadPlus"}]}),i.ActionRegistration.registerActionExtension({actionId:"layers.zoom-out",category:"LAYERS",title:C(D.zoomOut),bindings:[{shortcut:"Shift+Minus"},{shortcut:"NumpadMinus"}]}),i.ActionRegistration.registerActionExtension({actionId:"layers.up",category:"LAYERS",title:C(D.panOrRotateUp),bindings:[{shortcut:"Up"},{shortcut:"w"}]}),i.ActionRegistration.registerActionExtension({actionId:"layers.down",category:"LAYERS",title:C(D.panOrRotateDown),bindings:[{shortcut:"Down"},{shortcut:"s"}]}),i.ActionRegistration.registerActionExtension({actionId:"layers.left",category:"LAYERS",title:C(D.panOrRotateLeft),bindings:[{shortcut:"Left"},{shortcut:"a"}]}),i.ActionRegistration.registerActionExtension({actionId:"layers.right",category:"LAYERS",title:C(D.panOrRotateRight),bindings:[{shortcut:"Right"},{shortcut:"d"}]});const I={throttling:"Throttling",showThrottling:"Show Throttling",goOffline:"Go offline",device:"device",throttlingTag:"throttling",enableSlowGThrottling:"Enable slow `3G` throttling",enableFastGThrottling:"Enable fast `3G` throttling",goOnline:"Go online"},V=e.i18n.registerUIStrings("panels/mobile_throttling/mobile_throttling-meta.ts",I),M=e.i18n.getLazilyComputedLocalizedString.bind(void 0,V);let O;async function B(){return O||(O=await import("../../panels/mobile_throttling/mobile_throttling.js")),O}i.ViewManager.registerViewExtension({location:"settings-view",id:"throttling-conditions",title:M(I.throttling),commandPrompt:M(I.showThrottling),order:35,loadView:async()=>new((await B()).ThrottlingSettingsTab.ThrottlingSettingsTab),settings:["custom-network-conditions","calibrated-cpu-throttling"],iconName:"performance"}),i.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-offline",category:"NETWORK",title:M(I.goOffline),loadActionDelegate:async()=>new((await B()).ThrottlingManager.ActionDelegate),tags:[M(I.device),M(I.throttlingTag)]}),i.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-low-end-mobile",category:"NETWORK",title:M(I.enableSlowGThrottling),loadActionDelegate:async()=>new((await B()).ThrottlingManager.ActionDelegate),tags:[M(I.device),M(I.throttlingTag)]}),i.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-mid-tier-mobile",category:"NETWORK",title:M(I.enableFastGThrottling),loadActionDelegate:async()=>new((await B()).ThrottlingManager.ActionDelegate),tags:[M(I.device),M(I.throttlingTag)]}),i.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-online",category:"NETWORK",title:M(I.goOnline),loadActionDelegate:async()=>new((await B()).ThrottlingManager.ActionDelegate),tags:[M(I.device),M(I.throttlingTag)]}),n.Settings.registerSettingExtension({storageType:"Synced",settingName:"custom-network-conditions",settingType:"array",defaultValue:[]});const F={showNetwork:"Show Network",network:"Network",networkExpoUnstable:"Expo Network",showNetworkRequestBlocking:"Show Network request blocking",networkRequestBlocking:"Network request blocking",showNetworkConditions:"Show Network conditions",networkConditions:"Network conditions",diskCache:"disk cache",networkThrottling:"network throttling",showSearch:"Show Search",search:"Search",recordNetworkLog:"Record network log",stopRecordingNetworkLog:"Stop recording network log",hideRequestDetails:"Hide request details",colorcodeResourceTypes:"Color-code resource types",colorCode:"color code",resourceType:"resource type",colorCodeByResourceType:"Color code by resource type",useDefaultColors:"Use default colors",groupNetworkLogByFrame:"Group network log by frame",netWork:"network",frame:"frame",group:"group",groupNetworkLogItemsByFrame:"Group network log items by frame",dontGroupNetworkLogItemsByFrame:"Don't group network log items by frame",clear:"Clear network log",addNetworkRequestBlockingPattern:"Add network request blocking pattern",removeAllNetworkRequestBlockingPatterns:"Remove all network request blocking patterns",allowToGenerateHarWithSensitiveData:"Allow to generate `HAR` with sensitive data",dontAllowToGenerateHarWithSensitiveData:"Don't allow to generate `HAR` with sensitive data",allowToGenerateHarWithSensitiveDataDocumentation:"By default generated HAR logs are sanitized and don't include `Cookie`, `Set-Cookie`, or `Authorization` HTTP headers. When this setting is enabled, options to export/copy HAR with sensitive data are provided."},W=e.i18n.registerUIStrings("panels/network/network-meta.ts",F),U=e.i18n.getLazilyComputedLocalizedString.bind(void 0,W),j=e.i18n.getLocalizedString.bind(void 0,W);let _;async function q(){return _||(_=await import("../../panels/network/network.js")),_}function z(e){return void 0===_?[]:e(_)}i.ViewManager.registerViewExtension({location:"panel",id:"network",commandPrompt:U(F.showNetwork),title:()=>t.Runtime.conditions.reactNativeExpoNetworkPanel()?j(F.networkExpoUnstable):j(F.network),order:40,loadView:async()=>(await q()).NetworkPanel.NetworkPanel.instance()}),i.ViewManager.registerViewExtension({location:"drawer-view",id:"network.blocked-urls",commandPrompt:U(F.showNetworkRequestBlocking),title:U(F.networkRequestBlocking),persistence:"closeable",order:60,loadView:async()=>new((await q()).BlockedURLsPane.BlockedURLsPane)}),i.ViewManager.registerViewExtension({location:"drawer-view",id:"network.config",commandPrompt:U(F.showNetworkConditions),title:U(F.networkConditions),persistence:"closeable",order:40,tags:[U(F.diskCache),U(F.networkThrottling),e.i18n.lockedLazyString("useragent"),e.i18n.lockedLazyString("user agent"),e.i18n.lockedLazyString("user-agent")],loadView:async()=>(await q()).NetworkConfigView.NetworkConfigView.instance()}),i.ViewManager.registerViewExtension({location:"network-sidebar",id:"network.search-network-tab",commandPrompt:U(F.showSearch),title:U(F.search),persistence:"permanent",loadView:async()=>(await q()).NetworkPanel.SearchNetworkView.instance()}),i.ActionRegistration.registerActionExtension({actionId:"network.toggle-recording",category:"NETWORK",iconClass:"record-start",toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,contextTypes:()=>z((e=>[e.NetworkPanel.NetworkPanel])),loadActionDelegate:async()=>new((await q()).NetworkPanel.ActionDelegate),options:[{value:!0,title:U(F.recordNetworkLog)},{value:!1,title:U(F.stopRecordingNetworkLog)}],bindings:[{shortcut:"Ctrl+E",platform:"windows,linux"},{shortcut:"Meta+E",platform:"mac"}]}),i.ActionRegistration.registerActionExtension({actionId:"network.clear",category:"NETWORK",title:U(F.clear),iconClass:"clear",loadActionDelegate:async()=>new((await q()).NetworkPanel.ActionDelegate),contextTypes:()=>z((e=>[e.NetworkPanel.NetworkPanel])),bindings:[{shortcut:"Ctrl+L"},{shortcut:"Meta+K",platform:"mac"}]}),i.ActionRegistration.registerActionExtension({actionId:"network.hide-request-details",category:"NETWORK",title:U(F.hideRequestDetails),contextTypes:()=>z((e=>[e.NetworkPanel.NetworkPanel])),loadActionDelegate:async()=>new((await q()).NetworkPanel.ActionDelegate),bindings:[{shortcut:"Esc"}]}),i.ActionRegistration.registerActionExtension({actionId:"network.search",category:"NETWORK",title:U(F.search),contextTypes:()=>z((e=>[e.NetworkPanel.NetworkPanel])),loadActionDelegate:async()=>new((await q()).NetworkPanel.ActionDelegate),bindings:[{platform:"mac",shortcut:"Meta+F",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+F",keybindSets:["devToolsDefault","vsCode"]}]}),i.ActionRegistration.registerActionExtension({actionId:"network.add-network-request-blocking-pattern",category:"NETWORK",title:U(F.addNetworkRequestBlockingPattern),iconClass:"plus",contextTypes:()=>z((e=>[e.BlockedURLsPane.BlockedURLsPane])),loadActionDelegate:async()=>new((await q()).BlockedURLsPane.ActionDelegate)}),i.ActionRegistration.registerActionExtension({actionId:"network.remove-all-network-request-blocking-patterns",category:"NETWORK",title:U(F.removeAllNetworkRequestBlockingPatterns),iconClass:"clear",contextTypes:()=>z((e=>[e.BlockedURLsPane.BlockedURLsPane])),loadActionDelegate:async()=>new((await q()).BlockedURLsPane.ActionDelegate)}),n.Settings.registerSettingExtension({category:"NETWORK",storageType:"Synced",title:U(F.allowToGenerateHarWithSensitiveData),settingName:"network.show-options-to-generate-har-with-sensitive-data",settingType:"boolean",defaultValue:!1,tags:[e.i18n.lockedLazyString("HAR")],options:[{value:!0,title:U(F.allowToGenerateHarWithSensitiveData)},{value:!1,title:U(F.dontAllowToGenerateHarWithSensitiveData)}],learnMore:{url:"https://goo.gle/devtools-export-hars",tooltip:U(F.allowToGenerateHarWithSensitiveDataDocumentation)}}),n.Settings.registerSettingExtension({category:"NETWORK",storageType:"Synced",title:U(F.colorcodeResourceTypes),settingName:"network-color-code-resource-types",settingType:"boolean",defaultValue:!1,tags:[U(F.colorCode),U(F.resourceType)],options:[{value:!0,title:U(F.colorCodeByResourceType)},{value:!1,title:U(F.useDefaultColors)}]}),n.Settings.registerSettingExtension({category:"NETWORK",storageType:"Synced",title:U(F.groupNetworkLogByFrame),settingName:"network.group-by-frame",settingType:"boolean",defaultValue:!1,tags:[U(F.netWork),U(F.frame),U(F.group)],options:[{value:!0,title:U(F.groupNetworkLogItemsByFrame)},{value:!1,title:U(F.dontGroupNetworkLogItemsByFrame)}]}),i.ViewManager.registerLocationResolver({name:"network-sidebar",category:"NETWORK",loadResolver:async()=>(await q()).NetworkPanel.NetworkPanel.instance()}),i.ContextMenu.registerProvider({contextTypes:()=>[o.NetworkRequest.NetworkRequest,o.Resource.Resource,s.UISourceCode.UISourceCode,o.TraceObject.RevealableNetworkRequest],loadProvider:async()=>(await q()).NetworkPanel.NetworkPanel.instance(),experiment:void 0}),n.Revealer.registerRevealer({contextTypes:()=>[o.NetworkRequest.NetworkRequest],destination:n.Revealer.RevealerDestination.NETWORK_PANEL,loadRevealer:async()=>new((await q()).NetworkPanel.RequestRevealer)}),n.Revealer.registerRevealer({contextTypes:()=>[l.UIRequestLocation.UIRequestLocation],destination:void 0,loadRevealer:async()=>new((await q()).NetworkPanel.RequestLocationRevealer)}),n.Revealer.registerRevealer({contextTypes:()=>[l.NetworkRequestId.NetworkRequestId],destination:n.Revealer.RevealerDestination.NETWORK_PANEL,loadRevealer:async()=>new((await q()).NetworkPanel.RequestIdRevealer)}),n.Revealer.registerRevealer({contextTypes:()=>[l.UIFilter.UIRequestFilter,r.ExtensionServer.RevealableNetworkRequestFilter],destination:n.Revealer.RevealerDestination.NETWORK_PANEL,loadRevealer:async()=>new((await q()).NetworkPanel.NetworkLogWithFilterRevealer)});const G={application:"Application",showApplication:"Show Application",pwa:"pwa",clearSiteData:"Clear site data",clearSiteDataIncludingThirdparty:"Clear site data (including third-party cookies)",startRecordingEvents:"Start recording events",stopRecordingEvents:"Stop recording events"},H=e.i18n.registerUIStrings("panels/application/application-meta.ts",G),K=e.i18n.getLazilyComputedLocalizedString.bind(void 0,H);let Y;async function X(){return Y||(Y=await import("../../panels/application/application.js")),Y}i.ViewManager.registerViewExtension({location:"panel",id:"resources",title:K(G.application),commandPrompt:K(G.showApplication),order:70,loadView:async()=>(await X()).ResourcesPanel.ResourcesPanel.instance(),tags:[K(G.pwa)]}),i.ActionRegistration.registerActionExtension({category:"RESOURCES",actionId:"resources.clear",title:K(G.clearSiteData),loadActionDelegate:async()=>new((await X()).StorageView.ActionDelegate)}),i.ActionRegistration.registerActionExtension({category:"RESOURCES",actionId:"resources.clear-incl-third-party-cookies",title:K(G.clearSiteDataIncludingThirdparty),loadActionDelegate:async()=>new((await X()).StorageView.ActionDelegate)}),i.ActionRegistration.registerActionExtension({actionId:"background-service.toggle-recording",iconClass:"record-start",toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,contextTypes:()=>void 0===Y?[]:(e=>[e.BackgroundServiceView.BackgroundServiceView])(Y),loadActionDelegate:async()=>new((await X()).BackgroundServiceView.ActionDelegate),category:"BACKGROUND_SERVICES",options:[{value:!0,title:K(G.startRecordingEvents)},{value:!1,title:K(G.stopRecordingEvents)}],bindings:[{platform:"windows,linux",shortcut:"Ctrl+E"},{platform:"mac",shortcut:"Meta+E"}]}),n.Revealer.registerRevealer({contextTypes:()=>[o.Resource.Resource],destination:n.Revealer.RevealerDestination.APPLICATION_PANEL,loadRevealer:async()=>new((await X()).ResourcesPanel.ResourceRevealer)}),n.Revealer.registerRevealer({contextTypes:()=>[o.ResourceTreeModel.ResourceTreeFrame],destination:n.Revealer.RevealerDestination.APPLICATION_PANEL,loadRevealer:async()=>new((await X()).ResourcesPanel.FrameDetailsRevealer)}),n.Revealer.registerRevealer({contextTypes:()=>[c.PreloadingForward.RuleSetView],destination:n.Revealer.RevealerDestination.APPLICATION_PANEL,loadRevealer:async()=>new((await X()).ResourcesPanel.RuleSetViewRevealer)}),n.Revealer.registerRevealer({contextTypes:()=>[c.PreloadingForward.AttemptViewWithFilter],destination:n.Revealer.RevealerDestination.APPLICATION_PANEL,loadRevealer:async()=>new((await X()).ResourcesPanel.AttemptViewWithFilterRevealer)});const Z={performance:"Performance",showPerformance:"Show Performance",record:"Record",stop:"Stop",recordAndReload:"Record and reload",saveProfile:"Save profileโ€ฆ",loadProfile:"Load profileโ€ฆ",previousFrame:"Previous frame",nextFrame:"Next frame",showRecentTimelineSessions:"Show recent timeline sessions",previousRecording:"Previous recording",nextRecording:"Next recording",hideChromeFrameInLayersView:"Hide `chrome` frame in Layers view"},J=e.i18n.registerUIStrings("panels/timeline/timeline-meta.ts",Z),Q=e.i18n.getLazilyComputedLocalizedString.bind(void 0,J);let $;async function ee(){return $||($=await import("../../panels/timeline/timeline.js")),$}function te(e){return void 0===$?[]:e($)}i.ViewManager.registerViewExtension({location:"panel",id:"timeline",title:Q(Z.performance),commandPrompt:Q(Z.showPerformance),order:50,loadView:async()=>(await ee()).TimelinePanel.TimelinePanel.instance()}),i.ActionRegistration.registerActionExtension({actionId:"timeline.toggle-recording",category:"PERFORMANCE",iconClass:"record-start",toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,contextTypes:()=>te((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await ee()).TimelinePanel.ActionDelegate),options:[{value:!0,title:Q(Z.record)},{value:!1,title:Q(Z.stop)}],bindings:[{platform:"windows,linux",shortcut:"Ctrl+E"},{platform:"mac",shortcut:"Meta+E"}]}),i.ActionRegistration.registerActionExtension({actionId:"timeline.record-reload",iconClass:"refresh",contextTypes:()=>te((e=>[e.TimelinePanel.TimelinePanel])),category:"PERFORMANCE",title:Q(Z.recordAndReload),loadActionDelegate:async()=>new((await ee()).TimelinePanel.ActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+E"},{platform:"mac",shortcut:"Meta+Shift+E"}],experiment:"!react-native-specific-ui"}),i.ActionRegistration.registerActionExtension({category:"PERFORMANCE",actionId:"timeline.save-to-file",contextTypes:()=>te((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await ee()).TimelinePanel.ActionDelegate),title:Q(Z.saveProfile),bindings:[{platform:"windows,linux",shortcut:"Ctrl+S"},{platform:"mac",shortcut:"Meta+S"}]}),i.ActionRegistration.registerActionExtension({category:"PERFORMANCE",actionId:"timeline.load-from-file",contextTypes:()=>te((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await ee()).TimelinePanel.ActionDelegate),title:Q(Z.loadProfile),bindings:[{platform:"windows,linux",shortcut:"Ctrl+O"},{platform:"mac",shortcut:"Meta+O"}]}),i.ActionRegistration.registerActionExtension({actionId:"timeline.jump-to-previous-frame",category:"PERFORMANCE",title:Q(Z.previousFrame),contextTypes:()=>te((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await ee()).TimelinePanel.ActionDelegate),bindings:[{shortcut:"["}]}),i.ActionRegistration.registerActionExtension({actionId:"timeline.jump-to-next-frame",category:"PERFORMANCE",title:Q(Z.nextFrame),contextTypes:()=>te((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await ee()).TimelinePanel.ActionDelegate),bindings:[{shortcut:"]"}]}),i.ActionRegistration.registerActionExtension({actionId:"timeline.show-history",loadActionDelegate:async()=>new((await ee()).TimelinePanel.ActionDelegate),category:"PERFORMANCE",title:Q(Z.showRecentTimelineSessions),contextTypes:()=>te((e=>[e.TimelinePanel.TimelinePanel])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+H"},{platform:"mac",shortcut:"Meta+Y"}]}),i.ActionRegistration.registerActionExtension({actionId:"timeline.previous-recording",category:"PERFORMANCE",loadActionDelegate:async()=>new((await ee()).TimelinePanel.ActionDelegate),title:Q(Z.previousRecording),contextTypes:()=>te((e=>[e.TimelinePanel.TimelinePanel])),bindings:[{platform:"windows,linux",shortcut:"Alt+Left"},{platform:"mac",shortcut:"Meta+Left"}]}),i.ActionRegistration.registerActionExtension({actionId:"timeline.next-recording",category:"PERFORMANCE",loadActionDelegate:async()=>new((await ee()).TimelinePanel.ActionDelegate),title:Q(Z.nextRecording),contextTypes:()=>te((e=>[e.TimelinePanel.TimelinePanel])),bindings:[{platform:"windows,linux",shortcut:"Alt+Right"},{platform:"mac",shortcut:"Meta+Right"}]}),n.Settings.registerSettingExtension({category:"PERFORMANCE",storageType:"Synced",title:Q(Z.hideChromeFrameInLayersView),settingName:"frame-viewer-hide-chrome-window",settingType:"boolean",defaultValue:!1}),n.Settings.registerSettingExtension({category:"PERFORMANCE",storageType:"Synced",settingName:"annotations-hidden",settingType:"boolean",defaultValue:!1}),n.Linkifier.registerLinkifier({contextTypes:()=>te((e=>[e.CLSLinkifier.CLSRect])),loadLinkifier:async()=>(await ee()).CLSLinkifier.Linkifier.instance()}),i.ContextMenu.registerItem({location:"timelineMenu/open",actionId:"timeline.load-from-file",order:10}),i.ContextMenu.registerItem({location:"timelineMenu/open",actionId:"timeline.save-to-file",order:15}),n.Revealer.registerRevealer({contextTypes:()=>[o.TraceObject.TraceObject],destination:n.Revealer.RevealerDestination.TIMELINE_PANEL,loadRevealer:async()=>new((await ee()).TimelinePanel.TraceRevealer)}),n.Revealer.registerRevealer({contextTypes:()=>[o.TraceObject.RevealableEvent],destination:n.Revealer.RevealerDestination.TIMELINE_PANEL,loadRevealer:async()=>new((await ee()).TimelinePanel.EventRevealer)});const oe={main:"Main"},ie=e.i18n.registerUIStrings("entrypoints/worker_app/WorkerMain.ts",oe),ne=e.i18n.getLocalizedString.bind(void 0,ie);let ae;class re{static instance(e={forceNew:null}){const{forceNew:t}=e;return ae&&!t||(ae=new re),ae}async run(){o.Connections.initMainConnection((async()=>{await o.TargetManager.TargetManager.instance().maybeAttachInitialTarget()||o.TargetManager.TargetManager.instance().createTarget("main",ne(oe.main),o.Target.Type.ServiceWorker,null)}),d.TargetDetachedDialog.TargetDetachedDialog.connectionLost),new g.NetworkPanelIndicator.NetworkPanelIndicator}}n.Runnable.registerEarlyInitializationRunnable(re.instance),o.ChildTargetManager.ChildTargetManager.install((async({target:e,waitingForDebugger:t})=>{if(e.parentTarget()||e.type()!==o.Target.Type.ServiceWorker||!t)return;const i=e.model(o.DebuggerModel.DebuggerModel);i&&(i.isReadyToPause()||await i.once(o.DebuggerModel.Events.DebuggerIsReadyToPause),i.pause())})),self.runtime=t.Runtime.Runtime.instance({forceNew:!0}),new w.MainImpl.MainImpl; +import"../shell/shell.js";import*as e from"../../core/i18n/i18n.js";import*as t from"../../core/root/root.js";import*as o from"../../core/sdk/sdk.js";import*as i from"../../ui/legacy/legacy.js";import*as n from"../../core/common/common.js";import*as a from"../../models/issues_manager/issues_manager.js";import*as r from"../../models/extensions/extensions.js";import*as s from"../../models/workspace/workspace.js";import*as l from"../../panels/network/forward/forward.js";import*as c from"../../panels/application/preloading/helper/helper.js";import*as g from"../../panels/mobile_throttling/mobile_throttling.js";import*as d from"../../ui/legacy/components/utils/utils.js";import*as w from"../main/main.js";const p={showEventListenerBreakpoints:"Show Event Listener Breakpoints",eventListenerBreakpoints:"Event Listener Breakpoints",showCspViolationBreakpoints:"Show CSP Violation Breakpoints",cspViolationBreakpoints:"CSP Violation Breakpoints",showXhrfetchBreakpoints:"Show XHR/fetch Breakpoints",xhrfetchBreakpoints:"XHR/fetch Breakpoints",showDomBreakpoints:"Show DOM Breakpoints",domBreakpoints:"DOM Breakpoints",showGlobalListeners:"Show Global Listeners",globalListeners:"Global Listeners",page:"Page",showPage:"Show Page",overrides:"Overrides",showOverrides:"Show Overrides",contentScripts:"Content scripts",showContentScripts:"Show Content scripts",refreshGlobalListeners:"Refresh global listeners"},m=e.i18n.registerUIStrings("panels/browser_debugger/browser_debugger-meta.ts",p),u=e.i18n.getLazilyComputedLocalizedString.bind(void 0,m);let R,v;async function h(){return R||(R=await import("../../panels/browser_debugger/browser_debugger.js")),R}async function y(){return v||(v=await import("../../panels/sources/sources.js")),v}i.ViewManager.registerViewExtension({loadView:async()=>(await h()).EventListenerBreakpointsSidebarPane.EventListenerBreakpointsSidebarPane.instance(),id:"sources.event-listener-breakpoints",location:"sources.sidebar-bottom",commandPrompt:u(p.showEventListenerBreakpoints),title:u(p.eventListenerBreakpoints),order:9,persistence:"permanent"}),i.ViewManager.registerViewExtension({loadView:async()=>new((await h()).CSPViolationBreakpointsSidebarPane.CSPViolationBreakpointsSidebarPane),id:"sources.csp-violation-breakpoints",location:"sources.sidebar-bottom",commandPrompt:u(p.showCspViolationBreakpoints),title:u(p.cspViolationBreakpoints),order:10,persistence:"permanent"}),i.ViewManager.registerViewExtension({loadView:async()=>(await h()).XHRBreakpointsSidebarPane.XHRBreakpointsSidebarPane.instance(),id:"sources.xhr-breakpoints",location:"sources.sidebar-bottom",commandPrompt:u(p.showXhrfetchBreakpoints),title:u(p.xhrfetchBreakpoints),order:5,persistence:"permanent",hasToolbar:!0}),i.ViewManager.registerViewExtension({loadView:async()=>(await h()).DOMBreakpointsSidebarPane.DOMBreakpointsSidebarPane.instance(),id:"sources.dom-breakpoints",location:"sources.sidebar-bottom",commandPrompt:u(p.showDomBreakpoints),title:u(p.domBreakpoints),order:7,persistence:"permanent"}),i.ViewManager.registerViewExtension({loadView:async()=>new((await h()).ObjectEventListenersSidebarPane.ObjectEventListenersSidebarPane),id:"sources.global-listeners",location:"sources.sidebar-bottom",commandPrompt:u(p.showGlobalListeners),title:u(p.globalListeners),order:8,persistence:"permanent",hasToolbar:!0}),i.ViewManager.registerViewExtension({loadView:async()=>(await h()).DOMBreakpointsSidebarPane.DOMBreakpointsSidebarPane.instance(),id:"elements.dom-breakpoints",location:"elements-sidebar",commandPrompt:u(p.showDomBreakpoints),title:u(p.domBreakpoints),order:6,persistence:"permanent"}),i.ViewManager.registerViewExtension({location:"navigator-view",id:"navigator-network",title:u(p.page),commandPrompt:u(p.showPage),order:2,persistence:"permanent",loadView:async()=>(await y()).SourcesNavigator.NetworkNavigatorView.instance()}),i.ViewManager.registerViewExtension({location:"navigator-view",id:"navigator-overrides",title:u(p.overrides),commandPrompt:u(p.showOverrides),order:4,persistence:"permanent",loadView:async()=>(await y()).SourcesNavigator.OverridesNavigatorView.instance()}),i.ViewManager.registerViewExtension({location:"navigator-view",id:"navigator-content-scripts",title:u(p.contentScripts),commandPrompt:u(p.showContentScripts),order:5,persistence:"permanent",condition:()=>"/bundled/worker_app.html"!==t.Runtime.getPathName(),loadView:async()=>new((await y()).SourcesNavigator.ContentScriptsNavigatorView)}),i.ActionRegistration.registerActionExtension({category:"DEBUGGER",actionId:"browser-debugger.refresh-global-event-listeners",loadActionDelegate:async()=>new((await h()).ObjectEventListenersSidebarPane.ActionDelegate),title:u(p.refreshGlobalListeners),iconClass:"refresh",contextTypes:()=>void 0===R?[]:(e=>[e.ObjectEventListenersSidebarPane.ObjectEventListenersSidebarPane])(R)}),i.ContextMenu.registerProvider({contextTypes:()=>[o.DOMModel.DOMNode],loadProvider:async()=>new((await h()).DOMBreakpointsSidebarPane.ContextMenuProvider),experiment:void 0}),i.Context.registerListener({contextTypes:()=>[o.DebuggerModel.DebuggerPausedDetails],loadListener:async()=>(await h()).XHRBreakpointsSidebarPane.XHRBreakpointsSidebarPane.instance()}),i.Context.registerListener({contextTypes:()=>[o.DebuggerModel.DebuggerPausedDetails],loadListener:async()=>(await h()).DOMBreakpointsSidebarPane.DOMBreakpointsSidebarPane.instance()});const k={developerResources:"Developer resources",showDeveloperResources:"Show Developer resources"},P=e.i18n.registerUIStrings("panels/developer_resources/developer_resources-meta.ts",k),T=e.i18n.getLazilyComputedLocalizedString.bind(void 0,P);let A;async function E(){return A||(A=await import("../../panels/developer_resources/developer_resources.js")),A}i.ViewManager.registerViewExtension({location:"drawer-view",id:"developer-resources",title:T(k.developerResources),commandPrompt:T(k.showDeveloperResources),order:100,persistence:"closeable",loadView:async()=>new((await E()).DeveloperResourcesView.DeveloperResourcesView)}),n.Revealer.registerRevealer({contextTypes:()=>[o.PageResourceLoader.ResourceKey],destination:n.Revealer.RevealerDestination.DEVELOPER_RESOURCES_PANEL,loadRevealer:async()=>new((await E()).DeveloperResourcesView.DeveloperResourcesRevealer)});const b={issues:"Issues",showIssues:"Show Issues"},S=e.i18n.registerUIStrings("panels/issues/issues-meta.ts",b),f=e.i18n.getLazilyComputedLocalizedString.bind(void 0,S);let x;async function N(){return x||(x=await import("../../panels/issues/issues.js")),x}i.ViewManager.registerViewExtension({location:"drawer-view",id:"issues-pane",title:f(b.issues),commandPrompt:f(b.showIssues),order:100,persistence:"closeable",loadView:async()=>new((await N()).IssuesPane.IssuesPane)}),n.Revealer.registerRevealer({contextTypes:()=>[a.Issue.Issue],destination:n.Revealer.RevealerDestination.ISSUES_VIEW,loadRevealer:async()=>new((await N()).IssueRevealer.IssueRevealer)});const D={resetView:"Reset view",switchToPanMode:"Switch to pan mode",switchToRotateMode:"Switch to rotate mode",zoomIn:"Zoom in",zoomOut:"Zoom out",panOrRotateUp:"Pan or rotate up",panOrRotateDown:"Pan or rotate down",panOrRotateLeft:"Pan or rotate left",panOrRotateRight:"Pan or rotate right"},L=e.i18n.registerUIStrings("panels/layer_viewer/layer_viewer-meta.ts",D),C=e.i18n.getLazilyComputedLocalizedString.bind(void 0,L);i.ActionRegistration.registerActionExtension({actionId:"layers.reset-view",category:"LAYERS",title:C(D.resetView),bindings:[{shortcut:"0"}]}),i.ActionRegistration.registerActionExtension({actionId:"layers.pan-mode",category:"LAYERS",title:C(D.switchToPanMode),bindings:[{shortcut:"x"}]}),i.ActionRegistration.registerActionExtension({actionId:"layers.rotate-mode",category:"LAYERS",title:C(D.switchToRotateMode),bindings:[{shortcut:"v"}]}),i.ActionRegistration.registerActionExtension({actionId:"layers.zoom-in",category:"LAYERS",title:C(D.zoomIn),bindings:[{shortcut:"Shift+Plus"},{shortcut:"NumpadPlus"}]}),i.ActionRegistration.registerActionExtension({actionId:"layers.zoom-out",category:"LAYERS",title:C(D.zoomOut),bindings:[{shortcut:"Shift+Minus"},{shortcut:"NumpadMinus"}]}),i.ActionRegistration.registerActionExtension({actionId:"layers.up",category:"LAYERS",title:C(D.panOrRotateUp),bindings:[{shortcut:"Up"},{shortcut:"w"}]}),i.ActionRegistration.registerActionExtension({actionId:"layers.down",category:"LAYERS",title:C(D.panOrRotateDown),bindings:[{shortcut:"Down"},{shortcut:"s"}]}),i.ActionRegistration.registerActionExtension({actionId:"layers.left",category:"LAYERS",title:C(D.panOrRotateLeft),bindings:[{shortcut:"Left"},{shortcut:"a"}]}),i.ActionRegistration.registerActionExtension({actionId:"layers.right",category:"LAYERS",title:C(D.panOrRotateRight),bindings:[{shortcut:"Right"},{shortcut:"d"}]});const I={throttling:"Throttling",showThrottling:"Show Throttling",goOffline:"Go offline",device:"device",throttlingTag:"throttling",enableSlowGThrottling:"Enable slow `3G` throttling",enableFastGThrottling:"Enable fast `3G` throttling",goOnline:"Go online"},V=e.i18n.registerUIStrings("panels/mobile_throttling/mobile_throttling-meta.ts",I),M=e.i18n.getLazilyComputedLocalizedString.bind(void 0,V);let O;async function B(){return O||(O=await import("../../panels/mobile_throttling/mobile_throttling.js")),O}i.ViewManager.registerViewExtension({location:"settings-view",id:"throttling-conditions",title:M(I.throttling),commandPrompt:M(I.showThrottling),order:35,loadView:async()=>new((await B()).ThrottlingSettingsTab.ThrottlingSettingsTab),settings:["custom-network-conditions","calibrated-cpu-throttling"],iconName:"performance"}),i.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-offline",category:"NETWORK",experiment:"!react-native-specific-ui",title:M(I.goOffline),loadActionDelegate:async()=>new((await B()).ThrottlingManager.ActionDelegate),tags:[M(I.device),M(I.throttlingTag)]}),i.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-low-end-mobile",category:"NETWORK",experiment:"!react-native-specific-ui",title:M(I.enableSlowGThrottling),loadActionDelegate:async()=>new((await B()).ThrottlingManager.ActionDelegate),tags:[M(I.device),M(I.throttlingTag)]}),i.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-mid-tier-mobile",category:"NETWORK",experiment:"!react-native-specific-ui",title:M(I.enableFastGThrottling),loadActionDelegate:async()=>new((await B()).ThrottlingManager.ActionDelegate),tags:[M(I.device),M(I.throttlingTag)]}),i.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-online",category:"NETWORK",experiment:"!react-native-specific-ui",title:M(I.goOnline),loadActionDelegate:async()=>new((await B()).ThrottlingManager.ActionDelegate),tags:[M(I.device),M(I.throttlingTag)]}),n.Settings.registerSettingExtension({storageType:"Synced",settingName:"custom-network-conditions",settingType:"array",defaultValue:[]});const F={showNetwork:"Show Network",network:"Network",networkExpoUnstable:"Expo Network",showNetworkRequestBlocking:"Show Network request blocking",networkRequestBlocking:"Network request blocking",showNetworkConditions:"Show Network conditions",networkConditions:"Network conditions",diskCache:"disk cache",networkThrottling:"network throttling",showSearch:"Show Search",search:"Search",recordNetworkLog:"Record network log",stopRecordingNetworkLog:"Stop recording network log",hideRequestDetails:"Hide request details",colorcodeResourceTypes:"Color-code resource types",colorCode:"color code",resourceType:"resource type",colorCodeByResourceType:"Color code by resource type",useDefaultColors:"Use default colors",groupNetworkLogByFrame:"Group network log by frame",netWork:"network",frame:"frame",group:"group",groupNetworkLogItemsByFrame:"Group network log items by frame",dontGroupNetworkLogItemsByFrame:"Don't group network log items by frame",clear:"Clear network log",addNetworkRequestBlockingPattern:"Add network request blocking pattern",removeAllNetworkRequestBlockingPatterns:"Remove all network request blocking patterns",allowToGenerateHarWithSensitiveData:"Allow to generate `HAR` with sensitive data",dontAllowToGenerateHarWithSensitiveData:"Don't allow to generate `HAR` with sensitive data",allowToGenerateHarWithSensitiveDataDocumentation:"By default generated HAR logs are sanitized and don't include `Cookie`, `Set-Cookie`, or `Authorization` HTTP headers. When this setting is enabled, options to export/copy HAR with sensitive data are provided."},W=e.i18n.registerUIStrings("panels/network/network-meta.ts",F),U=e.i18n.getLazilyComputedLocalizedString.bind(void 0,W),j=e.i18n.getLocalizedString.bind(void 0,W);let _;async function q(){return _||(_=await import("../../panels/network/network.js")),_}function z(e){return void 0===_?[]:e(_)}i.ViewManager.registerViewExtension({location:"panel",id:"network",commandPrompt:U(F.showNetwork),title:()=>t.Runtime.conditions.reactNativeExpoNetworkPanel()?j(F.networkExpoUnstable):j(F.network),order:40,loadView:async()=>(await q()).NetworkPanel.NetworkPanel.instance()}),i.ViewManager.registerViewExtension({location:"drawer-view",id:"network.blocked-urls",commandPrompt:U(F.showNetworkRequestBlocking),title:U(F.networkRequestBlocking),persistence:"closeable",order:60,loadView:async()=>new((await q()).BlockedURLsPane.BlockedURLsPane)}),i.ViewManager.registerViewExtension({location:"drawer-view",id:"network.config",commandPrompt:U(F.showNetworkConditions),title:U(F.networkConditions),persistence:"closeable",order:40,tags:[U(F.diskCache),U(F.networkThrottling),e.i18n.lockedLazyString("useragent"),e.i18n.lockedLazyString("user agent"),e.i18n.lockedLazyString("user-agent")],loadView:async()=>(await q()).NetworkConfigView.NetworkConfigView.instance()}),i.ViewManager.registerViewExtension({location:"network-sidebar",id:"network.search-network-tab",commandPrompt:U(F.showSearch),title:U(F.search),persistence:"permanent",loadView:async()=>(await q()).NetworkPanel.SearchNetworkView.instance()}),i.ActionRegistration.registerActionExtension({actionId:"network.toggle-recording",category:"NETWORK",iconClass:"record-start",toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,contextTypes:()=>z((e=>[e.NetworkPanel.NetworkPanel])),loadActionDelegate:async()=>new((await q()).NetworkPanel.ActionDelegate),options:[{value:!0,title:U(F.recordNetworkLog)},{value:!1,title:U(F.stopRecordingNetworkLog)}],bindings:[{shortcut:"Ctrl+E",platform:"windows,linux"},{shortcut:"Meta+E",platform:"mac"}]}),i.ActionRegistration.registerActionExtension({actionId:"network.clear",category:"NETWORK",title:U(F.clear),iconClass:"clear",loadActionDelegate:async()=>new((await q()).NetworkPanel.ActionDelegate),contextTypes:()=>z((e=>[e.NetworkPanel.NetworkPanel])),bindings:[{shortcut:"Ctrl+L"},{shortcut:"Meta+K",platform:"mac"}]}),i.ActionRegistration.registerActionExtension({actionId:"network.hide-request-details",category:"NETWORK",title:U(F.hideRequestDetails),contextTypes:()=>z((e=>[e.NetworkPanel.NetworkPanel])),loadActionDelegate:async()=>new((await q()).NetworkPanel.ActionDelegate),bindings:[{shortcut:"Esc"}]}),i.ActionRegistration.registerActionExtension({actionId:"network.search",category:"NETWORK",title:U(F.search),contextTypes:()=>z((e=>[e.NetworkPanel.NetworkPanel])),loadActionDelegate:async()=>new((await q()).NetworkPanel.ActionDelegate),bindings:[{platform:"mac",shortcut:"Meta+F",keybindSets:["devToolsDefault","vsCode"]},{platform:"windows,linux",shortcut:"Ctrl+F",keybindSets:["devToolsDefault","vsCode"]}]}),i.ActionRegistration.registerActionExtension({actionId:"network.add-network-request-blocking-pattern",category:"NETWORK",title:U(F.addNetworkRequestBlockingPattern),iconClass:"plus",contextTypes:()=>z((e=>[e.BlockedURLsPane.BlockedURLsPane])),loadActionDelegate:async()=>new((await q()).BlockedURLsPane.ActionDelegate)}),i.ActionRegistration.registerActionExtension({actionId:"network.remove-all-network-request-blocking-patterns",category:"NETWORK",title:U(F.removeAllNetworkRequestBlockingPatterns),iconClass:"clear",contextTypes:()=>z((e=>[e.BlockedURLsPane.BlockedURLsPane])),loadActionDelegate:async()=>new((await q()).BlockedURLsPane.ActionDelegate)}),n.Settings.registerSettingExtension({category:"NETWORK",storageType:"Synced",title:U(F.allowToGenerateHarWithSensitiveData),settingName:"network.show-options-to-generate-har-with-sensitive-data",settingType:"boolean",defaultValue:!1,tags:[e.i18n.lockedLazyString("HAR")],options:[{value:!0,title:U(F.allowToGenerateHarWithSensitiveData)},{value:!1,title:U(F.dontAllowToGenerateHarWithSensitiveData)}],learnMore:{url:"https://goo.gle/devtools-export-hars",tooltip:U(F.allowToGenerateHarWithSensitiveDataDocumentation)}}),n.Settings.registerSettingExtension({category:"NETWORK",storageType:"Synced",title:U(F.colorcodeResourceTypes),settingName:"network-color-code-resource-types",settingType:"boolean",defaultValue:!1,tags:[U(F.colorCode),U(F.resourceType)],options:[{value:!0,title:U(F.colorCodeByResourceType)},{value:!1,title:U(F.useDefaultColors)}]}),n.Settings.registerSettingExtension({category:"NETWORK",storageType:"Synced",title:U(F.groupNetworkLogByFrame),settingName:"network.group-by-frame",settingType:"boolean",defaultValue:!1,tags:[U(F.netWork),U(F.frame),U(F.group)],options:[{value:!0,title:U(F.groupNetworkLogItemsByFrame)},{value:!1,title:U(F.dontGroupNetworkLogItemsByFrame)}]}),i.ViewManager.registerLocationResolver({name:"network-sidebar",category:"NETWORK",loadResolver:async()=>(await q()).NetworkPanel.NetworkPanel.instance()}),i.ContextMenu.registerProvider({contextTypes:()=>[o.NetworkRequest.NetworkRequest,o.Resource.Resource,s.UISourceCode.UISourceCode,o.TraceObject.RevealableNetworkRequest],loadProvider:async()=>(await q()).NetworkPanel.NetworkPanel.instance(),experiment:void 0}),n.Revealer.registerRevealer({contextTypes:()=>[o.NetworkRequest.NetworkRequest],destination:n.Revealer.RevealerDestination.NETWORK_PANEL,loadRevealer:async()=>new((await q()).NetworkPanel.RequestRevealer)}),n.Revealer.registerRevealer({contextTypes:()=>[l.UIRequestLocation.UIRequestLocation],destination:void 0,loadRevealer:async()=>new((await q()).NetworkPanel.RequestLocationRevealer)}),n.Revealer.registerRevealer({contextTypes:()=>[l.NetworkRequestId.NetworkRequestId],destination:n.Revealer.RevealerDestination.NETWORK_PANEL,loadRevealer:async()=>new((await q()).NetworkPanel.RequestIdRevealer)}),n.Revealer.registerRevealer({contextTypes:()=>[l.UIFilter.UIRequestFilter,r.ExtensionServer.RevealableNetworkRequestFilter],destination:n.Revealer.RevealerDestination.NETWORK_PANEL,loadRevealer:async()=>new((await q()).NetworkPanel.NetworkLogWithFilterRevealer)});const G={application:"Application",showApplication:"Show Application",pwa:"pwa",clearSiteData:"Clear site data",clearSiteDataIncludingThirdparty:"Clear site data (including third-party cookies)",startRecordingEvents:"Start recording events",stopRecordingEvents:"Stop recording events"},H=e.i18n.registerUIStrings("panels/application/application-meta.ts",G),K=e.i18n.getLazilyComputedLocalizedString.bind(void 0,H);let Y;async function X(){return Y||(Y=await import("../../panels/application/application.js")),Y}i.ViewManager.registerViewExtension({location:"panel",id:"resources",title:K(G.application),commandPrompt:K(G.showApplication),order:70,loadView:async()=>(await X()).ResourcesPanel.ResourcesPanel.instance(),tags:[K(G.pwa)]}),i.ActionRegistration.registerActionExtension({category:"RESOURCES",actionId:"resources.clear",title:K(G.clearSiteData),loadActionDelegate:async()=>new((await X()).StorageView.ActionDelegate)}),i.ActionRegistration.registerActionExtension({category:"RESOURCES",actionId:"resources.clear-incl-third-party-cookies",title:K(G.clearSiteDataIncludingThirdparty),loadActionDelegate:async()=>new((await X()).StorageView.ActionDelegate)}),i.ActionRegistration.registerActionExtension({actionId:"background-service.toggle-recording",iconClass:"record-start",toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,contextTypes:()=>void 0===Y?[]:(e=>[e.BackgroundServiceView.BackgroundServiceView])(Y),loadActionDelegate:async()=>new((await X()).BackgroundServiceView.ActionDelegate),category:"BACKGROUND_SERVICES",options:[{value:!0,title:K(G.startRecordingEvents)},{value:!1,title:K(G.stopRecordingEvents)}],bindings:[{platform:"windows,linux",shortcut:"Ctrl+E"},{platform:"mac",shortcut:"Meta+E"}]}),n.Revealer.registerRevealer({contextTypes:()=>[o.Resource.Resource],destination:n.Revealer.RevealerDestination.APPLICATION_PANEL,loadRevealer:async()=>new((await X()).ResourcesPanel.ResourceRevealer)}),n.Revealer.registerRevealer({contextTypes:()=>[o.ResourceTreeModel.ResourceTreeFrame],destination:n.Revealer.RevealerDestination.APPLICATION_PANEL,loadRevealer:async()=>new((await X()).ResourcesPanel.FrameDetailsRevealer)}),n.Revealer.registerRevealer({contextTypes:()=>[c.PreloadingForward.RuleSetView],destination:n.Revealer.RevealerDestination.APPLICATION_PANEL,loadRevealer:async()=>new((await X()).ResourcesPanel.RuleSetViewRevealer)}),n.Revealer.registerRevealer({contextTypes:()=>[c.PreloadingForward.AttemptViewWithFilter],destination:n.Revealer.RevealerDestination.APPLICATION_PANEL,loadRevealer:async()=>new((await X()).ResourcesPanel.AttemptViewWithFilterRevealer)});const Z={performance:"Performance",showPerformance:"Show Performance",record:"Record",stop:"Stop",recordAndReload:"Record and reload",saveProfile:"Save profileโ€ฆ",loadProfile:"Load profileโ€ฆ",previousFrame:"Previous frame",nextFrame:"Next frame",showRecentTimelineSessions:"Show recent timeline sessions",previousRecording:"Previous recording",nextRecording:"Next recording",hideChromeFrameInLayersView:"Hide `chrome` frame in Layers view"},J=e.i18n.registerUIStrings("panels/timeline/timeline-meta.ts",Z),Q=e.i18n.getLazilyComputedLocalizedString.bind(void 0,J);let $;async function ee(){return $||($=await import("../../panels/timeline/timeline.js")),$}function te(e){return void 0===$?[]:e($)}i.ViewManager.registerViewExtension({location:"panel",id:"timeline",title:Q(Z.performance),commandPrompt:Q(Z.showPerformance),order:50,loadView:async()=>(await ee()).TimelinePanel.TimelinePanel.instance()}),i.ActionRegistration.registerActionExtension({actionId:"timeline.toggle-recording",category:"PERFORMANCE",iconClass:"record-start",toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,contextTypes:()=>te((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await ee()).TimelinePanel.ActionDelegate),options:[{value:!0,title:Q(Z.record)},{value:!1,title:Q(Z.stop)}],bindings:[{platform:"windows,linux",shortcut:"Ctrl+E"},{platform:"mac",shortcut:"Meta+E"}]}),i.ActionRegistration.registerActionExtension({actionId:"timeline.record-reload",iconClass:"refresh",contextTypes:()=>te((e=>[e.TimelinePanel.TimelinePanel])),category:"PERFORMANCE",title:Q(Z.recordAndReload),loadActionDelegate:async()=>new((await ee()).TimelinePanel.ActionDelegate),bindings:[{platform:"windows,linux",shortcut:"Ctrl+Shift+E"},{platform:"mac",shortcut:"Meta+Shift+E"}],experiment:"!react-native-specific-ui"}),i.ActionRegistration.registerActionExtension({category:"PERFORMANCE",actionId:"timeline.save-to-file",contextTypes:()=>te((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await ee()).TimelinePanel.ActionDelegate),title:Q(Z.saveProfile),bindings:[{platform:"windows,linux",shortcut:"Ctrl+S"},{platform:"mac",shortcut:"Meta+S"}]}),i.ActionRegistration.registerActionExtension({category:"PERFORMANCE",actionId:"timeline.load-from-file",contextTypes:()=>te((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await ee()).TimelinePanel.ActionDelegate),title:Q(Z.loadProfile),bindings:[{platform:"windows,linux",shortcut:"Ctrl+O"},{platform:"mac",shortcut:"Meta+O"}]}),i.ActionRegistration.registerActionExtension({actionId:"timeline.jump-to-previous-frame",category:"PERFORMANCE",title:Q(Z.previousFrame),contextTypes:()=>te((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await ee()).TimelinePanel.ActionDelegate),bindings:[{shortcut:"["}]}),i.ActionRegistration.registerActionExtension({actionId:"timeline.jump-to-next-frame",category:"PERFORMANCE",title:Q(Z.nextFrame),contextTypes:()=>te((e=>[e.TimelinePanel.TimelinePanel])),loadActionDelegate:async()=>new((await ee()).TimelinePanel.ActionDelegate),bindings:[{shortcut:"]"}]}),i.ActionRegistration.registerActionExtension({actionId:"timeline.show-history",loadActionDelegate:async()=>new((await ee()).TimelinePanel.ActionDelegate),category:"PERFORMANCE",title:Q(Z.showRecentTimelineSessions),contextTypes:()=>te((e=>[e.TimelinePanel.TimelinePanel])),bindings:[{platform:"windows,linux",shortcut:"Ctrl+H"},{platform:"mac",shortcut:"Meta+Y"}]}),i.ActionRegistration.registerActionExtension({actionId:"timeline.previous-recording",category:"PERFORMANCE",loadActionDelegate:async()=>new((await ee()).TimelinePanel.ActionDelegate),title:Q(Z.previousRecording),contextTypes:()=>te((e=>[e.TimelinePanel.TimelinePanel])),bindings:[{platform:"windows,linux",shortcut:"Alt+Left"},{platform:"mac",shortcut:"Meta+Left"}]}),i.ActionRegistration.registerActionExtension({actionId:"timeline.next-recording",category:"PERFORMANCE",loadActionDelegate:async()=>new((await ee()).TimelinePanel.ActionDelegate),title:Q(Z.nextRecording),contextTypes:()=>te((e=>[e.TimelinePanel.TimelinePanel])),bindings:[{platform:"windows,linux",shortcut:"Alt+Right"},{platform:"mac",shortcut:"Meta+Right"}]}),n.Settings.registerSettingExtension({category:"PERFORMANCE",storageType:"Synced",title:Q(Z.hideChromeFrameInLayersView),settingName:"frame-viewer-hide-chrome-window",settingType:"boolean",defaultValue:!1}),n.Settings.registerSettingExtension({category:"PERFORMANCE",storageType:"Synced",settingName:"annotations-hidden",settingType:"boolean",defaultValue:!1}),n.Linkifier.registerLinkifier({contextTypes:()=>te((e=>[e.CLSLinkifier.CLSRect])),loadLinkifier:async()=>(await ee()).CLSLinkifier.Linkifier.instance()}),i.ContextMenu.registerItem({location:"timelineMenu/open",actionId:"timeline.load-from-file",order:10}),i.ContextMenu.registerItem({location:"timelineMenu/open",actionId:"timeline.save-to-file",order:15}),n.Revealer.registerRevealer({contextTypes:()=>[o.TraceObject.TraceObject],destination:n.Revealer.RevealerDestination.TIMELINE_PANEL,loadRevealer:async()=>new((await ee()).TimelinePanel.TraceRevealer)}),n.Revealer.registerRevealer({contextTypes:()=>[o.TraceObject.RevealableEvent],destination:n.Revealer.RevealerDestination.TIMELINE_PANEL,loadRevealer:async()=>new((await ee()).TimelinePanel.EventRevealer)});const oe={main:"Main"},ie=e.i18n.registerUIStrings("entrypoints/worker_app/WorkerMain.ts",oe),ne=e.i18n.getLocalizedString.bind(void 0,ie);let ae;class re{static instance(e={forceNew:null}){const{forceNew:t}=e;return ae&&!t||(ae=new re),ae}async run(){o.Connections.initMainConnection((async()=>{await o.TargetManager.TargetManager.instance().maybeAttachInitialTarget()||o.TargetManager.TargetManager.instance().createTarget("main",ne(oe.main),o.Target.Type.ServiceWorker,null)}),d.TargetDetachedDialog.TargetDetachedDialog.connectionLost),new g.NetworkPanelIndicator.NetworkPanelIndicator}}n.Runnable.registerEarlyInitializationRunnable(re.instance),o.ChildTargetManager.ChildTargetManager.install((async({target:e,waitingForDebugger:t})=>{if(e.parentTarget()||e.type()!==o.Target.Type.ServiceWorker||!t)return;const i=e.model(o.DebuggerModel.DebuggerModel);i&&(i.isReadyToPause()||await i.once(o.DebuggerModel.Events.DebuggerIsReadyToPause),i.pause())})),self.runtime=t.Runtime.Runtime.instance({forceNew:!0}),new w.MainImpl.MainImpl; diff --git a/packages/debugger-frontend/dist/third-party/front_end/panels/coverage/coverage-meta.js b/packages/debugger-frontend/dist/third-party/front_end/panels/coverage/coverage-meta.js index fbac0bea8704..287b1b82af19 100644 --- a/packages/debugger-frontend/dist/third-party/front_end/panels/coverage/coverage-meta.js +++ b/packages/debugger-frontend/dist/third-party/front_end/panels/coverage/coverage-meta.js @@ -1 +1 @@ -import*as e from"../../core/i18n/i18n.js";import*as t from"../../ui/legacy/legacy.js";const o={coverage:"Coverage",showCoverage:"Show Coverage",instrumentCoverage:"Instrument coverage",stopInstrumentingCoverageAndShow:"Stop instrumenting coverage and show results",startInstrumentingCoverageAnd:"Start instrumenting coverage and reload page",clearCoverage:"Clear coverage",exportCoverage:"Export coverage"},a=e.i18n.registerUIStrings("panels/coverage/coverage-meta.ts",o),r=e.i18n.getLazilyComputedLocalizedString.bind(void 0,a);let n;async function i(){return n||(n=await import("./coverage.js")),n}function g(e){return void 0===n?[]:e(n)}t.ViewManager.registerViewExtension({location:"drawer-view",id:"coverage",title:r(o.coverage),commandPrompt:r(o.showCoverage),persistence:"closeable",order:100,loadView:async()=>(await i()).CoverageView.CoverageView.instance()}),t.ActionRegistration.registerActionExtension({actionId:"coverage.toggle-recording",iconClass:"record-start",toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,loadActionDelegate:async()=>new((await i()).CoverageView.ActionDelegate),category:"PERFORMANCE",options:[{value:!0,title:r(o.instrumentCoverage)},{value:!1,title:r(o.stopInstrumentingCoverageAndShow)}]}),t.ActionRegistration.registerActionExtension({actionId:"coverage.start-with-reload",iconClass:"refresh",loadActionDelegate:async()=>new((await i()).CoverageView.ActionDelegate),category:"PERFORMANCE",title:r(o.startInstrumentingCoverageAnd)}),t.ActionRegistration.registerActionExtension({actionId:"coverage.clear",iconClass:"clear",category:"PERFORMANCE",title:r(o.clearCoverage),loadActionDelegate:async()=>new((await i()).CoverageView.ActionDelegate),contextTypes:()=>g((e=>[e.CoverageView.CoverageView]))}),t.ActionRegistration.registerActionExtension({actionId:"coverage.export",iconClass:"download",category:"PERFORMANCE",title:r(o.exportCoverage),loadActionDelegate:async()=>new((await i()).CoverageView.ActionDelegate),contextTypes:()=>g((e=>[e.CoverageView.CoverageView]))}); +import*as e from"../../core/i18n/i18n.js";import"../../core/root/root.js";import*as t from"../../ui/legacy/legacy.js";const o={coverage:"Coverage",showCoverage:"Show Coverage",instrumentCoverage:"Instrument coverage",stopInstrumentingCoverageAndShow:"Stop instrumenting coverage and show results",startInstrumentingCoverageAnd:"Start instrumenting coverage and reload page",clearCoverage:"Clear coverage",exportCoverage:"Export coverage"},a=e.i18n.registerUIStrings("panels/coverage/coverage-meta.ts",o),r=e.i18n.getLazilyComputedLocalizedString.bind(void 0,a);let i;async function n(){return i||(i=await import("./coverage.js")),i}function g(e){return void 0===i?[]:e(i)}t.ViewManager.registerViewExtension({location:"drawer-view",id:"coverage",title:r(o.coverage),commandPrompt:r(o.showCoverage),persistence:"closeable",order:100,loadView:async()=>(await n()).CoverageView.CoverageView.instance()}),t.ActionRegistration.registerActionExtension({actionId:"coverage.toggle-recording",iconClass:"record-start",toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,loadActionDelegate:async()=>new((await n()).CoverageView.ActionDelegate),category:"PERFORMANCE",options:[{value:!0,title:r(o.instrumentCoverage)},{value:!1,title:r(o.stopInstrumentingCoverageAndShow)}]}),t.ActionRegistration.registerActionExtension({actionId:"coverage.start-with-reload",iconClass:"refresh",loadActionDelegate:async()=>new((await n()).CoverageView.ActionDelegate),category:"PERFORMANCE",experiment:"!react-native-specific-ui",title:r(o.startInstrumentingCoverageAnd)}),t.ActionRegistration.registerActionExtension({actionId:"coverage.clear",iconClass:"clear",category:"PERFORMANCE",title:r(o.clearCoverage),loadActionDelegate:async()=>new((await n()).CoverageView.ActionDelegate),contextTypes:()=>g((e=>[e.CoverageView.CoverageView]))}),t.ActionRegistration.registerActionExtension({actionId:"coverage.export",iconClass:"download",category:"PERFORMANCE",title:r(o.exportCoverage),loadActionDelegate:async()=>new((await n()).CoverageView.ActionDelegate),contextTypes:()=>g((e=>[e.CoverageView.CoverageView]))}); diff --git a/packages/debugger-frontend/dist/third-party/front_end/panels/emulation/emulation-meta.js b/packages/debugger-frontend/dist/third-party/front_end/panels/emulation/emulation-meta.js index af7cca83d780..9fb48736eaca 100644 --- a/packages/debugger-frontend/dist/third-party/front_end/panels/emulation/emulation-meta.js +++ b/packages/debugger-frontend/dist/third-party/front_end/panels/emulation/emulation-meta.js @@ -1 +1 @@ -import*as e from"../../core/common/common.js";import*as t from"../../core/i18n/i18n.js";import*as i from"../../core/root/root.js";import*as o from"../../ui/legacy/legacy.js";const n={toggleDeviceToolbar:"Toggle device toolbar",captureScreenshot:"Capture screenshot",captureFullSizeScreenshot:"Capture full size screenshot",captureNodeScreenshot:"Capture node screenshot",showMediaQueries:"Show media queries",device:"device",hideMediaQueries:"Hide media queries",showRulers:"Show rulers in the Device Mode toolbar",hideRulers:"Hide rulers in the Device Mode toolbar",showDeviceFrame:"Show device frame",hideDeviceFrame:"Hide device frame"},a=t.i18n.registerUIStrings("panels/emulation/emulation-meta.ts",n),r=t.i18n.getLazilyComputedLocalizedString.bind(void 0,a);let c;async function s(){return c||(c=await import("./emulation.js")),c}o.ActionRegistration.registerActionExtension({category:"MOBILE",actionId:"emulation.toggle-device-mode",toggleable:!0,loadActionDelegate:async()=>new((await s()).DeviceModeWrapper.ActionDelegate),condition:i.Runtime.conditions.canDock,title:r(n.toggleDeviceToolbar),iconClass:"devices",bindings:[{platform:"windows,linux",shortcut:"Shift+Ctrl+M"},{platform:"mac",shortcut:"Shift+Meta+M"}]}),o.ActionRegistration.registerActionExtension({actionId:"emulation.capture-screenshot",category:"SCREENSHOT",loadActionDelegate:async()=>new((await s()).DeviceModeWrapper.ActionDelegate),condition:i.Runtime.conditions.canDock,title:r(n.captureScreenshot)}),o.ActionRegistration.registerActionExtension({actionId:"emulation.capture-full-height-screenshot",category:"SCREENSHOT",loadActionDelegate:async()=>new((await s()).DeviceModeWrapper.ActionDelegate),condition:i.Runtime.conditions.canDock,title:r(n.captureFullSizeScreenshot)}),o.ActionRegistration.registerActionExtension({actionId:"emulation.capture-node-screenshot",category:"SCREENSHOT",loadActionDelegate:async()=>new((await s()).DeviceModeWrapper.ActionDelegate),condition:i.Runtime.conditions.canDock,title:r(n.captureNodeScreenshot)}),e.Settings.registerSettingExtension({category:"MOBILE",settingName:"show-media-query-inspector",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:r(n.showMediaQueries)},{value:!1,title:r(n.hideMediaQueries)}],tags:[r(n.device)]}),e.Settings.registerSettingExtension({category:"MOBILE",settingName:"emulation.show-rulers",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:r(n.showRulers)},{value:!1,title:r(n.hideRulers)}],tags:[r(n.device)]}),e.Settings.registerSettingExtension({category:"MOBILE",settingName:"emulation.show-device-outline",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:r(n.showDeviceFrame)},{value:!1,title:r(n.hideDeviceFrame)}],tags:[r(n.device)]}),o.Toolbar.registerToolbarItem({actionId:"emulation.toggle-device-mode",condition:i.Runtime.conditions.canDock,location:"main-toolbar-left",order:1,loadItem:void 0,separator:void 0}),e.AppProvider.registerAppProvider({loadAppProvider:async()=>(await s()).AdvancedApp.AdvancedAppProvider.instance(),condition:i.Runtime.conditions.canDock,order:0}),o.ContextMenu.registerItem({location:"deviceModeMenu/save",order:12,actionId:"emulation.capture-screenshot"}),o.ContextMenu.registerItem({location:"deviceModeMenu/save",order:13,actionId:"emulation.capture-full-height-screenshot"}); +import*as e from"../../core/common/common.js";import*as t from"../../core/i18n/i18n.js";import*as i from"../../core/root/root.js";import*as o from"../../ui/legacy/legacy.js";const n={toggleDeviceToolbar:"Toggle device toolbar",captureScreenshot:"Capture screenshot",captureFullSizeScreenshot:"Capture full size screenshot",captureNodeScreenshot:"Capture node screenshot",showMediaQueries:"Show media queries",device:"device",hideMediaQueries:"Hide media queries",showRulers:"Show rulers in the Device Mode toolbar",hideRulers:"Hide rulers in the Device Mode toolbar",showDeviceFrame:"Show device frame",hideDeviceFrame:"Hide device frame"},a=t.i18n.registerUIStrings("panels/emulation/emulation-meta.ts",n),r=t.i18n.getLazilyComputedLocalizedString.bind(void 0,a);let c;async function s(){return c||(c=await import("./emulation.js")),c}o.ActionRegistration.registerActionExtension({category:"MOBILE",experiment:"!react-native-specific-ui",actionId:"emulation.toggle-device-mode",toggleable:!0,loadActionDelegate:async()=>new((await s()).DeviceModeWrapper.ActionDelegate),condition:i.Runtime.conditions.canDock,title:r(n.toggleDeviceToolbar),iconClass:"devices",bindings:[{platform:"windows,linux",shortcut:"Shift+Ctrl+M"},{platform:"mac",shortcut:"Shift+Meta+M"}]}),o.ActionRegistration.registerActionExtension({actionId:"emulation.capture-screenshot",category:"SCREENSHOT",loadActionDelegate:async()=>new((await s()).DeviceModeWrapper.ActionDelegate),title:r(n.captureScreenshot)}),o.ActionRegistration.registerActionExtension({actionId:"emulation.capture-full-height-screenshot",category:"SCREENSHOT",experiment:"!react-native-specific-ui",loadActionDelegate:async()=>new((await s()).DeviceModeWrapper.ActionDelegate),condition:i.Runtime.conditions.canDock,title:r(n.captureFullSizeScreenshot)}),o.ActionRegistration.registerActionExtension({actionId:"emulation.capture-node-screenshot",category:"SCREENSHOT",experiment:"!react-native-specific-ui",loadActionDelegate:async()=>new((await s()).DeviceModeWrapper.ActionDelegate),condition:i.Runtime.conditions.canDock,title:r(n.captureNodeScreenshot)}),e.Settings.registerSettingExtension({category:"MOBILE",experiment:"!react-native-specific-ui",settingName:"show-media-query-inspector",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:r(n.showMediaQueries)},{value:!1,title:r(n.hideMediaQueries)}],tags:[r(n.device)]}),e.Settings.registerSettingExtension({category:"MOBILE",experiment:"!react-native-specific-ui",settingName:"emulation.show-rulers",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:r(n.showRulers)},{value:!1,title:r(n.hideRulers)}],tags:[r(n.device)]}),e.Settings.registerSettingExtension({category:"MOBILE",experiment:"!react-native-specific-ui",settingName:"emulation.show-device-outline",settingType:"boolean",defaultValue:!1,options:[{value:!0,title:r(n.showDeviceFrame)},{value:!1,title:r(n.hideDeviceFrame)}],tags:[r(n.device)]}),o.Toolbar.registerToolbarItem({actionId:"emulation.toggle-device-mode",condition:i.Runtime.conditions.canDock,location:"main-toolbar-left",order:1,loadItem:void 0,separator:void 0}),e.AppProvider.registerAppProvider({loadAppProvider:async()=>(await s()).AdvancedApp.AdvancedAppProvider.instance(),condition:i.Runtime.conditions.canDock,order:0}),o.ContextMenu.registerItem({location:"deviceModeMenu/save",order:12,actionId:"emulation.capture-screenshot"}),o.ContextMenu.registerItem({location:"deviceModeMenu/save",order:13,actionId:"emulation.capture-full-height-screenshot"}); diff --git a/packages/debugger-frontend/dist/third-party/front_end/panels/emulation/emulation.js b/packages/debugger-frontend/dist/third-party/front_end/panels/emulation/emulation.js index 42ba41cf7a8b..ad182872fbb3 100644 --- a/packages/debugger-frontend/dist/third-party/front_end/panels/emulation/emulation.js +++ b/packages/debugger-frontend/dist/third-party/front_end/panels/emulation/emulation.js @@ -1 +1 @@ -import*as e from"../../core/host/host.js";import*as t from"../../ui/legacy/legacy.js";import*as i from"../../ui/legacy/theme_support/theme_support.js";import*as o from"../../core/root/root.js";import*as s from"../../core/sdk/sdk.js";import*as n from"../../models/emulation/emulation.js";import*as r from"../../core/common/common.js";import*as a from"../../core/i18n/i18n.js";import*as d from"../../core/platform/platform.js";import*as l from"../../ui/visual_logging/visual_logging.js";import*as c from"../mobile_throttling/mobile_throttling.js";import*as h from"./components/components.js";import*as m from"../../models/bindings/bindings.js";const p={dimensions:"Dimensions",width:"Width",heightLeaveEmptyForFull:"Height (leave empty for full)",zoom:"Zoom",devicePixelRatio:"Device pixel ratio",deviceType:"Device type",experimentalWebPlatformFeature:'"`Experimental Web Platform Feature`" flag is enabled. Click to disable it.',experimentalWebPlatformFeatureFlag:'"`Experimental Web Platform Feature`" flag is disabled. Click to enable it.',moreOptions:"More options",fitToWindowF:"Fit to window ({PH1}%)",autoadjustZoom:"Auto-adjust zoom",defaultF:"Default: {PH1}",hideDeviceFrame:"Hide device frame",showDeviceFrame:"Show device frame",hideMediaQueries:"Hide media queries",showMediaQueries:"Show media queries",hideRulers:"Hide rulers",showRulers:"Show rulers",removeDevicePixelRatio:"Remove device pixel ratio",addDevicePixelRatio:"Add device pixel ratio",removeDeviceType:"Remove device type",addDeviceType:"Add device type",resetToDefaults:"Reset to defaults",closeDevtools:"Close DevTools",responsive:"Responsive",edit:"Editโ€ฆ",portrait:"Portrait",landscape:"Landscape",rotate:"Rotate",none:"None",screenOrientationOptions:"Screen orientation options",toggleDualscreenMode:"Toggle dual-screen mode",devicePosture:"Device posture"},u=a.i18n.registerUIStrings("panels/emulation/DeviceModeToolbar.ts",p),g=a.i18n.getLocalizedString.bind(void 0,u);function v(e,t){e.setTitle(t),e.element.title=t}class b{model;showMediaInspectorSetting;showRulersSetting;deviceOutlineSetting;showDeviceScaleFactorSetting;showUserAgentTypeSetting;autoAdjustScaleSetting;lastMode;elementInternal;emulatedDevicesList;persistenceSetting;spanButton;postureItem;modeButton;widthInput;heightInput;deviceScaleItem;deviceSelectItem;scaleItem;uaItem;experimentalButton;cachedDeviceScale;cachedUaType;xItem;throttlingConditionsItem;cachedModelType;cachedScale;cachedModelDevice;cachedModelMode;constructor(e,t,i){this.model=e,this.showMediaInspectorSetting=t,this.showRulersSetting=i,this.deviceOutlineSetting=this.model.deviceOutlineSetting(),this.showDeviceScaleFactorSetting=r.Settings.Settings.instance().createSetting("emulation.show-device-scale-factor",!1),this.showDeviceScaleFactorSetting.addChangeListener(this.updateDeviceScaleFactorVisibility,this),this.showUserAgentTypeSetting=r.Settings.Settings.instance().createSetting("emulation.show-user-agent-type",!1),this.showUserAgentTypeSetting.addChangeListener(this.updateUserAgentTypeVisibility,this),this.autoAdjustScaleSetting=r.Settings.Settings.instance().createSetting("emulation.auto-adjust-scale",!0),this.lastMode=new Map,this.elementInternal=document.createElement("div"),this.elementInternal.classList.add("device-mode-toolbar"),this.elementInternal.setAttribute("jslog",`${l.toolbar("device-mode").track({resize:!0})}`);const o=this.elementInternal.createChild("devtools-toolbar","main-toolbar");this.appendDeviceSelectMenu(o),this.widthInput=new h.DeviceSizeInputElement.SizeInputElement(g(p.width),{jslogContext:"width"}),this.widthInput.addEventListener("sizechanged",(({size:e})=>{this.autoAdjustScaleSetting.get()?this.model.setWidthAndScaleToFit(e):this.model.setWidth(e)})),this.heightInput=new h.DeviceSizeInputElement.SizeInputElement(g(p.heightLeaveEmptyForFull),{jslogContext:"height"}),this.heightInput.addEventListener("sizechanged",(({size:e})=>{this.autoAdjustScaleSetting.get()?this.model.setHeightAndScaleToFit(e):this.model.setHeight(e)})),this.appendDimensionInputs(o),this.appendDisplaySettings(o),this.appendDevicePositionItems(o);const s=this.elementInternal.createChild("devtools-toolbar","device-mode-toolbar-options");function a(){const t=e.toolbarControlsEnabledSetting().get();o.setEnabled(t),s.setEnabled(t)}s.wrappable=!0,this.fillOptionsToolbar(s),this.emulatedDevicesList=n.EmulatedDevices.EmulatedDevicesList.instance(),this.emulatedDevicesList.addEventListener("CustomDevicesUpdated",this.deviceListChanged,this),this.emulatedDevicesList.addEventListener("StandardDevicesUpdated",this.deviceListChanged,this),this.persistenceSetting=r.Settings.Settings.instance().createSetting("emulation.device-mode-value",{device:"",orientation:"",mode:""}),this.model.toolbarControlsEnabledSetting().addChangeListener(a),a()}createEmptyToolbarElement(){const e=document.createElement("div");return e.classList.add("device-mode-empty-toolbar-element"),e}appendDeviceSelectMenu(e){e.appendToolbarItem(new t.Toolbar.ToolbarItem(this.createEmptyToolbarElement())),this.deviceSelectItem=new t.Toolbar.ToolbarMenuButton(this.appendDeviceMenuItems.bind(this),void 0,void 0,"device"),this.deviceSelectItem.turnShrinkable(),this.deviceSelectItem.setDarkText(),e.appendToolbarItem(this.deviceSelectItem)}appendDimensionInputs(e){e.appendToolbarItem(new t.Toolbar.ToolbarItem(this.widthInput));const i=document.createElement("div");i.classList.add("device-mode-x"),i.textContent="ร—",this.xItem=new t.Toolbar.ToolbarItem(i),e.appendToolbarItem(this.xItem),e.appendToolbarItem(new t.Toolbar.ToolbarItem(this.heightInput))}appendDisplaySettings(e){e.appendToolbarItem(new t.Toolbar.ToolbarItem(this.createEmptyToolbarElement())),this.scaleItem=new t.Toolbar.ToolbarMenuButton(this.appendScaleMenuItems.bind(this),void 0,void 0,"scale"),v(this.scaleItem,g(p.zoom)),this.scaleItem.turnShrinkable(),this.scaleItem.setDarkText(),e.appendToolbarItem(this.scaleItem),e.appendToolbarItem(new t.Toolbar.ToolbarItem(this.createEmptyToolbarElement())),this.deviceScaleItem=new t.Toolbar.ToolbarMenuButton(this.appendDeviceScaleMenuItems.bind(this),void 0,void 0,"device-pixel-ratio"),this.deviceScaleItem.turnShrinkable(),this.deviceScaleItem.setVisible(this.showDeviceScaleFactorSetting.get()),v(this.deviceScaleItem,g(p.devicePixelRatio)),this.deviceScaleItem.setDarkText(),e.appendToolbarItem(this.deviceScaleItem),e.appendToolbarItem(new t.Toolbar.ToolbarItem(this.createEmptyToolbarElement())),this.uaItem=new t.Toolbar.ToolbarMenuButton(this.appendUserAgentMenuItems.bind(this),void 0,void 0,"device-type"),this.uaItem.turnShrinkable(),this.uaItem.setVisible(this.showUserAgentTypeSetting.get()),v(this.uaItem,g(p.deviceType)),this.uaItem.setDarkText(),e.appendToolbarItem(this.uaItem),this.throttlingConditionsItem=c.ThrottlingManager.throttlingManager().createMobileThrottlingButton(),this.throttlingConditionsItem.turnShrinkable(),e.appendToolbarItem(this.throttlingConditionsItem)}appendDevicePositionItems(e){e.appendToolbarItem(new t.Toolbar.ToolbarItem(this.createEmptyToolbarElement())),this.modeButton=new t.Toolbar.ToolbarButton("","screen-rotation",void 0,"screen-rotation"),this.modeButton.addEventListener("Click",this.modeMenuClicked,this),e.appendToolbarItem(this.modeButton),this.spanButton=new t.Toolbar.ToolbarButton("","device-fold",void 0,"device-fold"),this.spanButton.addEventListener("Click",this.spanClicked,this),e.appendToolbarItem(this.spanButton),e.appendToolbarItem(new t.Toolbar.ToolbarItem(this.createEmptyToolbarElement())),this.postureItem=new t.Toolbar.ToolbarMenuButton(this.appendDevicePostureItems.bind(this),void 0,void 0,"device-posture"),this.postureItem.turnShrinkable(),this.postureItem.setDarkText(),v(this.postureItem,g(p.devicePosture)),e.appendToolbarItem(this.postureItem),this.createExperimentalButton(e)}createExperimentalButton(e){e.appendToolbarItem(new t.Toolbar.ToolbarSeparator(!0));const i=this.model.webPlatformExperimentalFeaturesEnabled()?g(p.experimentalWebPlatformFeature):g(p.experimentalWebPlatformFeatureFlag);this.experimentalButton=new t.Toolbar.ToolbarToggle(i,"experiment-check"),this.experimentalButton.setToggled(this.model.webPlatformExperimentalFeaturesEnabled()),this.experimentalButton.setEnabled(!0),this.experimentalButton.addEventListener("Click",this.experimentalClicked,this),e.appendToolbarItem(this.experimentalButton)}experimentalClicked(){e.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab("chrome://flags/#enable-experimental-web-platform-features")}fillOptionsToolbar(e){e.appendToolbarItem(new t.Toolbar.ToolbarItem(this.createEmptyToolbarElement()));const i=new t.Toolbar.ToolbarMenuButton(this.appendOptionsMenuItems.bind(this),!0,void 0,"more-options","dots-vertical");i.setTitle(g(p.moreOptions)),e.appendToolbarItem(i)}appendDevicePostureItems(e){for(const t of["Continuous","Folded"])e.defaultSection().appendCheckboxItem(t,this.spanClicked.bind(this),{checked:t===this.currentDevicePosture(),jslogContext:t.toLowerCase()})}currentDevicePosture(){const e=this.model.mode();return!e||e.orientation!==n.EmulatedDevices.VerticalSpanned&&e.orientation!==n.EmulatedDevices.HorizontalSpanned?"Continuous":"Folded"}appendScaleMenuItems(e){this.model.type()===n.DeviceModeModel.Type.Device&&e.footerSection().appendItem(g(p.fitToWindowF,{PH1:this.getPrettyFitZoomPercentage()}),this.onScaleMenuChanged.bind(this,this.model.fitScale()),{jslogContext:"fit-to-window"}),e.footerSection().appendCheckboxItem(g(p.autoadjustZoom),this.onAutoAdjustScaleChanged.bind(this),{checked:this.autoAdjustScaleSetting.get(),jslogContext:"auto-adjust-zoom"});const t=function(t,i){e.defaultSection().appendCheckboxItem(t,this.onScaleMenuChanged.bind(this,i),{checked:this.model.scaleSetting().get()===i,jslogContext:t})}.bind(this);t("50%",.5),t("75%",.75),t("100%",1),t("125%",1.25),t("150%",1.5),t("200%",2)}onScaleMenuChanged(e){this.model.scaleSetting().set(e)}onAutoAdjustScaleChanged(){this.autoAdjustScaleSetting.set(!this.autoAdjustScaleSetting.get())}appendDeviceScaleMenuItems(e){const t=this.model.deviceScaleFactorSetting(),i="Mobile"===this.model.uaSetting().get()||"Mobile (no touch)"===this.model.uaSetting().get()?n.DeviceModeModel.defaultMobileScaleFactor:window.devicePixelRatio;function o(e,i,o,s){e.appendCheckboxItem(i,t.set.bind(t,o),{checked:t.get()===o,jslogContext:s})}o(e.headerSection(),g(p.defaultF,{PH1:i}),0,"dpr-default"),o(e.defaultSection(),"1",1,"dpr-1"),o(e.defaultSection(),"2",2,"dpr-2"),o(e.defaultSection(),"3",3,"dpr-3")}appendUserAgentMenuItems(e){const t=this.model.uaSetting();function i(i,o){e.defaultSection().appendCheckboxItem(i,t.set.bind(t,o),{checked:t.get()===o,jslogContext:d.StringUtilities.toKebabCase(o)})}i("Mobile","Mobile"),i("Mobile (no touch)","Mobile (no touch)"),i("Desktop","Desktop"),i("Desktop (touch)","Desktop (touch)")}appendOptionsMenuItems(t){const i=this.model;function o(e,t,o,s,r,a){void 0===r&&(r=i.type()===n.DeviceModeModel.Type.None);const d=t.get(),l=`${a}-${d?"disable":"enable"}`;e.appendItem(d?o:s,t.set.bind(t,!t.get()),{disabled:r,jslogContext:l})}o(t.headerSection(),this.deviceOutlineSetting,g(p.hideDeviceFrame),g(p.showDeviceFrame),i.type()!==n.DeviceModeModel.Type.Device,"device-frame"),o(t.headerSection(),this.showMediaInspectorSetting,g(p.hideMediaQueries),g(p.showMediaQueries),void 0,"media-queries"),o(t.headerSection(),this.showRulersSetting,g(p.hideRulers),g(p.showRulers),void 0,"rulers"),o(t.defaultSection(),this.showDeviceScaleFactorSetting,g(p.removeDevicePixelRatio),g(p.addDevicePixelRatio),void 0,"device-pixel-ratio"),o(t.defaultSection(),this.showUserAgentTypeSetting,g(p.removeDeviceType),g(p.addDeviceType),void 0,"device-type"),t.appendItemsAtLocation("deviceModeMenu"),t.footerSection().appendItem(g(p.resetToDefaults),this.reset.bind(this),{jslogContext:"reset-to-defaults"}),t.footerSection().appendItem(g(p.closeDevtools),e.InspectorFrontendHost.InspectorFrontendHostInstance.closeWindow.bind(e.InspectorFrontendHost.InspectorFrontendHostInstance),{jslogContext:"close-dev-tools"})}reset(){this.deviceOutlineSetting.set(!1),this.showDeviceScaleFactorSetting.set(!1),this.showUserAgentTypeSetting.set(!1),this.showMediaInspectorSetting.set(!1),this.showRulersSetting.set(!1),this.model.reset()}emulateDevice(e){const t=this.autoAdjustScaleSetting.get()?void 0:this.model.scaleSetting().get();this.model.emulate(n.DeviceModeModel.Type.Device,e,this.lastMode.get(e)||e.modes[0],t)}switchToResponsive(){this.model.emulate(n.DeviceModeModel.Type.Responsive,null,null)}filterDevices(e){return(e=e.filter((function(e){return e.show()}))).sort(n.EmulatedDevices.EmulatedDevice.deviceComparator),e}standardDevices(){return this.filterDevices(this.emulatedDevicesList.standard())}customDevices(){return this.filterDevices(this.emulatedDevicesList.custom())}allDevices(){return this.standardDevices().concat(this.customDevices())}appendDeviceMenuItems(e){function t(t){if(!t.length)return;const i=e.section();for(const e of t)i.appendCheckboxItem(e.title,this.emulateDevice.bind(this,e),{checked:this.model.device()===e,jslogContext:d.StringUtilities.toKebabCase(e.title)})}e.headerSection().appendCheckboxItem(g(p.responsive),this.switchToResponsive.bind(this),{checked:this.model.type()===n.DeviceModeModel.Type.Responsive,jslogContext:"responsive"}),t.call(this,this.standardDevices()),t.call(this,this.customDevices()),e.footerSection().appendItem(g(p.edit),this.emulatedDevicesList.revealCustomSetting.bind(this.emulatedDevicesList),{jslogContext:"edit"})}deviceListChanged(){const e=this.model.device();if(!e)return;const t=this.allDevices();-1===t.indexOf(e)?t.length?this.emulateDevice(t[0]):this.model.emulate(n.DeviceModeModel.Type.Responsive,null,null):this.emulateDevice(e)}updateDeviceScaleFactorVisibility(){this.deviceScaleItem&&this.deviceScaleItem.setVisible(this.showDeviceScaleFactorSetting.get())}updateUserAgentTypeVisibility(){this.uaItem&&this.uaItem.setVisible(this.showUserAgentTypeSetting.get())}spanClicked(){const e=this.model.device();if(!e||!e.isDualScreen&&!e.isFoldableScreen)return;const t=this.autoAdjustScaleSetting.get()?void 0:this.model.scaleSetting().get(),i=this.model.mode();if(!i)return;const o=e.getSpanPartner(i);o&&this.model.emulate(this.model.type(),e,o,t)}modeMenuClicked(e){const i=this.model.device(),o=this.model,s=this.autoAdjustScaleSetting;if(o.type()===n.DeviceModeModel.Type.Responsive){const e=o.appliedDeviceSize();return void(s.get()?o.setSizeAndScaleToFit(e.height,e.width):(o.setWidth(e.height),o.setHeight(e.width)))}if(!i)return;if((i.isDualScreen||i.isFoldableScreen||2===i.modes.length)&&i.modes[0].orientation!==i.modes[1].orientation){const e=s.get()?void 0:o.scaleSetting().get(),t=o.mode();if(!t)return;const n=i.getRotationPartner(t);if(!n)return;return void o.emulate(o.type(),o.device(),n,e)}if(!this.modeButton)return;const r=new t.ContextMenu.ContextMenu(e.data,{useSoftMenu:!1,x:this.modeButton.element.getBoundingClientRect().left,y:this.modeButton.element.getBoundingClientRect().top+this.modeButton.element.offsetHeight});function a(e,t){if(!i)return;const o=i.modesForOrientation(e);if(o.length)if(1===o.length)d(o[0],t);else for(let e=0;e=2),v(this.modeButton,g(2===t?p.rotate:p.screenOrientationOptions))}this.cachedModelDevice=e}if(this.experimentalButton){const e=this.model.device();e&&(e.isDualScreen||e.isFoldableScreen)?(e.isDualScreen?(this.spanButton.setVisible(!0),this.postureItem.setVisible(!1)):e.isFoldableScreen&&(this.spanButton.setVisible(!1),this.postureItem.setVisible(!0),this.postureItem.setText(this.currentDevicePosture())),this.experimentalButton.setVisible(!0)):(this.spanButton.setVisible(!1),this.postureItem.setVisible(!1),this.experimentalButton.setVisible(!1)),v(this.spanButton,g(p.toggleDualscreenMode))}if(this.model.type()===n.DeviceModeModel.Type.Device&&this.lastMode.set(this.model.device(),this.model.mode()),this.model.mode()!==this.cachedModelMode&&this.model.type()!==n.DeviceModeModel.Type.None){this.cachedModelMode=this.model.mode();const e=this.persistenceSetting.get(),t=this.model.device();if(t){e.device=t.title;const i=this.model.mode();e.orientation=i?i.orientation:"",e.mode=i?i.title:""}else e.device="",e.orientation="",e.mode="";this.persistenceSetting.set(e)}}restore(){for(const e of this.allDevices())if(e.title===this.persistenceSetting.get().device)for(const t of e.modes)if(t.orientation===this.persistenceSetting.get().orientation&&t.title===this.persistenceSetting.get().mode)return this.lastMode.set(e,t),void this.emulateDevice(e);this.model.emulate(n.DeviceModeModel.Type.Responsive,null,null)}}var S=Object.freeze({__proto__:null,DeviceModeToolbar:b}),w={cssText:`:host{overflow:hidden;align-items:stretch;flex:auto;background-color:var(--app-color-toolbar-background)}.device-mode-toolbar{flex:none;background-color:var(--app-color-toolbar-background);border-bottom:1px solid var(--sys-color-divider);display:flex;flex-direction:row;align-items:stretch}.device-mode-x{margin:0 1px;font-size:16px}.device-mode-empty-toolbar-element{width:0}devtools-toolbar{overflow:hidden;flex:0 100000 auto;padding:0 5px;&[wrappable]{height:var(--toolbar-height)}}devtools-toolbar.main-toolbar{margin:0 auto}devtools-toolbar.device-mode-toolbar-options{flex:none}.device-mode-content-clip{overflow:hidden;flex:auto}.device-mode-media-container{flex:none;overflow:hidden;box-shadow:inset 0 -1px var(--sys-color-divider)}.device-mode-content-clip:not(.device-mode-outline-visible) .device-mode-media-container{margin-bottom:20px}.device-mode-presets-container{flex:0 0 20px;display:flex}.device-mode-presets-container-inner{flex:auto;justify-content:center;position:relative;background-color:var(--sys-color-surface1);border-bottom:1px solid var(--sys-color-divider)}.device-mode-presets-container:hover{transition:opacity 0.1s;transition-delay:50ms;opacity:100%}.device-mode-preset-bar-outer{pointer-events:none;display:flex;justify-content:center}.device-mode-preset-bar{border-left:2px solid var(--sys-color-divider);border-right:2px solid var(--sys-color-divider);pointer-events:auto;text-align:center;flex:none;color:var(--sys-color-on-surface);display:flex;align-items:center;justify-content:center;white-space:nowrap;margin-bottom:1px}.device-mode-preset-bar:hover{transition:background-color 0.1s;transition-delay:50ms;background-color:var(--sys-color-state-hover-on-subtle)}.device-mode-preset-bar > span{visibility:hidden}.device-mode-preset-bar:hover > span{transition:visibility 0.1s;transition-delay:50ms;visibility:visible}.device-mode-content-area{flex:auto;position:relative;margin:0}.device-mode-screen-area{position:absolute;left:0;right:0;width:0;height:0;background-color:var(--sys-color-inverse-surface)}.device-mode-content-clip:not(.device-mode-outline-visible) .device-mode-screen-area{--override-screen-area-box-shadow:hsl(240deg 3% 84%) 0 0 0 0.5px,hsl(0deg 0% 80%/40%) 0 0 20px;box-shadow:var(--override-screen-area-box-shadow)}.theme-with-dark-background .device-mode-content-clip:not(.device-mode-outline-visible) .device-mode-screen-area,\n:host-context(.theme-with-dark-background) .device-mode-content-clip:not(.device-mode-outline-visible) .device-mode-screen-area{--override-screen-area-box-shadow:rgb(40 40 42) 0 0 0 0.5px,rgb(51 51 51/40%) 0 0 20px}.device-mode-screen-image{position:absolute;left:0;top:0;width:100%;height:100%}.device-mode-resizer{position:absolute;display:flex;align-items:center;justify-content:center;overflow:hidden;transition:background-color 0.1s ease,opacity 0.1s ease}.device-mode-resizer:hover{background-color:var(--sys-color-state-hover-on-subtle);opacity:100%}.device-mode-resizer > div{pointer-events:none}.device-mode-right-resizer{top:0;bottom:-1px;right:-20px;width:20px}.device-mode-left-resizer{top:0;bottom:-1px;left:-20px;width:20px;opacity:0%}.device-mode-bottom-resizer{left:0;right:-1px;bottom:-20px;height:20px}.device-mode-bottom-right-resizer{inset:0 -20px -20px 0;background-color:var(--sys-color-surface1)}.device-mode-bottom-left-resizer{inset:0 0 -20px -20px;opacity:0%}.device-mode-right-resizer > div{content:var(--image-file-resizeHorizontal);width:6px;height:26px}.device-mode-left-resizer > div{content:var(--image-file-resizeHorizontal);width:6px;height:26px}.device-mode-bottom-resizer > div{content:var(--image-file-resizeVertical);margin-bottom:-2px;width:26px;height:6px}.device-mode-bottom-right-resizer > div{position:absolute;bottom:3px;right:3px;width:13px;height:13px;content:var(--image-file-resizeDiagonal)}.device-mode-bottom-left-resizer > div{position:absolute;bottom:3px;left:3px;width:13px;height:13px;content:var(--image-file-resizeDiagonal);transform:rotate(90deg)}.device-mode-page-area{position:absolute;left:0;right:0;width:0;height:0;display:flex;background-color:var(--sys-color-cdt-base-container)}.device-mode-ruler{position:absolute;overflow:visible}.device-mode-ruler-top{height:20px;right:0}.device-mode-ruler-left{width:20px;bottom:0}.device-mode-ruler-content{pointer-events:none;position:absolute;left:-20px;top:-20px}.device-mode-ruler-top .device-mode-ruler-content{border-top:1px solid transparent;right:0;bottom:20px;background-color:var(--sys-color-cdt-base-container)}.device-mode-ruler-left .device-mode-ruler-content{border-left:1px solid transparent;border-top:1px solid transparent;right:20px;bottom:0}.device-mode-content-clip.device-mode-outline-visible .device-mode-ruler-top .device-mode-ruler-content{border-top:1px solid var(--sys-color-token-subtle)}.device-mode-content-clip.device-mode-outline-visible .device-mode-ruler-left .device-mode-ruler-content{border-left:1px solid var(--sys-color-token-subtle);border-top:1px solid var(--sys-color-token-subtle)}.device-mode-ruler-inner{position:absolute}.device-mode-ruler-top .device-mode-ruler-inner{inset:0 0 0 20px;border-bottom:1px solid var(--sys-color-token-subtle)}.device-mode-ruler-left .device-mode-ruler-inner{inset:19px 0 0;border-right:1px solid var(--sys-color-token-subtle);background-color:var(--sys-color-cdt-base-container)}.device-mode-ruler-marker{position:absolute}.device-mode-ruler-top .device-mode-ruler-marker{width:0;height:5px;bottom:0;border-right:1px solid var(--sys-color-token-subtle);margin-right:-1px}.device-mode-ruler-top .device-mode-ruler-marker.device-mode-ruler-marker-medium{height:10px}.device-mode-ruler-top .device-mode-ruler-marker.device-mode-ruler-marker-large{height:15px}.device-mode-ruler-left .device-mode-ruler-marker{height:0;width:5px;right:0;border-bottom:1px solid var(--sys-color-token-subtle);margin-bottom:-1px}.device-mode-ruler-left .device-mode-ruler-marker.device-mode-ruler-marker-medium{width:10px}.device-mode-ruler-left .device-mode-ruler-marker.device-mode-ruler-marker-large{width:15px}.device-mode-ruler-text{color:var(--sys-color-token-subtle);position:relative;pointer-events:auto}.device-mode-ruler-text:hover{color:var(--sys-color-on-surface)}.device-mode-ruler-top .device-mode-ruler-text{left:2px;top:-2px}.device-mode-ruler-left .device-mode-ruler-text{left:-4px;top:-15px;transform:rotate(270deg)}\n/*# sourceURL=${import.meta.resolve("./deviceModeView.css")} */\n`},M={cssText:`.media-inspector-view{height:50px}.media-inspector-marker-container{height:14px;margin:2px 0;position:relative}.media-inspector-bar{display:flex;flex-direction:row;align-items:stretch;pointer-events:none;position:absolute;inset:0}.media-inspector-marker{flex:none;pointer-events:auto;margin:1px 0;white-space:nowrap;z-index:auto;position:relative}.media-inspector-marker-spacer{flex:auto}.media-inspector-marker:hover{margin:-1px 0;opacity:100%}.media-inspector-marker-min-width{flex:auto;background-color:var(--sys-color-yellow-container);border-right:2px solid var(--sys-color-yellow-bright);border-left:2px solid var(--sys-color-yellow-bright);&:hover{background-color:color-mix(in srgb,var(--sys-color-yellow-container),var(--sys-color-yellow-bright) 30%)}}.media-inspector-marker-min-width-right{border-left:2px solid var(--sys-color-yellow-bright)}.media-inspector-marker-min-width-left{border-right:2px solid var(--sys-color-yellow-bright)}.media-inspector-marker-min-max-width{background-color:var(--sys-color-tertiary-container);border-left:2px solid var(--sys-color-tertiary);border-right:2px solid var(--sys-color-tertiary)}.media-inspector-marker-min-max-width:hover{z-index:1}.media-inspector-marker-max-width{background-color:var(--sys-color-inverse-primary);border-right:2px solid var(--sys-color-primary-bright);border-left:2px solid var(--sys-color-primary-bright)}.media-inspector-marker-inactive .media-inspector-marker-min-width:not(:hover){background-color:var(--sys-color-surface-yellow)}.media-inspector-marker-inactive .media-inspector-marker-min-max-width:not(:hover){background-color:color-mix(in srgb,var(--sys-color-tertiary-container),var(--sys-color-cdt-base-container) 30%)}.media-inspector-marker-inactive .media-inspector-marker-max-width:not(:hover){background-color:var(--sys-color-tonal-container)}.media-inspector-marker-label-container{position:absolute;z-index:1}.media-inspector-marker:not(:hover) .media-inspector-marker-label-container{display:none}.media-inspector-marker-label-container-left{left:-2px}.media-inspector-marker-label-container-right{right:-2px}.media-inspector-marker-label{color:var(--sys-color-on-surface);position:absolute;top:1px;bottom:0;font-size:12px;pointer-events:none}.media-inspector-label-right{right:4px}.media-inspector-label-left{left:4px}\n/*# sourceURL=${import.meta.resolve("./mediaQueryInspector.css")} */\n`};const f={revealInSourceCode:"Reveal in source code"},x=a.i18n.registerUIStrings("panels/emulation/MediaQueryInspector.ts",f),I=a.i18n.getLocalizedString.bind(void 0,x);class y extends t.Widget.Widget{mediaThrottler;getWidthCallback;setWidthCallback;scale;elementsToMediaQueryModel;elementsToCSSLocations;cssModel;cachedQueryModels;constructor(e,i,o){super(!0),this.registerRequiredCSS(M),this.contentElement.classList.add("media-inspector-view"),this.contentElement.setAttribute("jslog",`${l.mediaInspectorView().track({click:!0})}`),this.contentElement.addEventListener("click",this.onMediaQueryClicked.bind(this),!1),this.contentElement.addEventListener("contextmenu",this.onContextMenu.bind(this),!1),this.mediaThrottler=o,this.getWidthCallback=e,this.setWidthCallback=i,this.scale=1,this.elementsToMediaQueryModel=new WeakMap,this.elementsToCSSLocations=new WeakMap,s.TargetManager.TargetManager.instance().observeModels(s.CSSModel.CSSModel,this),t.ZoomManager.ZoomManager.instance().addEventListener("ZoomChanged",this.renderMediaQueries.bind(this),this)}modelAdded(e){e.target()===s.TargetManager.TargetManager.instance().primaryPageTarget()&&(this.cssModel=e,this.cssModel.addEventListener(s.CSSModel.Events.StyleSheetAdded,this.scheduleMediaQueriesUpdate,this),this.cssModel.addEventListener(s.CSSModel.Events.StyleSheetRemoved,this.scheduleMediaQueriesUpdate,this),this.cssModel.addEventListener(s.CSSModel.Events.StyleSheetChanged,this.scheduleMediaQueriesUpdate,this),this.cssModel.addEventListener(s.CSSModel.Events.MediaQueryResultChanged,this.scheduleMediaQueriesUpdate,this))}modelRemoved(e){e===this.cssModel&&(this.cssModel.removeEventListener(s.CSSModel.Events.StyleSheetAdded,this.scheduleMediaQueriesUpdate,this),this.cssModel.removeEventListener(s.CSSModel.Events.StyleSheetRemoved,this.scheduleMediaQueriesUpdate,this),this.cssModel.removeEventListener(s.CSSModel.Events.StyleSheetChanged,this.scheduleMediaQueriesUpdate,this),this.cssModel.removeEventListener(s.CSSModel.Events.MediaQueryResultChanged,this.scheduleMediaQueriesUpdate,this),delete this.cssModel)}setAxisTransform(e){Math.abs(this.scale-e)<1e-8||(this.scale=e,this.renderMediaQueries())}onMediaQueryClicked(e){const t=e.target.enclosingNodeOrSelfWithClass("media-inspector-bar");if(!t)return;const i=this.elementsToMediaQueryModel.get(t);if(!i)return;const o=i.maxWidthExpression(),s=i.minWidthExpression();if(0===i.section())return void this.setWidthCallback(o&&o.computedLength()||0);if(2===i.section())return void this.setWidthCallback(s&&s.computedLength()||0);const n=this.getWidthCallback();s&&n!==s.computedLength()?this.setWidthCallback(s.computedLength()||0):this.setWidthCallback(o&&o.computedLength()||0)}onContextMenu(e){if(!this.cssModel?.isEnabled())return;const i=e.target.enclosingNodeOrSelfWithClass("media-inspector-bar");if(!i)return;const o=this.elementsToCSSLocations.get(i)||[],s=new Map;for(let e=0;en&&(s=t,n=d)}return n>o||!i&&!s?null:new C(e,s,i,t.active())}equals(e){return 0===this.compareTo(e)}dimensionsEqual(e){const t=this.minWidthExpression(),i=e.minWidthExpression(),o=this.maxWidthExpression(),s=e.maxWidthExpression(),n=this.section()===e.section(),r=!t||t.computedLength()===i?.computedLength(),a=!o||o.computedLength()===s?.computedLength();return n&&r&&a}compareTo(e){if(this.section()!==e.section())return this.section()-e.section();if(this.dimensionsEqual(e)){const t=this.rawLocation(),i=e.rawLocation();return t||i?t&&!i?1:!t&&i?-1:this.active()!==e.active()?this.active()?-1:1:t&&i?d.StringUtilities.compare(t.url,i.url)||t.lineNumber-i.lineNumber||t.columnNumber-i.columnNumber:0:d.StringUtilities.compare(this.mediaText(),e.mediaText())}const t=this.maxWidthExpression(),i=e.maxWidthExpression(),o=t&&t.computedLength()||0,s=i&&i.computedLength()||0,n=this.minWidthExpression(),r=e.minWidthExpression(),a=n&&n.computedLength()||0,l=r&&r.computedLength()||0;return 0===this.section()?s-o:2===this.section()?a-l:a-l||s-o}section(){return this.sectionInternal}mediaText(){return this.cssMedia.text||""}rawLocation(){return this.rawLocationInternal||(this.rawLocationInternal=this.cssMedia.rawLocation()),this.rawLocationInternal}minWidthExpression(){return this.minWidthExpressionInternal}maxWidthExpression(){return this.maxWidthExpressionInternal}active(){return this.activeInternal}}var k=Object.freeze({__proto__:null,MediaQueryInspector:y,MediaQueryUIModel:C});const D={doubleclickForFullHeight:"Double-click for full height",mobileS:"Mobile S",mobileM:"Mobile M",mobileL:"Mobile L",tablet:"Tablet",laptop:"Laptop",laptopL:"Laptop L"},T=a.i18n.registerUIStrings("panels/emulation/DeviceModeView.ts",D),E=a.i18n.getLocalizedString.bind(void 0,T);class R extends t.Widget.VBox{wrapperInstance;blockElementToWidth;model;mediaInspector;showMediaInspectorSetting;showRulersSetting;topRuler;leftRuler;presetBlocks;responsivePresetsContainer;screenArea;pageArea;outlineImage;contentClip;contentArea;rightResizerElement;leftResizerElement;bottomResizerElement;bottomRightResizerElement;bottomLeftResizerElement;cachedResizable;mediaInspectorContainer;screenImage;toolbar;slowPositionStart;resizeStart;cachedCssScreenRect;cachedCssVisiblePageRect;cachedOutlineRect;cachedMediaInspectorVisible;cachedShowRulers;cachedScale;handleWidth;handleHeight;constructor(){super(!0),this.blockElementToWidth=new WeakMap,this.setMinimumSize(150,150),this.element.classList.add("device-mode-view"),this.registerRequiredCSS(w),this.model=n.DeviceModeModel.DeviceModeModel.instance(),this.model.addEventListener("Updated",this.updateUI,this),this.mediaInspector=new y((()=>this.model.appliedDeviceSize().width),this.model.setWidth.bind(this.model),new r.Throttler.Throttler(0)),this.showMediaInspectorSetting=r.Settings.Settings.instance().moduleSetting("show-media-query-inspector"),this.showMediaInspectorSetting.addChangeListener(this.updateUI,this),this.showRulersSetting=r.Settings.Settings.instance().moduleSetting("emulation.show-rulers"),this.showRulersSetting.addChangeListener(this.updateUI,this),this.topRuler=new z(!0,this.model.setWidthAndScaleToFit.bind(this.model)),this.topRuler.element.classList.add("device-mode-ruler-top"),this.leftRuler=new z(!1,this.model.setHeightAndScaleToFit.bind(this.model)),this.leftRuler.element.classList.add("device-mode-ruler-left"),this.createUI(),t.ZoomManager.ZoomManager.instance().addEventListener("ZoomChanged",this.zoomChanged,this)}createUI(){this.toolbar=new b(this.model,this.showMediaInspectorSetting,this.showRulersSetting),this.contentElement.appendChild(this.toolbar.element()),this.contentClip=this.contentElement.createChild("div","device-mode-content-clip vbox"),this.responsivePresetsContainer=this.contentClip.createChild("div","device-mode-presets-container"),this.responsivePresetsContainer.setAttribute("jslog",`${l.responsivePresets()}`),this.populatePresetsContainer(),this.mediaInspectorContainer=this.contentClip.createChild("div","device-mode-media-container"),this.contentArea=this.contentClip.createChild("div","device-mode-content-area"),this.outlineImage=this.contentArea.createChild("img","device-mode-outline-image hidden fill"),this.outlineImage.addEventListener("load",this.onImageLoaded.bind(this,this.outlineImage,!0),!1),this.outlineImage.addEventListener("error",this.onImageLoaded.bind(this,this.outlineImage,!1),!1),this.screenArea=this.contentArea.createChild("div","device-mode-screen-area"),this.screenImage=this.screenArea.createChild("img","device-mode-screen-image hidden"),this.screenImage.addEventListener("load",this.onImageLoaded.bind(this,this.screenImage,!0),!1),this.screenImage.addEventListener("error",this.onImageLoaded.bind(this,this.screenImage,!1),!1),this.bottomRightResizerElement=this.screenArea.createChild("div","device-mode-resizer device-mode-bottom-right-resizer"),this.bottomRightResizerElement.createChild("div",""),this.createResizer(this.bottomRightResizerElement,2,1),this.bottomLeftResizerElement=this.screenArea.createChild("div","device-mode-resizer device-mode-bottom-left-resizer"),this.bottomLeftResizerElement.createChild("div",""),this.createResizer(this.bottomLeftResizerElement,-2,1),this.rightResizerElement=this.screenArea.createChild("div","device-mode-resizer device-mode-right-resizer"),this.rightResizerElement.createChild("div",""),this.createResizer(this.rightResizerElement,2,0),this.leftResizerElement=this.screenArea.createChild("div","device-mode-resizer device-mode-left-resizer"),this.leftResizerElement.createChild("div",""),this.createResizer(this.leftResizerElement,-2,0),this.bottomResizerElement=this.screenArea.createChild("div","device-mode-resizer device-mode-bottom-resizer"),this.bottomResizerElement.createChild("div",""),this.createResizer(this.bottomResizerElement,0,1),this.bottomResizerElement.addEventListener("dblclick",this.model.setHeight.bind(this.model,0),!1),t.Tooltip.Tooltip.install(this.bottomResizerElement,E(D.doubleclickForFullHeight)),this.pageArea=this.screenArea.createChild("div","device-mode-page-area"),this.pageArea.createChild("slot")}populatePresetsContainer(){const e=[320,375,425,768,1024,1440,2560],t=[E(D.mobileS),E(D.mobileM),E(D.mobileL),E(D.tablet),E(D.laptop),E(D.laptopL),"4K"];this.presetBlocks=[];const i=this.responsivePresetsContainer.createChild("div","device-mode-presets-container-inner");for(let s=e.length-1;s>=0;--s){const n=i.createChild("div","fill device-mode-preset-bar-outer").createChild("div","device-mode-preset-bar");n.createChild("span").textContent=t[s]+" โ€“ "+e[s]+"px",n.setAttribute("jslog",`${l.action().track({click:!0}).context(`device-mode-preset-${e[s]}px`)}`),n.addEventListener("click",o.bind(this,e[s]),!1),this.blockElementToWidth.set(n,e[s]),this.presetBlocks.push(n)}function o(e,t){this.model.emulate(n.DeviceModeModel.Type.Responsive,null,null),this.model.setWidthAndScaleToFit(e),t.consume()}}createResizer(e,i,o){const s=new t.ResizerWidget.ResizerWidget;e.setAttribute("jslog",`${l.slider("device-mode-resizer").track({drag:!0})}`),s.addElement(e);let n=i?"ew-resize":"ns-resize";return i*o>0&&(n="nwse-resize"),i*o<0&&(n="nesw-resize"),s.setCursor(n),s.addEventListener("ResizeStart",this.onResizeStart,this),s.addEventListener("ResizeUpdateXY",this.onResizeUpdate.bind(this,i,o)),s.addEventListener("ResizeEnd",this.onResizeEnd,this),s}onResizeStart(){this.slowPositionStart=null;const e=this.model.screenRect();this.resizeStart=new t.Geometry.Size(e.width,e.height)}onResizeUpdate(e,i,o){o.data.shiftKey!==Boolean(this.slowPositionStart)&&(this.slowPositionStart=o.data.shiftKey?{x:o.data.currentX,y:o.data.currentY}:null);let s=o.data.currentX-o.data.startX,r=o.data.currentY-o.data.startY;if(this.slowPositionStart&&(s=(o.data.currentX-this.slowPositionStart.x)/10+this.slowPositionStart.x-o.data.startX,r=(o.data.currentY-this.slowPositionStart.y)/10+this.slowPositionStart.y-o.data.startY),e&&this.resizeStart){const i=s*t.ZoomManager.ZoomManager.instance().zoomFactor();let o=this.resizeStart.width+i*e;o=Math.round(o/this.model.scale()),o>=n.DeviceModeModel.MinDeviceSize&&o<=n.DeviceModeModel.MaxDeviceSize&&this.model.setWidth(o)}if(i&&this.resizeStart){const e=r*t.ZoomManager.ZoomManager.instance().zoomFactor();let o=this.resizeStart.height+e*i;o=Math.round(o/this.model.scale()),o>=n.DeviceModeModel.MinDeviceSize&&o<=n.DeviceModeModel.MaxDeviceSize&&this.model.setHeight(o)}}exitHingeMode(){this.model&&this.model.exitHingeMode()}onResizeEnd(){delete this.resizeStart,e.userMetrics.actionTaken(e.UserMetrics.Action.ResizedViewInResponsiveMode)}updateUI(){function e(e,t){e.style.left=t.left+"px",e.style.top=t.top+"px",e.style.width=t.width+"px",e.style.height=t.height+"px"}if(!this.isShowing())return;const i=t.ZoomManager.ZoomManager.instance().zoomFactor();let o=!1;const s=this.showRulersSetting.get()&&this.model.type()!==n.DeviceModeModel.Type.None;let r=!1,a=!1;const d=this.model.screenRect().scale(1/i);this.cachedCssScreenRect&&d.isEqual(this.cachedCssScreenRect)||(e(this.screenArea,d),a=!0,o=!0,this.cachedCssScreenRect=d);const l=this.model.visiblePageRect().scale(1/i);this.cachedCssVisiblePageRect&&l.isEqual(this.cachedCssVisiblePageRect)||(e(this.pageArea,l),o=!0,this.cachedCssVisiblePageRect=l);const c=this.model.outlineRect();if(c){const t=c.scale(1/i);this.cachedOutlineRect&&t.isEqual(this.cachedOutlineRect)||(e(this.outlineImage,t),o=!0,this.cachedOutlineRect=t)}this.contentClip.classList.toggle("device-mode-outline-visible",Boolean(this.model.outlineImage()));const h=this.model.type()===n.DeviceModeModel.Type.Responsive;h!==this.cachedResizable&&(this.rightResizerElement.classList.toggle("hidden",!h),this.leftResizerElement.classList.toggle("hidden",!h),this.bottomResizerElement.classList.toggle("hidden",!h),this.bottomRightResizerElement.classList.toggle("hidden",!h),this.bottomLeftResizerElement.classList.toggle("hidden",!h),this.cachedResizable=h);const m=this.showMediaInspectorSetting.get()&&this.model.type()!==n.DeviceModeModel.Type.None;if(m!==this.cachedMediaInspectorVisible&&(m?this.mediaInspector.show(this.mediaInspectorContainer):this.mediaInspector.detach(),r=!0,o=!0,this.cachedMediaInspectorVisible=m),s!==this.cachedShowRulers&&(this.contentClip.classList.toggle("device-mode-rulers-visible",s),s?(this.topRuler.show(this.contentArea),this.leftRuler.show(this.contentArea)):(this.topRuler.detach(),this.leftRuler.detach()),r=!0,o=!0,this.cachedShowRulers=s),this.model.scale()!==this.cachedScale){a=!0,o=!0;for(const e of this.presetBlocks){const t=this.blockElementToWidth.get(e);if(!t)throw new Error("Could not get width for block.");e.style.width=t*this.model.scale()+"px"}this.cachedScale=this.model.scale()}this.toolbar.update(),this.loadImage(this.screenImage,this.model.screenImage()),this.loadImage(this.outlineImage,this.model.outlineImage()),this.mediaInspector.setAxisTransform(this.model.scale()),o&&this.doResize(),a&&(this.topRuler.render(this.model.scale()),this.leftRuler.render(this.model.scale()),this.topRuler.element.positionAt(this.cachedCssScreenRect?this.cachedCssScreenRect.left:0,this.cachedCssScreenRect?this.cachedCssScreenRect.top:0),this.leftRuler.element.positionAt(this.cachedCssScreenRect?this.cachedCssScreenRect.left:0,this.cachedCssScreenRect?this.cachedCssScreenRect.top:0)),r&&this.contentAreaResized()}loadImage(e,t){e.getAttribute("srcset")!==t&&(e.setAttribute("srcset",t),t||e.classList.toggle("hidden",!0))}onImageLoaded(e,t){e.classList.toggle("hidden",!t)}setNonEmulatedAvailableSize(e){if(this.model.type()!==n.DeviceModeModel.Type.None)return;const i=t.ZoomManager.ZoomManager.instance().zoomFactor(),o=e.getBoundingClientRect(),s=new t.Geometry.Size(Math.max(o.width*i,1),Math.max(o.height*i,1));this.model.setAvailableSize(s,s)}contentAreaResized(){const e=t.ZoomManager.ZoomManager.instance().zoomFactor(),i=this.contentArea.getBoundingClientRect(),o=new t.Geometry.Size(Math.max(i.width*e,1),Math.max(i.height*e,1)),s=new t.Geometry.Size(Math.max((i.width-2*(this.handleWidth||0))*e,1),Math.max((i.height-(this.handleHeight||0))*e,1));this.model.setAvailableSize(o,s)}measureHandles(){const e=this.rightResizerElement.classList.contains("hidden");this.rightResizerElement.classList.toggle("hidden",!1),this.bottomResizerElement.classList.toggle("hidden",!1),this.handleWidth=this.rightResizerElement.offsetWidth,this.handleHeight=this.bottomResizerElement.offsetHeight,this.rightResizerElement.classList.toggle("hidden",e),this.bottomResizerElement.classList.toggle("hidden",e)}zoomChanged(){delete this.handleWidth,delete this.handleHeight,this.isShowing()&&(this.measureHandles(),this.contentAreaResized())}onResize(){this.isShowing()&&this.contentAreaResized()}wasShown(){this.measureHandles(),this.toolbar.restore()}willHide(){this.model.emulate(n.DeviceModeModel.Type.None,null,null)}async captureScreenshot(){const e=await this.model.captureScreenshot(!1);if(null===e)return;const t=new Image;t.src="data:image/png;base64,"+e,t.onload=async()=>{const e=t.naturalWidth/this.model.screenRect().width,i=this.model.outlineRect();if(!i)throw new Error("Unable to take screenshot: no outlineRect available.");const o=i.scale(e),s=this.model.screenRect().scale(e),n=this.model.visiblePageRect().scale(e),r=s.left+n.left-o.left,a=s.top+n.top-o.top,d=document.createElement("canvas");d.width=Math.floor(o.width),d.height=Math.min(16384,Math.floor(o.height));const l=d.getContext("2d");if(!l)throw new Error("Could not get 2d context from canvas.");l.imageSmoothingEnabled=!1,this.model.outlineImage()&&await this.paintImage(l,this.model.outlineImage(),o.relativeTo(o)),this.model.screenImage()&&await this.paintImage(l,this.model.screenImage(),s.relativeTo(o)),l.drawImage(t,Math.floor(r),Math.floor(a)),this.saveScreenshot(d)}}async captureFullSizeScreenshot(){const e=await this.model.captureScreenshot(!0);if(null!==e)return this.saveScreenshotBase64(e)}async captureAreaScreenshot(e){const t=await this.model.captureScreenshot(!1,e);if(null!==t)return this.saveScreenshotBase64(t)}saveScreenshotBase64(e){const t=new Image;t.src="data:image/png;base64,"+e,t.onload=()=>{const e=document.createElement("canvas");e.width=t.naturalWidth,e.height=Math.min(16384,Math.floor(t.naturalHeight));const i=e.getContext("2d");if(!i)throw new Error("Could not get 2d context for base64 screenshot.");i.imageSmoothingEnabled=!1,i.drawImage(t,0,0),this.saveScreenshot(e)}}paintImage(e,t,i){return new Promise((o=>{const s=new Image;s.crossOrigin="Anonymous",s.srcset=t,s.onerror=()=>o(),s.onload=()=>{e.drawImage(s,i.left,i.top,i.width,i.height),o()}}))}saveScreenshot(e){const t=this.model.inspectedURL();let i="";if(t){const e=d.StringUtilities.removeURLFragment(t);i=d.StringUtilities.trimURL(e)}const o=this.model.device();o&&this.model.type()===n.DeviceModeModel.Type.Device&&(i+=`(${o.title})`);const s=document.createElement("a");s.download=i+".png",e.toBlob((e=>{null!==e&&(s.href=URL.createObjectURL(e),s.click())}))}}class z extends t.Widget.VBox{contentElementInternal;horizontal;scale;count;throttler;applyCallback;renderedScale;renderedZoomFactor;constructor(e,t){super(),this.element.classList.add("device-mode-ruler"),this.element.setAttribute("jslog",`${l.deviceModeRuler().track({click:!0})}`),this.contentElementInternal=this.element.createChild("div","device-mode-ruler-content").createChild("div","device-mode-ruler-inner"),this.horizontal=e,this.scale=1,this.count=0,this.throttler=new r.Throttler.Throttler(0),this.applyCallback=t}render(e){this.scale=e,this.throttler.schedule(this.update.bind(this))}onResize(){this.throttler.schedule(this.update.bind(this))}update(){const e=t.ZoomManager.ZoomManager.instance().zoomFactor(),i=this.horizontal?this.contentElementInternal.offsetWidth:this.contentElementInternal.offsetHeight;this.scale===this.renderedScale&&e===this.renderedZoomFactor||(this.contentElementInternal.removeChildren(),this.count=0,this.renderedScale=this.scale,this.renderedZoomFactor=e);const o=i*e/this.scale,s=Math.ceil(o/5);let n=1;this.scale<.8&&(n=2),this.scale<.6&&(n=4),this.scale<.4&&(n=8),this.scale<.2&&(n=16),this.scale<.1&&(n=32);for(let e=s;e{this.autoAdjustScaleSetting.get()?this.model.setWidthAndScaleToFit(e):this.model.setWidth(e)})),this.heightInput=new h.DeviceSizeInputElement.SizeInputElement(g(p.heightLeaveEmptyForFull),{jslogContext:"height"}),this.heightInput.addEventListener("sizechanged",(({size:e})=>{this.autoAdjustScaleSetting.get()?this.model.setHeightAndScaleToFit(e):this.model.setHeight(e)})),this.appendDimensionInputs(o),this.appendDisplaySettings(o),this.appendDevicePositionItems(o);const s=this.elementInternal.createChild("devtools-toolbar","device-mode-toolbar-options");function a(){const t=e.toolbarControlsEnabledSetting().get();o.setEnabled(t),s.setEnabled(t)}s.wrappable=!0,this.fillOptionsToolbar(s),this.emulatedDevicesList=n.EmulatedDevices.EmulatedDevicesList.instance(),this.emulatedDevicesList.addEventListener("CustomDevicesUpdated",this.deviceListChanged,this),this.emulatedDevicesList.addEventListener("StandardDevicesUpdated",this.deviceListChanged,this),this.persistenceSetting=r.Settings.Settings.instance().createSetting("emulation.device-mode-value",{device:"",orientation:"",mode:""}),this.model.toolbarControlsEnabledSetting().addChangeListener(a),a()}createEmptyToolbarElement(){const e=document.createElement("div");return e.classList.add("device-mode-empty-toolbar-element"),e}appendDeviceSelectMenu(e){e.appendToolbarItem(new t.Toolbar.ToolbarItem(this.createEmptyToolbarElement())),this.deviceSelectItem=new t.Toolbar.ToolbarMenuButton(this.appendDeviceMenuItems.bind(this),void 0,void 0,"device"),this.deviceSelectItem.turnShrinkable(),this.deviceSelectItem.setDarkText(),e.appendToolbarItem(this.deviceSelectItem)}appendDimensionInputs(e){e.appendToolbarItem(new t.Toolbar.ToolbarItem(this.widthInput));const i=document.createElement("div");i.classList.add("device-mode-x"),i.textContent="ร—",this.xItem=new t.Toolbar.ToolbarItem(i),e.appendToolbarItem(this.xItem),e.appendToolbarItem(new t.Toolbar.ToolbarItem(this.heightInput))}appendDisplaySettings(e){e.appendToolbarItem(new t.Toolbar.ToolbarItem(this.createEmptyToolbarElement())),this.scaleItem=new t.Toolbar.ToolbarMenuButton(this.appendScaleMenuItems.bind(this),void 0,void 0,"scale"),v(this.scaleItem,g(p.zoom)),this.scaleItem.turnShrinkable(),this.scaleItem.setDarkText(),e.appendToolbarItem(this.scaleItem),e.appendToolbarItem(new t.Toolbar.ToolbarItem(this.createEmptyToolbarElement())),this.deviceScaleItem=new t.Toolbar.ToolbarMenuButton(this.appendDeviceScaleMenuItems.bind(this),void 0,void 0,"device-pixel-ratio"),this.deviceScaleItem.turnShrinkable(),this.deviceScaleItem.setVisible(this.showDeviceScaleFactorSetting.get()),v(this.deviceScaleItem,g(p.devicePixelRatio)),this.deviceScaleItem.setDarkText(),e.appendToolbarItem(this.deviceScaleItem),e.appendToolbarItem(new t.Toolbar.ToolbarItem(this.createEmptyToolbarElement())),this.uaItem=new t.Toolbar.ToolbarMenuButton(this.appendUserAgentMenuItems.bind(this),void 0,void 0,"device-type"),this.uaItem.turnShrinkable(),this.uaItem.setVisible(this.showUserAgentTypeSetting.get()),v(this.uaItem,g(p.deviceType)),this.uaItem.setDarkText(),e.appendToolbarItem(this.uaItem),this.throttlingConditionsItem=c.ThrottlingManager.throttlingManager().createMobileThrottlingButton(),this.throttlingConditionsItem.turnShrinkable(),e.appendToolbarItem(this.throttlingConditionsItem)}appendDevicePositionItems(e){e.appendToolbarItem(new t.Toolbar.ToolbarItem(this.createEmptyToolbarElement())),this.modeButton=new t.Toolbar.ToolbarButton("","screen-rotation",void 0,"screen-rotation"),this.modeButton.addEventListener("Click",this.modeMenuClicked,this),e.appendToolbarItem(this.modeButton),this.spanButton=new t.Toolbar.ToolbarButton("","device-fold",void 0,"device-fold"),this.spanButton.addEventListener("Click",this.spanClicked,this),e.appendToolbarItem(this.spanButton),e.appendToolbarItem(new t.Toolbar.ToolbarItem(this.createEmptyToolbarElement())),this.postureItem=new t.Toolbar.ToolbarMenuButton(this.appendDevicePostureItems.bind(this),void 0,void 0,"device-posture"),this.postureItem.turnShrinkable(),this.postureItem.setDarkText(),v(this.postureItem,g(p.devicePosture)),e.appendToolbarItem(this.postureItem),this.createExperimentalButton(e)}createExperimentalButton(e){e.appendToolbarItem(new t.Toolbar.ToolbarSeparator(!0));const i=this.model.webPlatformExperimentalFeaturesEnabled()?g(p.experimentalWebPlatformFeature):g(p.experimentalWebPlatformFeatureFlag);this.experimentalButton=new t.Toolbar.ToolbarToggle(i,"experiment-check"),this.experimentalButton.setToggled(this.model.webPlatformExperimentalFeaturesEnabled()),this.experimentalButton.setEnabled(!0),this.experimentalButton.addEventListener("Click",this.experimentalClicked,this),e.appendToolbarItem(this.experimentalButton)}experimentalClicked(){e.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab("chrome://flags/#enable-experimental-web-platform-features")}fillOptionsToolbar(e){e.appendToolbarItem(new t.Toolbar.ToolbarItem(this.createEmptyToolbarElement()));const i=new t.Toolbar.ToolbarMenuButton(this.appendOptionsMenuItems.bind(this),!0,void 0,"more-options","dots-vertical");i.setTitle(g(p.moreOptions)),e.appendToolbarItem(i)}appendDevicePostureItems(e){for(const t of["Continuous","Folded"])e.defaultSection().appendCheckboxItem(t,this.spanClicked.bind(this),{checked:t===this.currentDevicePosture(),jslogContext:t.toLowerCase()})}currentDevicePosture(){const e=this.model.mode();return!e||e.orientation!==n.EmulatedDevices.VerticalSpanned&&e.orientation!==n.EmulatedDevices.HorizontalSpanned?"Continuous":"Folded"}appendScaleMenuItems(e){this.model.type()===n.DeviceModeModel.Type.Device&&e.footerSection().appendItem(g(p.fitToWindowF,{PH1:this.getPrettyFitZoomPercentage()}),this.onScaleMenuChanged.bind(this,this.model.fitScale()),{jslogContext:"fit-to-window"}),e.footerSection().appendCheckboxItem(g(p.autoadjustZoom),this.onAutoAdjustScaleChanged.bind(this),{checked:this.autoAdjustScaleSetting.get(),jslogContext:"auto-adjust-zoom"});const t=function(t,i){e.defaultSection().appendCheckboxItem(t,this.onScaleMenuChanged.bind(this,i),{checked:this.model.scaleSetting().get()===i,jslogContext:t})}.bind(this);t("50%",.5),t("75%",.75),t("100%",1),t("125%",1.25),t("150%",1.5),t("200%",2)}onScaleMenuChanged(e){this.model.scaleSetting().set(e)}onAutoAdjustScaleChanged(){this.autoAdjustScaleSetting.set(!this.autoAdjustScaleSetting.get())}appendDeviceScaleMenuItems(e){const t=this.model.deviceScaleFactorSetting(),i="Mobile"===this.model.uaSetting().get()||"Mobile (no touch)"===this.model.uaSetting().get()?n.DeviceModeModel.defaultMobileScaleFactor:window.devicePixelRatio;function o(e,i,o,s){e.appendCheckboxItem(i,t.set.bind(t,o),{checked:t.get()===o,jslogContext:s})}o(e.headerSection(),g(p.defaultF,{PH1:i}),0,"dpr-default"),o(e.defaultSection(),"1",1,"dpr-1"),o(e.defaultSection(),"2",2,"dpr-2"),o(e.defaultSection(),"3",3,"dpr-3")}appendUserAgentMenuItems(e){const t=this.model.uaSetting();function i(i,o){e.defaultSection().appendCheckboxItem(i,t.set.bind(t,o),{checked:t.get()===o,jslogContext:d.StringUtilities.toKebabCase(o)})}i("Mobile","Mobile"),i("Mobile (no touch)","Mobile (no touch)"),i("Desktop","Desktop"),i("Desktop (touch)","Desktop (touch)")}appendOptionsMenuItems(t){const i=this.model;function o(e,t,o,s,r,a){void 0===r&&(r=i.type()===n.DeviceModeModel.Type.None);const d=t.get(),l=`${a}-${d?"disable":"enable"}`;e.appendItem(d?o:s,t.set.bind(t,!t.get()),{disabled:r,jslogContext:l})}o(t.headerSection(),this.deviceOutlineSetting,g(p.hideDeviceFrame),g(p.showDeviceFrame),i.type()!==n.DeviceModeModel.Type.Device,"device-frame"),o(t.headerSection(),this.showMediaInspectorSetting,g(p.hideMediaQueries),g(p.showMediaQueries),void 0,"media-queries"),o(t.headerSection(),this.showRulersSetting,g(p.hideRulers),g(p.showRulers),void 0,"rulers"),o(t.defaultSection(),this.showDeviceScaleFactorSetting,g(p.removeDevicePixelRatio),g(p.addDevicePixelRatio),void 0,"device-pixel-ratio"),o(t.defaultSection(),this.showUserAgentTypeSetting,g(p.removeDeviceType),g(p.addDeviceType),void 0,"device-type"),t.appendItemsAtLocation("deviceModeMenu"),t.footerSection().appendItem(g(p.resetToDefaults),this.reset.bind(this),{jslogContext:"reset-to-defaults"}),t.footerSection().appendItem(g(p.closeDevtools),e.InspectorFrontendHost.InspectorFrontendHostInstance.closeWindow.bind(e.InspectorFrontendHost.InspectorFrontendHostInstance),{jslogContext:"close-dev-tools"})}reset(){this.deviceOutlineSetting.set(!1),this.showDeviceScaleFactorSetting.set(!1),this.showUserAgentTypeSetting.set(!1),this.showMediaInspectorSetting.set(!1),this.showRulersSetting.set(!1),this.model.reset()}emulateDevice(e){const t=this.autoAdjustScaleSetting.get()?void 0:this.model.scaleSetting().get();this.model.emulate(n.DeviceModeModel.Type.Device,e,this.lastMode.get(e)||e.modes[0],t)}switchToResponsive(){this.model.emulate(n.DeviceModeModel.Type.Responsive,null,null)}filterDevices(e){return(e=e.filter((function(e){return e.show()}))).sort(n.EmulatedDevices.EmulatedDevice.deviceComparator),e}standardDevices(){return this.filterDevices(this.emulatedDevicesList.standard())}customDevices(){return this.filterDevices(this.emulatedDevicesList.custom())}allDevices(){return this.standardDevices().concat(this.customDevices())}appendDeviceMenuItems(e){function t(t){if(!t.length)return;const i=e.section();for(const e of t)i.appendCheckboxItem(e.title,this.emulateDevice.bind(this,e),{checked:this.model.device()===e,jslogContext:d.StringUtilities.toKebabCase(e.title)})}e.headerSection().appendCheckboxItem(g(p.responsive),this.switchToResponsive.bind(this),{checked:this.model.type()===n.DeviceModeModel.Type.Responsive,jslogContext:"responsive"}),t.call(this,this.standardDevices()),t.call(this,this.customDevices()),e.footerSection().appendItem(g(p.edit),this.emulatedDevicesList.revealCustomSetting.bind(this.emulatedDevicesList),{jslogContext:"edit"})}deviceListChanged(){const e=this.model.device();if(!e)return;const t=this.allDevices();-1===t.indexOf(e)?t.length?this.emulateDevice(t[0]):this.model.emulate(n.DeviceModeModel.Type.Responsive,null,null):this.emulateDevice(e)}updateDeviceScaleFactorVisibility(){this.deviceScaleItem&&this.deviceScaleItem.setVisible(this.showDeviceScaleFactorSetting.get())}updateUserAgentTypeVisibility(){this.uaItem&&this.uaItem.setVisible(this.showUserAgentTypeSetting.get())}spanClicked(){const e=this.model.device();if(!e||!e.isDualScreen&&!e.isFoldableScreen)return;const t=this.autoAdjustScaleSetting.get()?void 0:this.model.scaleSetting().get(),i=this.model.mode();if(!i)return;const o=e.getSpanPartner(i);o&&this.model.emulate(this.model.type(),e,o,t)}modeMenuClicked(e){const i=this.model.device(),o=this.model,s=this.autoAdjustScaleSetting;if(o.type()===n.DeviceModeModel.Type.Responsive){const e=o.appliedDeviceSize();return void(s.get()?o.setSizeAndScaleToFit(e.height,e.width):(o.setWidth(e.height),o.setHeight(e.width)))}if(!i)return;if((i.isDualScreen||i.isFoldableScreen||2===i.modes.length)&&i.modes[0].orientation!==i.modes[1].orientation){const e=s.get()?void 0:o.scaleSetting().get(),t=o.mode();if(!t)return;const n=i.getRotationPartner(t);if(!n)return;return void o.emulate(o.type(),o.device(),n,e)}if(!this.modeButton)return;const r=new t.ContextMenu.ContextMenu(e.data,{useSoftMenu:!1,x:this.modeButton.element.getBoundingClientRect().left,y:this.modeButton.element.getBoundingClientRect().top+this.modeButton.element.offsetHeight});function a(e,t){if(!i)return;const o=i.modesForOrientation(e);if(o.length)if(1===o.length)d(o[0],t);else for(let e=0;e=2),v(this.modeButton,g(2===t?p.rotate:p.screenOrientationOptions))}this.cachedModelDevice=e}if(this.experimentalButton){const e=this.model.device();e&&(e.isDualScreen||e.isFoldableScreen)?(e.isDualScreen?(this.spanButton.setVisible(!0),this.postureItem.setVisible(!1)):e.isFoldableScreen&&(this.spanButton.setVisible(!1),this.postureItem.setVisible(!0),this.postureItem.setText(this.currentDevicePosture())),this.experimentalButton.setVisible(!0)):(this.spanButton.setVisible(!1),this.postureItem.setVisible(!1),this.experimentalButton.setVisible(!1)),v(this.spanButton,g(p.toggleDualscreenMode))}if(this.model.type()===n.DeviceModeModel.Type.Device&&this.lastMode.set(this.model.device(),this.model.mode()),this.model.mode()!==this.cachedModelMode&&this.model.type()!==n.DeviceModeModel.Type.None){this.cachedModelMode=this.model.mode();const e=this.persistenceSetting.get(),t=this.model.device();if(t){e.device=t.title;const i=this.model.mode();e.orientation=i?i.orientation:"",e.mode=i?i.title:""}else e.device="",e.orientation="",e.mode="";this.persistenceSetting.set(e)}}restore(){for(const e of this.allDevices())if(e.title===this.persistenceSetting.get().device)for(const t of e.modes)if(t.orientation===this.persistenceSetting.get().orientation&&t.title===this.persistenceSetting.get().mode)return this.lastMode.set(e,t),void this.emulateDevice(e);this.model.emulate(n.DeviceModeModel.Type.Responsive,null,null)}}var S=Object.freeze({__proto__:null,DeviceModeToolbar:b}),w={cssText:`:host{overflow:hidden;align-items:stretch;flex:auto;background-color:var(--app-color-toolbar-background)}.device-mode-toolbar{flex:none;background-color:var(--app-color-toolbar-background);border-bottom:1px solid var(--sys-color-divider);display:flex;flex-direction:row;align-items:stretch}.device-mode-x{margin:0 1px;font-size:16px}.device-mode-empty-toolbar-element{width:0}devtools-toolbar{overflow:hidden;flex:0 100000 auto;padding:0 5px;&[wrappable]{height:var(--toolbar-height)}}devtools-toolbar.main-toolbar{margin:0 auto}devtools-toolbar.device-mode-toolbar-options{flex:none}.device-mode-content-clip{overflow:hidden;flex:auto}.device-mode-media-container{flex:none;overflow:hidden;box-shadow:inset 0 -1px var(--sys-color-divider)}.device-mode-content-clip:not(.device-mode-outline-visible) .device-mode-media-container{margin-bottom:20px}.device-mode-presets-container{flex:0 0 20px;display:flex}.device-mode-presets-container-inner{flex:auto;justify-content:center;position:relative;background-color:var(--sys-color-surface1);border-bottom:1px solid var(--sys-color-divider)}.device-mode-presets-container:hover{transition:opacity 0.1s;transition-delay:50ms;opacity:100%}.device-mode-preset-bar-outer{pointer-events:none;display:flex;justify-content:center}.device-mode-preset-bar{border-left:2px solid var(--sys-color-divider);border-right:2px solid var(--sys-color-divider);pointer-events:auto;text-align:center;flex:none;color:var(--sys-color-on-surface);display:flex;align-items:center;justify-content:center;white-space:nowrap;margin-bottom:1px}.device-mode-preset-bar:hover{transition:background-color 0.1s;transition-delay:50ms;background-color:var(--sys-color-state-hover-on-subtle)}.device-mode-preset-bar > span{visibility:hidden}.device-mode-preset-bar:hover > span{transition:visibility 0.1s;transition-delay:50ms;visibility:visible}.device-mode-content-area{flex:auto;position:relative;margin:0}.device-mode-screen-area{position:absolute;left:0;right:0;width:0;height:0;background-color:var(--sys-color-inverse-surface)}.device-mode-content-clip:not(.device-mode-outline-visible) .device-mode-screen-area{--override-screen-area-box-shadow:hsl(240deg 3% 84%) 0 0 0 0.5px,hsl(0deg 0% 80%/40%) 0 0 20px;box-shadow:var(--override-screen-area-box-shadow)}.theme-with-dark-background .device-mode-content-clip:not(.device-mode-outline-visible) .device-mode-screen-area,\n:host-context(.theme-with-dark-background) .device-mode-content-clip:not(.device-mode-outline-visible) .device-mode-screen-area{--override-screen-area-box-shadow:rgb(40 40 42) 0 0 0 0.5px,rgb(51 51 51/40%) 0 0 20px}.device-mode-screen-image{position:absolute;left:0;top:0;width:100%;height:100%}.device-mode-resizer{position:absolute;display:flex;align-items:center;justify-content:center;overflow:hidden;transition:background-color 0.1s ease,opacity 0.1s ease}.device-mode-resizer:hover{background-color:var(--sys-color-state-hover-on-subtle);opacity:100%}.device-mode-resizer > div{pointer-events:none}.device-mode-right-resizer{top:0;bottom:-1px;right:-20px;width:20px}.device-mode-left-resizer{top:0;bottom:-1px;left:-20px;width:20px;opacity:0%}.device-mode-bottom-resizer{left:0;right:-1px;bottom:-20px;height:20px}.device-mode-bottom-right-resizer{inset:0 -20px -20px 0;background-color:var(--sys-color-surface1)}.device-mode-bottom-left-resizer{inset:0 0 -20px -20px;opacity:0%}.device-mode-right-resizer > div{content:var(--image-file-resizeHorizontal);width:6px;height:26px}.device-mode-left-resizer > div{content:var(--image-file-resizeHorizontal);width:6px;height:26px}.device-mode-bottom-resizer > div{content:var(--image-file-resizeVertical);margin-bottom:-2px;width:26px;height:6px}.device-mode-bottom-right-resizer > div{position:absolute;bottom:3px;right:3px;width:13px;height:13px;content:var(--image-file-resizeDiagonal)}.device-mode-bottom-left-resizer > div{position:absolute;bottom:3px;left:3px;width:13px;height:13px;content:var(--image-file-resizeDiagonal);transform:rotate(90deg)}.device-mode-page-area{position:absolute;left:0;right:0;width:0;height:0;display:flex;background-color:var(--sys-color-cdt-base-container)}.device-mode-ruler{position:absolute;overflow:visible}.device-mode-ruler-top{height:20px;right:0}.device-mode-ruler-left{width:20px;bottom:0}.device-mode-ruler-content{pointer-events:none;position:absolute;left:-20px;top:-20px}.device-mode-ruler-top .device-mode-ruler-content{border-top:1px solid transparent;right:0;bottom:20px;background-color:var(--sys-color-cdt-base-container)}.device-mode-ruler-left .device-mode-ruler-content{border-left:1px solid transparent;border-top:1px solid transparent;right:20px;bottom:0}.device-mode-content-clip.device-mode-outline-visible .device-mode-ruler-top .device-mode-ruler-content{border-top:1px solid var(--sys-color-token-subtle)}.device-mode-content-clip.device-mode-outline-visible .device-mode-ruler-left .device-mode-ruler-content{border-left:1px solid var(--sys-color-token-subtle);border-top:1px solid var(--sys-color-token-subtle)}.device-mode-ruler-inner{position:absolute}.device-mode-ruler-top .device-mode-ruler-inner{inset:0 0 0 20px;border-bottom:1px solid var(--sys-color-token-subtle)}.device-mode-ruler-left .device-mode-ruler-inner{inset:19px 0 0;border-right:1px solid var(--sys-color-token-subtle);background-color:var(--sys-color-cdt-base-container)}.device-mode-ruler-marker{position:absolute}.device-mode-ruler-top .device-mode-ruler-marker{width:0;height:5px;bottom:0;border-right:1px solid var(--sys-color-token-subtle);margin-right:-1px}.device-mode-ruler-top .device-mode-ruler-marker.device-mode-ruler-marker-medium{height:10px}.device-mode-ruler-top .device-mode-ruler-marker.device-mode-ruler-marker-large{height:15px}.device-mode-ruler-left .device-mode-ruler-marker{height:0;width:5px;right:0;border-bottom:1px solid var(--sys-color-token-subtle);margin-bottom:-1px}.device-mode-ruler-left .device-mode-ruler-marker.device-mode-ruler-marker-medium{width:10px}.device-mode-ruler-left .device-mode-ruler-marker.device-mode-ruler-marker-large{width:15px}.device-mode-ruler-text{color:var(--sys-color-token-subtle);position:relative;pointer-events:auto}.device-mode-ruler-text:hover{color:var(--sys-color-on-surface)}.device-mode-ruler-top .device-mode-ruler-text{left:2px;top:-2px}.device-mode-ruler-left .device-mode-ruler-text{left:-4px;top:-15px;transform:rotate(270deg)}\n/*# sourceURL=${import.meta.resolve("./deviceModeView.css")} */\n`},M={cssText:`.media-inspector-view{height:50px}.media-inspector-marker-container{height:14px;margin:2px 0;position:relative}.media-inspector-bar{display:flex;flex-direction:row;align-items:stretch;pointer-events:none;position:absolute;inset:0}.media-inspector-marker{flex:none;pointer-events:auto;margin:1px 0;white-space:nowrap;z-index:auto;position:relative}.media-inspector-marker-spacer{flex:auto}.media-inspector-marker:hover{margin:-1px 0;opacity:100%}.media-inspector-marker-min-width{flex:auto;background-color:var(--sys-color-yellow-container);border-right:2px solid var(--sys-color-yellow-bright);border-left:2px solid var(--sys-color-yellow-bright);&:hover{background-color:color-mix(in srgb,var(--sys-color-yellow-container),var(--sys-color-yellow-bright) 30%)}}.media-inspector-marker-min-width-right{border-left:2px solid var(--sys-color-yellow-bright)}.media-inspector-marker-min-width-left{border-right:2px solid var(--sys-color-yellow-bright)}.media-inspector-marker-min-max-width{background-color:var(--sys-color-tertiary-container);border-left:2px solid var(--sys-color-tertiary);border-right:2px solid var(--sys-color-tertiary)}.media-inspector-marker-min-max-width:hover{z-index:1}.media-inspector-marker-max-width{background-color:var(--sys-color-inverse-primary);border-right:2px solid var(--sys-color-primary-bright);border-left:2px solid var(--sys-color-primary-bright)}.media-inspector-marker-inactive .media-inspector-marker-min-width:not(:hover){background-color:var(--sys-color-surface-yellow)}.media-inspector-marker-inactive .media-inspector-marker-min-max-width:not(:hover){background-color:color-mix(in srgb,var(--sys-color-tertiary-container),var(--sys-color-cdt-base-container) 30%)}.media-inspector-marker-inactive .media-inspector-marker-max-width:not(:hover){background-color:var(--sys-color-tonal-container)}.media-inspector-marker-label-container{position:absolute;z-index:1}.media-inspector-marker:not(:hover) .media-inspector-marker-label-container{display:none}.media-inspector-marker-label-container-left{left:-2px}.media-inspector-marker-label-container-right{right:-2px}.media-inspector-marker-label{color:var(--sys-color-on-surface);position:absolute;top:1px;bottom:0;font-size:12px;pointer-events:none}.media-inspector-label-right{right:4px}.media-inspector-label-left{left:4px}\n/*# sourceURL=${import.meta.resolve("./mediaQueryInspector.css")} */\n`};const f={revealInSourceCode:"Reveal in source code"},x=a.i18n.registerUIStrings("panels/emulation/MediaQueryInspector.ts",f),I=a.i18n.getLocalizedString.bind(void 0,x);class y extends t.Widget.Widget{mediaThrottler;getWidthCallback;setWidthCallback;scale;elementsToMediaQueryModel;elementsToCSSLocations;cssModel;cachedQueryModels;constructor(e,i,o){super(!0),this.registerRequiredCSS(M),this.contentElement.classList.add("media-inspector-view"),this.contentElement.setAttribute("jslog",`${l.mediaInspectorView().track({click:!0})}`),this.contentElement.addEventListener("click",this.onMediaQueryClicked.bind(this),!1),this.contentElement.addEventListener("contextmenu",this.onContextMenu.bind(this),!1),this.mediaThrottler=o,this.getWidthCallback=e,this.setWidthCallback=i,this.scale=1,this.elementsToMediaQueryModel=new WeakMap,this.elementsToCSSLocations=new WeakMap,s.TargetManager.TargetManager.instance().observeModels(s.CSSModel.CSSModel,this),t.ZoomManager.ZoomManager.instance().addEventListener("ZoomChanged",this.renderMediaQueries.bind(this),this)}modelAdded(e){e.target()===s.TargetManager.TargetManager.instance().primaryPageTarget()&&(this.cssModel=e,this.cssModel.addEventListener(s.CSSModel.Events.StyleSheetAdded,this.scheduleMediaQueriesUpdate,this),this.cssModel.addEventListener(s.CSSModel.Events.StyleSheetRemoved,this.scheduleMediaQueriesUpdate,this),this.cssModel.addEventListener(s.CSSModel.Events.StyleSheetChanged,this.scheduleMediaQueriesUpdate,this),this.cssModel.addEventListener(s.CSSModel.Events.MediaQueryResultChanged,this.scheduleMediaQueriesUpdate,this))}modelRemoved(e){e===this.cssModel&&(this.cssModel.removeEventListener(s.CSSModel.Events.StyleSheetAdded,this.scheduleMediaQueriesUpdate,this),this.cssModel.removeEventListener(s.CSSModel.Events.StyleSheetRemoved,this.scheduleMediaQueriesUpdate,this),this.cssModel.removeEventListener(s.CSSModel.Events.StyleSheetChanged,this.scheduleMediaQueriesUpdate,this),this.cssModel.removeEventListener(s.CSSModel.Events.MediaQueryResultChanged,this.scheduleMediaQueriesUpdate,this),delete this.cssModel)}setAxisTransform(e){Math.abs(this.scale-e)<1e-8||(this.scale=e,this.renderMediaQueries())}onMediaQueryClicked(e){const t=e.target.enclosingNodeOrSelfWithClass("media-inspector-bar");if(!t)return;const i=this.elementsToMediaQueryModel.get(t);if(!i)return;const o=i.maxWidthExpression(),s=i.minWidthExpression();if(0===i.section())return void this.setWidthCallback(o&&o.computedLength()||0);if(2===i.section())return void this.setWidthCallback(s&&s.computedLength()||0);const n=this.getWidthCallback();s&&n!==s.computedLength()?this.setWidthCallback(s.computedLength()||0):this.setWidthCallback(o&&o.computedLength()||0)}onContextMenu(e){if(!this.cssModel?.isEnabled())return;const i=e.target.enclosingNodeOrSelfWithClass("media-inspector-bar");if(!i)return;const o=this.elementsToCSSLocations.get(i)||[],s=new Map;for(let e=0;en&&(s=t,n=d)}return n>o||!i&&!s?null:new C(e,s,i,t.active())}equals(e){return 0===this.compareTo(e)}dimensionsEqual(e){const t=this.minWidthExpression(),i=e.minWidthExpression(),o=this.maxWidthExpression(),s=e.maxWidthExpression(),n=this.section()===e.section(),r=!t||t.computedLength()===i?.computedLength(),a=!o||o.computedLength()===s?.computedLength();return n&&r&&a}compareTo(e){if(this.section()!==e.section())return this.section()-e.section();if(this.dimensionsEqual(e)){const t=this.rawLocation(),i=e.rawLocation();return t||i?t&&!i?1:!t&&i?-1:this.active()!==e.active()?this.active()?-1:1:t&&i?d.StringUtilities.compare(t.url,i.url)||t.lineNumber-i.lineNumber||t.columnNumber-i.columnNumber:0:d.StringUtilities.compare(this.mediaText(),e.mediaText())}const t=this.maxWidthExpression(),i=e.maxWidthExpression(),o=t&&t.computedLength()||0,s=i&&i.computedLength()||0,n=this.minWidthExpression(),r=e.minWidthExpression(),a=n&&n.computedLength()||0,l=r&&r.computedLength()||0;return 0===this.section()?s-o:2===this.section()?a-l:a-l||s-o}section(){return this.sectionInternal}mediaText(){return this.cssMedia.text||""}rawLocation(){return this.rawLocationInternal||(this.rawLocationInternal=this.cssMedia.rawLocation()),this.rawLocationInternal}minWidthExpression(){return this.minWidthExpressionInternal}maxWidthExpression(){return this.maxWidthExpressionInternal}active(){return this.activeInternal}}var k=Object.freeze({__proto__:null,MediaQueryInspector:y,MediaQueryUIModel:C});const D={doubleclickForFullHeight:"Double-click for full height",mobileS:"Mobile S",mobileM:"Mobile M",mobileL:"Mobile L",tablet:"Tablet",laptop:"Laptop",laptopL:"Laptop L"},T=a.i18n.registerUIStrings("panels/emulation/DeviceModeView.ts",D),E=a.i18n.getLocalizedString.bind(void 0,T);class R extends t.Widget.VBox{wrapperInstance;blockElementToWidth;model;mediaInspector;showMediaInspectorSetting;showRulersSetting;topRuler;leftRuler;presetBlocks;responsivePresetsContainer;screenArea;pageArea;outlineImage;contentClip;contentArea;rightResizerElement;leftResizerElement;bottomResizerElement;bottomRightResizerElement;bottomLeftResizerElement;cachedResizable;mediaInspectorContainer;screenImage;toolbar;slowPositionStart;resizeStart;cachedCssScreenRect;cachedCssVisiblePageRect;cachedOutlineRect;cachedMediaInspectorVisible;cachedShowRulers;cachedScale;handleWidth;handleHeight;constructor(){super(!0),this.blockElementToWidth=new WeakMap,this.setMinimumSize(150,150),this.element.classList.add("device-mode-view"),this.registerRequiredCSS(w),this.model=n.DeviceModeModel.DeviceModeModel.instance(),this.model.addEventListener("Updated",this.updateUI,this),this.mediaInspector=new y((()=>this.model.appliedDeviceSize().width),this.model.setWidth.bind(this.model),new r.Throttler.Throttler(0)),this.showMediaInspectorSetting=r.Settings.Settings.instance().moduleSetting("show-media-query-inspector"),this.showMediaInspectorSetting.addChangeListener(this.updateUI,this),this.showRulersSetting=r.Settings.Settings.instance().moduleSetting("emulation.show-rulers"),this.showRulersSetting.addChangeListener(this.updateUI,this),this.topRuler=new z(!0,this.model.setWidthAndScaleToFit.bind(this.model)),this.topRuler.element.classList.add("device-mode-ruler-top"),this.leftRuler=new z(!1,this.model.setHeightAndScaleToFit.bind(this.model)),this.leftRuler.element.classList.add("device-mode-ruler-left"),this.createUI(),t.ZoomManager.ZoomManager.instance().addEventListener("ZoomChanged",this.zoomChanged,this)}createUI(){this.toolbar=new b(this.model,this.showMediaInspectorSetting,this.showRulersSetting),this.contentElement.appendChild(this.toolbar.element()),this.contentClip=this.contentElement.createChild("div","device-mode-content-clip vbox"),this.responsivePresetsContainer=this.contentClip.createChild("div","device-mode-presets-container"),this.responsivePresetsContainer.setAttribute("jslog",`${l.responsivePresets()}`),this.populatePresetsContainer(),this.mediaInspectorContainer=this.contentClip.createChild("div","device-mode-media-container"),this.contentArea=this.contentClip.createChild("div","device-mode-content-area"),this.outlineImage=this.contentArea.createChild("img","device-mode-outline-image hidden fill"),this.outlineImage.addEventListener("load",this.onImageLoaded.bind(this,this.outlineImage,!0),!1),this.outlineImage.addEventListener("error",this.onImageLoaded.bind(this,this.outlineImage,!1),!1),this.screenArea=this.contentArea.createChild("div","device-mode-screen-area"),this.screenImage=this.screenArea.createChild("img","device-mode-screen-image hidden"),this.screenImage.addEventListener("load",this.onImageLoaded.bind(this,this.screenImage,!0),!1),this.screenImage.addEventListener("error",this.onImageLoaded.bind(this,this.screenImage,!1),!1),this.bottomRightResizerElement=this.screenArea.createChild("div","device-mode-resizer device-mode-bottom-right-resizer"),this.bottomRightResizerElement.createChild("div",""),this.createResizer(this.bottomRightResizerElement,2,1),this.bottomLeftResizerElement=this.screenArea.createChild("div","device-mode-resizer device-mode-bottom-left-resizer"),this.bottomLeftResizerElement.createChild("div",""),this.createResizer(this.bottomLeftResizerElement,-2,1),this.rightResizerElement=this.screenArea.createChild("div","device-mode-resizer device-mode-right-resizer"),this.rightResizerElement.createChild("div",""),this.createResizer(this.rightResizerElement,2,0),this.leftResizerElement=this.screenArea.createChild("div","device-mode-resizer device-mode-left-resizer"),this.leftResizerElement.createChild("div",""),this.createResizer(this.leftResizerElement,-2,0),this.bottomResizerElement=this.screenArea.createChild("div","device-mode-resizer device-mode-bottom-resizer"),this.bottomResizerElement.createChild("div",""),this.createResizer(this.bottomResizerElement,0,1),this.bottomResizerElement.addEventListener("dblclick",this.model.setHeight.bind(this.model,0),!1),t.Tooltip.Tooltip.install(this.bottomResizerElement,E(D.doubleclickForFullHeight)),this.pageArea=this.screenArea.createChild("div","device-mode-page-area"),this.pageArea.createChild("slot")}populatePresetsContainer(){const e=[320,375,425,768,1024,1440,2560],t=[E(D.mobileS),E(D.mobileM),E(D.mobileL),E(D.tablet),E(D.laptop),E(D.laptopL),"4K"];this.presetBlocks=[];const i=this.responsivePresetsContainer.createChild("div","device-mode-presets-container-inner");for(let s=e.length-1;s>=0;--s){const n=i.createChild("div","fill device-mode-preset-bar-outer").createChild("div","device-mode-preset-bar");n.createChild("span").textContent=t[s]+" โ€“ "+e[s]+"px",n.setAttribute("jslog",`${l.action().track({click:!0}).context(`device-mode-preset-${e[s]}px`)}`),n.addEventListener("click",o.bind(this,e[s]),!1),this.blockElementToWidth.set(n,e[s]),this.presetBlocks.push(n)}function o(e,t){this.model.emulate(n.DeviceModeModel.Type.Responsive,null,null),this.model.setWidthAndScaleToFit(e),t.consume()}}createResizer(e,i,o){const s=new t.ResizerWidget.ResizerWidget;e.setAttribute("jslog",`${l.slider("device-mode-resizer").track({drag:!0})}`),s.addElement(e);let n=i?"ew-resize":"ns-resize";return i*o>0&&(n="nwse-resize"),i*o<0&&(n="nesw-resize"),s.setCursor(n),s.addEventListener("ResizeStart",this.onResizeStart,this),s.addEventListener("ResizeUpdateXY",this.onResizeUpdate.bind(this,i,o)),s.addEventListener("ResizeEnd",this.onResizeEnd,this),s}onResizeStart(){this.slowPositionStart=null;const e=this.model.screenRect();this.resizeStart=new t.Geometry.Size(e.width,e.height)}onResizeUpdate(e,i,o){o.data.shiftKey!==Boolean(this.slowPositionStart)&&(this.slowPositionStart=o.data.shiftKey?{x:o.data.currentX,y:o.data.currentY}:null);let s=o.data.currentX-o.data.startX,r=o.data.currentY-o.data.startY;if(this.slowPositionStart&&(s=(o.data.currentX-this.slowPositionStart.x)/10+this.slowPositionStart.x-o.data.startX,r=(o.data.currentY-this.slowPositionStart.y)/10+this.slowPositionStart.y-o.data.startY),e&&this.resizeStart){const i=s*t.ZoomManager.ZoomManager.instance().zoomFactor();let o=this.resizeStart.width+i*e;o=Math.round(o/this.model.scale()),o>=n.DeviceModeModel.MinDeviceSize&&o<=n.DeviceModeModel.MaxDeviceSize&&this.model.setWidth(o)}if(i&&this.resizeStart){const e=r*t.ZoomManager.ZoomManager.instance().zoomFactor();let o=this.resizeStart.height+e*i;o=Math.round(o/this.model.scale()),o>=n.DeviceModeModel.MinDeviceSize&&o<=n.DeviceModeModel.MaxDeviceSize&&this.model.setHeight(o)}}exitHingeMode(){this.model&&this.model.exitHingeMode()}onResizeEnd(){delete this.resizeStart,e.userMetrics.actionTaken(e.UserMetrics.Action.ResizedViewInResponsiveMode)}updateUI(){function e(e,t){e.style.left=t.left+"px",e.style.top=t.top+"px",e.style.width=t.width+"px",e.style.height=t.height+"px"}if(!this.isShowing())return;const i=t.ZoomManager.ZoomManager.instance().zoomFactor();let o=!1;const s=this.showRulersSetting.get()&&this.model.type()!==n.DeviceModeModel.Type.None;let r=!1,a=!1;const d=this.model.screenRect().scale(1/i);this.cachedCssScreenRect&&d.isEqual(this.cachedCssScreenRect)||(e(this.screenArea,d),a=!0,o=!0,this.cachedCssScreenRect=d);const l=this.model.visiblePageRect().scale(1/i);this.cachedCssVisiblePageRect&&l.isEqual(this.cachedCssVisiblePageRect)||(e(this.pageArea,l),o=!0,this.cachedCssVisiblePageRect=l);const c=this.model.outlineRect();if(c){const t=c.scale(1/i);this.cachedOutlineRect&&t.isEqual(this.cachedOutlineRect)||(e(this.outlineImage,t),o=!0,this.cachedOutlineRect=t)}this.contentClip.classList.toggle("device-mode-outline-visible",Boolean(this.model.outlineImage()));const h=this.model.type()===n.DeviceModeModel.Type.Responsive;h!==this.cachedResizable&&(this.rightResizerElement.classList.toggle("hidden",!h),this.leftResizerElement.classList.toggle("hidden",!h),this.bottomResizerElement.classList.toggle("hidden",!h),this.bottomRightResizerElement.classList.toggle("hidden",!h),this.bottomLeftResizerElement.classList.toggle("hidden",!h),this.cachedResizable=h);const m=this.showMediaInspectorSetting.get()&&this.model.type()!==n.DeviceModeModel.Type.None;if(m!==this.cachedMediaInspectorVisible&&(m?this.mediaInspector.show(this.mediaInspectorContainer):this.mediaInspector.detach(),r=!0,o=!0,this.cachedMediaInspectorVisible=m),s!==this.cachedShowRulers&&(this.contentClip.classList.toggle("device-mode-rulers-visible",s),s?(this.topRuler.show(this.contentArea),this.leftRuler.show(this.contentArea)):(this.topRuler.detach(),this.leftRuler.detach()),r=!0,o=!0,this.cachedShowRulers=s),this.model.scale()!==this.cachedScale){a=!0,o=!0;for(const e of this.presetBlocks){const t=this.blockElementToWidth.get(e);if(!t)throw new Error("Could not get width for block.");e.style.width=t*this.model.scale()+"px"}this.cachedScale=this.model.scale()}this.toolbar.update(),this.loadImage(this.screenImage,this.model.screenImage()),this.loadImage(this.outlineImage,this.model.outlineImage()),this.mediaInspector.setAxisTransform(this.model.scale()),o&&this.doResize(),a&&(this.topRuler.render(this.model.scale()),this.leftRuler.render(this.model.scale()),this.topRuler.element.positionAt(this.cachedCssScreenRect?this.cachedCssScreenRect.left:0,this.cachedCssScreenRect?this.cachedCssScreenRect.top:0),this.leftRuler.element.positionAt(this.cachedCssScreenRect?this.cachedCssScreenRect.left:0,this.cachedCssScreenRect?this.cachedCssScreenRect.top:0)),r&&this.contentAreaResized()}loadImage(e,t){e.getAttribute("srcset")!==t&&(e.setAttribute("srcset",t),t||e.classList.toggle("hidden",!0))}onImageLoaded(e,t){e.classList.toggle("hidden",!t)}setNonEmulatedAvailableSize(e){if(this.model.type()!==n.DeviceModeModel.Type.None)return;const i=t.ZoomManager.ZoomManager.instance().zoomFactor(),o=e.getBoundingClientRect(),s=new t.Geometry.Size(Math.max(o.width*i,1),Math.max(o.height*i,1));this.model.setAvailableSize(s,s)}contentAreaResized(){const e=t.ZoomManager.ZoomManager.instance().zoomFactor(),i=this.contentArea.getBoundingClientRect(),o=new t.Geometry.Size(Math.max(i.width*e,1),Math.max(i.height*e,1)),s=new t.Geometry.Size(Math.max((i.width-2*(this.handleWidth||0))*e,1),Math.max((i.height-(this.handleHeight||0))*e,1));this.model.setAvailableSize(o,s)}measureHandles(){const e=this.rightResizerElement.classList.contains("hidden");this.rightResizerElement.classList.toggle("hidden",!1),this.bottomResizerElement.classList.toggle("hidden",!1),this.handleWidth=this.rightResizerElement.offsetWidth,this.handleHeight=this.bottomResizerElement.offsetHeight,this.rightResizerElement.classList.toggle("hidden",e),this.bottomResizerElement.classList.toggle("hidden",e)}zoomChanged(){delete this.handleWidth,delete this.handleHeight,this.isShowing()&&(this.measureHandles(),this.contentAreaResized())}onResize(){this.isShowing()&&this.contentAreaResized()}wasShown(){this.measureHandles(),this.toolbar.restore()}willHide(){this.model.emulate(n.DeviceModeModel.Type.None,null,null)}async captureScreenshot(){const e=await this.model.captureScreenshot(!1);if(null===e)return;const t=new Image;t.src="data:image/png;base64,"+e,t.onload=async()=>{const e=t.naturalWidth/this.model.screenRect().width,i=this.model.outlineRect();if(!i)throw new Error("Unable to take screenshot: no outlineRect available.");const o=i.scale(e),s=this.model.screenRect().scale(e),n=this.model.visiblePageRect().scale(e),r=s.left+n.left-o.left,a=s.top+n.top-o.top,d=document.createElement("canvas");d.width=Math.floor(o.width),d.height=Math.min(16384,Math.floor(o.height));const l=d.getContext("2d");if(!l)throw new Error("Could not get 2d context from canvas.");l.imageSmoothingEnabled=!1,this.model.outlineImage()&&await this.paintImage(l,this.model.outlineImage(),o.relativeTo(o)),this.model.screenImage()&&await this.paintImage(l,this.model.screenImage(),s.relativeTo(o)),l.drawImage(t,Math.floor(r),Math.floor(a)),this.saveScreenshot(d)}}async captureFullSizeScreenshot(){const e=await this.model.captureScreenshot(!0);if(null!==e)return this.saveScreenshotBase64(e)}async captureAreaScreenshot(e){const t=await this.model.captureScreenshot(!1,e);if(null!==t)return this.saveScreenshotBase64(t)}saveScreenshotBase64(e){const t=new Image;t.src="data:image/png;base64,"+e,t.onload=()=>{const e=document.createElement("canvas");e.width=t.naturalWidth,e.height=Math.min(16384,Math.floor(t.naturalHeight));const i=e.getContext("2d");if(!i)throw new Error("Could not get 2d context for base64 screenshot.");i.imageSmoothingEnabled=!1,i.drawImage(t,0,0),this.saveScreenshot(e)}}paintImage(e,t,i){return new Promise((o=>{const s=new Image;s.crossOrigin="Anonymous",s.srcset=t,s.onerror=()=>o(),s.onload=()=>{e.drawImage(s,i.left,i.top,i.width,i.height),o()}}))}saveScreenshot(e){const t=this.model.inspectedURL();let i="";if(t){const e=d.StringUtilities.removeURLFragment(t);i=d.StringUtilities.trimURL(e)}const o=this.model.device();o&&this.model.type()===n.DeviceModeModel.Type.Device&&(i+=`(${o.title})`);const s=document.createElement("a");s.download=i+".png",e.toBlob((e=>{null!==e&&(s.href=URL.createObjectURL(e),s.click())}))}}class z extends t.Widget.VBox{contentElementInternal;horizontal;scale;count;throttler;applyCallback;renderedScale;renderedZoomFactor;constructor(e,t){super(),this.element.classList.add("device-mode-ruler"),this.element.setAttribute("jslog",`${l.deviceModeRuler().track({click:!0})}`),this.contentElementInternal=this.element.createChild("div","device-mode-ruler-content").createChild("div","device-mode-ruler-inner"),this.horizontal=e,this.scale=1,this.count=0,this.throttler=new r.Throttler.Throttler(0),this.applyCallback=t}render(e){this.scale=e,this.throttler.schedule(this.update.bind(this))}onResize(){this.throttler.schedule(this.update.bind(this))}update(){const e=t.ZoomManager.ZoomManager.instance().zoomFactor(),i=this.horizontal?this.contentElementInternal.offsetWidth:this.contentElementInternal.offsetHeight;this.scale===this.renderedScale&&e===this.renderedZoomFactor||(this.contentElementInternal.removeChildren(),this.count=0,this.renderedScale=this.scale,this.renderedZoomFactor=e);const o=i*e/this.scale,s=Math.ceil(o/5);let n=1;this.scale<.8&&(n=2),this.scale<.6&&(n=4),this.scale<.4&&(n=8),this.scale<.2&&(n=16),this.scale<.1&&(n=32);for(let e=s;enew((await g()).ThrottlingSettingsTab.ThrottlingSettingsTab),settings:["custom-network-conditions","calibrated-cpu-throttling"],iconName:"performance"}),e.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-offline",category:"NETWORK",title:a(i.goOffline),loadActionDelegate:async()=>new((await g()).ThrottlingManager.ActionDelegate),tags:[a(i.device),a(i.throttlingTag)]}),e.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-low-end-mobile",category:"NETWORK",title:a(i.enableSlowGThrottling),loadActionDelegate:async()=>new((await g()).ThrottlingManager.ActionDelegate),tags:[a(i.device),a(i.throttlingTag)]}),e.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-mid-tier-mobile",category:"NETWORK",title:a(i.enableFastGThrottling),loadActionDelegate:async()=>new((await g()).ThrottlingManager.ActionDelegate),tags:[a(i.device),a(i.throttlingTag)]}),e.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-online",category:"NETWORK",title:a(i.goOnline),loadActionDelegate:async()=>new((await g()).ThrottlingManager.ActionDelegate),tags:[a(i.device),a(i.throttlingTag)]}),t.Settings.registerSettingExtension({storageType:"Synced",settingName:"custom-network-conditions",settingType:"array",defaultValue:[]}); +import*as t from"../../core/common/common.js";import*as e from"../../core/i18n/i18n.js";import"../../core/root/root.js";import*as i from"../../ui/legacy/legacy.js";const n={throttling:"Throttling",showThrottling:"Show Throttling",goOffline:"Go offline",device:"device",throttlingTag:"throttling",enableSlowGThrottling:"Enable slow `3G` throttling",enableFastGThrottling:"Enable fast `3G` throttling",goOnline:"Go online"},o=e.i18n.registerUIStrings("panels/mobile_throttling/mobile_throttling-meta.ts",n),a=e.i18n.getLazilyComputedLocalizedString.bind(void 0,o);let r;async function g(){return r||(r=await import("./mobile_throttling.js")),r}i.ViewManager.registerViewExtension({location:"settings-view",id:"throttling-conditions",title:a(n.throttling),commandPrompt:a(n.showThrottling),order:35,loadView:async()=>new((await g()).ThrottlingSettingsTab.ThrottlingSettingsTab),settings:["custom-network-conditions","calibrated-cpu-throttling"],iconName:"performance"}),i.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-offline",category:"NETWORK",experiment:"!react-native-specific-ui",title:a(n.goOffline),loadActionDelegate:async()=>new((await g()).ThrottlingManager.ActionDelegate),tags:[a(n.device),a(n.throttlingTag)]}),i.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-low-end-mobile",category:"NETWORK",experiment:"!react-native-specific-ui",title:a(n.enableSlowGThrottling),loadActionDelegate:async()=>new((await g()).ThrottlingManager.ActionDelegate),tags:[a(n.device),a(n.throttlingTag)]}),i.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-mid-tier-mobile",category:"NETWORK",experiment:"!react-native-specific-ui",title:a(n.enableFastGThrottling),loadActionDelegate:async()=>new((await g()).ThrottlingManager.ActionDelegate),tags:[a(n.device),a(n.throttlingTag)]}),i.ActionRegistration.registerActionExtension({actionId:"network-conditions.network-online",category:"NETWORK",experiment:"!react-native-specific-ui",title:a(n.goOnline),loadActionDelegate:async()=>new((await g()).ThrottlingManager.ActionDelegate),tags:[a(n.device),a(n.throttlingTag)]}),t.Settings.registerSettingExtension({storageType:"Synced",settingName:"custom-network-conditions",settingType:"array",defaultValue:[]}); diff --git a/packages/debugger-frontend/index.js b/packages/debugger-frontend/index.js index ecd558a5d286..742f654eb78e 100644 --- a/packages/debugger-frontend/index.js +++ b/packages/debugger-frontend/index.js @@ -8,9 +8,14 @@ * @format */ -const path = require('path'); +const path = require('node:path'); -let frontEndPath = path.join(__dirname, 'dist', 'third-party', 'front_end'); +let frontEndPath /*:string */ = path.join( + __dirname, + 'dist', + 'third-party', + 'front_end', +); if (process.env.REACT_NATIVE_DEBUGGER_FRONTEND_PATH != null) { frontEndPath = process.env.REACT_NATIVE_DEBUGGER_FRONTEND_PATH; @@ -33,4 +38,4 @@ if (process.env.REACT_NATIVE_DEBUGGER_FRONTEND_PATH != null) { ); } -module.exports = frontEndPath /*:: as string */; +module.exports = frontEndPath; diff --git a/packages/debugger-frontend/package.json b/packages/debugger-frontend/package.json index 40ccadb4510d..e5860ab107d9 100644 --- a/packages/debugger-frontend/package.json +++ b/packages/debugger-frontend/package.json @@ -6,11 +6,11 @@ "react-native", "tools" ], - "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/debugger-frontend#readme", - "bugs": "https://github.com/facebook/react-native/issues", + "homepage": "https://github.com/react/react-native/tree/HEAD/packages/debugger-frontend#readme", + "bugs": "https://github.com/react/react-native/issues", "repository": { "type": "git", - "url": "git+https://github.com/facebook/react-native.git", + "url": "git+https://github.com/react/react-native.git", "directory": "packages/debugger-frontend" }, "license": "BSD-3-Clause", diff --git a/packages/debugger-shell/README.md b/packages/debugger-shell/README.md index 30c43bae907b..f19ba22505ea 100644 --- a/packages/debugger-shell/README.md +++ b/packages/debugger-shell/README.md @@ -1,8 +1,11 @@ # @react-native/debugger-shell -![npm package](https://img.shields.io/npm/v/@react-native/debugger-shell?color=brightgreen&label=npm%20package) +[![npm]](https://www.npmjs.com/package/@react-native/debugger-shell) [![npm downloads]](https://www.npmjs.com/package/@react-native/debugger-shell) -Experimental Electron-based shell for React Native DevTools. This package is not part of React Native's public API. +[npm]: https://img.shields.io/npm/v/@react-native/debugger-shell.svg?color=blue +[npm downloads]: https://img.shields.io/npm/dm/@react-native/debugger-shell.svg + +Experimental Electron-based shell for React Native DevTools. ## Why Electron? diff --git a/packages/debugger-shell/__tests__/dotslash-test.js b/packages/debugger-shell/__tests__/dotslash-test.js index e481dc6e7abc..55937dece45f 100644 --- a/packages/debugger-shell/__tests__/dotslash-test.js +++ b/packages/debugger-shell/__tests__/dotslash-test.js @@ -11,10 +11,10 @@ const { prepareDebuggerShellFromDotSlashFile, } = require('../src/node/private/LaunchUtils'); -const fs = require('fs').promises; -const http = require('http'); -const os = require('os'); -const path = require('path'); +const fs = require('node:fs').promises; +const http = require('node:http'); +const os = require('node:os'); +const path = require('node:path'); // The implementation of prepareDebuggerShellFromDotSlashFile relies on // details of DotSlash that are not guaranteed to be stable (support for diff --git a/packages/debugger-shell/package.json b/packages/debugger-shell/package.json index 9e7c16369fd1..23a04ba7f99a 100644 --- a/packages/debugger-shell/package.json +++ b/packages/debugger-shell/package.json @@ -7,8 +7,8 @@ "react-native", "tools" ], - "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/debugger-shell#readme", - "bugs": "https://github.com/facebook/react-native/issues", + "homepage": "https://github.com/react/react-native/tree/HEAD/packages/debugger-shell#readme", + "bugs": "https://github.com/react/react-native/issues", "main": "./src/index.js", "exports": { ".": { @@ -33,7 +33,7 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/facebook/react-native.git", + "url": "git+https://github.com/react/react-native.git", "directory": "packages/debugger-shell" }, "license": "MIT", @@ -46,7 +46,7 @@ "fb-dotslash": "0.5.8" }, "devDependencies": { - "electron": "39.0.0", + "electron": "43.0.0", "semver": "^7.1.3" }, "files": [ diff --git a/packages/debugger-shell/src/electron/AppMenu.js b/packages/debugger-shell/src/electron/AppMenu.js new file mode 100644 index 000000000000..70b16a57e48b --- /dev/null +++ b/packages/debugger-shell/src/electron/AppMenu.js @@ -0,0 +1,129 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + */ + +const {BrowserWindow, Menu, app, nativeImage, shell} = + // $FlowFixMe[unclear-type] We have no Flow types for the Electron API. + require('electron') as any; + +const {isMacOSAtLeast} = require('./utils'); + +export function configureAppMenu(): void { + const template = [ + ...(process.platform === 'darwin' ? [{role: 'appMenu'}] : []), + { + label: 'File', + submenu: [ + { + label: 'Reload App', + accelerator: + process.platform === 'darwin' ? 'Command+R' : 'Control+R', + click: () => invokeCommand('inspector-main.reload'), + }, + { + label: 'Reload DevTools', + accelerator: process.platform === 'darwin' ? 'Option+R' : 'Alt+R', + click: () => BrowserWindow.getFocusedWindow()?.webContents.reload(), + }, + {type: 'separator'}, + { + label: 'Quick Openโ€ฆ', + ...menuSymbol('doc.text.magnifyingglass'), + accelerator: + process.platform === 'darwin' ? 'Command+P' : 'Control+P', + click: () => invokeCommand('quick-open.show'), + }, + {type: 'separator'}, + {role: 'close'}, + ], + }, + { + label: 'Edit', + submenu: [ + {role: 'undo'}, + {role: 'redo'}, + {type: 'separator'}, + {role: 'cut'}, + {role: 'copy'}, + {role: 'paste'}, + {role: 'selectAll'}, + ], + }, + { + label: 'View', + submenu: [ + { + label: 'Command Paletteโ€ฆ', + ...menuSymbol('filemenu.and.selection'), + accelerator: + process.platform === 'darwin' + ? 'Command+Shift+P' + : 'Control+Shift+P', + click: () => invokeCommand('quick-open.show-command-menu'), + }, + // Enable Developer Tools only in development + ...(!app.isPackaged + ? [{type: 'separator'}, {role: 'toggleDevTools'}] + : []), + {type: 'separator'}, + {role: 'resetZoom'}, + {role: 'zoomIn'}, + {role: 'zoomOut'}, + {type: 'separator'}, + {role: 'togglefullscreen'}, + ], + }, + {role: 'windowMenu'}, + { + role: 'help', + submenu: [ + { + label: 'Keyboard Shortcuts', + ...menuSymbol('keyboard'), + click: () => invokeCommand('settings.shortcuts'), + }, + {type: 'separator'}, + { + label: 'React Native Website', + click: () => shell.openExternal('https://reactnative.dev'), + }, + { + label: 'Release Notes', + click: () => + shell.openExternal( + 'https://github.com/facebook/react-native/releases', + ), + }, + ], + }, + ]; + const menu = Menu.buildFromTemplate(template); + Menu.setApplicationMenu(menu); +} + +function menuSymbol(symbolName: string): {icon?: unknown} { + if (!isMacOSAtLeast(26)) { + return {}; + } + return { + icon: nativeImage.createMenuSymbol(symbolName), + }; +} + +function invokeCommand(commandId: string): void { + const win = BrowserWindow.getFocusedWindow(); + win?.webContents.executeJavaScript( + `(async () => { + const UI = await import('./ui/legacy/legacy.js'); + return UI.ActionRegistry.ActionRegistry.instance() + .getAction(${JSON.stringify(commandId)})?.execute(); + })()`, + true, + ); +} diff --git a/packages/debugger-shell/src/electron/MainInstanceEntryPoint.js b/packages/debugger-shell/src/electron/MainInstanceEntryPoint.js index 77ae7250645a..f8c3b19aab01 100644 --- a/packages/debugger-shell/src/electron/MainInstanceEntryPoint.js +++ b/packages/debugger-shell/src/electron/MainInstanceEntryPoint.js @@ -8,13 +8,14 @@ * @format */ +import {configureAppMenu} from './AppMenu.js'; import SettingsStore from './SettingsStore.js'; -const path = require('path'); -const util = require('util'); +const path = require('node:path'); +const util = require('node:util'); // $FlowFixMe[unclear-type] We have no Flow types for the Electron API. -const {BrowserWindow, Menu, app, shell, ipcMain} = require('electron') as any; +const {BrowserWindow, app, shell, ipcMain} = require('electron') as any; const appSettings = new SettingsStore(); const windowMetadata = new WeakMap< @@ -102,34 +103,6 @@ function handleLaunchArgs(argv: string[]) { frontendWindow.focus(); } -function configureAppMenu() { - const template = [ - ...(process.platform === 'darwin' ? [{role: 'appMenu'}] : []), - {role: 'fileMenu'}, - {role: 'editMenu'}, - {role: 'viewMenu'}, - {role: 'windowMenu'}, - { - role: 'help', - submenu: [ - { - label: 'React Native Website', - click: () => shell.openExternal('https://reactnative.dev'), - }, - { - label: 'Release Notes', - click: () => - shell.openExternal( - 'https://github.com/facebook/react-native/releases', - ), - }, - ], - }, - ]; - const menu = Menu.buildFromTemplate(template); - Menu.setApplicationMenu(menu); -} - function getSavedWindowPosition( windowKey: string, ): ?{width: number, height: number, x?: number, y?: number} { diff --git a/packages/debugger-shell/src/electron/SettingsStore.js b/packages/debugger-shell/src/electron/SettingsStore.js index 0fe913e13791..c4714beed615 100644 --- a/packages/debugger-shell/src/electron/SettingsStore.js +++ b/packages/debugger-shell/src/electron/SettingsStore.js @@ -11,8 +11,8 @@ // $FlowFixMe[unclear-type] We have no Flow types for the Electron API. const {app} = require('electron') as any; -const fs = require('fs'); -const path = require('path'); +const fs = require('node:fs'); +const path = require('node:path'); type Options = Readonly<{ name?: string, diff --git a/packages/debugger-shell/src/electron/index.flow.js b/packages/debugger-shell/src/electron/index.flow.js index bdd847d5ee03..207738c42a60 100644 --- a/packages/debugger-shell/src/electron/index.flow.js +++ b/packages/debugger-shell/src/electron/index.flow.js @@ -12,7 +12,7 @@ import buildInfo from './BuildInfo'; // $FlowFixMe[untyped-import] Flow doesn't infer JSON types const pkg = require('../../package.json'); -const util = require('util'); +const util = require('node:util'); // $FlowFixMe[unclear-type] We have no Flow types for the Electron API. const {app} = require('electron') as any; diff --git a/packages/debugger-shell/src/electron/resources/icon.icns b/packages/debugger-shell/src/electron/resources/AppIcon.icns similarity index 100% rename from packages/debugger-shell/src/electron/resources/icon.icns rename to packages/debugger-shell/src/electron/resources/AppIcon.icns diff --git a/packages/debugger-shell/src/electron/resources/AppIcon.icon/Assets/logo_light.svg b/packages/debugger-shell/src/electron/resources/AppIcon.icon/Assets/logo_light.svg new file mode 100644 index 000000000000..18508013dfcd --- /dev/null +++ b/packages/debugger-shell/src/electron/resources/AppIcon.icon/Assets/logo_light.svg @@ -0,0 +1,12 @@ + + + logo_light + + + + + + + + + \ No newline at end of file diff --git a/packages/debugger-shell/src/electron/resources/AppIcon.icon/icon.json b/packages/debugger-shell/src/electron/resources/AppIcon.icon/icon.json new file mode 100644 index 000000000000..842309756868 --- /dev/null +++ b/packages/debugger-shell/src/electron/resources/AppIcon.icon/icon.json @@ -0,0 +1,41 @@ +{ + "fill" : { + "linear-gradient" : [ + "display-p3:0.21574,0.21966,0.23974,1.00000", + "display-p3:0.13729,0.14116,0.15294,1.00000" + ] + }, + "groups" : [ + { + "blur-material" : null, + "layers" : [ + { + "glass" : false, + "image-name" : "logo_light.svg", + "name" : "logo_light", + "position" : { + "scale" : 1.37, + "translation-in-points" : [ + 0, + 0 + ] + } + } + ], + "shadow" : { + "kind" : "neutral", + "opacity" : 0.5 + }, + "specular" : true, + "translucency" : { + "enabled" : false, + "value" : 0.5 + } + } + ], + "supported-platforms" : { + "squares" : [ + "macOS" + ] + } +} \ No newline at end of file diff --git a/packages/debugger-shell/src/electron/utils.js b/packages/debugger-shell/src/electron/utils.js new file mode 100644 index 000000000000..bf45bf0032e7 --- /dev/null +++ b/packages/debugger-shell/src/electron/utils.js @@ -0,0 +1,18 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + */ + +/** Equivalent of Swift's `if #available(macOS 26, *)`. */ +export function isMacOSAtLeast(major: number): boolean { + return ( + process.platform === 'darwin' && + // $FlowFixMe[prop-missing] + Number.parseInt(process.getSystemVersion().split('.')[0], 10) >= major + ); +} diff --git a/packages/debugger-shell/src/node/index.flow.js b/packages/debugger-shell/src/node/index.flow.js index 1a8e4d2b2aef..60140b75fcc3 100644 --- a/packages/debugger-shell/src/node/index.flow.js +++ b/packages/debugger-shell/src/node/index.flow.js @@ -12,7 +12,7 @@ import {prepareDebuggerShellFromDotSlashFile} from './private/LaunchUtils'; const {spawn} = require('cross-spawn'); const debug = require('debug')('Metro:DebuggerShell'); -const path = require('path'); +const path = require('node:path'); // The 'prebuilt' flavor will use the prebuilt shell binary (and the JavaScript embedded in it). // The 'dev' flavor will use a stock Electron binary and run the shell code from the `electron/` directory. diff --git a/packages/dev-middleware/README.md b/packages/dev-middleware/README.md index cf2945afd78c..c6a7f64d68b6 100644 --- a/packages/dev-middleware/README.md +++ b/packages/dev-middleware/README.md @@ -1,6 +1,9 @@ # @react-native/dev-middleware -![npm package](https://img.shields.io/npm/v/@react-native/dev-middleware?color=brightgreen&label=npm%20package) +[![npm]](https://www.npmjs.com/package/@react-native/dev-middleware) [![npm downloads]](https://www.npmjs.com/package/@react-native/dev-middleware) + +[npm]: https://img.shields.io/npm/v/@react-native/dev-middleware.svg?color=blue +[npm downloads]: https://img.shields.io/npm/dm/@react-native/dev-middleware.svg Dev server middleware supporting core React Native development features. This package is preconfigured in all React Native projects. diff --git a/packages/dev-middleware/package.json b/packages/dev-middleware/package.json index 5b9b74814428..814097db9e2c 100644 --- a/packages/dev-middleware/package.json +++ b/packages/dev-middleware/package.json @@ -6,11 +6,11 @@ "react-native", "tools" ], - "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/dev-middleware#readme", - "bugs": "https://github.com/facebook/react-native/issues", + "homepage": "https://github.com/react/react-native/tree/HEAD/packages/dev-middleware#readme", + "bugs": "https://github.com/react/react-native/issues", "repository": { "type": "git", - "url": "git+https://github.com/facebook/react-native.git", + "url": "git+https://github.com/react/react-native.git", "directory": "packages/dev-middleware" }, "license": "MIT", @@ -34,13 +34,11 @@ "@isaacs/ttlcache": "^1.4.1", "@react-native/debugger-frontend": "0.87.0-main", "@react-native/debugger-shell": "0.87.0-main", - "chrome-launcher": "^0.15.2", - "chromium-edge-launcher": "^0.3.0", "connect": "^3.6.5", "debug": "^4.4.0", "invariant": "^2.2.4", "nullthrows": "^1.1.1", - "open": "^7.0.3", + "open": "^8.4.2", "serve-static": "^1.16.2", "ws": "^7.5.10" }, diff --git a/packages/dev-middleware/src/__tests__/InspectorProxyCdpRewritingHacks-test.js b/packages/dev-middleware/src/__tests__/InspectorProxyCdpRewritingHacks-test.js index 46b9c2806da7..7547b1c17fe6 100644 --- a/packages/dev-middleware/src/__tests__/InspectorProxyCdpRewritingHacks-test.js +++ b/packages/dev-middleware/src/__tests__/InspectorProxyCdpRewritingHacks-test.js @@ -20,7 +20,7 @@ import { serveStaticText, withServerForEachTest, } from './ServerUtils'; -import {createHash} from 'crypto'; +import {createHash} from 'node:crypto'; // WebSocket is unreliable when using fake timers. jest.useRealTimers(); diff --git a/packages/dev-middleware/src/__tests__/ServerUtils.js b/packages/dev-middleware/src/__tests__/ServerUtils.js index 0469a99e970d..6a7b9c1bacd1 100644 --- a/packages/dev-middleware/src/__tests__/ServerUtils.js +++ b/packages/dev-middleware/src/__tests__/ServerUtils.js @@ -13,8 +13,8 @@ import type {HandleFunction} from 'connect'; import {createDevMiddleware} from '../'; import connect from 'connect'; -import http from 'http'; -import https from 'https'; +import http from 'node:http'; +import https from 'node:https'; import * as selfsigned from 'selfsigned'; type CreateDevMiddlewareOptions = Parameters[0]; diff --git a/packages/dev-middleware/src/createDevMiddleware.js b/packages/dev-middleware/src/createDevMiddleware.js index 00c892e5c184..f741cc1c6f46 100644 --- a/packages/dev-middleware/src/createDevMiddleware.js +++ b/packages/dev-middleware/src/createDevMiddleware.js @@ -21,7 +21,7 @@ import openDebuggerMiddleware from './middleware/openDebuggerMiddleware'; import DefaultToolLauncher from './utils/DefaultToolLauncher'; import reactNativeDebuggerFrontendPath from '@react-native/debugger-frontend'; import connect from 'connect'; -import path from 'path'; +import path from 'node:path'; import serveStaticMiddleware from 'serve-static'; type Options = Readonly<{ diff --git a/packages/dev-middleware/src/inspector-proxy/CdpDebugLogging.js b/packages/dev-middleware/src/inspector-proxy/CdpDebugLogging.js index 056c07f76f0a..f8305d4c8627 100644 --- a/packages/dev-middleware/src/inspector-proxy/CdpDebugLogging.js +++ b/packages/dev-middleware/src/inspector-proxy/CdpDebugLogging.js @@ -8,12 +8,10 @@ * @format */ -// $FlowFixMe[cannot-resolve-module] libdef missing in RN OSS -import type {Timeout} from 'timers'; +import type {Timeout} from 'node:timers'; -// $FlowFixMe[cannot-resolve-module] libdef missing in RN OSS -import {setTimeout} from 'timers'; -import util from 'util'; +import {setTimeout} from 'node:timers'; +import util from 'node:util'; const debug = require('debug')('Metro:InspectorProxy'); const debugCDPMessages = require('debug')('Metro:InspectorProxyCDPMessages'); @@ -21,10 +19,7 @@ const debugCDPMessages = require('debug')('Metro:InspectorProxyCDPMessages'); const CDP_MESSAGES_BATCH_DEBUGGING_THROTTLE_MS = 5000; export type CDPMessageDestination = - | 'DebuggerToProxy' - | 'ProxyToDebugger' - | 'DeviceToProxy' - | 'ProxyToDevice'; + 'DebuggerToProxy' | 'ProxyToDebugger' | 'DeviceToProxy' | 'ProxyToDevice'; function getCDPLogPrefix(destination: CDPMessageDestination): string { return util.format( diff --git a/packages/dev-middleware/src/inspector-proxy/Device.js b/packages/dev-middleware/src/inspector-proxy/Device.js index 4dc3d685defc..9239f04ed94a 100644 --- a/packages/dev-middleware/src/inspector-proxy/Device.js +++ b/packages/dev-middleware/src/inspector-proxy/Device.js @@ -30,8 +30,8 @@ import type { import CdpDebugLogging from './CdpDebugLogging'; import DeviceEventReporter from './DeviceEventReporter'; -import crypto from 'crypto'; import invariant from 'invariant'; +import crypto from 'node:crypto'; import WS from 'ws'; const debug = require('debug')('Metro:InspectorProxy'); diff --git a/packages/dev-middleware/src/inspector-proxy/EventLoopPerfTracker.js b/packages/dev-middleware/src/inspector-proxy/EventLoopPerfTracker.js index e58afde2849c..ac1f0263989f 100644 --- a/packages/dev-middleware/src/inspector-proxy/EventLoopPerfTracker.js +++ b/packages/dev-middleware/src/inspector-proxy/EventLoopPerfTracker.js @@ -11,10 +11,8 @@ // $FlowFixMe[cannot-resolve-module] libdef missing in RN OSS import type {DebuggerSessionIDs} from '../types/EventReporter'; -// $FlowFixMe[cannot-resolve-module] libdef missing in RN OSS -import {monitorEventLoopDelay, performance} from 'perf_hooks'; -// $FlowFixMe[cannot-resolve-module] libdef missing in RN OSS -import {setTimeout} from 'timers'; +import {monitorEventLoopDelay, performance} from 'node:perf_hooks'; +import {setTimeout} from 'node:timers'; export type EventLoopPerfTrackerArgs = { perfMeasurementDuration: number, diff --git a/packages/dev-middleware/src/inspector-proxy/InspectorProxy.js b/packages/dev-middleware/src/inspector-proxy/InspectorProxy.js index 672181f39cf7..f260dd5a5a38 100644 --- a/packages/dev-middleware/src/inspector-proxy/InspectorProxy.js +++ b/packages/dev-middleware/src/inspector-proxy/InspectorProxy.js @@ -20,7 +20,7 @@ import type { Page, PageDescription, } from './types'; -import type {IncomingMessage, ServerResponse} from 'http'; +import type {IncomingMessage, ServerResponse} from 'node:http'; import getBaseUrlFromRequest from '../utils/getBaseUrlFromRequest'; import getDevToolsFrontendUrl from '../utils/getDevToolsFrontendUrl'; diff --git a/packages/dev-middleware/src/inspector-proxy/InspectorProxyHeartbeat.js b/packages/dev-middleware/src/inspector-proxy/InspectorProxyHeartbeat.js index 6fc6d3387021..f66ce086a7df 100644 --- a/packages/dev-middleware/src/inspector-proxy/InspectorProxyHeartbeat.js +++ b/packages/dev-middleware/src/inspector-proxy/InspectorProxyHeartbeat.js @@ -8,12 +8,10 @@ * @format */ -// $FlowFixMe[cannot-resolve-module] libdef missing in RN OSS -import type {Timeout} from 'timers'; +import type {Timeout} from 'node:timers'; // Import these from node:timers to get the correct Flow types. -// $FlowFixMe[cannot-resolve-module] libdef missing in RN OSS -import {clearTimeout, setTimeout} from 'timers'; +import {clearTimeout, setTimeout} from 'node:timers'; import WS from 'ws'; export type HeartbeatTrackerArgs = { diff --git a/packages/dev-middleware/src/inspector-proxy/types.js b/packages/dev-middleware/src/inspector-proxy/types.js index 89838f2d11d0..707d19ed3bbe 100644 --- a/packages/dev-middleware/src/inspector-proxy/types.js +++ b/packages/dev-middleware/src/inspector-proxy/types.js @@ -107,16 +107,11 @@ export type GetPagesResponse = { // Union type for all possible messages sent from device to Inspector Proxy. export type MessageFromDevice = - | GetPagesResponse - | WrappedEventFromDevice - | DisconnectRequest; + GetPagesResponse | WrappedEventFromDevice | DisconnectRequest; // Union type for all possible messages sent from Inspector Proxy to device. export type MessageToDevice = - | GetPagesRequest - | WrappedEventToDevice - | ConnectRequest - | DisconnectRequest; + GetPagesRequest | WrappedEventToDevice | ConnectRequest | DisconnectRequest; // Page description object that is sent in response to /json HTTP request from debugger. export type PageDescription = Readonly<{ diff --git a/packages/dev-middleware/src/middleware/openDebuggerMiddleware.js b/packages/dev-middleware/src/middleware/openDebuggerMiddleware.js index 54a62c649b7e..a9dc09b945a3 100644 --- a/packages/dev-middleware/src/middleware/openDebuggerMiddleware.js +++ b/packages/dev-middleware/src/middleware/openDebuggerMiddleware.js @@ -19,10 +19,10 @@ import type {Experiments} from '../types/Experiments'; import type {Logger} from '../types/Logger'; import type {ReadonlyURL} from '../types/ReadonlyURL'; import type {NextHandleFunction} from 'connect'; -import type {IncomingMessage, ServerResponse} from 'http'; +import type {IncomingMessage, ServerResponse} from 'node:http'; import getDevToolsFrontendUrl from '../utils/getDevToolsFrontendUrl'; -import {createHash} from 'crypto'; +import {createHash} from 'node:crypto'; const LEGACY_SYNTHETIC_PAGE_TITLE = 'React Native Experimental (Improved Chrome Reloads)'; diff --git a/packages/dev-middleware/src/utils/DefaultToolLauncher.js b/packages/dev-middleware/src/utils/DefaultToolLauncher.js index 01f829260ed4..8f8d89961d8b 100644 --- a/packages/dev-middleware/src/utils/DefaultToolLauncher.js +++ b/packages/dev-middleware/src/utils/DefaultToolLauncher.js @@ -14,11 +14,10 @@ const { unstable_prepareDebuggerShell, unstable_spawnDebuggerShellWithArgs, } = require('@react-native/debugger-shell'); -const {spawn} = require('child_process'); -const ChromeLauncher = require('chrome-launcher'); -const {Launcher: EdgeLauncher} = require('chromium-edge-launcher'); const open = require('open'); +const {apps, openApp} = open; + /** * Default `DevToolLauncher` implementation which handles opening apps on the * local machine. @@ -29,44 +28,27 @@ const DefaultToolLauncher = { assertMockedInTests(); } - let chromePath; - + // NOTE: Since 0.88 this is a simplified approach, since app launching is + // now handled by `launchDebuggerShell`. Frameworks may still override + // `DevToolLauncher` with an improved fallback stack. try { - // Locate Chrome installation path, will throw if not found - chromePath = ChromeLauncher.getChromePath(); - } catch (e) { - // Fall back to Microsoft Edge - chromePath = EdgeLauncher.getFirstInstallation(); - } - - if (chromePath == null) { + const subprocess = await openApp(apps.chrome, { + arguments: [`--app=${url}`], + newInstance: true, + }); + await new Promise((resolve, reject) => { + subprocess.once('error', reject); + subprocess.once('exit', code => { + code === 0 + ? resolve() + : reject(new Error(`openApp exited with code ${code}`)); + }); + }); + } catch (e: unknown) { // Fall back to default browser - the frontend will warn if the browser // is not supported. await open(url); - return; } - - const chromeFlags = [`--app=${url}`, '--window-size=1200,600']; - - return new Promise((resolve, reject) => { - const childProcess = spawn(chromePath, chromeFlags, { - detached: true, - stdio: 'ignore', - }); - - childProcess.on('data', () => { - resolve(); - }); - childProcess.on('close', (code: number) => { - if (code !== 0) { - reject( - new Error( - `Failed to launch debugger app window: ${chromePath} exited with code ${code}`, - ), - ); - } - }); - }); }, async launchDebuggerShell(url: string, windowKey: string): Promise { diff --git a/packages/eslint-config-react-native/README.md b/packages/eslint-config-react-native/README.md index f06151c0d004..4c21428c5623 100644 --- a/packages/eslint-config-react-native/README.md +++ b/packages/eslint-config-react-native/README.md @@ -1,15 +1,18 @@ # @react-native/eslint-config -[![Version][version-badge]][package] +[![npm]](https://www.npmjs.com/package/@react-native/eslint-config) [![npm downloads]](https://www.npmjs.com/package/@react-native/eslint-config) + +[npm]: https://img.shields.io/npm/v/@react-native/eslint-config.svg?color=blue +[npm downloads]: https://img.shields.io/npm/dm/@react-native/eslint-config.svg + +ESLint and Prettier configuration used by React Native apps. ## Installation -``` +```sh yarn add --dev eslint prettier @react-native/eslint-config ``` -*Note: We're using `yarn` to install deps. Feel free to change commands to use `npm` 3+ and `npx` if you like* - ## Usage ### For ESLint 9+ (Flat Config) @@ -45,6 +48,3 @@ Add to your eslint config (`.eslintrc`, or `eslintConfig` field in `package.json "extends": "@react-native" } ``` - -[version-badge]: https://img.shields.io/npm/v/@react-native/eslint-config.svg?style=flat-square -[package]: https://www.npmjs.com/package/@react-native/eslint-config diff --git a/packages/eslint-config-react-native/package.json b/packages/eslint-config-react-native/package.json index 45682f40c083..99fc3a8d2e9c 100644 --- a/packages/eslint-config-react-native/package.json +++ b/packages/eslint-config-react-native/package.json @@ -5,16 +5,16 @@ "license": "MIT", "repository": { "type": "git", - "url": "git+https://github.com/facebook/react-native.git", + "url": "git+https://github.com/react/react-native.git", "directory": "packages/eslint-config-react-native" }, - "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/eslint-config-react-native#readme", + "homepage": "https://github.com/react/react-native/tree/HEAD/packages/eslint-config-react-native#readme", "keywords": [ "eslint", "config", "react-native" ], - "bugs": "https://github.com/facebook/react-native/issues", + "bugs": "https://github.com/react/react-native/issues", "engines": { "node": "^22.13.0 || ^24.3.0 || >= 26.0.0" }, @@ -23,6 +23,7 @@ ".": "./index.js", "./flat": "./flat.js" }, + "files": ["README.md", "flat.js", "index.js", "shared.js"], "dependencies": { "@babel/core": "^7.25.2", "@babel/eslint-parser": "^7.25.1", @@ -43,6 +44,6 @@ }, "devDependencies": { "eslint": "^8.57.0", - "prettier": "3.6.2" + "prettier": "3.9.4" } } diff --git a/packages/eslint-plugin-react-native/README.md b/packages/eslint-plugin-react-native/README.md index 48fc9bcf67c1..cb974cfec212 100644 --- a/packages/eslint-plugin-react-native/README.md +++ b/packages/eslint-plugin-react-native/README.md @@ -1,34 +1,14 @@ # @react-native/eslint-plugin -This plugin is intended to be used in [`@react-native/eslint-config`](https://github.com/facebook/react-native/tree/HEAD/packages/eslint-config-react-native). You probably want to install that package instead. +[![npm]](https://www.npmjs.com/package/@react-native/eslint-plugin) [![npm downloads]](https://www.npmjs.com/package/@react-native/eslint-plugin) -## Installation +[npm]: https://img.shields.io/npm/v/@react-native/eslint-plugin.svg?color=blue +[npm downloads]: https://img.shields.io/npm/dm/@react-native/eslint-plugin.svg -``` -yarn add --dev eslint @react-native/eslint-plugin -``` - -*Note: We're using `yarn` to install deps. Feel free to change commands to use `npm` 3+ and `npx` if you like* - -## Usage - -Add to your eslint config (`.eslintrc`, or `eslintConfig` field in `package.json`): - -```json -{ - "plugins": ["@react-native"] -} -``` +ESLint rules for [`@react-native/eslint-config`](https://github.com/facebook/react-native/tree/HEAD/packages/eslint-config-react-native). You probably want to install that package instead. ## Rules ### `platform-colors` Enforces that calls to `PlatformColor` and `DynamicColorIOS` are statically analyzable to enable performance optimizations. - -## Testing - -To run the tests in this package, run the following commands from the React Native root folder: - -1. `yarn` to install the dependencies. You just need to run this once -2. `yarn jest packages/eslint-plugin-react-native`. diff --git a/packages/eslint-plugin-react-native/__tests__/eslint-tester.js b/packages/eslint-plugin-react-native/__tests__/eslint-tester.js index ffecf3149315..d956afcb4e13 100644 --- a/packages/eslint-plugin-react-native/__tests__/eslint-tester.js +++ b/packages/eslint-plugin-react-native/__tests__/eslint-tester.js @@ -13,7 +13,7 @@ const ESLintTester = require('eslint').RuleTester; ESLintTester.setDefaultConfig({ - parser: require.resolve('hermes-eslint'), + parser: require.resolve('flow-eslint'), parserOptions: { requireConfigFile: false, ecmaVersion: 6, diff --git a/packages/eslint-plugin-react-native/__tests__/no-deep-imports-test.js b/packages/eslint-plugin-react-native/__tests__/no-deep-imports-test.js index d28b33f45835..ca7637e21c1e 100644 --- a/packages/eslint-plugin-react-native/__tests__/no-deep-imports-test.js +++ b/packages/eslint-plugin-react-native/__tests__/no-deep-imports-test.js @@ -29,10 +29,12 @@ eslintTester.run('../no-deep-imports', rule, { "import Foo from 'react-native-foo';", "import Foo from 'react-native-foo/Foo';", "import Foo from 'react/native/Foo';", - "import 'react-native/Libraries/Core/InitializeCore';", - "require('react-native/Libraries/Core/InitializeCore');", "import Foo from 'react-native/src/fb_internal/Foo'", "require('react-native/src/fb_internal/Foo')", + "import 'react-native/setup-env';", + "require('react-native/setup-env');", + "import {BatchedBridge} from 'react-native/react-private-interface';", + "require('react-native/react-private-interface');", ], invalid: [ { @@ -125,5 +127,31 @@ eslintTester.run('../no-deep-imports', rule, { ], output: null, }, + { + code: "import 'react-native/Libraries/Core/InitializeCore';", + errors: [ + { + messageId: 'useReplacementSource', + data: { + importPath: 'react-native/Libraries/Core/InitializeCore', + replacementSource: 'react-native/setup-env', + }, + }, + ], + output: "import 'react-native/setup-env';", + }, + { + code: "require('react-native/Libraries/Core/InitializeCore');", + errors: [ + { + messageId: 'useReplacementSource', + data: { + importPath: 'react-native/Libraries/Core/InitializeCore', + replacementSource: 'react-native/setup-env', + }, + }, + ], + output: "require('react-native/setup-env');", + }, ], }); diff --git a/packages/eslint-plugin-react-native/__tests__/platform-colors-test.js b/packages/eslint-plugin-react-native/__tests__/platform-colors-test.js index ea27e59e0b49..aa6d3fa12683 100644 --- a/packages/eslint-plugin-react-native/__tests__/platform-colors-test.js +++ b/packages/eslint-plugin-react-native/__tests__/platform-colors-test.js @@ -19,6 +19,8 @@ eslintTester.run('../platform-colors', rule, { valid: [ "const color = PlatformColor('labelColor');", "const color = PlatformColor('controlAccentColor', 'controlColor');", + "const color = PlatformColor('labelColor', {fallback: '#FF0000'});", + "const color = PlatformColor('controlAccentColor', 'controlColor', {fallback: 'red'});", "const color = DynamicColorIOS({light: 'black', dark: 'white'});", "const color = DynamicColorIOS({light: PlatformColor('black'), dark: PlatformColor('white')});", "const color = DynamicColorIOS({light: PlatformColor('black'), dark: PlatformColor('white'), highContrastLight: PlatformColor('black'), highContrastDark: PlatformColor('white')});", @@ -32,6 +34,26 @@ eslintTester.run('../platform-colors', rule, { code: "const labelColor = 'labelColor'; const color = PlatformColor(labelColor);", errors: [{message: rule.meta.messages.platformColorArgTypes}], }, + { + code: "const raw = '#FF0000'; const color = PlatformColor('labelColor', {fallback: raw});", + errors: [{message: rule.meta.messages.platformColorArgTypes}], + }, + { + code: "const color = PlatformColor({fallback: '#FF0000'}, 'labelColor');", + errors: [{message: rule.meta.messages.platformColorArgTypes}], + }, + { + code: "const color = PlatformColor('labelColor', {fallback: '#FF0000', fallback: '#00FF00'});", + errors: [{message: rule.meta.messages.platformColorArgTypes}], + }, + { + code: "const color = PlatformColor('labelColor', {fallback: '#FF0000', extra: 'red'});", + errors: [{message: rule.meta.messages.platformColorArgTypes}], + }, + { + code: "const color = PlatformColor('labelColor', {['fallback']: '#FF0000'});", + errors: [{message: rule.meta.messages.platformColorArgTypes}], + }, { code: "const tuple = {light: 'black', dark: 'white'}; const color = DynamicColorIOS(tuple);", errors: [{message: rule.meta.messages.dynamicColorIOSArg}], diff --git a/packages/eslint-plugin-react-native/no-deep-imports.js b/packages/eslint-plugin-react-native/no-deep-imports.js index 697c89b9d616..1a682374c6be 100644 --- a/packages/eslint-plugin-react-native/no-deep-imports.js +++ b/packages/eslint-plugin-react-native/no-deep-imports.js @@ -21,6 +21,8 @@ module.exports = { messages: { deepImport: "'{{importPath}}' React Native deep imports are deprecated. Please use the top level import instead.", + useReplacementSource: + "'{{importPath}}' is deprecated. Please import '{{replacementSource}}' instead.", }, schema: [], fixable: 'code', @@ -31,11 +33,14 @@ module.exports = { ImportDeclaration(node) { if ( !isDeepReactNativeImport(node.source) || - isInitializeCoreImport(node.source) || + isSecondaryEntryPoint(node.source) || isFbInternalImport(node.source) ) { return; } + if (reportReplacementSource(node.source)) { + return; + } if (isDefaultImport(node)) { const reactNativeSource = node.source.value.slice( 'react-native/'.length, @@ -87,12 +92,16 @@ module.exports = { CallExpression(node) { if ( !isDeepRequire(node) || - isInitializeCoreImport(node.arguments[0]) || + isSecondaryEntryPoint(node.arguments[0]) || isFbInternalImport(node.arguments[0]) ) { return; } + if (reportReplacementSource(node.arguments[0])) { + return; + } + const parent = node.parent; const importPath = node.arguments[0].value; @@ -121,6 +130,26 @@ module.exports = { }, }; + function reportReplacementSource(source) { + const reactNativeSource = source.value.slice('react-native/'.length); + const mapping = publicAPIMapping[reactNativeSource]; + if (!mapping || !mapping.replacementSource) { + return false; + } + context.report({ + node: source, + messageId: 'useReplacementSource', + data: { + importPath: source.value, + replacementSource: mapping.replacementSource, + }, + fix(fixer) { + return fixer.replaceText(source, `'${mapping.replacementSource}'`); + }, + }); + return true; + } + function getStandardReport(source) { return { node: source, @@ -165,12 +194,16 @@ module.exports = { return parts.length > 1 && parts[0] === 'react-native'; } - function isInitializeCoreImport(source) { + function isSecondaryEntryPoint(source) { if (source.type !== 'Literal' || typeof source.value !== 'string') { return false; } - return source.value === 'react-native/Libraries/Core/InitializeCore'; + return ( + source.value === 'react-native/asset-registry' || + source.value === 'react-native/react-private-interface' || + source.value === 'react-native/setup-env' + ); } function isFbInternalImport(source) { diff --git a/packages/eslint-plugin-react-native/package.json b/packages/eslint-plugin-react-native/package.json index 872d7b789e37..30699b45b20c 100644 --- a/packages/eslint-plugin-react-native/package.json +++ b/packages/eslint-plugin-react-native/package.json @@ -5,21 +5,28 @@ "license": "MIT", "repository": { "type": "git", - "url": "git+https://github.com/facebook/react-native.git", + "url": "git+https://github.com/react/react-native.git", "directory": "packages/eslint-plugin-react-native" }, - "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/eslint-plugin-react-native#readme", + "homepage": "https://github.com/react/react-native/tree/HEAD/packages/eslint-plugin-react-native#readme", "keywords": [ "eslint", "rules", "eslint-config", "react-native" ], - "bugs": "https://github.com/facebook/react-native/issues", + "bugs": "https://github.com/react/react-native/issues", "main": "index.js", + "files": [ + "README.md", + "index.js", + "no-deep-imports.js", + "platform-colors.js", + "utils.js" + ], "devDependencies": { - "babel-plugin-syntax-hermes-parser": "0.36.1", - "hermes-eslint": "0.36.1" + "flow-parser": "0.327.0", + "flow-eslint": "0.327.0" }, "engines": { "node": "^22.13.0 || ^24.3.0 || >= 26.0.0" diff --git a/packages/eslint-plugin-react-native/platform-colors.js b/packages/eslint-plugin-react-native/platform-colors.js index b154aabcbe53..228c7c3609c6 100644 --- a/packages/eslint-plugin-react-native/platform-colors.js +++ b/packages/eslint-plugin-react-native/platform-colors.js @@ -33,6 +33,21 @@ module.exports = { CallExpression: function (node) { if (node.callee.name === 'PlatformColor') { const args = node.arguments; + // Optional trailing {fallback: }: exactly one `fallback` + // property with a literal value, so it stays statically analyzable. + const isFallbackObject = arg => + arg.type === 'ObjectExpression' && + arg.properties.length === 1 && + arg.properties.every( + property => + property.type === 'Property' && + // Reject computed keys (e.g. {['fallback']: ...}); only a plain + // identifier key keeps the object statically analyzable. + property.computed === false && + property.key.type === 'Identifier' && + property.key.name === 'fallback' && + property.value.type === 'Literal', + ); if (args.length === 0) { context.report({ node, @@ -40,7 +55,13 @@ module.exports = { }); return; } - if (!args.every(arg => arg.type === 'Literal')) { + if ( + !args.every( + (arg, index) => + arg.type === 'Literal' || + (index === args.length - 1 && isFallbackObject(arg)), + ) + ) { context.report({ node, messageId: 'platformColorArgTypes', @@ -58,14 +79,12 @@ module.exports = { } const properties = args[0].properties; properties.forEach(property => { - if ( - !( - property.type === 'Property' && - (property.value.type === 'Literal' || - (property.value.type === 'CallExpression' && - property.value.callee.name === 'PlatformColor')) - ) - ) { + if (!( + property.type === 'Property' && + (property.value.type === 'Literal' || + (property.value.type === 'CallExpression' && + property.value.callee.name === 'PlatformColor')) + )) { context.report({ node, messageId: 'dynamicColorIOSValue', diff --git a/packages/eslint-plugin-react-native/utils.js b/packages/eslint-plugin-react-native/utils.js index 98d1e90ca0b0..728cc26d6ab3 100644 --- a/packages/eslint-plugin-react-native/utils.js +++ b/packages/eslint-plugin-react-native/utils.js @@ -37,6 +37,13 @@ const publicAPIMapping = { default: 'experimental_LayoutConformance', types: ['LayoutConformanceProps'], }, + 'Libraries/Core/InitializeCore': { + // `InitializeCore` has no public named export; the deep import must be + // swapped for the `react-native/setup-env` entry point entirely. + default: null, + types: null, + replacementSource: 'react-native/setup-env', + }, 'Libraries/Lists/FlatList': { default: 'FlatList', types: ['FlatListProps'], diff --git a/packages/eslint-plugin-specs/README.md b/packages/eslint-plugin-specs/README.md index 824fe031ea64..7b2d1cc16a32 100644 --- a/packages/eslint-plugin-specs/README.md +++ b/packages/eslint-plugin-specs/README.md @@ -1,21 +1,8 @@ # @react-native/eslint-plugin-specs -[![Version][version-badge]][package] +[![npm]](https://www.npmjs.com/package/@react-native/eslint-plugin-specs) [![npm downloads]](https://www.npmjs.com/package/@react-native/eslint-plugin-specs) -## Installation +[npm]: https://img.shields.io/npm/v/@react-native/eslint-plugin-specs.svg?color=blue +[npm downloads]: https://img.shields.io/npm/dm/@react-native/eslint-plugin-specs.svg -``` -yarn add --dev @react-native/eslint-plugin-specs -``` - -*Note: We're using `yarn` to install deps. Feel free to change commands to use `npm` 3+ and `npx` if you like* - -[version-badge]: https://img.shields.io/npm/v/@react-native/eslint-plugin-specs?style=flat-square -[package]: https://www.npmjs.com/package/@react-native/eslint-plugin-specs - -## Testing - -To run the tests in this package, run the following commands from the React Native root folder: - -1. `yarn` to install the dependencies. You just need to run this once -2. `yarn jest packages/eslint-plugin-specs`. +ESLint rules that validate React Native Native Module and Component specs. diff --git a/packages/eslint-plugin-specs/__tests__/eslint-tester.js b/packages/eslint-plugin-specs/__tests__/eslint-tester.js index 264a3e8c1a97..ed73951f7781 100644 --- a/packages/eslint-plugin-specs/__tests__/eslint-tester.js +++ b/packages/eslint-plugin-specs/__tests__/eslint-tester.js @@ -13,13 +13,13 @@ const ESLintTester = require('eslint').RuleTester; ESLintTester.setDefaultConfig({ - parser: require.resolve('hermes-eslint'), + parser: require.resolve('flow-eslint'), parserOptions: { requireConfigFile: false, ecmaVersion: 6, sourceType: 'module', babelOptions: { - presets: [require.resolve('babel-plugin-syntax-hermes-parser')], + presets: [require.resolve('flow-parser/babel-plugin')], }, }, }); diff --git a/packages/eslint-plugin-specs/package.json b/packages/eslint-plugin-specs/package.json index e8ed9d1e7703..9536701e628e 100644 --- a/packages/eslint-plugin-specs/package.json +++ b/packages/eslint-plugin-specs/package.json @@ -5,10 +5,10 @@ "license": "MIT", "repository": { "type": "git", - "url": "git+https://github.com/facebook/react-native.git", + "url": "git+https://github.com/react/react-native.git", "directory": "packages/eslint-plugin-specs" }, - "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/eslint-plugin-specs#readme", + "homepage": "https://github.com/react/react-native/tree/HEAD/packages/eslint-plugin-specs#readme", "keywords": [ "eslint", "rules", @@ -17,8 +17,14 @@ "components", "specs" ], - "bugs": "https://github.com/facebook/react-native/issues", + "bugs": "https://github.com/react/react-native/issues", "main": "index.js", + "files": [ + "README.md", + "index.js", + "react-native-modules.js", + "with-babel-register" + ], "scripts": { "prepack": "node prepack.js", "postpack": "node postpack.js" @@ -29,11 +35,11 @@ "@react-native/codegen": "0.87.0-main", "make-dir": "^2.1.0", "pirates": "^4.0.1", - "babel-plugin-syntax-hermes-parser": "0.36.1", + "flow-parser": "0.327.0", "source-map-support": "0.5.0" }, "devDependencies": { - "hermes-eslint": "0.36.1" + "flow-eslint": "0.327.0" }, "engines": { "node": "^22.13.0 || ^24.3.0 || >= 26.0.0" diff --git a/packages/eslint-plugin-specs/postpack.js b/packages/eslint-plugin-specs/postpack.js index 2b4dd7da32b4..91f57f7fd18c 100644 --- a/packages/eslint-plugin-specs/postpack.js +++ b/packages/eslint-plugin-specs/postpack.js @@ -8,7 +8,7 @@ * @noflow */ -const fs = require('fs'); +const fs = require('node:fs'); /** * script to prepare package for publish. diff --git a/packages/eslint-plugin-specs/prepack.js b/packages/eslint-plugin-specs/prepack.js index 031074804670..433ecf589a07 100644 --- a/packages/eslint-plugin-specs/prepack.js +++ b/packages/eslint-plugin-specs/prepack.js @@ -8,7 +8,7 @@ * @noflow */ -const fs = require('fs'); +const fs = require('node:fs'); /** * script to prepare package for publish. diff --git a/packages/eslint-plugin-specs/react-native-modules.js b/packages/eslint-plugin-specs/react-native-modules.js index 78e6e11559ca..4fa25a683de4 100644 --- a/packages/eslint-plugin-specs/react-native-modules.js +++ b/packages/eslint-plugin-specs/react-native-modules.js @@ -11,7 +11,7 @@ 'use strict'; const withBabelRegister = require('./with-babel-register'); -const path = require('path'); +const path = require('node:path'); // We use the prepack hook before publishing package to set this value to true const PACKAGE_USAGE = false; @@ -36,7 +36,7 @@ function requireModuleParser() { configFile: false, only: [/react-native-codegen\/src\//], plugins: [ - require('babel-plugin-syntax-hermes-parser'), + require('flow-parser/babel-plugin'), require('@babel/plugin-transform-flow-strip-types').default, ], }; @@ -54,7 +54,7 @@ function requireModuleParser() { configFile: false, only: [/@react-native\/codegen\/lib\//], plugins: [ - require('babel-plugin-syntax-hermes-parser'), + require('flow-parser/babel-plugin'), require('@babel/plugin-transform-flow-strip-types').default, ], }; @@ -91,22 +91,18 @@ function isModuleRequire(node) { } const memberExpression = callExpression.callee; - if ( - !( - memberExpression.object.type === 'Identifier' && - memberExpression.object.name === 'TurboModuleRegistry' - ) - ) { + if (!( + memberExpression.object.type === 'Identifier' && + memberExpression.object.name === 'TurboModuleRegistry' + )) { return false; } - if ( - !( - memberExpression.property.type === 'Identifier' && - (memberExpression.property.name === 'get' || - memberExpression.property.name === 'getEnforcing') - ) - ) { + if (!( + memberExpression.property.type === 'Identifier' && + (memberExpression.property.name === 'get' || + memberExpression.property.name === 'getEnforcing') + )) { return false; } return true; diff --git a/packages/eslint-plugin-specs/with-babel-register/disk-cache.js b/packages/eslint-plugin-specs/with-babel-register/disk-cache.js index 1ab6cb0aeb05..2a1d811bd43b 100644 --- a/packages/eslint-plugin-specs/with-babel-register/disk-cache.js +++ b/packages/eslint-plugin-specs/with-babel-register/disk-cache.js @@ -8,10 +8,10 @@ * @noflow */ -const fs = require('fs'); const {sync: makeDirSync} = require('make-dir'); -const os = require('os'); -const path = require('path'); +const fs = require('node:fs'); +const os = require('node:os'); +const path = require('node:path'); const packageJson = JSON.parse( fs.readFileSync(require.resolve('../package.json'), 'utf8'), diff --git a/packages/eslint-plugin-specs/with-babel-register/index.js b/packages/eslint-plugin-specs/with-babel-register/index.js index dc3a3350229c..e9dab51300ec 100644 --- a/packages/eslint-plugin-specs/with-babel-register/index.js +++ b/packages/eslint-plugin-specs/with-babel-register/index.js @@ -11,8 +11,8 @@ const diskCache = require('./disk-cache'); const babel = require('@babel/core'); const {DEFAULT_EXTENSIONS, OptionManager} = require('@babel/core'); -const fs = require('fs'); -const path = require('path'); +const fs = require('node:fs'); +const path = require('node:path'); const {addHook} = require('pirates'); const sourceMapSupport = require('source-map-support'); diff --git a/packages/gradle-plugin/README.md b/packages/gradle-plugin/README.md index bb9f0a3a87b8..c86dcc49a27b 100644 --- a/packages/gradle-plugin/README.md +++ b/packages/gradle-plugin/README.md @@ -1,23 +1,8 @@ # @react-native/gradle-plugin -[![Version][version-badge]][package] +[![npm]](https://www.npmjs.com/package/@react-native/gradle-plugin) [![npm downloads]](https://www.npmjs.com/package/@react-native/gradle-plugin) -A Gradle Plugin used to support development of React Native applications for Android. +[npm]: https://img.shields.io/npm/v/@react-native/gradle-plugin.svg?color=blue +[npm downloads]: https://img.shields.io/npm/dm/@react-native/gradle-plugin.svg -## Installation - -``` -yarn add @react-native/gradle-plugin -``` - -*Note: We're using `yarn` to install deps. Feel free to change commands to use `npm` 3+ and `npx` if you like* - -[version-badge]: https://img.shields.io/npm/v/@react-native/gradle-plugin?style=flat-square -[package]: https://www.npmjs.com/package/@react-native/gradle-plugin - -## Testing - -To run the tests in this package, run the following commands from the React Native root folder: - -1. `yarn` to install the dependencies. You just need to run this once -2. `./gradlew -p packages/gradle-plugin test`. +Gradle plugin used to build and configure React Native applications for Android. It is applied automatically by apps created from the React Native template. diff --git a/packages/gradle-plugin/package.json b/packages/gradle-plugin/package.json index 236f12d39865..356a94383e90 100644 --- a/packages/gradle-plugin/package.json +++ b/packages/gradle-plugin/package.json @@ -5,16 +5,16 @@ "license": "MIT", "repository": { "type": "git", - "url": "git+https://github.com/facebook/react-native.git", + "url": "git+https://github.com/react/react-native.git", "directory": "packages/gradle-plugin" }, - "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/gradle-plugin#readme", + "homepage": "https://github.com/react/react-native/tree/HEAD/packages/gradle-plugin#readme", "keywords": [ "gradle", "plugin", "react-native" ], - "bugs": "https://github.com/facebook/react-native/issues", + "bugs": "https://github.com/react/react-native/issues", "engines": { "node": "^22.13.0 || ^24.3.0 || >= 26.0.0" }, diff --git a/packages/gradle-plugin/react-native-gradle-plugin/build.gradle.kts b/packages/gradle-plugin/react-native-gradle-plugin/build.gradle.kts index c4f92db2e1a1..1450a701a71a 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/build.gradle.kts +++ b/packages/gradle-plugin/react-native-gradle-plugin/build.gradle.kts @@ -68,7 +68,7 @@ tasks.withType().configureEach { // See comment above on JDK 11 support jvmTarget.set(JvmTarget.JVM_11) allWarningsAsErrors.set( - project.properties["enableWarningsAsErrors"]?.toString()?.toBoolean() ?: false + project.properties["enableWarningsAsErrors"]?.toString()?.toBoolean() ?: false, ) } } diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt index 961649623d5a..2704dd9fc217 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt @@ -208,7 +208,7 @@ abstract class ReactExtension @Inject constructor(val project: Project) { } else { buildTypes.forEach { buildType -> result.add( - (dependencyConfiguration ?: "${buildType}Implementation") to ":$nameCleansed" + (dependencyConfiguration ?: "${buildType}Implementation") to ":$nameCleansed", ) } } diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt index f7bd68eeb2e5..890edb58bd86 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt @@ -69,11 +69,11 @@ class ReactPlugin : Plugin { .toBoolean() if (value) { project.logger.warn( - "WARNING: The 'hermesV1Enabled' property is no longer needed. Hermes V1 is now always enabled. You can safely remove this property from your gradle.properties." + "WARNING: The 'hermesV1Enabled' property is no longer needed. Hermes V1 is now always enabled. You can safely remove this property from your gradle.properties.", ) } else { project.logger.warn( - "WARNING: Opting out of Hermes V1 is no longer supported. The 'hermesV1Enabled=false' property will be ignored. Hermes V1 is now always enabled. Please remove this property from your gradle.properties." + "WARNING: Opting out of Hermes V1 is no longer supported. The 'hermesV1Enabled=false' property will be ignored. Hermes V1 is now always enabled. Please remove this property from your gradle.properties.", ) } } @@ -113,6 +113,30 @@ class ReactPlugin : Plugin { configureCodegen(project, extension, rootExtension, isLibrary = false) configureResources(project, extension) configureBuildTypesForApp(project) + + // Apply the namespace fallback to every Android library in the build, including third-party + // libraries that don't apply the `com.facebook.react` plugin and still rely on the manifest + // `package` attribute (which AGP 9 no longer accepts as a namespace). The per-library hook + // below only covers libraries that apply our plugin, so we additionally sweep all library + // subprojects from the app. We do this once, from the application project, because re-running + // a rootProject-wide traversal from every library breaks on AGP 9, which errors when + // `finalizeDsl` is registered after a project's DSL has been finalized. + // See https://github.com/facebook/react-native/pull/57038. + // + // We skip projects that have already been evaluated: AGP finalizes a project's DSL during/ + // after its evaluation, so registering a `finalizeDsl` callback on an already-evaluated + // project is "too late" and fails on AGP 9. In a regular app build the app is evaluated + // before its libraries (see ReactRootProjectPlugin's `evaluationDependsOn(":app")`), so every + // library is still pending here. In composite/monorepo builds (e.g. rn-tester, where + // ReactAndroid is a sibling) some library projects are already evaluated by this point; those + // already define their own namespace, so skipping them is safe. + project.rootProject.allprojects { subproject -> + subproject.pluginManager.withPlugin("com.android.library") { + if (!subproject.state.executed) { + configureNamespaceForLibraries(subproject) + } + } + } } // Library Only Configuration @@ -137,7 +161,7 @@ class ReactPlugin : Plugin { ******************************************************************************** """ - .trimIndent() + .trimIndent(), ) exitProcess(1) } @@ -176,44 +200,42 @@ class ReactPlugin : Plugin { } // We create the tasks to produce schema from JS files and generate artifacts from schema. - val generateCodegenArtifactsTask = - registerCodegenTasks( - project = project, - rootExtension = rootExtension, - generatedSrcDir = generatedSrcDir, - packageJsonFile = { findPackageJsonFile(project, rootExtension.root) }, - schemaTaskName = "generateCodegenSchemaFromJavaScript", - artifactsTaskName = "generateCodegenArtifactsFromSchema", - configureJsRoot = { task, packageJson -> - // We're reading the package.json at configuration time to properly feed - // the `jsRootDir` @Input property of this task & the onlyIf. Therefore, the - // parsePackageJson should be invoked inside this lambda. - val parsedPackageJson = packageJson?.let { JsonUtils.fromPackageJson(it) } - val jsSrcsDirInPackageJson = parsedPackageJson?.codegenConfig?.jsSrcsDir - - if (packageJson != null && jsSrcsDirInPackageJson != null) { - task.jsRootDir.set(File(packageJson.parentFile, jsSrcsDirInPackageJson)) - } else { - task.jsRootDir.set(localExtension.jsRootDir) - } - }, - configureCodegenArtifacts = { task, _ -> - task.codegenJavaPackageName.set(localExtension.codegenJavaPackageName) - task.libraryName.set(localExtension.libraryName) - }, - onlyIf = { packageJson -> - // Please note that needsCodegenFromPackageJson is triggering a read of the - // package.json at configuration time as we need to feed the onlyIf condition of this - // task. Therefore, needsCodegenFromPackageJson needs to be invoked inside this - // lambda. - val needsCodegenFromPackageJson = - project.needsCodegenFromPackageJson(rootExtension.root) - val parsedPackageJson = packageJson?.let { JsonUtils.fromPackageJson(it) } - val includesGeneratedCode = - parsedPackageJson?.codegenConfig?.includesGeneratedCode ?: false - (isLibrary || needsCodegenFromPackageJson) && !includesGeneratedCode - }, - ) + val generateCodegenArtifactsTask = registerCodegenTasks( + project = project, + rootExtension = rootExtension, + generatedSrcDir = generatedSrcDir, + packageJsonFile = { findPackageJsonFile(project, rootExtension.root) }, + schemaTaskName = "generateCodegenSchemaFromJavaScript", + artifactsTaskName = "generateCodegenArtifactsFromSchema", + configureJsRoot = { task, packageJson -> + // We're reading the package.json at configuration time to properly feed + // the `jsRootDir` @Input property of this task & the onlyIf. Therefore, the + // parsePackageJson should be invoked inside this lambda. + val parsedPackageJson = packageJson?.let { JsonUtils.fromPackageJson(it) } + val jsSrcsDirInPackageJson = parsedPackageJson?.codegenConfig?.jsSrcsDir + + if (packageJson != null && jsSrcsDirInPackageJson != null) { + task.jsRootDir.set(File(packageJson.parentFile, jsSrcsDirInPackageJson)) + } else { + task.jsRootDir.set(localExtension.jsRootDir) + } + }, + configureCodegenArtifacts = { task, _ -> + task.codegenJavaPackageName.set(localExtension.codegenJavaPackageName) + task.libraryName.set(localExtension.libraryName) + }, + onlyIf = { packageJson -> + // Please note that needsCodegenFromPackageJson is triggering a read of the + // package.json at configuration time as we need to feed the onlyIf condition of this + // task. Therefore, needsCodegenFromPackageJson needs to be invoked inside this + // lambda. + val needsCodegenFromPackageJson = project.needsCodegenFromPackageJson(rootExtension.root) + val parsedPackageJson = packageJson?.let { JsonUtils.fromPackageJson(it) } + val includesGeneratedCode = + parsedPackageJson?.codegenConfig?.includesGeneratedCode ?: false + (isLibrary || needsCodegenFromPackageJson) && !includesGeneratedCode + }, + ) // We update the android configuration to include the generated sources. // This is equivalent to this DSL: @@ -282,7 +304,7 @@ class ReactPlugin : Plugin { // We want to exclude the build directory, to avoid picking them up for execution // avoidance. tree.exclude("**/build/**/*") - } + }, ) val shouldRunTask = onlyIf(packageJson) task.onlyIf { shouldRunTask } @@ -331,14 +353,13 @@ class ReactPlugin : Plugin { project.rootProject.layout.buildDirectory.file("generated/autolinking/autolinking.json") val pureCxxDependencies = getPureCxxCodegenDependencies(rootGeneratedAutolinkingFile.get().asFile) - val pureCxxCodegenTasks = - configurePureCxxDependenciesCodegen( - project, - extension, - rootExtension, - generatedPureCxxSourceDir, - pureCxxDependencies, - ) + val pureCxxCodegenTasks = configurePureCxxDependenciesCodegen( + project, + extension, + rootExtension, + generatedPureCxxSourceDir, + pureCxxDependencies, + ) // We add a task called generateAutolinkingPackageList to do not clash with the existing task // called generatePackageList. This can to be renamed once we unlink the rn <-> cli @@ -392,7 +413,7 @@ class ReactPlugin : Plugin { project.extensions.getByType(ApplicationAndroidComponentsExtension::class.java).apply { onVariants(selector().all()) { variant -> variant.sources.java?.addStaticSourceDirectory( - generatedAutolinkingJavaDir.get().asFile.absolutePath + generatedAutolinkingJavaDir.get().asFile.absolutePath, ) } } @@ -445,7 +466,7 @@ class ReactPlugin : Plugin { } internal fun getPureCxxCodegenDependencies( - autolinkingFile: File + autolinkingFile: File, ): List { val model = JsonUtils.fromAutolinkingConfigJson(autolinkingFile) return model?.dependencies?.values?.filter { dependency -> diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactRootProjectPlugin.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactRootProjectPlugin.kt index 18f09958dcff..24a10ae2cdeb 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactRootProjectPlugin.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactRootProjectPlugin.kt @@ -79,7 +79,7 @@ class ReactRootProjectPlugin : Plugin { ******************************************************************************** """ - .trimIndent() + .trimIndent(), ) } } diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/internal/PrivateReactExtension.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/internal/PrivateReactExtension.kt index 0c993f59c607..bcaf4cb698f2 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/internal/PrivateReactExtension.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/internal/PrivateReactExtension.kt @@ -46,7 +46,7 @@ abstract class PrivateReactExtension @Inject constructor(project: Project) { project.rootProject.layout.projectDirectory.dir("../../") } else { project.rootProject.layout.projectDirectory.dir("../") - } + }, ) val reactNativeDir: DirectoryProperty = diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/BundleHermesCTask.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/BundleHermesCTask.kt index 89ba3656a3e6..1ed09caa17de 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/BundleHermesCTask.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/BundleHermesCTask.kt @@ -109,13 +109,12 @@ abstract class BundleHermesCTask : DefaultTask() { val reactNativeDir = reactNativeDir.get().asFile val composeScriptFile = File(reactNativeDir, "scripts/compose-source-maps.js") - val composeSourceMapsCommand = - getComposeSourceMapsCommand( - composeScriptFile, - packagerSourceMap, - compilerSourceMap, - outputSourceMap, - ) + val composeSourceMapsCommand = getComposeSourceMapsCommand( + composeScriptFile, + packagerSourceMap, + compilerSourceMap, + outputSourceMap, + ) runCommand(composeSourceMapsCommand) } } diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateAutolinkingNewArchitecturesFileTask.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateAutolinkingNewArchitecturesFileTask.kt index 39ba082fc532..ecee9ceaa833 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateAutolinkingNewArchitecturesFileTask.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateAutolinkingNewArchitecturesFileTask.kt @@ -48,12 +48,12 @@ abstract class GenerateAutolinkingNewArchitecturesFileTask : DefaultTask() { } internal fun filterAndroidPackages( - model: ModelAutolinkingConfigJson? + model: ModelAutolinkingConfigJson?, ): List = model?.dependencies?.values?.mapNotNull { it.platforms?.android } ?: emptyList() internal fun generateCmakeFileContent( - packages: List + packages: List, ): String { val libraryIncludes = packages.joinToString("\n") { dep -> @@ -102,7 +102,7 @@ abstract class GenerateAutolinkingNewArchitecturesFileTask : DefaultTask() { } internal fun cmakeListsPathForDependency( - dep: ModelAutolinkingDependenciesPlatformAndroidJson + dep: ModelAutolinkingDependenciesPlatformAndroidJson, ): String? { if (dep.cmakeListsPath != null) { return dep.cmakeListsPath @@ -124,7 +124,7 @@ abstract class GenerateAutolinkingNewArchitecturesFileTask : DefaultTask() { } internal fun generateCppFileContent( - packages: List + packages: List, ): String { val packagesWithLibraryNames = packages.filter { android -> android.libraryName != null } diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateCodegenArtifactsTask.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateCodegenArtifactsTask.kt index df38179ca089..db7e560252d8 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateCodegenArtifactsTask.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateCodegenArtifactsTask.kt @@ -82,7 +82,7 @@ abstract class GenerateCodegenArtifactsTask : Exec() { libraryName, "--javaPackageName", codegenJavaPackageName, - ) + ), ) } } diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateCodegenSchemaTask.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateCodegenSchemaTask.kt index 8fbcdb559b8d..67da80307ca8 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateCodegenSchemaTask.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateCodegenSchemaTask.kt @@ -67,7 +67,7 @@ abstract class GenerateCodegenSchemaTask : Exec() { "android", generatedSchemaFile.get().asFile.cliPath(workingDir), jsRootDir.asFile.get().cliPath(workingDir), - ) + ), ) } } diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateEntryPointTask.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateEntryPointTask.kt index e62b7be075c4..a4ff616157cb 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateEntryPointTask.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateEntryPointTask.kt @@ -37,13 +37,13 @@ abstract class GenerateEntryPointTask : DefaultTask() { The file is either missing or not containing valid JSON so the build won't succeed. """ - .trimIndent() + .trimIndent(), ) val packageName = model.project?.android?.packageName ?: error( - "RNGP - Autolinking: Could not find project.android.packageName in react-native config output! Could not autolink packages without this field." + "RNGP - Autolinking: Could not find project.android.packageName in react-native config output! Could not autolink packages without this field.", ) val generatedFileContents = composeFileContent(packageName) diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GeneratePackageListTask.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GeneratePackageListTask.kt index 1156bc280694..3bc2386901a7 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GeneratePackageListTask.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GeneratePackageListTask.kt @@ -39,13 +39,13 @@ abstract class GeneratePackageListTask : DefaultTask() { The file is either missing or not containing valid JSON so the build won't succeed. """ - .trimIndent() + .trimIndent(), ) val packageName = model.project?.android?.packageName ?: error( - "RNGP - Autolinking: Could not find project.android.packageName in react-native config output! Could not autolink packages without this field." + "RNGP - Autolinking: Could not find project.android.packageName in react-native config output! Could not autolink packages without this field.", ) val androidPackages = filterAndroidPackages(model) @@ -105,7 +105,7 @@ abstract class GeneratePackageListTask : DefaultTask() { } internal fun filterAndroidPackages( - model: ModelAutolinkingConfigJson? + model: ModelAutolinkingConfigJson?, ): Map { val packages = model?.dependencies?.values ?: emptyList() return packages diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/BuildCodegenCLITask.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/BuildCodegenCLITask.kt index 5bed6d861668..91c0080a1e3f 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/BuildCodegenCLITask.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/BuildCodegenCLITask.kt @@ -54,7 +54,7 @@ abstract class BuildCodegenCLITask : Exec() { windowsAwareBashCommandLine( codegenDir.asFile.get().canonicalPath.unixifyPath().plus(BUILD_SCRIPT_PATH), bashWindowsHome = bashWindowsHome.orNull, - ) + ), ) super.exec() } diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareGflagsTask.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareGflagsTask.kt index 1139380abb4f..45416fd0c3aa 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareGflagsTask.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareGflagsTask.kt @@ -64,7 +64,7 @@ abstract class PrepareGflagsTask : DefaultTask() { .replace(Regex("@GFLAGS_NAMESPACE@"), "gflags") .replace( Regex( - "@(HAVE_STDINT_H|HAVE_SYS_TYPES_H|HAVE_INTTYPES_H|GFLAGS_INTTYPES_FORMAT_C99)@" + "@(HAVE_STDINT_H|HAVE_SYS_TYPES_H|HAVE_INTTYPES_H|GFLAGS_INTTYPES_FORMAT_C99)@", ), "1", ) diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareGlogTask.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareGlogTask.kt index 4a785deffcb7..85a34339a337 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareGlogTask.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareGlogTask.kt @@ -61,7 +61,7 @@ abstract class PrepareGlogTask : DefaultTask() { "ac_cv___attribute___noreturn" to "__attribute__ ((noreturn))", "ac_cv___attribute___printf_4_5" to "__attribute__((__format__ (__printf__, 4, 5)))", - ) + ), ), ReplaceTokens::class.java, ) diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/AgpConfiguratorUtils.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/AgpConfiguratorUtils.kt index 8d2b31f13390..36a52185a6d0 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/AgpConfiguratorUtils.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/AgpConfiguratorUtils.kt @@ -106,6 +106,15 @@ internal object AgpConfiguratorUtils { } fun configureNamespaceForLibraries(project: Project) { + // This helper can be reached both from a library's own application of the React plugin and + // from the app-level sweep in ReactPlugin (which also covers libraries that don't apply + // `com.facebook.react`). A project's `finalizeDsl` callback must be registered before AGP + // finalizes its DSL โ€” registering it twice (or after finalization) is a hard error on AGP 9+ โ€” + // so we guard to register the namespace fallback at most once per project. + if (project.extensions.extraProperties.has(NAMESPACE_CONFIGURED_PROPERTY)) { + return + } + project.extensions.extraProperties.set(NAMESPACE_CONFIGURED_PROPERTY, true) project.extensions.getByType(LibraryAndroidComponentsExtension::class.java).finalizeDsl { ext -> if (ext.namespace == null) { val manifestFile = @@ -122,6 +131,8 @@ internal object AgpConfiguratorUtils { } } +private const val NAMESPACE_CONFIGURED_PROPERTY = "com.facebook.react.internal.namespaceConfigured" + const val DEFAULT_DEV_SERVER_PORT = "8081" fun getPackageNameFromManifest(manifest: File): String? { diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/BackwardCompatUtils.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/BackwardCompatUtils.kt index 8225f40e637f..c76cd3938258 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/BackwardCompatUtils.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/BackwardCompatUtils.kt @@ -39,7 +39,7 @@ internal object BackwardCompatUtils { ******************************************************************************** """ - .trimIndent() + .trimIndent(), ) } } diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/DependencyUtils.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/DependencyUtils.kt index b686aefa0162..4b4ffd0c1dd2 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/DependencyUtils.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/DependencyUtils.kt @@ -15,6 +15,8 @@ import com.facebook.react.utils.PropertyUtils.INCLUDE_JITPACK_REPOSITORY_DEFAULT import com.facebook.react.utils.PropertyUtils.INTERNAL_HERMES_PUBLISHING_GROUP import com.facebook.react.utils.PropertyUtils.INTERNAL_HERMES_VERSION_NAME import com.facebook.react.utils.PropertyUtils.INTERNAL_REACT_NATIVE_MAVEN_LOCAL_REPO +import com.facebook.react.utils.PropertyUtils.INTERNAL_REACT_NATIVE_MAVEN_MIRROR_ENABLED +import com.facebook.react.utils.PropertyUtils.INTERNAL_REACT_NATIVE_MAVEN_MIRROR_ENABLED_DEFAULT import com.facebook.react.utils.PropertyUtils.INTERNAL_REACT_PUBLISHING_GROUP import com.facebook.react.utils.PropertyUtils.INTERNAL_USE_HERMES_NIGHTLY import com.facebook.react.utils.PropertyUtils.INTERNAL_VERSION_NAME @@ -27,6 +29,8 @@ import org.gradle.api.Project import org.gradle.api.artifacts.repositories.MavenArtifactRepository internal object DependencyUtils { + private const val REACT_NATIVE_MAVEN_MIRROR_URL = "https://repo.reactnative.dev/maven2" + private const val REACT_NATIVE_MAVEN_MIRROR_ENABLED_ENV = "RCT_REACT_NATIVE_MAVEN_MIRROR_ENABLED" internal data class Coordinates( val versionString: String, @@ -47,7 +51,7 @@ internal object DependencyUtils { val exclusiveEnterpriseRepository = project.rootProject.exclusiveEnterpriseRepository() if (exclusiveEnterpriseRepository != null) { project.logger.lifecycle( - "Replacing ALL Maven Repositories with: $exclusiveEnterpriseRepository" + "Replacing ALL Maven Repositories with: $exclusiveEnterpriseRepository", ) } @@ -75,6 +79,19 @@ internal object DependencyUtils { repo.content { it.excludeGroup("org.webkit") } } } + // The React Native Maven mirror must be added before Maven Central so it can serve cached + // artifacts first, while Maven Central remains the fallback. + if ( + !hasProperty(INTERNAL_REACT_NATIVE_MAVEN_LOCAL_REPO) && + isReactNativeMavenMirrorEnabled() + ) { + mavenRepoFromUrl(REACT_NATIVE_MAVEN_MIRROR_URL) { repo -> + repo.content { content -> + content.includeGroupByRegex("com\\.facebook\\.react.*") + content.includeGroupByRegex("com\\.facebook\\.hermes.*") + } + } + } repositories.mavenCentral { repo -> // We don't want to fetch JSC from Maven Central as there are older versions there. repo.content { it.excludeGroup("org.webkit") } @@ -136,7 +153,7 @@ internal object DependencyUtils { // Contributors only: The hermes-engine version is forced only if the user has // not opted into using nightlies for local development. configuration.resolutionStrategy.force( - "${coordinates.hermesGroupString}:hermes-android:${coordinates.hermesVersionString}" + "${coordinates.hermesGroupString}:hermes-android:${coordinates.hermesVersionString}", ) } } @@ -154,21 +171,21 @@ internal object DependencyUtils { "com.facebook.react:react-native", "${coordinates.reactGroupString}:react-android:${coordinates.versionString}", "The react-native artifact was deprecated in favor of react-android due to https://github.com/facebook/react-native/issues/35210.", - ) + ), ) dependencySubstitution.add( Triple( "com.facebook.react:hermes-engine", hermesVersionString, "The hermes-engine artifact was deprecated in favor of hermes-android due to https://github.com/facebook/react-native/issues/35210.", - ) + ), ) dependencySubstitution.add( Triple( "com.facebook.react:hermes-android", hermesVersionString, "The hermes-android artifact was moved to com.facebook.hermes publishing group.", - ) + ), ) if (coordinates.reactGroupString != DEFAULT_INTERNAL_REACT_PUBLISHING_GROUP) { dependencySubstitution.add( @@ -176,14 +193,14 @@ internal object DependencyUtils { "com.facebook.react:react-android", "${coordinates.reactGroupString}:react-android:${coordinates.versionString}", "The react-android dependency was modified to use the correct Maven group.", - ) + ), ) dependencySubstitution.add( Triple( "com.facebook.react:hermes-android", hermesVersionString, "The hermes-android dependency was modified to use the correct Maven group.", - ) + ), ) } if (coordinates.hermesGroupString != DEFAULT_INTERNAL_HERMES_PUBLISHING_GROUP) { @@ -192,7 +209,7 @@ internal object DependencyUtils { "com.facebook.hermes:hermes-android", hermesVersionString, "The hermes-android dependency was modified to use the correct Maven group.", - ) + ), ) } return dependencySubstitution @@ -271,6 +288,19 @@ internal object DependencyUtils { else -> INCLUDE_JITPACK_REPOSITORY_DEFAULT } + internal fun Project.isReactNativeMavenMirrorEnabled( + environmentValue: String? = System.getenv(REACT_NATIVE_MAVEN_MIRROR_ENABLED_ENV), + ): Boolean = + when { + hasProperty(INTERNAL_REACT_NATIVE_MAVEN_MIRROR_ENABLED) -> { + val value = property(INTERNAL_REACT_NATIVE_MAVEN_MIRROR_ENABLED).toString() + !value.equals("false", ignoreCase = true) && value != "0" + } + !environmentValue.isNullOrEmpty() -> + !environmentValue.equals("false", ignoreCase = true) && environmentValue != "0" + else -> INTERNAL_REACT_NATIVE_MAVEN_MIRROR_ENABLED_DEFAULT + } + internal fun String.isNightly(): Boolean = this.startsWith("0.0.0") || "-nightly-" in this internal fun Project.exclusiveEnterpriseRepository() = diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/NdkConfiguratorUtils.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/NdkConfiguratorUtils.kt index 119c80de03c6..5c69496f3db0 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/NdkConfiguratorUtils.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/NdkConfiguratorUtils.kt @@ -45,7 +45,7 @@ internal object NdkConfiguratorUtils { } if (cmakeArgs.none { it.startsWith("-DREACT_ANDROID_DIR") }) { cmakeArgs.add( - "-DREACT_ANDROID_DIR=${extension.reactNativeDir.file("ReactAndroid").get().asFile}" + "-DREACT_ANDROID_DIR=${extension.reactNativeDir.file("ReactAndroid").get().asFile}", ) } if (cmakeArgs.none { it.startsWith("-DANDROID_STL") }) { @@ -87,7 +87,7 @@ internal object NdkConfiguratorUtils { "**/libjsi.so", // AGP will give priority of libc++_shared coming from App modules. "**/libc++_shared.so", - ) + ), ) } diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/PathUtils.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/PathUtils.kt index e1acfc8f62d7..70c0912c327f 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/PathUtils.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/PathUtils.kt @@ -25,12 +25,14 @@ import org.gradle.api.file.DirectoryProperty * * @param config The [ReactExtension] configured for this project */ -internal fun detectedEntryFile(config: ReactExtension, envVariableOverride: String? = null): File = - detectEntryFile( - entryFile = config.entryFile.orNull?.asFile, - reactRoot = config.root.get().asFile, - envVariableOverride = envVariableOverride, - ) +internal fun detectedEntryFile( + config: ReactExtension, + envVariableOverride: String? = null, +): File = detectEntryFile( + entryFile = config.entryFile.orNull?.asFile, + reactRoot = config.root.get().asFile, + envVariableOverride = envVariableOverride, +) /** * Computes the CLI file for React Native. The Algo follows this order: @@ -39,12 +41,11 @@ internal fun detectedEntryFile(config: ReactExtension, envVariableOverride: Stri * 3. The `node_modules/react-native/cli.js` file if exists * 4. Fails otherwise */ -internal fun detectedCliFile(config: ReactExtension): File = - detectCliFile( - project = config.project, - reactNativeRoot = config.root.get().asFile, - preconfiguredCliFile = config.cliFile.asFile.orNull, - ) +internal fun detectedCliFile(config: ReactExtension): File = detectCliFile( + project = config.project, + reactNativeRoot = config.root.get().asFile, + preconfiguredCliFile = config.cliFile.asFile.orNull, +) /** * Computes the `hermesc` command location. The Algo follows this order: @@ -113,7 +114,7 @@ private fun detectCliFile( build.gradle to the path of the react-native cli.js file. This file typically resides in `node_modules/react-native/cli.js` """ - .trimIndent() + .trimIndent(), ) } @@ -165,7 +166,7 @@ internal fun detectOSAwareHermesCommand( error( "Couldn't determine Hermesc location. " + "Please set `react.hermesCommand` to the path of the hermesc binary file. " + - "node_modules/react-native/sdks/hermesc/%OS-BIN%/hermesc" + "node_modules/react-native/sdks/hermesc/%OS-BIN%/hermesc", ) } @@ -192,7 +193,7 @@ internal fun getHermesOSBin(): String { if (Os.isLinuxAmd64()) return "linux64-bin" error( "OS not recognized. Please set project.react.hermesCommand " + - "to the path of a working Hermes compiler." + "to the path of a working Hermes compiler.", ) } diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/PropertyUtils.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/PropertyUtils.kt index a35e5f37c5d1..a0c57e759734 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/PropertyUtils.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/PropertyUtils.kt @@ -62,6 +62,11 @@ object PropertyUtils { */ const val INTERNAL_REACT_NATIVE_MAVEN_LOCAL_REPO = "react.internal.mavenLocalRepo" + /** Internal property that controls the React Native Maven mirror, which is enabled by default. */ + const val INTERNAL_REACT_NATIVE_MAVEN_MIRROR_ENABLED = + "react.internal.reactNativeMavenMirrorEnabled" + const val INTERNAL_REACT_NATIVE_MAVEN_MIRROR_ENABLED_DEFAULT = true + /** * Internal property used to specify where the Windows Bash executable is located. This is useful * for contributors who are running Windows on their machine. diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/ReactExtensionTest.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/ReactExtensionTest.kt index 8994ac5a8ae1..11a164afaecc 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/ReactExtensionTest.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/ReactExtensionTest.kt @@ -20,15 +20,14 @@ class ReactExtensionTest { @Test fun getGradleDependenciesToApply_withEmptyFile_returnsEmptyMap() { - val validJsonFile = - createJsonFile( - """ - { - "reactNativeVersion": "1000.0.0" - } - """ - .trimIndent() - ) + val validJsonFile = createJsonFile( + """ + { + "reactNativeVersion": "1000.0.0" + } + """ + .trimIndent(), + ) val deps = getGradleDependenciesToApply(validJsonFile) assertThat(deps).isEmpty() @@ -36,27 +35,26 @@ class ReactExtensionTest { @Test fun getGradleDependenciesToApply_withOneDependency_returnsValidDep() { - val validJsonFile = - createJsonFile( - """ - { - "reactNativeVersion": "1000.0.0", - "dependencies": { - "@react-native/oss-library-example": { - "root": "./node_modules/@react-native/oss-library-example", - "name": "@react-native/oss-library-example", - "platforms": { - "android": { - "sourceDir": "src/main/java", - "packageImportPath": "com.facebook.react" - } - } + val validJsonFile = createJsonFile( + """ + { + "reactNativeVersion": "1000.0.0", + "dependencies": { + "@react-native/oss-library-example": { + "root": "./node_modules/@react-native/oss-library-example", + "name": "@react-native/oss-library-example", + "platforms": { + "android": { + "sourceDir": "src/main/java", + "packageImportPath": "com.facebook.react" } } } - """ - .trimIndent() - ) + } + } + """ + .trimIndent(), + ) val deps = getGradleDependenciesToApply(validJsonFile) assertThat(deps).containsExactly("implementation" to ":react-native_oss-library-example") @@ -64,28 +62,27 @@ class ReactExtensionTest { @Test fun getGradleDependenciesToApply_withDependencyConfiguration_returnsValidConfiguration() { - val validJsonFile = - createJsonFile( - """ - { - "reactNativeVersion": "1000.0.0", - "dependencies": { - "@react-native/oss-library-example": { - "root": "./node_modules/@react-native/oss-library-example", - "name": "@react-native/oss-library-example", - "platforms": { - "android": { - "sourceDir": "src/main/java", - "packageImportPath": "com.facebook.react", - "dependencyConfiguration": "compileOnly" - } - } + val validJsonFile = createJsonFile( + """ + { + "reactNativeVersion": "1000.0.0", + "dependencies": { + "@react-native/oss-library-example": { + "root": "./node_modules/@react-native/oss-library-example", + "name": "@react-native/oss-library-example", + "platforms": { + "android": { + "sourceDir": "src/main/java", + "packageImportPath": "com.facebook.react", + "dependencyConfiguration": "compileOnly" } } } - """ - .trimIndent() - ) + } + } + """ + .trimIndent(), + ) val deps = getGradleDependenciesToApply(validJsonFile) assertThat(deps).containsExactly("compileOnly" to ":react-native_oss-library-example") @@ -93,28 +90,27 @@ class ReactExtensionTest { @Test fun getGradleDependenciesToApply_withBuildTypes_returnsValidConfiguration() { - val validJsonFile = - createJsonFile( - """ - { - "reactNativeVersion": "1000.0.0", - "dependencies": { - "@react-native/oss-library-example": { - "root": "./node_modules/@react-native/oss-library-example", - "name": "@react-native/oss-library-example", - "platforms": { - "android": { - "sourceDir": "src/main/java", - "packageImportPath": "com.facebook.react", - "buildTypes": ["debug", "release"] - } - } + val validJsonFile = createJsonFile( + """ + { + "reactNativeVersion": "1000.0.0", + "dependencies": { + "@react-native/oss-library-example": { + "root": "./node_modules/@react-native/oss-library-example", + "name": "@react-native/oss-library-example", + "platforms": { + "android": { + "sourceDir": "src/main/java", + "packageImportPath": "com.facebook.react", + "buildTypes": ["debug", "release"] } } } - """ - .trimIndent() - ) + } + } + """ + .trimIndent(), + ) val deps = getGradleDependenciesToApply(validJsonFile) assertThat(deps) @@ -126,37 +122,36 @@ class ReactExtensionTest { @Test fun getGradleDependenciesToApply_withMultipleDependencies_returnsValidConfiguration() { - val validJsonFile = - createJsonFile( - """ - { - "reactNativeVersion": "1000.0.0", - "dependencies": { - "@react-native/oss-library-example": { - "root": "./node_modules/@react-native/oss-library-example", - "name": "@react-native/oss-library-example", - "platforms": { - "android": { - "sourceDir": "src/main/java", - "packageImportPath": "com.facebook.react" - } - } - }, - "@react-native/another-library-for-testing": { - "root": "./node_modules/@react-native/another-library-for-testing", - "name": "@react-native/another-library-for-testing", - "platforms": { - "android": { - "sourceDir": "src/main/java", - "packageImportPath": "com.facebook.react" - } - } + val validJsonFile = createJsonFile( + """ + { + "reactNativeVersion": "1000.0.0", + "dependencies": { + "@react-native/oss-library-example": { + "root": "./node_modules/@react-native/oss-library-example", + "name": "@react-native/oss-library-example", + "platforms": { + "android": { + "sourceDir": "src/main/java", + "packageImportPath": "com.facebook.react" + } + } + }, + "@react-native/another-library-for-testing": { + "root": "./node_modules/@react-native/another-library-for-testing", + "name": "@react-native/another-library-for-testing", + "platforms": { + "android": { + "sourceDir": "src/main/java", + "packageImportPath": "com.facebook.react" } } } - """ - .trimIndent() - ) + } + } + """ + .trimIndent(), + ) val deps = getGradleDependenciesToApply(validJsonFile) assertThat(deps) @@ -168,30 +163,29 @@ class ReactExtensionTest { @Test fun getGradleDependenciesToApply_withiOSOnlyLibrary_returnsEmptyDepsMap() { - val validJsonFile = - createJsonFile( - """ - { - "reactNativeVersion": "1000.0.0", - "dependencies": { - "@react-native/oss-library-example": { - "root": "./node_modules/@react-native/oss-library-example", - "name": "@react-native/oss-library-example", - "platforms": { - "ios": { - "podspecPath": "./node_modules/@react-native/oss-library-example/oss-library-example.podspec", - "version": "0.0.0", - "configurations": [], - "scriptPhases": [] - }, - "android": null - } - } + val validJsonFile = createJsonFile( + """ + { + "reactNativeVersion": "1000.0.0", + "dependencies": { + "@react-native/oss-library-example": { + "root": "./node_modules/@react-native/oss-library-example", + "name": "@react-native/oss-library-example", + "platforms": { + "ios": { + "podspecPath": "./node_modules/@react-native/oss-library-example/oss-library-example.podspec", + "version": "0.0.0", + "configurations": [], + "scriptPhases": [] + }, + "android": null } } - """ - .trimIndent() - ) + } + } + """ + .trimIndent(), + ) val deps = getGradleDependenciesToApply(validJsonFile) assertThat(deps).isEmpty() @@ -199,38 +193,37 @@ class ReactExtensionTest { @Test fun getGradleDependenciesToApply_withIsPureCxxDeps_filtersCorrectly() { - val validJsonFile = - createJsonFile( - """ - { - "reactNativeVersion": "1000.0.0", - "dependencies": { - "@react-native/oss-library-example": { - "root": "./node_modules/@react-native/android-example", - "name": "@react-native/android-example", - "platforms": { - "android": { - "sourceDir": "src/main/java", - "packageImportPath": "com.facebook.react" - } - } - }, - "@react-native/another-library-for-testing": { - "root": "./node_modules/@react-native/cxx-testing", - "name": "@react-native/cxx-testing", - "platforms": { - "android": { - "sourceDir": "src/main/java", - "packageImportPath": "com.facebook.react", - "isPureCxxDependency": true - } - } + val validJsonFile = createJsonFile( + """ + { + "reactNativeVersion": "1000.0.0", + "dependencies": { + "@react-native/oss-library-example": { + "root": "./node_modules/@react-native/android-example", + "name": "@react-native/android-example", + "platforms": { + "android": { + "sourceDir": "src/main/java", + "packageImportPath": "com.facebook.react" + } + } + }, + "@react-native/another-library-for-testing": { + "root": "./node_modules/@react-native/cxx-testing", + "name": "@react-native/cxx-testing", + "platforms": { + "android": { + "sourceDir": "src/main/java", + "packageImportPath": "com.facebook.react", + "isPureCxxDependency": true } } } - """ - .trimIndent() - ) + } + } + """ + .trimIndent(), + ) val deps = getGradleDependenciesToApply(validJsonFile) assertThat(deps).containsExactly("implementation" to ":react-native_android-example") diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/ReactPluginTest.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/ReactPluginTest.kt index f19b140f4425..68978242bb79 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/ReactPluginTest.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/ReactPluginTest.kt @@ -27,9 +27,8 @@ class ReactPluginTest { val withoutCodegenConfig = createPackageWithoutCodegenConfig("without-codegen-config") val missingNonPureCxxPackage = File(tempFolder.root, "missing-non-pure-cxx-package") - val autolinkingFile = - createAutolinkingFile( - """ + val autolinkingFile = createAutolinkingFile( + """ { "reactNativeVersion": "1000.0.0", "dependencies": { @@ -106,8 +105,8 @@ class ReactPluginTest { } } """ - .trimIndent() - ) + .trimIndent(), + ) val result = ReactPlugin().getPureCxxCodegenDependencies(autolinkingFile) @@ -127,12 +126,11 @@ class ReactPluginTest { @Test fun taskNameSuffixForDependency_withNonAlphanumericCharacters_encodesThem() { - val dependency = - ModelAutolinkingDependenciesJson( - root = "./node_modules/@foo/bar-baz", - name = "@foo/bar-baz", - platforms = null, - ) + val dependency = ModelAutolinkingDependenciesJson( + root = "./node_modules/@foo/bar-baz", + name = "@foo/bar-baz", + platforms = null, + ) val result = ReactPlugin().taskNameSuffixForDependency(dependency) @@ -144,12 +142,11 @@ class ReactPluginTest { val plugin = ReactPlugin() val suffixes = listOf("@foo/bar", "foo.bar", "foo-bar", "foo_bar", "foo_45_bar").map { name -> - val dependency = - ModelAutolinkingDependenciesJson( - root = "./node_modules/$name", - name = name, - platforms = null, - ) + val dependency = ModelAutolinkingDependenciesJson( + root = "./node_modules/$name", + name = name, + platforms = null, + ) plugin.taskNameSuffixForDependency(dependency) } @@ -159,12 +156,11 @@ class ReactPluginTest { @Test fun taskNameSuffixForDependency_withLocalModuleRoot_usesPackageName() { - val dependency = - ModelAutolinkingDependenciesJson( - root = "./modules/local-module", - name = "local-module", - platforms = null, - ) + val dependency = ModelAutolinkingDependenciesJson( + root = "./modules/local-module", + name = "local-module", + platforms = null, + ) val result = ReactPlugin().taskNameSuffixForDependency(dependency) diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/model/ModelAutolinkingDependenciesJsonTest.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/model/ModelAutolinkingDependenciesJsonTest.kt index 53b32aaa6b89..d865dec77d56 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/model/ModelAutolinkingDependenciesJsonTest.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/model/ModelAutolinkingDependenciesJsonTest.kt @@ -36,13 +36,13 @@ class ModelAutolinkingDependenciesJsonTest { assertThat(ModelAutolinkingDependenciesJson("", "@react-native/package", null).nameCleansed) .isEqualTo("react-native_package") assertThat( - ModelAutolinkingDependenciesJson( - "", - "@this*is~a(more)complicated/example!of~weird)packages", - null, - ) - .nameCleansed + ModelAutolinkingDependenciesJson( + "", + "@this*is~a(more)complicated/example!of~weird)packages", + null, ) + .nameCleansed, + ) .isEqualTo("this_is_a_more_complicated_example_of_weird_packages") } } diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateAutolinkingNewArchitecturesFileTaskTest.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateAutolinkingNewArchitecturesFileTaskTest.kt index df92f572e330..9449b007fc10 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateAutolinkingNewArchitecturesFileTaskTest.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateAutolinkingNewArchitecturesFileTaskTest.kt @@ -74,10 +74,10 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest { name = "a-dependency", platforms = ModelAutolinkingDependenciesPlatformJson(android = null), - ) + ), ), project = null, - ) + ), ) assertThat(result).isEmpty() } @@ -85,13 +85,12 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest { @Test fun filterAndroidPackages_withValidAndroidObject_returnsIt() { val task = createTestTask() - val android = - ModelAutolinkingDependenciesPlatformAndroidJson( - sourceDir = "./a/directory/android", - packageImportPath = "import com.facebook.react.aPackage;", - packageInstance = "new APackage()", - buildTypes = emptyList(), - ) + val android = ModelAutolinkingDependenciesPlatformAndroidJson( + sourceDir = "./a/directory/android", + packageImportPath = "import com.facebook.react.aPackage;", + packageInstance = "new APackage()", + buildTypes = emptyList(), + ) val result = task.filterAndroidPackages( @@ -105,10 +104,10 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest { name = "a-dependency", platforms = ModelAutolinkingDependenciesPlatformJson(android = android), - ) + ), ), project = null, - ) + ), ) assertThat(result).containsExactly(android) } @@ -116,16 +115,15 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest { @Test fun cmakeListsPathForDependency_withCmakeListsPath_returnsIt() { val task = createTestTask() - val dependency = - ModelAutolinkingDependenciesPlatformAndroidJson( - sourceDir = "./a/directory", - packageImportPath = "import com.facebook.react.aPackage;", - packageInstance = "new APackage()", - buildTypes = emptyList(), - libraryName = "aPackage", - cmakeListsPath = "./a/directory/CMakeLists.txt", - isPureCxxDependency = true, - ) + val dependency = ModelAutolinkingDependenciesPlatformAndroidJson( + sourceDir = "./a/directory", + packageImportPath = "import com.facebook.react.aPackage;", + packageInstance = "new APackage()", + buildTypes = emptyList(), + libraryName = "aPackage", + cmakeListsPath = "./a/directory/CMakeLists.txt", + isPureCxxDependency = true, + ) assertThat(task.cmakeListsPathForDependency(dependency)) .isEqualTo("./a/directory/CMakeLists.txt") @@ -138,34 +136,32 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest { createTestTask { it.generatedPureCxxSourceDirectory.set(generatedPureCxxSourceDirectory) } - val dependency = - ModelAutolinkingDependenciesPlatformAndroidJson( - sourceDir = "./a/directory", - packageImportPath = "import com.facebook.react.aPackage;", - packageInstance = "new APackage()", - buildTypes = emptyList(), - libraryName = "aPackage", - isPureCxxDependency = true, - ) + val dependency = ModelAutolinkingDependenciesPlatformAndroidJson( + sourceDir = "./a/directory", + packageImportPath = "import com.facebook.react.aPackage;", + packageInstance = "new APackage()", + buildTypes = emptyList(), + libraryName = "aPackage", + isPureCxxDependency = true, + ) assertThat(task.cmakeListsPathForDependency(dependency)) .isEqualTo( - File(generatedPureCxxSourceDirectory, "aPackage/jni/CMakeLists.txt").absolutePath + File(generatedPureCxxSourceDirectory, "aPackage/jni/CMakeLists.txt").absolutePath, ) } @Test fun cmakeListsPathForDependency_withMissingGeneratedDirectory_returnsNull() { val task = createTestTask() - val dependency = - ModelAutolinkingDependenciesPlatformAndroidJson( - sourceDir = "./a/directory", - packageImportPath = "import com.facebook.react.aPackage;", - packageInstance = "new APackage()", - buildTypes = emptyList(), - libraryName = "aPackage", - isPureCxxDependency = true, - ) + val dependency = ModelAutolinkingDependenciesPlatformAndroidJson( + sourceDir = "./a/directory", + packageImportPath = "import com.facebook.react.aPackage;", + packageInstance = "new APackage()", + buildTypes = emptyList(), + libraryName = "aPackage", + isPureCxxDependency = true, + ) assertThat(task.cmakeListsPathForDependency(dependency)).isNull() } @@ -177,15 +173,14 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest { createTestTask { it.generatedPureCxxSourceDirectory.set(generatedPureCxxSourceDirectory) } - val dependency = - ModelAutolinkingDependenciesPlatformAndroidJson( - sourceDir = "./a/directory", - packageImportPath = "import com.facebook.react.aPackage;", - packageInstance = "new APackage()", - buildTypes = emptyList(), - libraryName = "aPackage", - isPureCxxDependency = false, - ) + val dependency = ModelAutolinkingDependenciesPlatformAndroidJson( + sourceDir = "./a/directory", + packageImportPath = "import com.facebook.react.aPackage;", + packageInstance = "new APackage()", + buildTypes = emptyList(), + libraryName = "aPackage", + isPureCxxDependency = false, + ) assertThat(task.cmakeListsPathForDependency(dependency)).isNull() } @@ -211,7 +206,7 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest { """ - .trimIndent() + .trimIndent(), ) } @@ -253,7 +248,7 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest { message(WARNING "React Native: Skipping autolinked C++ module 'another_cxxModule' because the source directory does not exist: ./another/directory/cxx/") endif() """ - .trimIndent() + .trimIndent(), ) } @@ -279,8 +274,8 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest { buildTypes = emptyList(), libraryName = "aPackage", isPureCxxDependency = true, - ) - ) + ), + ), ) assertThat(output) @@ -293,7 +288,7 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest { message(WARNING "React Native: Skipping autolinked library 'react_codegen_aPackage' because the source directory does not exist: $generatedNativeFolderPath") endif() """ - .trimIndent() + .trimIndent(), ) } @@ -317,8 +312,8 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest { libraryName = "aPackage", cmakeListsPath = "./a/directory/CMakeLists.txt", isPureCxxDependency = true, - ) - ) + ), + ), ) assertThat(output) @@ -331,7 +326,7 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest { message(WARNING "React Native: Skipping autolinked library 'react_codegen_aPackage' because the source directory does not exist: ./a/directory/") endif() """ - .trimIndent() + .trimIndent(), ) assertThat(output).doesNotContain(generatedPureCxxSourceDirectory.absolutePath) } @@ -355,8 +350,8 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest { buildTypes = emptyList(), libraryName = "aPackage", isPureCxxDependency = false, - ) - ) + ), + ), ) assertThat(output).doesNotContain("aPackage_autolinked_build") @@ -376,8 +371,8 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest { buildTypes = emptyList(), libraryName = "aPackage", isPureCxxDependency = true, - ) - ) + ), + ), ) assertThat(output).doesNotContain("aPackage_autolinked_build") @@ -424,7 +419,7 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest { } // namespace react } // namespace facebook """ - .trimIndent() + .trimIndent(), ) } @@ -481,7 +476,7 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest { } // namespace react } // namespace facebook """ - .trimIndent() + .trimIndent(), ) } @@ -503,28 +498,27 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest { assertThat(sanitizeCmakeListsPath(input)).isEqualTo("./a/dir\\ ectory/") } - private val testDependencies = - listOf( - ModelAutolinkingDependenciesPlatformAndroidJson( - sourceDir = "./a/directory", - packageImportPath = "import com.facebook.react.aPackage;", - packageInstance = "new APackage()", - buildTypes = emptyList(), - libraryName = "aPackage", - componentDescriptors = emptyList(), - cmakeListsPath = "./a/directory/CMakeLists.txt", - ), - ModelAutolinkingDependenciesPlatformAndroidJson( - sourceDir = "./another/directory", - packageImportPath = "import com.facebook.react.anotherPackage;", - packageInstance = "new AnotherPackage()", - buildTypes = emptyList(), - libraryName = "anotherPackage", - componentDescriptors = listOf("AnotherPackageComponentDescriptor"), - cmakeListsPath = "./another/directory/with spaces/CMakeLists.txt", - cxxModuleCMakeListsPath = "./another/directory/cxx/CMakeLists.txt", - cxxModuleHeaderName = "AnotherCxxModule", - cxxModuleCMakeListsModuleName = "another_cxxModule", - ), - ) + private val testDependencies = listOf( + ModelAutolinkingDependenciesPlatformAndroidJson( + sourceDir = "./a/directory", + packageImportPath = "import com.facebook.react.aPackage;", + packageInstance = "new APackage()", + buildTypes = emptyList(), + libraryName = "aPackage", + componentDescriptors = emptyList(), + cmakeListsPath = "./a/directory/CMakeLists.txt", + ), + ModelAutolinkingDependenciesPlatformAndroidJson( + sourceDir = "./another/directory", + packageImportPath = "import com.facebook.react.anotherPackage;", + packageInstance = "new AnotherPackage()", + buildTypes = emptyList(), + libraryName = "anotherPackage", + componentDescriptors = listOf("AnotherPackageComponentDescriptor"), + cmakeListsPath = "./another/directory/with spaces/CMakeLists.txt", + cxxModuleCMakeListsPath = "./another/directory/cxx/CMakeLists.txt", + cxxModuleHeaderName = "AnotherCxxModule", + cxxModuleCMakeListsModuleName = "another_cxxModule", + ), + ) } diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateCodegenArtifactsTaskTest.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateCodegenArtifactsTaskTest.kt index d2d2a611f505..65cc23250852 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateCodegenArtifactsTaskTest.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateCodegenArtifactsTaskTest.kt @@ -148,7 +148,7 @@ class GenerateCodegenArtifactsTaskTest { } } """ - .trimIndent() + .trimIndent(), ) } @@ -178,7 +178,7 @@ class GenerateCodegenArtifactsTaskTest { } } """ - .trimIndent() + .trimIndent(), ) } diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateEntryPointTaskTest.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateEntryPointTaskTest.kt index dfeca8854210..cbe07e399087 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateEntryPointTaskTest.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateEntryPointTaskTest.kt @@ -86,7 +86,7 @@ class GenerateEntryPointTaskTest { } } """ - .trimIndent() + .trimIndent(), ) } } diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GeneratePackageListTaskTest.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GeneratePackageListTaskTest.kt index f8e455356a5a..789d7a75df20 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GeneratePackageListTaskTest.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GeneratePackageListTaskTest.kt @@ -79,7 +79,7 @@ class GeneratePackageListTaskTest { // @react-native/another-package new com.facebook.react.AnotherPackage() """ - .trimIndent() + .trimIndent(), ) } @@ -139,10 +139,10 @@ class GeneratePackageListTaskTest { name = "a-dependency", platforms = ModelAutolinkingDependenciesPlatformJson(android = null), - ) + ), ), project = null, - ) + ), ) assertThat(result) .isEqualTo(emptyMap()) @@ -151,13 +151,12 @@ class GeneratePackageListTaskTest { @Test fun filterAndroidPackages_withValidAndroidObject_returnsIt() { val task = createTestTask() - val android = - ModelAutolinkingDependenciesPlatformAndroidJson( - sourceDir = "./a/directory/android", - packageImportPath = "import com.facebook.react.aPackage;", - packageInstance = "new APackage()", - buildTypes = emptyList(), - ) + val android = ModelAutolinkingDependenciesPlatformAndroidJson( + sourceDir = "./a/directory/android", + packageImportPath = "import com.facebook.react.aPackage;", + packageInstance = "new APackage()", + buildTypes = emptyList(), + ) val result = task.filterAndroidPackages( @@ -171,10 +170,10 @@ class GeneratePackageListTaskTest { name = "a-dependency", platforms = ModelAutolinkingDependenciesPlatformJson(android = android), - ) + ), ), project = null, - ) + ), ) assertThat(result.entries.size).isEqualTo(1) assertThat(result["a-dependency"]).isEqualTo(android) @@ -183,14 +182,13 @@ class GeneratePackageListTaskTest { @Test fun filterAndroidPackages_withIsPureCxxDependencyObject_returnsIt() { val task = createTestTask() - val android = - ModelAutolinkingDependenciesPlatformAndroidJson( - sourceDir = "./a/directory/android", - packageImportPath = "import com.facebook.react.aPackage;", - packageInstance = "new APackage()", - buildTypes = emptyList(), - isPureCxxDependency = true, - ) + val android = ModelAutolinkingDependenciesPlatformAndroidJson( + sourceDir = "./a/directory/android", + packageImportPath = "import com.facebook.react.aPackage;", + packageInstance = "new APackage()", + buildTypes = emptyList(), + isPureCxxDependency = true, + ) val result = task.filterAndroidPackages( @@ -204,10 +202,10 @@ class GeneratePackageListTaskTest { name = "a-pure-cxx-dependency", platforms = ModelAutolinkingDependenciesPlatformJson(android = android), - ) + ), ), project = null, - ) + ), ) assertThat(result) .isEqualTo(emptyMap()) @@ -283,7 +281,7 @@ class GeneratePackageListTaskTest { } } """ - .trimIndent() + .trimIndent(), ) } @@ -362,31 +360,30 @@ class GeneratePackageListTaskTest { } } """ - .trimIndent() + .trimIndent(), ) } - private val testDependencies = - mapOf( - "@react-native/a-package" to - ModelAutolinkingDependenciesPlatformAndroidJson( - sourceDir = "./a/directory", - packageImportPath = "import com.facebook.react.APackage;", - packageInstance = "new APackage()", - buildTypes = emptyList(), - libraryName = "aPackage", - componentDescriptors = emptyList(), - cmakeListsPath = "./a/directory/CMakeLists.txt", - ), - "@react-native/another-package" to - ModelAutolinkingDependenciesPlatformAndroidJson( - sourceDir = "./another/directory", - packageImportPath = "import com.facebook.react.AnotherPackage;", - packageInstance = "new AnotherPackage()", - buildTypes = emptyList(), - libraryName = "anotherPackage", - componentDescriptors = emptyList(), - cmakeListsPath = "./another/directory/CMakeLists.txt", - ), - ) + private val testDependencies = mapOf( + "@react-native/a-package" to + ModelAutolinkingDependenciesPlatformAndroidJson( + sourceDir = "./a/directory", + packageImportPath = "import com.facebook.react.APackage;", + packageInstance = "new APackage()", + buildTypes = emptyList(), + libraryName = "aPackage", + componentDescriptors = emptyList(), + cmakeListsPath = "./a/directory/CMakeLists.txt", + ), + "@react-native/another-package" to + ModelAutolinkingDependenciesPlatformAndroidJson( + sourceDir = "./another/directory", + packageImportPath = "import com.facebook.react.AnotherPackage;", + packageInstance = "new AnotherPackage()", + buildTypes = emptyList(), + libraryName = "anotherPackage", + componentDescriptors = emptyList(), + cmakeListsPath = "./another/directory/CMakeLists.txt", + ), + ) } diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareBoostTaskTest.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareBoostTaskTest.kt index 0d2f65124e3d..8a35dbf87765 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareBoostTaskTest.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareBoostTaskTest.kt @@ -26,7 +26,7 @@ class PrepareBoostTaskTest { assertThatThrownBy { task.taskAction() } .isInstanceOf(IllegalStateException::class.java) .hasMessage( - "Cannot query the value of task ':PrepareBoostTask' property 'boostVersion' because it has no value available." + "Cannot query the value of task ':PrepareBoostTask' property 'boostVersion' because it has no value available.", ) } diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareGflagsTaskTest.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareGflagsTaskTest.kt index 96b11b7fc66c..c36c81714048 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareGflagsTaskTest.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareGflagsTaskTest.kt @@ -125,7 +125,7 @@ typedef unsigned __int64 uint64; #endif } // namespace GFLAGS_NAMESPACE -""" +""", ) } File(gflagspath, "gflags-1.0.0/src/config.h.in").apply { diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PreparePrefabHeadersTaskTest.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PreparePrefabHeadersTaskTest.kt index 7fcdc3e9c1bc..b692c65e4b8d 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PreparePrefabHeadersTaskTest.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PreparePrefabHeadersTaskTest.kt @@ -55,7 +55,7 @@ class PreparePrefabHeadersTaskTest { createTestTask(project = project) { it.outputDir.set(outputDir) it.input.set( - listOf(PrefabPreprocessingEntry("sample_library", "input/" to expectedPrefix)) + listOf(PrefabPreprocessingEntry("sample_library", "input/" to expectedPrefix)), ) } @@ -77,7 +77,7 @@ class PreparePrefabHeadersTaskTest { createTestTask(project = project) { it.outputDir.set(outputDir) it.input.set( - listOf(PrefabPreprocessingEntry("sample_library", "input/" to expectedPrefix)) + listOf(PrefabPreprocessingEntry("sample_library", "input/" to expectedPrefix)), ) } @@ -104,7 +104,7 @@ class PreparePrefabHeadersTaskTest { "sample_library", listOf("input/component1/" to "", "input/component2/" to ""), ), - ) + ), ) } @@ -128,7 +128,7 @@ class PreparePrefabHeadersTaskTest { listOf( PrefabPreprocessingEntry("libraryone", "input/lib1/" to ""), PrefabPreprocessingEntry("librarytwo", "input/lib2/" to ""), - ) + ), ) } @@ -159,7 +159,7 @@ class PreparePrefabHeadersTaskTest { "librarytwo", listOf("input/lib2/" to "", "input/shared/" to "shared/"), ), - ) + ), ) } diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/utils/PrefabPreprocessingEntryTest.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/utils/PrefabPreprocessingEntryTest.kt index b83c26d46875..dbff6173649e 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/utils/PrefabPreprocessingEntryTest.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/utils/PrefabPreprocessingEntryTest.kt @@ -14,11 +14,10 @@ class PrefabPreprocessingEntryTest { @Test fun secondaryConstructor_createsAList() { - val sampleEntry = - PrefabPreprocessingEntry( - libraryName = "justALibrary", - pathToPrefixCouple = "aPath" to "andAPrefix", - ) + val sampleEntry = PrefabPreprocessingEntry( + libraryName = "justALibrary", + pathToPrefixCouple = "aPath" to "andAPrefix", + ) assertThat(sampleEntry.pathToPrefixCouples.size).isEqualTo(1) assertThat(sampleEntry.pathToPrefixCouples[0].first).isEqualTo("aPath") diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/AgpConfiguratorUtilsTest.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/AgpConfiguratorUtilsTest.kt index d2ed87bf0931..ef4726e6203e 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/AgpConfiguratorUtilsTest.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/AgpConfiguratorUtilsTest.kt @@ -37,7 +37,7 @@ class AgpConfiguratorUtilsTest { """ - .trimIndent() + .trimIndent(), ) } @@ -56,7 +56,7 @@ class AgpConfiguratorUtilsTest { """ - .trimIndent() + .trimIndent(), ) } diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/DependencyUtilsTest.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/DependencyUtilsTest.kt index 5c57bb296fa4..fed57c2025c3 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/DependencyUtilsTest.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/DependencyUtilsTest.kt @@ -13,6 +13,7 @@ import com.facebook.react.utils.DependencyUtils.configureRepositories import com.facebook.react.utils.DependencyUtils.exclusiveEnterpriseRepository import com.facebook.react.utils.DependencyUtils.getDependencySubstitutions import com.facebook.react.utils.DependencyUtils.isNightly +import com.facebook.react.utils.DependencyUtils.isReactNativeMavenMirrorEnabled import com.facebook.react.utils.DependencyUtils.mavenRepoFromURI import com.facebook.react.utils.DependencyUtils.mavenRepoFromUrl import com.facebook.react.utils.DependencyUtils.readVersionAndGroupStrings @@ -39,10 +40,10 @@ class DependencyUtilsTest { configureRepositories(project, false) assertThat( - project.repositories.firstOrNull { - it is MavenArtifactRepository && it.url == localMavenURI - } - ) + project.repositories.firstOrNull { + it is MavenArtifactRepository && it.url == localMavenURI + }, + ) .isNotNull() } @@ -54,10 +55,26 @@ class DependencyUtilsTest { configureRepositories(project, false) assertThat( - project.repositories.firstOrNull { - it is MavenArtifactRepository && it.url == repositoryURI - } - ) + project.repositories.firstOrNull { + it is MavenArtifactRepository && it.url == repositoryURI + }, + ) + .isNotNull() + } + + @Test + fun configureRepositories_withReactNativeMavenMirrorEnabled_containsMavenMirror() { + val repositoryURI = URI.create("https://repo.reactnative.dev/maven2") + val project = createProject() + project.extensions.extraProperties.set("react.internal.reactNativeMavenMirrorEnabled", "true") + + configureRepositories(project, false) + + assertThat( + project.repositories.firstOrNull { + it is MavenArtifactRepository && it.url == repositoryURI + }, + ) .isNotNull() } @@ -69,10 +86,10 @@ class DependencyUtilsTest { configureRepositories(project, false) assertThat( - project.repositories.firstOrNull { - it is MavenArtifactRepository && it.url == repositoryURI - } - ) + project.repositories.firstOrNull { + it is MavenArtifactRepository && it.url == repositoryURI + }, + ) .isNotNull() } @@ -84,10 +101,10 @@ class DependencyUtilsTest { configureRepositories(project, false) assertThat( - project.repositories.firstOrNull { - it is MavenArtifactRepository && it.url == repositoryURI - } - ) + project.repositories.firstOrNull { + it is MavenArtifactRepository && it.url == repositoryURI + }, + ) .isNotNull() } @@ -105,10 +122,10 @@ class DependencyUtilsTest { assertThat(project.repositories).hasSize(1) assertThat( - project.repositories.firstOrNull { - it is MavenArtifactRepository && it.url == repositoryURI - } - ) + project.repositories.firstOrNull { + it is MavenArtifactRepository && it.url == repositoryURI + }, + ) .isNotNull() } @@ -121,10 +138,10 @@ class DependencyUtilsTest { configureRepositories(project, false) assertThat( - project.repositories.firstOrNull { - it is MavenArtifactRepository && it.url == repositoryURI - } - ) + project.repositories.firstOrNull { + it is MavenArtifactRepository && it.url == repositoryURI + }, + ) .isNull() // We test both with scoped and unscoped property @@ -134,10 +151,10 @@ class DependencyUtilsTest { configureRepositories(project, false) assertThat( - project.repositories.firstOrNull { - it is MavenArtifactRepository && it.url == repositoryURI - } - ) + project.repositories.firstOrNull { + it is MavenArtifactRepository && it.url == repositoryURI + }, + ) .isNull() } @@ -150,10 +167,10 @@ class DependencyUtilsTest { configureRepositories(project, false) assertThat( - project.repositories.firstOrNull { - it is MavenArtifactRepository && it.url == repositoryURI - } - ) + project.repositories.firstOrNull { + it is MavenArtifactRepository && it.url == repositoryURI + }, + ) .isNotNull() // We test both with scoped and unscoped property @@ -163,10 +180,10 @@ class DependencyUtilsTest { configureRepositories(project, false) assertThat( - project.repositories.firstOrNull { - it is MavenArtifactRepository && it.url == repositoryURI - } - ) + project.repositories.firstOrNull { + it is MavenArtifactRepository && it.url == repositoryURI + }, + ) .isNotNull() } @@ -178,10 +195,10 @@ class DependencyUtilsTest { configureRepositories(project, false) assertThat( - project.repositories.firstOrNull { - it is MavenArtifactRepository && it.url == repositoryURI - } - ) + project.repositories.firstOrNull { + it is MavenArtifactRepository && it.url == repositoryURI + }, + ) .isNull() } @@ -193,10 +210,10 @@ class DependencyUtilsTest { configureRepositories(project, true) assertThat( - project.repositories.firstOrNull { - it is MavenArtifactRepository && it.url == repositoryURI - } - ) + project.repositories.firstOrNull { + it is MavenArtifactRepository && it.url == repositoryURI + }, + ) .isNotNull() } @@ -221,6 +238,107 @@ class DependencyUtilsTest { assertThat(indexOfLocalRepo < indexOfMavenCentral).isTrue() } + @Test + fun configureRepositories_mavenMirrorHasHigherPriorityThanMavenCentral() { + val mavenMirrorURI = URI.create("https://repo.reactnative.dev/maven2") + val mavenCentralURI = URI.create("https://repo.maven.apache.org/maven2/") + val project = createProject() + project.extensions.extraProperties.set("react.internal.reactNativeMavenMirrorEnabled", "true") + + configureRepositories(project, false) + + val indexOfMavenMirror = + project.repositories.indexOfFirst { + it is MavenArtifactRepository && it.url == mavenMirrorURI + } + val indexOfMavenCentral = + project.repositories.indexOfFirst { + it is MavenArtifactRepository && it.url == mavenCentralURI + } + assertThat(indexOfMavenMirror < indexOfMavenCentral).isTrue() + } + + @Test + fun configureRepositories_withProjectPropertySet_doesNotContainMavenMirror() { + val localMaven = tempFolder.newFolder("m2") + val mavenMirrorURI = URI.create("https://repo.reactnative.dev/maven2") + val project = createProject() + project.extensions.extraProperties.set("react.internal.mavenLocalRepo", localMaven.absolutePath) + + configureRepositories(project, false) + + assertThat( + project.repositories.firstOrNull { + it is MavenArtifactRepository && it.url == mavenMirrorURI + }, + ) + .isNull() + } + + @Test + fun configureRepositories_byDefault_containsMavenMirror() { + val mavenMirrorURI = URI.create("https://repo.reactnative.dev/maven2") + val project = createProject() + + configureRepositories(project, false) + + assertThat( + project.repositories.firstOrNull { + it is MavenArtifactRepository && it.url == mavenMirrorURI + }, + ) + .isNotNull() + } + + @Test + fun configureRepositories_withReactNativeMavenMirrorDisabled_doesNotContainMavenMirror() { + val mavenMirrorURI = URI.create("https://repo.reactnative.dev/maven2") + val project = createProject() + project.extensions.extraProperties.set("react.internal.reactNativeMavenMirrorEnabled", "false") + + configureRepositories(project, false) + + assertThat( + project.repositories.firstOrNull { + it is MavenArtifactRepository && it.url == mavenMirrorURI + }, + ) + .isNull() + } + + @Test + fun isReactNativeMavenMirrorEnabled_withEnvironmentVariableEnabled_returnsTrue() { + val project = createProject() + + assertThat(project.isReactNativeMavenMirrorEnabled("true")).isTrue() + assertThat(project.isReactNativeMavenMirrorEnabled("1")).isTrue() + } + + @Test + fun isReactNativeMavenMirrorEnabled_withEnvironmentVariableDisabled_returnsFalse() { + val project = createProject() + + assertThat(project.isReactNativeMavenMirrorEnabled("false")).isFalse() + assertThat(project.isReactNativeMavenMirrorEnabled("FALSE")).isFalse() + assertThat(project.isReactNativeMavenMirrorEnabled("0")).isFalse() + } + + @Test + fun isReactNativeMavenMirrorEnabled_byDefault_returnsTrue() { + val project = createProject() + + assertThat(project.isReactNativeMavenMirrorEnabled(null)).isTrue() + assertThat(project.isReactNativeMavenMirrorEnabled("")).isTrue() + } + + @Test + fun isReactNativeMavenMirrorEnabled_withProjectProperty_ignoresEnvironmentVariable() { + val project = createProject() + project.extensions.extraProperties.set("react.internal.reactNativeMavenMirrorEnabled", "false") + + assertThat(project.isReactNativeMavenMirrorEnabled("true")).isFalse() + } + @Test fun configureRepositories_snapshotRepoHasHigherPriorityThanMavenCentral() { val repositoryURI = URI.create("https://central.sonatype.com/repository/maven-snapshots/") @@ -250,16 +368,16 @@ class DependencyUtilsTest { configureRepositories(appProject, false) assertThat( - appProject.repositories.firstOrNull { - it is MavenArtifactRepository && it.url == repositoryURI - } - ) + appProject.repositories.firstOrNull { + it is MavenArtifactRepository && it.url == repositoryURI + }, + ) .isNotNull() assertThat( - libProject.repositories.firstOrNull { - it is MavenArtifactRepository && it.url == repositoryURI - } - ) + libProject.repositories.firstOrNull { + it is MavenArtifactRepository && it.url == repositoryURI + }, + ) .isNotNull() } @@ -280,10 +398,10 @@ class DependencyUtilsTest { // We need to make sure we have Maven Central defined twice, one by the library, // and another is the override by RNGP. assertThat( - libProject.repositories.count { - it is MavenArtifactRepository && it.url == repositoryURI - } - ) + libProject.repositories.count { + it is MavenArtifactRepository && it.url == repositoryURI + }, + ) .isEqualTo(2) } @@ -354,14 +472,14 @@ class DependencyUtilsTest { assertThat(appForcedModules.any { it.toString() == "io.github.test:react-android:1.2.3" }) .isTrue() assertThat( - appForcedModules.any { it.toString() == "io.github.test.hermes:hermes-android:4.5.6" } - ) + appForcedModules.any { it.toString() == "io.github.test.hermes:hermes-android:4.5.6" }, + ) .isTrue() assertThat(libForcedModules.any { it.toString() == "io.github.test:react-android:1.2.3" }) .isTrue() assertThat( - libForcedModules.any { it.toString() == "io.github.test.hermes:hermes-android:4.5.6" } - ) + libForcedModules.any { it.toString() == "io.github.test.hermes:hermes-android:4.5.6" }, + ) .isTrue() } @@ -374,42 +492,41 @@ class DependencyUtilsTest { assertThat("com.facebook.react:react-android:0.42.0") .isEqualTo(dependencySubstitutions[0].second) assertThat( - "The react-native artifact was deprecated in favor of react-android due to https://github.com/facebook/react-native/issues/35210." - ) + "The react-native artifact was deprecated in favor of react-android due to https://github.com/facebook/react-native/issues/35210.", + ) .isEqualTo(dependencySubstitutions[0].third) assertThat("com.facebook.react:hermes-engine").isEqualTo(dependencySubstitutions[1].first) assertThat("com.facebook.hermes:hermes-android:0.42.0") .isEqualTo(dependencySubstitutions[1].second) assertThat( - "The hermes-engine artifact was deprecated in favor of hermes-android due to https://github.com/facebook/react-native/issues/35210." - ) + "The hermes-engine artifact was deprecated in favor of hermes-android due to https://github.com/facebook/react-native/issues/35210.", + ) .isEqualTo(dependencySubstitutions[1].third) } @Test fun getDependencySubstitutions_withCustomGroup_substitutesCorrectly() { - val dependencySubstitutions = - getDependencySubstitutions( - DependencyUtils.Coordinates( - "0.42.0", - "0.42.0", - "io.github.test", - "io.github.test.hermes", - ) - ) + val dependencySubstitutions = getDependencySubstitutions( + DependencyUtils.Coordinates( + "0.42.0", + "0.42.0", + "io.github.test", + "io.github.test.hermes", + ), + ) assertThat("com.facebook.react:react-native").isEqualTo(dependencySubstitutions[0].first) assertThat("io.github.test:react-android:0.42.0").isEqualTo(dependencySubstitutions[0].second) assertThat( - "The react-native artifact was deprecated in favor of react-android due to https://github.com/facebook/react-native/issues/35210." - ) + "The react-native artifact was deprecated in favor of react-android due to https://github.com/facebook/react-native/issues/35210.", + ) .isEqualTo(dependencySubstitutions[0].third) assertThat("com.facebook.react:hermes-engine").isEqualTo(dependencySubstitutions[1].first) assertThat("io.github.test.hermes:hermes-android:0.42.0") .isEqualTo(dependencySubstitutions[1].second) assertThat( - "The hermes-engine artifact was deprecated in favor of hermes-android due to https://github.com/facebook/react-native/issues/35210." - ) + "The hermes-engine artifact was deprecated in favor of hermes-android due to https://github.com/facebook/react-native/issues/35210.", + ) .isEqualTo(dependencySubstitutions[1].third) assertThat("com.facebook.react:hermes-android").isEqualTo(dependencySubstitutions[2].first) assertThat("io.github.test.hermes:hermes-android:0.42.0") @@ -436,7 +553,7 @@ class DependencyUtilsTest { VERSION_NAME=1000.0.0 ANOTHER_PROPERTY=true """ - .trimIndent() + .trimIndent(), ) } @@ -447,7 +564,7 @@ class DependencyUtilsTest { HERMES_VERSION_NAME=1000.0.0 ANOTHER_PROPERTY=true """ - .trimIndent() + .trimIndent(), ) } @@ -470,7 +587,7 @@ class DependencyUtilsTest { HERMES_VERSION_NAME=0.12.0-commitly-20221101-2019-cfe811ab1 ANOTHER_PROPERTY=true """ - .trimIndent() + .trimIndent(), ) } @@ -481,7 +598,7 @@ class DependencyUtilsTest { HERMES_VERSION_NAME=0.14.0 ANOTHER_PROPERTY=true """ - .trimIndent() + .trimIndent(), ) } @@ -502,7 +619,7 @@ class DependencyUtilsTest { """ ANOTHER_PROPERTY=true """ - .trimIndent() + .trimIndent(), ) } @@ -512,7 +629,7 @@ class DependencyUtilsTest { """ ANOTHER_PROPERTY=true """ - .trimIndent() + .trimIndent(), ) } @@ -533,7 +650,7 @@ class DependencyUtilsTest { VERSION_NAME= ANOTHER_PROPERTY=true """ - .trimIndent() + .trimIndent(), ) } @@ -544,7 +661,7 @@ class DependencyUtilsTest { HERMES_VERSION_NAME= ANOTHER_PROPERTY=true """ - .trimIndent() + .trimIndent(), ) } @@ -566,7 +683,7 @@ class DependencyUtilsTest { react.internal.hermesPublishingGroup=io.github.test ANOTHER_PROPERTY=true """ - .trimIndent() + .trimIndent(), ) } @@ -577,7 +694,7 @@ class DependencyUtilsTest { HERMES_VERSION_NAME= ANOTHER_PROPERTY=true """ - .trimIndent() + .trimIndent(), ) } @@ -598,7 +715,7 @@ class DependencyUtilsTest { """ ANOTHER_PROPERTY=true """ - .trimIndent() + .trimIndent(), ) } @@ -609,7 +726,7 @@ class DependencyUtilsTest { HERMES_VERSION_NAME= ANOTHER_PROPERTY=true """ - .trimIndent() + .trimIndent(), ) } @@ -689,14 +806,13 @@ class DependencyUtilsTest { @Test fun isNightly_returnsTrue_forValidNightlyVersions() { - val trueCases = - listOf( - "0.85.0-nightly-20260128-36f07a1b2", - "0.82.0-nightly-date-commit", - "0.0.0-20230505-2109-9b69263a1", - "0.0.0-date-commit", - "0.0.0-nightly-", - ) + val trueCases = listOf( + "0.85.0-nightly-20260128-36f07a1b2", + "0.82.0-nightly-date-commit", + "0.0.0-20230505-2109-9b69263a1", + "0.0.0-date-commit", + "0.0.0-nightly-", + ) trueCases.forEach { version -> assert(version.isNightly()) { "Expected '$version' to be detected as nightly" } @@ -705,17 +821,16 @@ class DependencyUtilsTest { @Test fun isNightly_returnsFalse_forNonNightlyVersions() { - val falseCases = - listOf( - "0.83.0", // Standard version - "0.0.1", - "nightly", // Missing hyphens - "0.83.0-nightly", // Missing trailing hyphen - "any-nightly", // Missing trailing hyphen - "nightly-build", // Missing leading hyphen - "", // Empty string - " ", // Blank string - ) + val falseCases = listOf( + "0.83.0", // Standard version + "0.0.1", + "nightly", // Missing hyphens + "0.83.0-nightly", // Missing trailing hyphen + "any-nightly", // Missing trailing hyphen + "nightly-build", // Missing leading hyphen + "", // Empty string + " ", // Blank string + ) falseCases.forEach { version -> assert(!version.isNightly()) { "Expected '$version' to NOT be detected as nightly" } diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/PathUtilsTest.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/PathUtilsTest.kt index 47b2d15ca807..f594cf71f93d 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/PathUtilsTest.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/PathUtilsTest.kt @@ -148,7 +148,7 @@ class PathUtilsTest { tempFolder.newFolder("node_modules/react-native/ReactAndroid/hermes-engine/build/hermes/bin/") val expected = tempFolder.newFile( - "node_modules/react-native/ReactAndroid/hermes-engine/build/hermes/bin/hermesc" + "node_modules/react-native/ReactAndroid/hermes-engine/build/hermes/bin/hermesc", ) assertThat(detectOSAwareHermesCommand(tempFolder.root, "")).isEqualTo(expected.toString()) @@ -191,7 +191,7 @@ class PathUtilsTest { tempFolder.newFolder("node_modules/react-native/ReactAndroid/hermes-engine/build/hermes/bin/") val expected = tempFolder.newFile( - "node_modules/react-native/ReactAndroid/hermes-engine/build/hermes/bin/hermesc" + "node_modules/react-native/ReactAndroid/hermes-engine/build/hermes/bin/hermesc", ) tempFolder.newFolder("node_modules/react-native/sdks/hermesc/osx-bin/") tempFolder.newFile("node_modules/react-native/sdks/hermesc/osx-bin/hermesc") @@ -206,7 +206,7 @@ class PathUtilsTest { File( tempFolder.root, "node_modules/react-native/ReactAndroid/hermes-engine/build/hermes/bin/hermesc", - ) + ), ) } @@ -218,7 +218,7 @@ class PathUtilsTest { File( tempFolder.root, "node_modules/react-native/ReactAndroid/hermes-engine/build/hermes/bin/hermesc.exe", - ) + ), ) } @@ -316,7 +316,7 @@ class PathUtilsTest { "codegenConfig": {} } """ - .trimIndent() + .trimIndent(), ) } val project = ProjectBuilder.builder().withProjectDir(moduleFolder).build() diff --git a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/ProjectUtilsTest.kt b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/ProjectUtilsTest.kt index 54a3016e9616..491dd9b9545d 100644 --- a/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/ProjectUtilsTest.kt +++ b/packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/ProjectUtilsTest.kt @@ -128,7 +128,7 @@ class ProjectUtilsTest { "codegenConfig": {} } """ - .trimIndent() + .trimIndent(), ) } extension.root.set(tempFolder.root) @@ -147,7 +147,7 @@ class ProjectUtilsTest { "name": "a-library" } """ - .trimIndent() + .trimIndent(), ) } extension.root.set(tempFolder.root) diff --git a/packages/gradle-plugin/settings-plugin/build.gradle.kts b/packages/gradle-plugin/settings-plugin/build.gradle.kts index 870844cb2921..39a1e490d4aa 100644 --- a/packages/gradle-plugin/settings-plugin/build.gradle.kts +++ b/packages/gradle-plugin/settings-plugin/build.gradle.kts @@ -58,7 +58,7 @@ tasks.withType().configureEach { // See comment above on JDK 11 support jvmTarget.set(JvmTarget.JVM_11) allWarningsAsErrors.set( - project.properties["enableWarningsAsErrors"]?.toString()?.toBoolean() ?: false + project.properties["enableWarningsAsErrors"]?.toString()?.toBoolean() ?: false, ) } } diff --git a/packages/gradle-plugin/settings-plugin/src/main/kotlin/com/facebook/react/ReactSettingsExtension.kt b/packages/gradle-plugin/settings-plugin/src/main/kotlin/com/facebook/react/ReactSettingsExtension.kt index bc712bd58b7f..37f130cd77f8 100644 --- a/packages/gradle-plugin/settings-plugin/src/main/kotlin/com/facebook/react/ReactSettingsExtension.kt +++ b/packages/gradle-plugin/settings-plugin/src/main/kotlin/com/facebook/react/ReactSettingsExtension.kt @@ -158,7 +158,9 @@ abstract class ReactSettingsExtension @Inject constructor(val settings: Settings logger.error(message) if (cacheJsonConfig.length() != 0L) { logger.error( - cacheJsonConfig.readText().substring(0, min(1024, cacheJsonConfig.length().toInt())) + cacheJsonConfig + .readText() + .substring(0, min(1024, cacheJsonConfig.length().toInt())), ) } cacheJsonConfig.delete() diff --git a/packages/gradle-plugin/settings-plugin/src/test/kotlin/com/facebook/react/ReactSettingsExtensionTest.kt b/packages/gradle-plugin/settings-plugin/src/test/kotlin/com/facebook/react/ReactSettingsExtensionTest.kt index ffb38a362fc6..5ed5e5111464 100644 --- a/packages/gradle-plugin/settings-plugin/src/test/kotlin/com/facebook/react/ReactSettingsExtensionTest.kt +++ b/packages/gradle-plugin/settings-plugin/src/test/kotlin/com/facebook/react/ReactSettingsExtensionTest.kt @@ -26,30 +26,28 @@ class ReactSettingsExtensionTest { @Test fun computeSha256_worksCorrectly() { - val validFile = - createJsonFile( - """ - { - "value": "ยฏ\\_(ใƒ„)_/ยฏ" - } - """ - .trimIndent() - ) + val validFile = createJsonFile( + """ + { + "value": "ยฏ\\_(ใƒ„)_/ยฏ" + } + """ + .trimIndent(), + ) assertThat(computeSha256(validFile)) .isEqualTo("838aa9a72a16fdd55b0d49b510a82e264a30f59333b5fdd97c7798a29146f6a8") } @Test fun getLibrariesToAutolink_withEmptyFile_returnsEmptyMap() { - val validJsonFile = - createJsonFile( - """ - { - "reactNativeVersion": "1000.0.0" - } - """ - .trimIndent() - ) + val validJsonFile = createJsonFile( + """ + { + "reactNativeVersion": "1000.0.0" + } + """ + .trimIndent(), + ) val map = getLibrariesToAutolink(validJsonFile) assertThat(map.keys).isEmpty() @@ -57,45 +55,44 @@ class ReactSettingsExtensionTest { @Test fun getLibrariesToAutolink_withLibraryToAutolink_returnsValidMap() { - val validJsonFile = - createJsonFile( - """ - { - "reactNativeVersion": "1000.0.0", - "dependencies": { - "@react-native/oss-library-example": { - "root": "./node_modules/@react-native/oss-library-example", - "name": "@react-native/oss-library-example", - "platforms": { - "ios": { - "podspecPath": "./node_modules/@react-native/oss-library-example/OSSLibraryExample.podspec", - "version": "0.0.1", - "configurations": [], - "scriptPhases": [] - }, - "android": { - "sourceDir": "./node_modules/@react-native/oss-library-example/android", - "packageImportPath": "import com.facebook.react.osslibraryexample.OSSLibraryExamplePackage;", - "packageInstance": "new OSSLibraryExamplePackage()", - "buildTypes": ["staging", "debug", "release"], - "libraryName": "OSSLibraryExampleSpec", - "componentDescriptors": [ - "SampleNativeComponentComponentDescriptor" - ], - "cmakeListsPath": "./node_modules/@react-native/oss-library-example/android/build/generated/source/codegen/jni/CMakeLists.txt", - "cxxModuleCMakeListsModuleName": null, - "cxxModuleCMakeListsPath": null, - "cxxModuleHeaderName": null, - "dependencyConfiguration": "implementation", - "isPureCxxDependency": false - } - } + val validJsonFile = createJsonFile( + """ + { + "reactNativeVersion": "1000.0.0", + "dependencies": { + "@react-native/oss-library-example": { + "root": "./node_modules/@react-native/oss-library-example", + "name": "@react-native/oss-library-example", + "platforms": { + "ios": { + "podspecPath": "./node_modules/@react-native/oss-library-example/OSSLibraryExample.podspec", + "version": "0.0.1", + "configurations": [], + "scriptPhases": [] + }, + "android": { + "sourceDir": "./node_modules/@react-native/oss-library-example/android", + "packageImportPath": "import com.facebook.react.osslibraryexample.OSSLibraryExamplePackage;", + "packageInstance": "new OSSLibraryExamplePackage()", + "buildTypes": ["staging", "debug", "release"], + "libraryName": "OSSLibraryExampleSpec", + "componentDescriptors": [ + "SampleNativeComponentComponentDescriptor" + ], + "cmakeListsPath": "./node_modules/@react-native/oss-library-example/android/build/generated/source/codegen/jni/CMakeLists.txt", + "cxxModuleCMakeListsModuleName": null, + "cxxModuleCMakeListsPath": null, + "cxxModuleHeaderName": null, + "dependencyConfiguration": "implementation", + "isPureCxxDependency": false } } } - """ - .trimIndent() - ) + } + } + """ + .trimIndent(), + ) val map = getLibrariesToAutolink(validJsonFile) assertThat(map.keys).containsExactly(":react-native_oss-library-example") @@ -105,29 +102,28 @@ class ReactSettingsExtensionTest { @Test fun getLibrariesToAutolink_withiOSOnlyLibrary_returnsEmptyMap() { - val validJsonFile = - createJsonFile( - """ - { - "reactNativeVersion": "1000.0.0", - "dependencies": { - "@react-native/oss-library-example": { - "root": "./node_modules/@react-native/oss-library-example", - "name": "@react-native/oss-library-example", - "platforms": { - "ios": { - "podspecPath": "./node_modules/@react-native/oss-library-example/OSSLibraryExample.podspec", - "version": "0.0.1", - "configurations": [], - "scriptPhases": [] - } - } + val validJsonFile = createJsonFile( + """ + { + "reactNativeVersion": "1000.0.0", + "dependencies": { + "@react-native/oss-library-example": { + "root": "./node_modules/@react-native/oss-library-example", + "name": "@react-native/oss-library-example", + "platforms": { + "ios": { + "podspecPath": "./node_modules/@react-native/oss-library-example/OSSLibraryExample.podspec", + "version": "0.0.1", + "configurations": [], + "scriptPhases": [] } } } - """ - .trimIndent() - ) + } + } + """ + .trimIndent(), + ) val map = getLibrariesToAutolink(validJsonFile) assertThat(map.keys).isEmpty() @@ -262,7 +258,7 @@ class ReactSettingsExtensionTest { } } """ - .trimIndent() + .trimIndent(), ) } tempFolder.newFile("yarn.lock").apply { writeText("I'm a lockfile") } @@ -316,7 +312,7 @@ class ReactSettingsExtensionTest { } } """ - .trimIndent() + .trimIndent(), ) } tempFolder.newFile("yarn.lock").apply { writeText("I'm a lockfile") } @@ -359,13 +355,12 @@ class ReactSettingsExtensionTest { } tempFolder.newFile("yarn.lock").apply { writeText("I'm a lockfile") } val lockfiles = project.files("yarn.lock") - val invalidConfigFile = - createJsonFile( - """ - {} - """ - .trimIndent() - ) + val invalidConfigFile = createJsonFile( + """ + {} + """ + .trimIndent(), + ) assertThat(ReactSettingsExtension.isCacheDirty(invalidConfigFile, buildFolder, lockfiles)) .isTrue() @@ -381,15 +376,14 @@ class ReactSettingsExtensionTest { } tempFolder.newFile("yarn.lock").apply { writeText("I'm a lockfile") } val lockfiles = project.files("yarn.lock") - val invalidConfigFile = - createJsonFile( - """ - { - "reactNativeVersion": "1000.0.0" - } - """ - .trimIndent() - ) + val invalidConfigFile = createJsonFile( + """ + { + "reactNativeVersion": "1000.0.0" + } + """ + .trimIndent(), + ) assertThat(ReactSettingsExtension.isCacheDirty(invalidConfigFile, buildFolder, lockfiles)) .isTrue() @@ -405,16 +399,15 @@ class ReactSettingsExtensionTest { } tempFolder.newFile("yarn.lock").apply { writeText("I'm a lockfile") } val lockfiles = project.files("yarn.lock") - val invalidConfigFile = - createJsonFile( - """ - { - "reactNativeVersion": "1000.0.0", - "dependencies": {} - } - """ - .trimIndent() - ) + val invalidConfigFile = createJsonFile( + """ + { + "reactNativeVersion": "1000.0.0", + "dependencies": {} + } + """ + .trimIndent(), + ) assertThat(ReactSettingsExtension.isCacheDirty(invalidConfigFile, buildFolder, lockfiles)) .isTrue() @@ -430,29 +423,28 @@ class ReactSettingsExtensionTest { } tempFolder.newFile("yarn.lock").apply { writeText("I'm a lockfile") } val lockfiles = project.files("yarn.lock") - val invalidConfigFile = - createJsonFile( - """ - { - "reactNativeVersion": "1000.0.0", - "dependencies": { - "@react-native/oss-library-example": { - "root": "./node_modules/@react-native/oss-library-example", - "name": "@react-native/oss-library-example", - "platforms": { - "ios": { - "podspecPath": "./node_modules/@react-native/oss-library-example/OSSLibraryExample.podspec", - "version": "0.0.1", - "configurations": [], - "scriptPhases": [] - } - } + val invalidConfigFile = createJsonFile( + """ + { + "reactNativeVersion": "1000.0.0", + "dependencies": { + "@react-native/oss-library-example": { + "root": "./node_modules/@react-native/oss-library-example", + "name": "@react-native/oss-library-example", + "platforms": { + "ios": { + "podspecPath": "./node_modules/@react-native/oss-library-example/OSSLibraryExample.podspec", + "version": "0.0.1", + "configurations": [], + "scriptPhases": [] } } } - """ - .trimIndent() - ) + } + } + """ + .trimIndent(), + ) assertThat(ReactSettingsExtension.isCacheDirty(invalidConfigFile, buildFolder, lockfiles)) .isTrue() diff --git a/packages/gradle-plugin/shared-testutil/build.gradle.kts b/packages/gradle-plugin/shared-testutil/build.gradle.kts index 307d8a9743f7..34591e06e8c5 100644 --- a/packages/gradle-plugin/shared-testutil/build.gradle.kts +++ b/packages/gradle-plugin/shared-testutil/build.gradle.kts @@ -31,7 +31,7 @@ tasks.withType().configureEach { // See comment above on JDK 11 support jvmTarget.set(JvmTarget.JVM_11) allWarningsAsErrors.set( - project.properties["enableWarningsAsErrors"]?.toString()?.toBoolean() ?: false + project.properties["enableWarningsAsErrors"]?.toString()?.toBoolean() ?: false, ) } } diff --git a/packages/gradle-plugin/shared/build.gradle.kts b/packages/gradle-plugin/shared/build.gradle.kts index 9395aab53483..0f62f3310afc 100644 --- a/packages/gradle-plugin/shared/build.gradle.kts +++ b/packages/gradle-plugin/shared/build.gradle.kts @@ -37,7 +37,7 @@ tasks.withType().configureEach { // See comment above on JDK 11 support jvmTarget.set(JvmTarget.JVM_11) allWarningsAsErrors.set( - project.properties["enableWarningsAsErrors"]?.toString()?.toBoolean() ?: false + project.properties["enableWarningsAsErrors"]?.toString()?.toBoolean() ?: false, ) } } diff --git a/packages/gradle-plugin/shared/src/main/kotlin/com/facebook/react/model/ModelAutolinkingDependenciesPlatformJson.kt b/packages/gradle-plugin/shared/src/main/kotlin/com/facebook/react/model/ModelAutolinkingDependenciesPlatformJson.kt index c6b1e30dc915..3804ff66a30a 100644 --- a/packages/gradle-plugin/shared/src/main/kotlin/com/facebook/react/model/ModelAutolinkingDependenciesPlatformJson.kt +++ b/packages/gradle-plugin/shared/src/main/kotlin/com/facebook/react/model/ModelAutolinkingDependenciesPlatformJson.kt @@ -8,5 +8,5 @@ package com.facebook.react.model data class ModelAutolinkingDependenciesPlatformJson( - val android: ModelAutolinkingDependenciesPlatformAndroidJson? + val android: ModelAutolinkingDependenciesPlatformAndroidJson?, ) diff --git a/packages/gradle-plugin/shared/src/main/kotlin/com/facebook/react/utils/JsonUtils.kt b/packages/gradle-plugin/shared/src/main/kotlin/com/facebook/react/utils/JsonUtils.kt index 6a6eeba7b932..ab632f223483 100644 --- a/packages/gradle-plugin/shared/src/main/kotlin/com/facebook/react/utils/JsonUtils.kt +++ b/packages/gradle-plugin/shared/src/main/kotlin/com/facebook/react/utils/JsonUtils.kt @@ -23,21 +23,21 @@ object JsonUtils { fun fromAutolinkingConfigJson(input: File): ModelAutolinkingConfigJson? = input.bufferedReader().use { reader -> runCatching { - // We sanitize the output of the `config` command as it could contain debug logs - // such as: - // - // > AwesomeProject@0.0.1 npx - // > rnc-cli config - // - // which will render the JSON invalid. - val content = - reader - .readLines() - .filterNot { line -> line.startsWith(">") } - .joinToString("\n") - .trim() - gsonConverter.fromJson(content, ModelAutolinkingConfigJson::class.java) - } + // We sanitize the output of the `config` command as it could contain debug logs + // such as: + // + // > AwesomeProject@0.0.1 npx + // > rnc-cli config + // + // which will render the JSON invalid. + val content = + reader + .readLines() + .filterNot { line -> line.startsWith(">") } + .joinToString("\n") + .trim() + gsonConverter.fromJson(content, ModelAutolinkingConfigJson::class.java) + } .getOrNull() } } diff --git a/packages/gradle-plugin/shared/src/test/kotlin/com/facebook/react/utils/JsonUtilsTest.kt b/packages/gradle-plugin/shared/src/test/kotlin/com/facebook/react/utils/JsonUtilsTest.kt index 0544a8775470..3baeaad1982f 100644 --- a/packages/gradle-plugin/shared/src/test/kotlin/com/facebook/react/utils/JsonUtilsTest.kt +++ b/packages/gradle-plugin/shared/src/test/kotlin/com/facebook/react/utils/JsonUtilsTest.kt @@ -36,24 +36,23 @@ class JsonUtilsTest { @Test fun fromPackageJson_withOldJsonConfig_returnsAnEmptyLibrary() { - val oldJsonConfig = - createJsonFile( - """ - { - "name": "yet another npm package", - "codegenConfig": { - "libraries": [ - { - "name": "an awesome library", - "jsSrcsDir": "../js/", - "android": {} - } - ] + val oldJsonConfig = createJsonFile( + """ + { + "name": "yet another npm package", + "codegenConfig": { + "libraries": [ + { + "name": "an awesome library", + "jsSrcsDir": "../js/", + "android": {} } - } - """ - .trimIndent() - ) + ] + } + } + """ + .trimIndent(), + ) val parsed = JsonUtils.fromPackageJson(oldJsonConfig)!! @@ -64,25 +63,24 @@ class JsonUtilsTest { @Test fun fromPackageJson_withValidJson_parsesCorrectly() { - val validJson = - createJsonFile( - """ - { - "name": "yet another npm package", - "codegenConfig": { - "name": "an awesome library", - "jsSrcsDir": "../js/", - "android": { - "javaPackageName": "com.awesome.library" - }, - "ios": { - "other ios only keys": "which are ignored during parsing" - } - } + val validJson = createJsonFile( + """ + { + "name": "yet another npm package", + "codegenConfig": { + "name": "an awesome library", + "jsSrcsDir": "../js/", + "android": { + "javaPackageName": "com.awesome.library" + }, + "ios": { + "other ios only keys": "which are ignored during parsing" } - """ - .trimIndent() - ) + } + } + """ + .trimIndent(), + ) val parsed = JsonUtils.fromPackageJson(validJson)!! @@ -110,15 +108,14 @@ class JsonUtilsTest { @Test fun fromReactNativePackageJson_withValidJson_parsesJsonCorrectly() { - val validJson = - createJsonFile( - """ - { - "version": "1000.0.0" - } - """ - .trimIndent() - ) + val validJson = createJsonFile( + """ + { + "version": "1000.0.0" + } + """ + .trimIndent(), + ) val parsed = JsonUtils.fromPackageJson(validJson)!! assertThat("1000.0.0").isEqualTo(parsed.version) @@ -133,15 +130,14 @@ class JsonUtilsTest { @Test fun fromAutolinkingConfigJson_withSimpleJson_returnsIt() { - val validJson = - createJsonFile( - """ - { - "reactNativeVersion": "1000.0.0" - } - """ - .trimIndent() - ) + val validJson = createJsonFile( + """ + { + "reactNativeVersion": "1000.0.0" + } + """ + .trimIndent(), + ) val parsed = JsonUtils.fromAutolinkingConfigJson(validJson)!! assertThat("1000.0.0").isEqualTo(parsed.reactNativeVersion) @@ -149,36 +145,35 @@ class JsonUtilsTest { @Test fun fromAutolinkingConfigJson_withProjectSpecified_canParseIt() { - val validJson = - createJsonFile( - """ - { - "reactNativeVersion": "1000.0.0", - "project": { - "ios": { - "sourceDir": "./packages/rn-tester", - "xcodeProject": { - "name": "RNTesterPods.xcworkspace", - "isWorkspace": true - }, - "automaticPodsInstallation": false - }, - "android": { - "sourceDir": "./packages/rn-tester", - "appName": "RN-Tester", - "packageName": "com.facebook.react.uiapp", - "applicationId": "com.facebook.react.uiapp", - "mainActivity": ".RNTesterActivity", - "watchModeCommandParams": [ - "--mode HermesDebug" - ], - "dependencyConfiguration": "implementation" - } - } + val validJson = createJsonFile( + """ + { + "reactNativeVersion": "1000.0.0", + "project": { + "ios": { + "sourceDir": "./packages/rn-tester", + "xcodeProject": { + "name": "RNTesterPods.xcworkspace", + "isWorkspace": true + }, + "automaticPodsInstallation": false + }, + "android": { + "sourceDir": "./packages/rn-tester", + "appName": "RN-Tester", + "packageName": "com.facebook.react.uiapp", + "applicationId": "com.facebook.react.uiapp", + "mainActivity": ".RNTesterActivity", + "watchModeCommandParams": [ + "--mode HermesDebug" + ], + "dependencyConfiguration": "implementation" } - """ - .trimIndent() - ) + } + } + """ + .trimIndent(), + ) val parsed = JsonUtils.fromAutolinkingConfigJson(validJson)!! assertThat("./packages/rn-tester").isEqualTo(parsed.project!!.android!!.sourceDir) @@ -194,40 +189,39 @@ class JsonUtilsTest { @Test fun fromAutolinkingConfigJson_withInfoLogs_sanitizeAndParseIt() { @Suppress("JsonStandardCompliance") - val validJson = - createJsonFile( - """ - - > AwesomeProject@0.0.1 npx - > rnc-cli config - - { - "reactNativeVersion": "1000.0.0", - "project": { - "ios": { - "sourceDir": "./packages/rn-tester", - "xcodeProject": { - "name": "RNTesterPods.xcworkspace", - "isWorkspace": true - }, - "automaticPodsInstallation": false - }, - "android": { - "sourceDir": "./packages/rn-tester", - "appName": "RN-Tester", - "packageName": "com.facebook.react.uiapp", - "applicationId": "com.facebook.react.uiapp", - "mainActivity": ".RNTesterActivity", - "watchModeCommandParams": [ - "--mode HermesDebug" - ], - "dependencyConfiguration": "implementation" - } - } - } - """ - .trimIndent() - ) + val validJson = createJsonFile( + """ + + > AwesomeProject@0.0.1 npx + > rnc-cli config + + { + "reactNativeVersion": "1000.0.0", + "project": { + "ios": { + "sourceDir": "./packages/rn-tester", + "xcodeProject": { + "name": "RNTesterPods.xcworkspace", + "isWorkspace": true + }, + "automaticPodsInstallation": false + }, + "android": { + "sourceDir": "./packages/rn-tester", + "appName": "RN-Tester", + "packageName": "com.facebook.react.uiapp", + "applicationId": "com.facebook.react.uiapp", + "mainActivity": ".RNTesterActivity", + "watchModeCommandParams": [ + "--mode HermesDebug" + ], + "dependencyConfiguration": "implementation" + } + } + } + """ + .trimIndent(), + ) val parsed = JsonUtils.fromAutolinkingConfigJson(validJson)!! assertThat("./packages/rn-tester").isEqualTo(parsed.project!!.android!!.sourceDir) @@ -242,45 +236,44 @@ class JsonUtilsTest { @Test fun fromAutolinkingConfigJson_withDependenciesSpecified_canParseIt() { - val validJson = - createJsonFile( - """ - { - "reactNativeVersion": "1000.0.0", - "dependencies": { - "@react-native/oss-library-example": { - "root": "./node_modules/@react-native/oss-library-example", - "name": "@react-native/oss-library-example", - "platforms": { - "ios": { - "podspecPath": "./node_modules/@react-native/oss-library-example/OSSLibraryExample.podspec", - "version": "0.0.1", - "configurations": [], - "scriptPhases": [] - }, - "android": { - "sourceDir": "./node_modules/@react-native/oss-library-example/android", - "packageImportPath": "import com.facebook.react.osslibraryexample.OSSLibraryExamplePackage;", - "packageInstance": "new OSSLibraryExamplePackage()", - "buildTypes": ["staging", "debug", "release"], - "libraryName": "OSSLibraryExampleSpec", - "componentDescriptors": [ - "SampleNativeComponentComponentDescriptor" - ], - "cmakeListsPath": "./node_modules/@react-native/oss-library-example/android/build/generated/source/codegen/jni/CMakeLists.txt", - "cxxModuleCMakeListsModuleName": null, - "cxxModuleCMakeListsPath": null, - "cxxModuleHeaderName": null, - "dependencyConfiguration": "implementation", - "isPureCxxDependency": false - } - } + val validJson = createJsonFile( + """ + { + "reactNativeVersion": "1000.0.0", + "dependencies": { + "@react-native/oss-library-example": { + "root": "./node_modules/@react-native/oss-library-example", + "name": "@react-native/oss-library-example", + "platforms": { + "ios": { + "podspecPath": "./node_modules/@react-native/oss-library-example/OSSLibraryExample.podspec", + "version": "0.0.1", + "configurations": [], + "scriptPhases": [] + }, + "android": { + "sourceDir": "./node_modules/@react-native/oss-library-example/android", + "packageImportPath": "import com.facebook.react.osslibraryexample.OSSLibraryExamplePackage;", + "packageInstance": "new OSSLibraryExamplePackage()", + "buildTypes": ["staging", "debug", "release"], + "libraryName": "OSSLibraryExampleSpec", + "componentDescriptors": [ + "SampleNativeComponentComponentDescriptor" + ], + "cmakeListsPath": "./node_modules/@react-native/oss-library-example/android/build/generated/source/codegen/jni/CMakeLists.txt", + "cxxModuleCMakeListsModuleName": null, + "cxxModuleCMakeListsPath": null, + "cxxModuleHeaderName": null, + "dependencyConfiguration": "implementation", + "isPureCxxDependency": false } } } - """ - .trimIndent() - ) + } + } + """ + .trimIndent(), + ) val parsed = JsonUtils.fromAutolinkingConfigJson(validJson)!! assertThat("./node_modules/@react-native/oss-library-example") @@ -294,86 +287,86 @@ class JsonUtilsTest { parsed.dependencies!!["@react-native/oss-library-example"]!! .platforms!! .android!! - .sourceDir + .sourceDir, ) assertThat("import com.facebook.react.osslibraryexample.OSSLibraryExamplePackage;") .isEqualTo( parsed.dependencies!!["@react-native/oss-library-example"]!! .platforms!! .android!! - .packageImportPath + .packageImportPath, ) assertThat("new OSSLibraryExamplePackage()") .isEqualTo( parsed.dependencies!!["@react-native/oss-library-example"]!! .platforms!! .android!! - .packageInstance + .packageInstance, ) assertThat(listOf("staging", "debug", "release")) .isEqualTo( parsed.dependencies!!["@react-native/oss-library-example"]!! .platforms!! .android!! - .buildTypes + .buildTypes, ) assertThat("OSSLibraryExampleSpec") .isEqualTo( parsed.dependencies!!["@react-native/oss-library-example"]!! .platforms!! .android!! - .libraryName + .libraryName, ) assertThat(listOf("SampleNativeComponentComponentDescriptor")) .isEqualTo( parsed.dependencies!!["@react-native/oss-library-example"]!! .platforms!! .android!! - .componentDescriptors + .componentDescriptors, ) assertThat( - "./node_modules/@react-native/oss-library-example/android/build/generated/source/codegen/jni/CMakeLists.txt" - ) + "./node_modules/@react-native/oss-library-example/android/build/generated/source/codegen/jni/CMakeLists.txt", + ) .isEqualTo( parsed.dependencies!!["@react-native/oss-library-example"]!! .platforms!! .android!! - .cmakeListsPath + .cmakeListsPath, ) assertThat( - parsed.dependencies!!["@react-native/oss-library-example"]!! - .platforms!! - .android!! - .cxxModuleHeaderName - ) + parsed.dependencies!!["@react-native/oss-library-example"]!! + .platforms!! + .android!! + .cxxModuleHeaderName, + ) .isNull() assertThat( - parsed.dependencies!!["@react-native/oss-library-example"]!! - .platforms!! - .android!! - .cxxModuleCMakeListsPath - ) + parsed.dependencies!!["@react-native/oss-library-example"]!! + .platforms!! + .android!! + .cxxModuleCMakeListsPath, + ) .isNull() assertThat( - parsed.dependencies!!["@react-native/oss-library-example"]!! - .platforms!! - .android!! - .cxxModuleCMakeListsModuleName - ) + parsed.dependencies!!["@react-native/oss-library-example"]!! + .platforms!! + .android!! + .cxxModuleCMakeListsModuleName, + ) .isNull() assertThat("implementation") .isEqualTo( parsed.dependencies!!["@react-native/oss-library-example"]!! .platforms!! .android!! - .dependencyConfiguration + .dependencyConfiguration, ) assertThat( - parsed.dependencies!!["@react-native/oss-library-example"]!! - .platforms!! - .android!! - .isPureCxxDependency!! - ) + parsed.dependencies!!["@react-native/oss-library-example"]!! + .platforms!! + .android!! + .isPureCxxDependency!!, + ) .isFalse() } diff --git a/packages/jest-preset/README.md b/packages/jest-preset/README.md index 723b230fd596..c53da96056d0 100644 --- a/packages/jest-preset/README.md +++ b/packages/jest-preset/README.md @@ -1,5 +1,10 @@ # @react-native/jest-preset +[![npm]](https://www.npmjs.com/package/@react-native/jest-preset) [![npm downloads]](https://www.npmjs.com/package/@react-native/jest-preset) + +[npm]: https://img.shields.io/npm/v/@react-native/jest-preset.svg?color=blue +[npm downloads]: https://img.shields.io/npm/dm/@react-native/jest-preset.svg + Jest preset for [React Native](https://reactnative.dev) apps. ## Usage @@ -31,9 +36,3 @@ module.exports = { ``` You can further customize your Jest configuration by specifying other options. See [Jest's `jest.config.js` documentation](https://jestjs.io/docs/configuration) to learn more. - -### Migration Note - -This Jest preset used to be part of the core `react-native` package and accessible at `react-native/jest-preset.js`. As long as `@react-native/jest-preset` is installed, `react-native/jest-preset.js` will be aliased to this package and continue to work but is deprecated. - -Follow the installation instructions above to migrate to `@react-native/jest-preset` and change `preset: 'react-native'` to `preset: '@react-native/jest-preset` to migrate. diff --git a/packages/jest-preset/jest-preset.js b/packages/jest-preset/jest-preset.js index 5632cc7fe5c2..720a73efdca4 100644 --- a/packages/jest-preset/jest-preset.js +++ b/packages/jest-preset/jest-preset.js @@ -10,7 +10,7 @@ 'use strict'; -const path = require('path'); +const path = require('node:path'); module.exports = { haste: { @@ -18,14 +18,20 @@ module.exports = { platforms: ['android', 'ios', 'native'], }, moduleNameMapper: { + // `setup-env` and `react-private-interface` are secondary entry points + // exposed via the package's `exports`, but `./jest/resolver.js` strips + // `exports` and the generic mapper below resolves subpaths as literal + // directory paths. Alias them explicitly so they resolve to their `src/` + // implementations. + '^react-native/react-private-interface$': `${path.dirname(require.resolve('react-native'))}/src/react-private-interface.js`, + '^react-native/setup-env$': `${path.dirname(require.resolve('react-native'))}/src/setup-env.js`, '^react-native($|/.*)': `${path.dirname(require.resolve('react-native'))}/$1`, }, resolver: require.resolve('./jest/resolver.js'), transform: { '^.+\\.(js|ts|tsx)$': 'babel-jest', - '^.+\\.(bmp|gif|jpg|jpeg|mp4|png|psd|svg|webp)$': require.resolve( - './jest/assetFileTransformer.js', - ), + '^.+\\.(bmp|gif|jpg|jpeg|mp4|png|psd|svg|webp)$': + require.resolve('./jest/assetFileTransformer.js'), }, transformIgnorePatterns: [ 'node_modules/(?!((jest-)?react-native|@react-native(-community)?)/)', diff --git a/packages/jest-preset/jest/assetFileTransformer.js b/packages/jest-preset/jest/assetFileTransformer.js index a7eae2c5ceb9..aac405e74535 100644 --- a/packages/jest-preset/jest/assetFileTransformer.js +++ b/packages/jest-preset/jest/assetFileTransformer.js @@ -14,7 +14,7 @@ const createCacheKeyFunction = require('@jest/create-cache-key-function').default; -const path = require('path'); +const path = require('node:path'); // NOTE: This file used to be at `react-native/jest/assetFileTransformer.js` // To keep the mock `testUri` paths the same, we create a fake path that outputs the same relative path as before diff --git a/packages/jest-preset/jest/mocks/NativeModules.js b/packages/jest-preset/jest/mocks/NativeModules.js index a3a358fed664..63bc6f410e44 100644 --- a/packages/jest-preset/jest/mocks/NativeModules.js +++ b/packages/jest-preset/jest/mocks/NativeModules.js @@ -186,15 +186,8 @@ const NativeModules = { }, }, StatusBarManager: { - setColor: jest.fn() as JestMockFn<$FlowFixMe, $FlowFixMe>, setStyle: jest.fn() as JestMockFn<$FlowFixMe, $FlowFixMe>, setHidden: jest.fn() as JestMockFn<$FlowFixMe, $FlowFixMe>, - setNetworkActivityIndicatorVisible: jest.fn() as JestMockFn< - $FlowFixMe, - $FlowFixMe, - >, - setBackgroundColor: jest.fn() as JestMockFn<$FlowFixMe, $FlowFixMe>, - setTranslucent: jest.fn() as JestMockFn<$FlowFixMe, $FlowFixMe>, getConstants: (): $FlowFixMe => ({ HEIGHT: 42, }), diff --git a/packages/jest-preset/jest/setup.js b/packages/jest-preset/jest/setup.js index 29f86698a129..5082aece44fe 100644 --- a/packages/jest-preset/jest/setup.js +++ b/packages/jest-preset/jest/setup.js @@ -81,7 +81,7 @@ try { */ jest.mock('prettier', () => { // $FlowExpectedError[underconstrained-implicit-instantiation] - const module = jest.requireActual('module'); + const module = jest.requireActual('node:module'); return module.prototype.require(require.resolve('prettier')); }); } catch {} @@ -133,6 +133,7 @@ mock( 'm#react-native/Libraries/Core/InitializeCore', 'm#./mocks/InitializeCore', ); +mock('m#react-native/setup-env', 'm#./mocks/InitializeCore'); mock('m#react-native/Libraries/Core/NativeExceptionsManager'); mock('m#react-native/Libraries/Image/Image', 'm#./mocks/Image'); mock( diff --git a/packages/jest-preset/package.json b/packages/jest-preset/package.json index 987afe28dacf..bc3f36a83450 100644 --- a/packages/jest-preset/package.json +++ b/packages/jest-preset/package.json @@ -9,7 +9,7 @@ ], "repository": { "type": "git", - "url": "git+https://github.com/facebook/react-native.git", + "url": "git+https://github.com/react/react-native.git", "directory": "packages/jest-preset" }, "license": "MIT", diff --git a/packages/metro-config/README.md b/packages/metro-config/README.md index 9dcb9a75a2fc..55c74d53fbbd 100644 --- a/packages/metro-config/README.md +++ b/packages/metro-config/README.md @@ -1,21 +1,29 @@ # @react-native/metro-config -[![Version][version-badge]][package] +[![npm]](https://www.npmjs.com/package/@react-native/metro-config) [![npm downloads]](https://www.npmjs.com/package/@react-native/metro-config) -## Installation +[npm]: https://img.shields.io/npm/v/@react-native/metro-config.svg?color=blue +[npm downloads]: https://img.shields.io/npm/dm/@react-native/metro-config.svg -``` -yarn add --dev @react-native/js-polyfills metro-config @react-native/metro-babel-transformer metro-runtime @react-native/metro-config -``` +Metro configuration for React Native. In React Native, your Metro config should extend either `@react-native/metro-config` or `@expo/metro-config`. These packages contain essential defaults necessary to build and run React Native apps. -*Note: We're using `yarn` to install deps. Feel free to change commands to use `npm` 3+ and `npx` if you like* +See [Configuring Metro](https://reactnative.dev/docs/next/metro#configuring-metro) for the full guide. -[version-badge]: https://img.shields.io/npm/v/@react-native/metro-config?style=flat-square -[package]: https://www.npmjs.com/package/@react-native/metro-config +## Usage -## Testing +```js +const { + getDefaultConfig, + mergeConfig, +} = require('@react-native/metro-config'); -To run the tests in this package, run the following commands from the React Native root folder: +/** + * Metro configuration + * https://metrobundler.dev/docs/configuration + * + * @type {import('metro-config').MetroConfig} + */ +const config = {}; -1. `yarn` to install the dependencies. You just need to run this once -2. `yarn jest packages/metro-config`. +module.exports = mergeConfig(getDefaultConfig(__dirname), config); +``` diff --git a/packages/metro-config/package.json b/packages/metro-config/package.json index a95b6c14753f..b8703bd178db 100644 --- a/packages/metro-config/package.json +++ b/packages/metro-config/package.json @@ -5,16 +5,16 @@ "license": "MIT", "repository": { "type": "git", - "url": "git+https://github.com/facebook/react-native.git", + "url": "git+https://github.com/react/react-native.git", "directory": "packages/metro-config" }, - "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/metro-config#readme", + "homepage": "https://github.com/react/react-native/tree/HEAD/packages/metro-config#readme", "keywords": [ "metro", "config", "react-native" ], - "bugs": "https://github.com/facebook/react-native/issues", + "bugs": "https://github.com/react/react-native/issues", "engines": { "node": "^22.13.0 || ^24.3.0 || >= 26.0.0" }, @@ -37,7 +37,7 @@ "dependencies": { "@react-native/js-polyfills": "0.87.0-main", "@react-native/metro-babel-transformer": "0.87.0-main", - "metro-config": "^0.84.3", - "metro-runtime": "^0.84.3" + "metro-config": "^0.87.0", + "metro-runtime": "^0.87.0" } } diff --git a/packages/metro-config/src/index.flow.js b/packages/metro-config/src/index.flow.js index 6bba33bd975a..5fb4be2cd3fe 100644 --- a/packages/metro-config/src/index.flow.js +++ b/packages/metro-config/src/index.flow.js @@ -59,9 +59,9 @@ export function getDefaultConfig(projectRoot: string): ConfigT { unstable_conditionNames: ['react-native'], }, serializer: { - // Note: This option is overridden in cli-plugin-metro (getOverrideConfig) + // NOTE: Overridden in community-cli-plugin getModulesRunBeforeMainModule: () => [ - require.resolve('react-native/Libraries/Core/InitializeCore'), + require.resolve('react-native/setup-env'), ], getPolyfills: () => require('@react-native/js-polyfills')(), isThirdPartyModule({path: modulePath}: Readonly<{path: string, ...}>) { @@ -84,13 +84,11 @@ export function getDefaultConfig(projectRoot: string): ConfigT { }, transformer: { allowOptionalDependencies: true, - assetRegistryPath: 'react-native/Libraries/Image/AssetRegistry', - asyncRequireModulePath: require.resolve( - 'metro-runtime/src/modules/asyncRequire', - ), - babelTransformerPath: require.resolve( - '@react-native/metro-babel-transformer', - ), + assetRegistryPath: 'react-native/asset-registry', + asyncRequireModulePath: + require.resolve('metro-runtime/src/modules/asyncRequire'), + babelTransformerPath: + require.resolve('@react-native/metro-babel-transformer'), getTransformOptions: async () => ({ transform: { experimentalImportSupport: false, @@ -101,9 +99,6 @@ export function getDefaultConfig(projectRoot: string): ConfigT { watchFolders: [], }; - // Set global hook so that the CLI can detect when this config has been loaded - global.__REACT_NATIVE_METRO_CONFIG_LOADED = true; - const metroDefaults = getBaseConfig.getDefaultValues(projectRoot); return mergeConfig(metroDefaults, reactNativeDefaults, frameworkDefaults); diff --git a/packages/new-app-screen/README.md b/packages/new-app-screen/README.md index 1c727270ecd5..eb1d9931ed82 100644 --- a/packages/new-app-screen/README.md +++ b/packages/new-app-screen/README.md @@ -1,6 +1,9 @@ # @react-native/new-app-screen -![npm package](https://img.shields.io/npm/v/@react-native/new-app-screen?color=brightgreen&label=npm%20package) +[![npm]](https://www.npmjs.com/package/@react-native/new-app-screen) [![npm downloads]](https://www.npmjs.com/package/@react-native/new-app-screen) + +[npm]: https://img.shields.io/npm/v/@react-native/new-app-screen.svg?color=blue +[npm downloads]: https://img.shields.io/npm/dm/@react-native/new-app-screen.svg `NewAppScreen` component for React Native. diff --git a/packages/new-app-screen/package.json b/packages/new-app-screen/package.json index d3c86465358c..4ebbf4c995c9 100644 --- a/packages/new-app-screen/package.json +++ b/packages/new-app-screen/package.json @@ -5,11 +5,11 @@ "keywords": [ "react-native" ], - "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/new-app-screen#readme", - "bugs": "https://github.com/facebook/react-native/issues", + "homepage": "https://github.com/react/react-native/tree/HEAD/packages/new-app-screen#readme", + "bugs": "https://github.com/react/react-native/issues", "repository": { "type": "git", - "url": "git+https://github.com/facebook/react-native.git", + "url": "git+https://github.com/react/react-native.git", "directory": "packages/new-app-screen" }, "license": "MIT", diff --git a/packages/normalize-color/README.md b/packages/normalize-color/README.md index 20b618d930a5..2b41c782d335 100644 --- a/packages/normalize-color/README.md +++ b/packages/normalize-color/README.md @@ -1,21 +1,8 @@ # @react-native/normalize-colors -[![Version][version-badge]][package] +[![npm]](https://www.npmjs.com/package/@react-native/normalize-colors) [![npm downloads]](https://www.npmjs.com/package/@react-native/normalize-colors) -## Installation +[npm]: https://img.shields.io/npm/v/@react-native/normalize-colors.svg?color=blue +[npm downloads]: https://img.shields.io/npm/dm/@react-native/normalize-colors.svg -``` -yarn add --dev @react-native/normalize-colors -``` - -*Note: We're using `yarn` to install deps. Feel free to change commands to use `npm` 3+ and `npx` if you like* - -[version-badge]: https://img.shields.io/npm/v/@react-native/normalize-colors?style=flat-square -[package]: https://www.npmjs.com/package/@react-native/normalize-colors - -## Testing - -To run the tests in this package, run the following commands from the React Native root folder: - -1. `yarn` to install the dependencies. You just need to run this once -2. `yarn jest packages/normalize-color`. +Color normalization utility for React Native. Converts CSS color values into the numeric form consumed by the native layer. diff --git a/packages/normalize-color/index.js b/packages/normalize-color/index.js index 67c5bdbb82ed..05bdc3adc93e 100644 --- a/packages/normalize-color/index.js +++ b/packages/normalize-color/index.js @@ -12,6 +12,8 @@ 'use strict'; +const cachedColors = new Map(); + function normalizeColor(color) { if (typeof color === 'number') { if (color >>> 0 === color && color >= 0 && color <= 0xffffffff) { @@ -24,6 +26,23 @@ function normalizeColor(color) { return null; } + if (cachedColors.has(color)) { + // Map iteration order follows insertion order, so re-inserting on every + // hit keeps the least-recently-used entry first. + const cachedColor = cachedColors.get(color); + cachedColors.delete(color); + cachedColors.set(color, cachedColor); + return cachedColor; + } + const normalizedColor = parseColorString(color); + if (cachedColors.size >= 1024) { + cachedColors.delete(cachedColors.keys().next().value); + } + cachedColors.set(color, normalizedColor); + return normalizedColor; +} + +function parseColorString(color) { const matchers = getMatchers(); let match; diff --git a/packages/normalize-color/package.json b/packages/normalize-color/package.json index 557ff8526da5..028fdce725c4 100644 --- a/packages/normalize-color/package.json +++ b/packages/normalize-color/package.json @@ -5,17 +5,17 @@ "license": "MIT", "repository": { "type": "git", - "url": "git+https://github.com/facebook/react-native.git", + "url": "git+https://github.com/react/react-native.git", "directory": "packages/normalize-color" }, - "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/normalize-color#readme", + "homepage": "https://github.com/react/react-native/tree/HEAD/packages/normalize-color#readme", "keywords": [ "color", "normalization", "normalize-colors", "react-native" ], - "bugs": "https://github.com/facebook/react-native/issues", + "bugs": "https://github.com/react/react-native/issues", "files": [ "index.js", "README.md", diff --git a/packages/polyfills/README.md b/packages/polyfills/README.md index 91f0b04de013..c701866fb80e 100644 --- a/packages/polyfills/README.md +++ b/packages/polyfills/README.md @@ -1,21 +1,10 @@ # @react-native/js-polyfills -[![Version][version-badge]][package] +[![npm]](https://www.npmjs.com/package/@react-native/js-polyfills) [![npm downloads]](https://www.npmjs.com/package/@react-native/js-polyfills) -## Installation +[npm]: https://img.shields.io/npm/v/@react-native/js-polyfills.svg?color=blue +[npm downloads]: https://img.shields.io/npm/dm/@react-native/js-polyfills.svg -``` -yarn add @react-native/js-polyfills -``` +> This is an internal dependency of React Native. **Please don't depend on it directly.** -*Note: We're using `yarn` to install deps. Feel free to change commands to use `npm` 3+ and `npx` if you like* - -[version-badge]: https://img.shields.io/npm/v/@react-native/js-polyfills?style=flat-square -[package]: https://www.npmjs.com/package/@react-native/js-polyfills - -## Testing - -To run the tests in this package, run the following commands from the React Native root folder: - -1. `yarn` to install the dependencies. You just need to run this once -2. `yarn jest packages/polyfills`. +JavaScript environment polyfills set up by React Native at startup (e.g. `Promise`, timers, and other runtime globals). diff --git a/packages/polyfills/package.json b/packages/polyfills/package.json index dc3df5d594f7..7ede0f183981 100644 --- a/packages/polyfills/package.json +++ b/packages/polyfills/package.json @@ -5,10 +5,10 @@ "license": "MIT", "repository": { "type": "git", - "url": "git+https://github.com/facebook/react-native.git", + "url": "git+https://github.com/react/react-native.git", "directory": "packages/polyfills" }, - "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/polyfills#readme", + "homepage": "https://github.com/react/react-native/tree/HEAD/packages/polyfills#readme", "keywords": [ "polyfill", "polyfills", @@ -16,7 +16,7 @@ "js-polyfills", "react-native" ], - "bugs": "https://github.com/facebook/react-native/issues", + "bugs": "https://github.com/react/react-native/issues", "engines": { "node": "^22.13.0 || ^24.3.0 || >= 26.0.0" }, diff --git a/packages/react-native-babel-preset/README.md b/packages/react-native-babel-preset/README.md index a29c400c093e..232982f0a4b2 100644 --- a/packages/react-native-babel-preset/README.md +++ b/packages/react-native-babel-preset/README.md @@ -1,12 +1,15 @@ # @react-native/babel-preset -Babel presets for [React Native](https://reactnative.dev) applications. React Native itself uses this Babel preset by default when transforming your app's source code. +[![npm]](https://www.npmjs.com/package/@react-native/babel-preset) [![npm downloads]](https://www.npmjs.com/package/@react-native/babel-preset) -If you wish to use a custom Babel configuration by writing a `babel.config.js` file in your project's root directory, you must specify all the plugins necessary to transform your code. React Native does not apply its default Babel configuration in this case. So, to make your life easier, you can use this preset to get the default configuration and then specify more plugins that run before it. +[npm]: https://img.shields.io/npm/v/@react-native/babel-preset.svg?color=blue +[npm downloads]: https://img.shields.io/npm/dm/@react-native/babel-preset.svg -## Usage +Babel preset for [React Native](https://reactnative.dev) applications. React Native uses this Babel preset by default when transforming your app's source code. + +You only need to use this preset directly if you provide a custom `babel.config.js` file in your project's root directory. React Native does not apply its default Babel configuration in that case, so you must specify all the plugins necessary to transform your code โ€” start from this preset to get the defaults and add more plugins on top. -As mentioned above, you only need to use this preset if you are writing a custom `babel.config.js` file. +## Usage ### Installation @@ -26,16 +29,12 @@ yarn add -D @react-native/babel-preset ### Configuring Babel -Then, create a file called `babel.config.js` in your project's root directory. The existence of this `babel.config.js` file will tell React Native to use your custom Babel configuration instead of its own. Then load this preset: +Then, create a file called `babel.config.js` in your project's root directory. The existence of this `babel.config.js` file tells React Native to use your custom Babel configuration instead of its own. Then load this preset: -``` +```json { "presets": ["module:@react-native/babel-preset"] } ``` You can further customize your Babel configuration by specifying plugins and other options. See [Babel's `babel.config.js` documentation](https://babeljs.io/docs/en/config-files/) to learn more. - -## Help and Support - -If you get stuck configuring Babel, please ask a question on Stack Overflow or find a consultant for help. If you discover a bug, please open up an issue. diff --git a/packages/react-native-babel-preset/package.json b/packages/react-native-babel-preset/package.json index 76bc44274252..98c09a57f234 100644 --- a/packages/react-native-babel-preset/package.json +++ b/packages/react-native-babel-preset/package.json @@ -4,7 +4,8 @@ "description": "Babel preset for React Native applications", "repository": { "type": "git", - "url": "git+ssh://git@github.com/facebook/react-native.git" + "url": "git+https://github.com/react/react-native.git", + "directory": "packages/react-native-babel-preset" }, "keywords": [ "babel", @@ -55,7 +56,7 @@ "@babel/plugin-transform-typescript": "^7.25.2", "@babel/plugin-transform-unicode-regex": "^7.24.7", "@react-native/babel-plugin-codegen": "0.87.0-main", - "babel-plugin-syntax-hermes-parser": "0.36.1", + "flow-parser": "0.327.0", "babel-plugin-transform-flow-enums": "^0.0.2", "react-refresh": "^0.14.0" }, diff --git a/packages/react-native-babel-preset/src/__mocks__/test-helpers.js b/packages/react-native-babel-preset/src/__mocks__/test-helpers.js index af52a7222d66..08135eb12436 100644 --- a/packages/react-native-babel-preset/src/__mocks__/test-helpers.js +++ b/packages/react-native-babel-preset/src/__mocks__/test-helpers.js @@ -11,6 +11,7 @@ 'use strict'; import type {BabelCoreOptions, EntryOptions, PluginEntry} from '@babel/core'; +import type {File as BabelNodeFile, Node as BabelNode} from '@babel/types'; const {transformSync} = require('@babel/core'); const generate = require('@babel/generator').default; diff --git a/packages/react-native-babel-preset/src/__tests__/__fixtures__/output/default-dev.js b/packages/react-native-babel-preset/src/__tests__/__fixtures__/output/hermes-legacy-dev.js similarity index 99% rename from packages/react-native-babel-preset/src/__tests__/__fixtures__/output/default-dev.js rename to packages/react-native-babel-preset/src/__tests__/__fixtures__/output/hermes-legacy-dev.js index fd6db645265f..3bfeb2c95ec1 100644 --- a/packages/react-native-babel-preset/src/__tests__/__fixtures__/output/default-dev.js +++ b/packages/react-native-babel-preset/src/__tests__/__fixtures__/output/hermes-legacy-dev.js @@ -14,7 +14,7 @@ * * Transform configuration: * - Default transform profile in development mode - * - Options: {"dev":true} + * - Options: {"dev":true,"unstable_transformProfile":"hermes-legacy"} */ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); diff --git a/packages/react-native-babel-preset/src/__tests__/__fixtures__/output/default-prod.js b/packages/react-native-babel-preset/src/__tests__/__fixtures__/output/hermes-legacy-prod.js similarity index 99% rename from packages/react-native-babel-preset/src/__tests__/__fixtures__/output/default-prod.js rename to packages/react-native-babel-preset/src/__tests__/__fixtures__/output/hermes-legacy-prod.js index 190d8969be82..9ced08fe256e 100644 --- a/packages/react-native-babel-preset/src/__tests__/__fixtures__/output/default-prod.js +++ b/packages/react-native-babel-preset/src/__tests__/__fixtures__/output/hermes-legacy-prod.js @@ -14,7 +14,7 @@ * * Transform configuration: * - Default transform profile in production mode - * - Options: {"dev":false} + * - Options: {"dev":false,"unstable_transformProfile":"hermes-legacy"} */ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); diff --git a/packages/react-native-babel-preset/src/__tests__/__fixtures__/output/hermes-stable-prod.js b/packages/react-native-babel-preset/src/__tests__/__fixtures__/output/hermes-stable-prod.js index 383e6ed5c83a..45e02c09b8ee 100644 --- a/packages/react-native-babel-preset/src/__tests__/__fixtures__/output/hermes-stable-prod.js +++ b/packages/react-native-babel-preset/src/__tests__/__fixtures__/output/hermes-stable-prod.js @@ -14,7 +14,7 @@ * * Transform configuration: * - Hermes stable transform profile in production mode - * - Options: {"dev":false,"unstable_transformProfile":"hermes-stable"} + * - Options: {"dev":false} */ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); diff --git a/packages/react-native-babel-preset/src/__tests__/__fixtures__/output/no-babel-runtime.js b/packages/react-native-babel-preset/src/__tests__/__fixtures__/output/no-babel-runtime.js index 48133ecf77da..33c53cca2501 100644 --- a/packages/react-native-babel-preset/src/__tests__/__fixtures__/output/no-babel-runtime.js +++ b/packages/react-native-babel-preset/src/__tests__/__fixtures__/output/no-babel-runtime.js @@ -44,26 +44,16 @@ var _jsxRuntime = require("react/jsx-runtime"); var _dataUtils = require("./data-utils"); function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); } function _wrapRegExp() { _wrapRegExp = function (e, r) { return new BabelRegExp(e, void 0, r); }; var e = RegExp.prototype, r = new WeakMap(); function BabelRegExp(e, t, p) { var o = RegExp(e, t); return r.set(o, p || r.get(e)), _setPrototypeOf(o, BabelRegExp.prototype); } function buildGroups(e, t) { var p = r.get(t); return Object.keys(p).reduce(function (r, t) { var o = p[t]; if ("number" == typeof o) r[t] = e[o];else { for (var i = 0; void 0 === e[o[i]] && i + 1 < o.length;) i++; r[t] = e[o[i]]; } return r; }, Object.create(null)); } return _inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (r) { var t = e.exec.call(this, r); if (t) { t.groups = buildGroups(t, this); var p = t.indices; p && (p.groups = buildGroups(p, this)); } return t; }, BabelRegExp.prototype[Symbol.replace] = function (t, p) { if ("string" == typeof p) { var o = r.get(this); return e[Symbol.replace].call(this, t, p.replace(/\$<([^>]+)(>|$)/g, function (e, r, t) { if ("" === t) return e; var p = o[r]; return Array.isArray(p) ? "$" + p.join("$") : "number" == typeof p ? "$" + p : ""; })); } if ("function" == typeof p) { var i = this; return e[Symbol.replace].call(this, t, function () { var e = arguments; return "object" != typeof e[e.length - 1] && (e = [].slice.call(e)).push(buildGroups(e, i)), p.apply(this, e); }); } return e[Symbol.replace].call(this, t, p); }, _wrapRegExp.apply(this, arguments); } +function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } +function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } } function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } -function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } -function _possibleConstructorReturn(t, e) { if (e && ("object" == typeof e || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } -function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } -function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); } -function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } -function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } -function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); } function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; } -function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } -function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } -function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } -function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; } -function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } function _classPrivateFieldLooseBase(e, t) { if (!{}.hasOwnProperty.call(e, t)) throw new TypeError("attempted to use private field on non-instance"); return e; } var id = 0; function _classPrivateFieldLooseKey(e) { return "__private_" + id++ + "_" + e; } @@ -75,9 +65,8 @@ function _OverloadYield(e, d) { this.v = e, this.k = d; } var _count = _classPrivateFieldLooseKey("count"); var _instances = _classPrivateFieldLooseKey("instances"); var _increment = _classPrivateFieldLooseKey("increment"); -var Counter = exports.Counter = function () { - function Counter() { - _classCallCheck(this, Counter); +class Counter { + constructor() { Object.defineProperty(this, _increment, { value: _increment2 }); @@ -87,23 +76,17 @@ var Counter = exports.Counter = function () { }); _classPrivateFieldLooseBase(Counter, _instances)[_instances]++; } - return _createClass(Counter, [{ - key: "value", - get: function () { - return _classPrivateFieldLooseBase(this, _count)[_count]; - } - }, { - key: "increment", - value: function increment() { - _classPrivateFieldLooseBase(this, _increment)[_increment](); - } - }], [{ - key: "instanceCount", - get: function () { - return _classPrivateFieldLooseBase(Counter, _instances)[_instances]; - } - }]); -}(); + get value() { + return _classPrivateFieldLooseBase(this, _count)[_count]; + } + increment() { + _classPrivateFieldLooseBase(this, _increment)[_increment](); + } + static get instanceCount() { + return _classPrivateFieldLooseBase(Counter, _instances)[_instances]; + } +} +exports.Counter = Counter; function _increment2() { _classPrivateFieldLooseBase(this, _count)[_count]++; } @@ -139,57 +122,36 @@ function _fetchData() { function getNestedValue(obj) { return obj?.a?.b?.c ?? 42; } -var _age = _classPrivateFieldLooseKey("age"); -var Animal = exports.Animal = function () { - function Animal(name, age) { - _classCallCheck(this, Animal); - Object.defineProperty(this, _age, { - writable: true, - value: void 0 - }); +class Animal { + #age; + constructor(name, age) { this.name = name; - _classPrivateFieldLooseBase(this, _age)[_age] = age; + this.#age = age; } - return _createClass(Animal, [{ - key: "speak", - value: function speak() { - return `${this.name} makes a sound`; - } - }, { - key: "age", - get: function () { - return _classPrivateFieldLooseBase(this, _age)[_age]; - } - }]); -}(); -var Dog = exports.Dog = function (_Animal2) { - function Dog(name, age, breed) { - var _this; - _classCallCheck(this, Dog); - _this = _callSuper(this, Dog, [name, age]); - _this.breed = breed; - return _this; + speak() { + return `${this.name} makes a sound`; } - _inherits(Dog, _Animal2); - return _createClass(Dog, [{ - key: "speak", - value: function speak() { - return `${this.name} barks!`; - } - }, { - key: "fetchTreats", - value: function () { - var _fetchTreats = _asyncToGenerator(function* () { - yield new Promise(resolve => setTimeout(resolve, 100)); - return ['bone', 'biscuit', 'toy']; - }); - function fetchTreats() { - return _fetchTreats.apply(this, arguments); - } - return fetchTreats; - }() - }]); -}(Animal); + get age() { + return this.#age; + } +} +exports.Animal = Animal; +class Dog extends Animal { + constructor(name, age, breed) { + super(name, age); + this.breed = breed; + } + speak() { + return `${this.name} barks!`; + } + fetchTreats() { + return _asyncToGenerator(function* () { + yield new Promise(resolve => setTimeout(resolve, 100)); + return ['bone', 'biscuit', 'toy']; + })(); + } +} +exports.Dog = Dog; function processUser({ name, age = 18, @@ -245,10 +207,12 @@ function matchEmoji(text) { var match = text.match(/(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEDC-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9\uDEF0-\uDEF8])/); return match?.[0]; } -var MyClass = exports.MyClass = _createClass(function MyClass(value) { - _classCallCheck(this, MyClass); - this.value = value; -}); +var MyClass = class { + constructor(value) { + this.value = value; + } +}; +exports.MyClass = MyClass; function loadModule() { return _loadModule.apply(this, arguments); } diff --git a/packages/react-native-babel-preset/src/__tests__/__fixtures__/output/no-import-export-transform.js b/packages/react-native-babel-preset/src/__tests__/__fixtures__/output/no-import-export-transform.js index f50ff8f413cf..8f35153a9a77 100644 --- a/packages/react-native-babel-preset/src/__tests__/__fixtures__/output/no-import-export-transform.js +++ b/packages/react-native-babel-preset/src/__tests__/__fixtures__/output/no-import-export-transform.js @@ -17,30 +17,23 @@ * - Options: {"dev":false,"disableImportExportTransform":true} */ +import _inherits from "@babel/runtime/helpers/inherits"; import _setPrototypeOf from "@babel/runtime/helpers/setPrototypeOf"; import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; -import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; -import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; -import _inherits from "@babel/runtime/helpers/inherits"; import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator"; -import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; -import _createClass from "@babel/runtime/helpers/createClass"; import _classPrivateFieldLooseBase from "@babel/runtime/helpers/classPrivateFieldLooseBase"; import _classPrivateFieldLooseKey from "@babel/runtime/helpers/classPrivateFieldLooseKey"; import _awaitAsyncGenerator from "@babel/runtime/helpers/awaitAsyncGenerator"; import _wrapAsyncGenerator from "@babel/runtime/helpers/wrapAsyncGenerator"; function _wrapRegExp() { _wrapRegExp = function (e, r) { return new BabelRegExp(e, void 0, r); }; var e = RegExp.prototype, r = new WeakMap(); function BabelRegExp(e, t, p) { var o = RegExp(e, t); return r.set(o, p || r.get(e)), _setPrototypeOf(o, BabelRegExp.prototype); } function buildGroups(e, t) { var p = r.get(t); return Object.keys(p).reduce(function (r, t) { var o = p[t]; if ("number" == typeof o) r[t] = e[o];else { for (var i = 0; void 0 === e[o[i]] && i + 1 < o.length;) i++; r[t] = e[o[i]]; } return r; }, Object.create(null)); } return _inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (r) { var t = e.exec.call(this, r); if (t) { t.groups = buildGroups(t, this); var p = t.indices; p && (p.groups = buildGroups(p, this)); } return t; }, BabelRegExp.prototype[Symbol.replace] = function (t, p) { if ("string" == typeof p) { var o = r.get(this); return e[Symbol.replace].call(this, t, p.replace(/\$<([^>]+)(>|$)/g, function (e, r, t) { if ("" === t) return e; var p = o[r]; return Array.isArray(p) ? "$" + p.join("$") : "number" == typeof p ? "$" + p : ""; })); } if ("function" == typeof p) { var i = this; return e[Symbol.replace].call(this, t, function () { var e = arguments; return "object" != typeof e[e.length - 1] && (e = [].slice.call(e)).push(buildGroups(e, i)), p.apply(this, e); }); } return e[Symbol.replace].call(this, t, p); }, _wrapRegExp.apply(this, arguments); } -function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } -function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); } import * as React from 'react'; import { useEffect, useState } from 'react'; import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; var _count = _classPrivateFieldLooseKey("count"); var _instances = _classPrivateFieldLooseKey("instances"); var _increment = _classPrivateFieldLooseKey("increment"); -var Counter = function () { - function Counter() { - _classCallCheck(this, Counter); +class Counter { + constructor() { Object.defineProperty(this, _increment, { value: _increment2 }); @@ -50,23 +43,16 @@ var Counter = function () { }); _classPrivateFieldLooseBase(Counter, _instances)[_instances]++; } - return _createClass(Counter, [{ - key: "value", - get: function () { - return _classPrivateFieldLooseBase(this, _count)[_count]; - } - }, { - key: "increment", - value: function increment() { - _classPrivateFieldLooseBase(this, _increment)[_increment](); - } - }], [{ - key: "instanceCount", - get: function () { - return _classPrivateFieldLooseBase(Counter, _instances)[_instances]; - } - }]); -}(); + get value() { + return _classPrivateFieldLooseBase(this, _count)[_count]; + } + increment() { + _classPrivateFieldLooseBase(this, _increment)[_increment](); + } + static get instanceCount() { + return _classPrivateFieldLooseBase(Counter, _instances)[_instances]; + } +} function _increment2() { _classPrivateFieldLooseBase(this, _count)[_count]++; } @@ -102,57 +88,34 @@ function _fetchData() { function getNestedValue(obj) { return obj?.a?.b?.c ?? 42; } -var _age = _classPrivateFieldLooseKey("age"); -var Animal = function () { - function Animal(name, age) { - _classCallCheck(this, Animal); - Object.defineProperty(this, _age, { - writable: true, - value: void 0 - }); +class Animal { + #age; + constructor(name, age) { this.name = name; - _classPrivateFieldLooseBase(this, _age)[_age] = age; + this.#age = age; } - return _createClass(Animal, [{ - key: "speak", - value: function speak() { - return `${this.name} makes a sound`; - } - }, { - key: "age", - get: function () { - return _classPrivateFieldLooseBase(this, _age)[_age]; - } - }]); -}(); -var Dog = function (_Animal2) { - function Dog(name, age, breed) { - var _this; - _classCallCheck(this, Dog); - _this = _callSuper(this, Dog, [name, age]); - _this.breed = breed; - return _this; + speak() { + return `${this.name} makes a sound`; } - _inherits(Dog, _Animal2); - return _createClass(Dog, [{ - key: "speak", - value: function speak() { - return `${this.name} barks!`; - } - }, { - key: "fetchTreats", - value: function () { - var _fetchTreats = _asyncToGenerator(function* () { - yield new Promise(resolve => setTimeout(resolve, 100)); - return ['bone', 'biscuit', 'toy']; - }); - function fetchTreats() { - return _fetchTreats.apply(this, arguments); - } - return fetchTreats; - }() - }]); -}(Animal); + get age() { + return this.#age; + } +} +class Dog extends Animal { + constructor(name, age, breed) { + super(name, age); + this.breed = breed; + } + speak() { + return `${this.name} barks!`; + } + fetchTreats() { + return _asyncToGenerator(function* () { + yield new Promise(resolve => setTimeout(resolve, 100)); + return ['bone', 'biscuit', 'toy']; + })(); + } +} function processUser({ name, age = 18, @@ -208,10 +171,11 @@ function matchEmoji(text) { var match = text.match(/(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEDC-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9\uDEF0-\uDEF8])/); return match?.[0]; } -var MyClass = _createClass(function MyClass(value) { - _classCallCheck(this, MyClass); - this.value = value; -}); +var MyClass = class { + constructor(value) { + this.value = value; + } +}; function loadModule() { return _loadModule.apply(this, arguments); } diff --git a/packages/react-native-babel-preset/src/__tests__/__fixtures__/output/with-babel-runtime-version.js b/packages/react-native-babel-preset/src/__tests__/__fixtures__/output/with-babel-runtime-version.js index 0c4f65846540..90ef1e57176b 100644 --- a/packages/react-native-babel-preset/src/__tests__/__fixtures__/output/with-babel-runtime-version.js +++ b/packages/react-native-babel-preset/src/__tests__/__fixtures__/output/with-babel-runtime-version.js @@ -42,11 +42,7 @@ exports.safeJsonParse = safeJsonParse; exports.sumPairs = sumPairs; var _wrapRegExp2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapRegExp")); var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); -var _callSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/callSuper")); -var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator")); -var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); -var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); var _classPrivateFieldLooseBase2 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateFieldLooseBase")); var _classPrivateFieldLooseKey2 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateFieldLooseKey")); var _awaitAsyncGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/awaitAsyncGenerator")); @@ -58,9 +54,8 @@ var _dataUtils = require("./data-utils"); var _count = (0, _classPrivateFieldLooseKey2.default)("count"); var _instances = (0, _classPrivateFieldLooseKey2.default)("instances"); var _increment = (0, _classPrivateFieldLooseKey2.default)("increment"); -var Counter = exports.Counter = function () { - function Counter() { - (0, _classCallCheck2.default)(this, Counter); +class Counter { + constructor() { Object.defineProperty(this, _increment, { value: _increment2 }); @@ -70,23 +65,17 @@ var Counter = exports.Counter = function () { }); (0, _classPrivateFieldLooseBase2.default)(Counter, _instances)[_instances]++; } - return (0, _createClass2.default)(Counter, [{ - key: "value", - get: function () { - return (0, _classPrivateFieldLooseBase2.default)(this, _count)[_count]; - } - }, { - key: "increment", - value: function increment() { - (0, _classPrivateFieldLooseBase2.default)(this, _increment)[_increment](); - } - }], [{ - key: "instanceCount", - get: function () { - return (0, _classPrivateFieldLooseBase2.default)(Counter, _instances)[_instances]; - } - }]); -}(); + get value() { + return (0, _classPrivateFieldLooseBase2.default)(this, _count)[_count]; + } + increment() { + (0, _classPrivateFieldLooseBase2.default)(this, _increment)[_increment](); + } + static get instanceCount() { + return (0, _classPrivateFieldLooseBase2.default)(Counter, _instances)[_instances]; + } +} +exports.Counter = Counter; function _increment2() { (0, _classPrivateFieldLooseBase2.default)(this, _count)[_count]++; } @@ -122,57 +111,36 @@ function _fetchData() { function getNestedValue(obj) { return obj?.a?.b?.c ?? 42; } -var _age = (0, _classPrivateFieldLooseKey2.default)("age"); -var Animal = exports.Animal = function () { - function Animal(name, age) { - (0, _classCallCheck2.default)(this, Animal); - Object.defineProperty(this, _age, { - writable: true, - value: void 0 - }); +class Animal { + #age; + constructor(name, age) { this.name = name; - (0, _classPrivateFieldLooseBase2.default)(this, _age)[_age] = age; + this.#age = age; } - return (0, _createClass2.default)(Animal, [{ - key: "speak", - value: function speak() { - return `${this.name} makes a sound`; - } - }, { - key: "age", - get: function () { - return (0, _classPrivateFieldLooseBase2.default)(this, _age)[_age]; - } - }]); -}(); -var Dog = exports.Dog = function (_Animal2) { - function Dog(name, age, breed) { - var _this; - (0, _classCallCheck2.default)(this, Dog); - _this = (0, _callSuper2.default)(this, Dog, [name, age]); - _this.breed = breed; - return _this; + speak() { + return `${this.name} makes a sound`; } - (0, _inherits2.default)(Dog, _Animal2); - return (0, _createClass2.default)(Dog, [{ - key: "speak", - value: function speak() { - return `${this.name} barks!`; - } - }, { - key: "fetchTreats", - value: function () { - var _fetchTreats = (0, _asyncToGenerator2.default)(function* () { - yield new Promise(resolve => setTimeout(resolve, 100)); - return ['bone', 'biscuit', 'toy']; - }); - function fetchTreats() { - return _fetchTreats.apply(this, arguments); - } - return fetchTreats; - }() - }]); -}(Animal); + get age() { + return this.#age; + } +} +exports.Animal = Animal; +class Dog extends Animal { + constructor(name, age, breed) { + super(name, age); + this.breed = breed; + } + speak() { + return `${this.name} barks!`; + } + fetchTreats() { + return (0, _asyncToGenerator2.default)(function* () { + yield new Promise(resolve => setTimeout(resolve, 100)); + return ['bone', 'biscuit', 'toy']; + })(); + } +} +exports.Dog = Dog; function processUser({ name, age = 18, @@ -228,10 +196,12 @@ function matchEmoji(text) { var match = text.match(/(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEDC-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9\uDEF0-\uDEF8])/); return match?.[0]; } -var MyClass = exports.MyClass = (0, _createClass2.default)(function MyClass(value) { - (0, _classCallCheck2.default)(this, MyClass); - this.value = value; -}); +var MyClass = class { + constructor(value) { + this.value = value; + } +}; +exports.MyClass = MyClass; function loadModule() { return _loadModule.apply(this, arguments); } diff --git a/packages/react-native-babel-preset/src/__tests__/inline-platform-opt-in-test.js b/packages/react-native-babel-preset/src/__tests__/inline-platform-opt-in-test.js new file mode 100644 index 000000000000..f47ee84146a0 --- /dev/null +++ b/packages/react-native-babel-preset/src/__tests__/inline-platform-opt-in-test.js @@ -0,0 +1,103 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + */ + +'use strict'; + +// $FlowExpectedError[untyped-import] - Preset is untyped +const preset = require('../index'); +const babel = require('@babel/core'); + +const FILENAME = '/app/src/App.js'; +const SRC = "import {Platform} from 'react-native';\nconst os = Platform.OS;"; + +type PresetOptions = { + platform?: ?string, + inlinePlatform?: boolean, +}; + +type CallerOptions = { + platform?: ?string, + inlinePlatform?: boolean, +}; + +function transform({ + presetOptions = {}, + caller = {}, +}: { + presetOptions?: PresetOptions, + caller?: CallerOptions, +} = {}): string { + const result = babel.transformSync(SRC, { + babelrc: false, + caller: {name: 'test', ...caller}, + compact: false, + configFile: false, + filename: FILENAME, + presets: [[preset, {dev: false, ...presetOptions}]], + sourceMaps: false, + }); + const code = result?.code; + if (code == null) { + throw new Error('Expected the transform to produce code'); + } + return code; +} + +function isInlined(code: string): boolean { + return code.includes('"ios"') && !/\.OS\b/.test(code); +} + +describe('Platform inlining is opt-in', () => { + test('does not inline when only a platform is given', () => { + // A platform on its own says which platform we are compiling *for*. It is + // also set by consumers that need platform-correct module resolution but + // must keep `Platform` observable at runtime - Jest mocks it. + expect(isInlined(transform({presetOptions: {platform: 'ios'}}))).toBe( + false, + ); + }); + + test('does not inline when only the Babel caller gives a platform', () => { + expect(isInlined(transform({caller: {platform: 'ios'}}))).toBe(false); + }); + + test('inlines when opted in via preset options', () => { + expect( + isInlined( + transform({presetOptions: {platform: 'ios', inlinePlatform: true}}), + ), + ).toBe(true); + }); + + test('inlines when opted in via the Babel caller', () => { + // The only channel available when the preset is named in a babel.config.js, + // where Babel supplies no preset options. + expect( + isInlined(transform({caller: {platform: 'ios', inlinePlatform: true}})), + ).toBe(true); + }); + + test('preset options take precedence over the caller', () => { + expect( + isInlined( + transform({ + presetOptions: {inlinePlatform: false}, + caller: {platform: 'ios', inlinePlatform: true}, + }), + ), + ).toBe(false); + }); + + test('opting in without a platform is still a no-op', () => { + expect(isInlined(transform({presetOptions: {inlinePlatform: true}}))).toBe( + false, + ); + }); +}); diff --git a/packages/react-native-babel-preset/src/__tests__/inline-platform-plugin-test.js b/packages/react-native-babel-preset/src/__tests__/inline-platform-plugin-test.js new file mode 100644 index 000000000000..92bb4aac0739 --- /dev/null +++ b/packages/react-native-babel-preset/src/__tests__/inline-platform-plugin-test.js @@ -0,0 +1,525 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + */ + +'use strict'; + +const inlinePlatformPlugin = require('../inline-platform-plugin.js'); +const {transformSync} = require('@babel/core'); +const path = require('node:path'); + +const RN_ROOT = '/app/node_modules/react-native'; +const APP_FILE = '/app/src/App.js'; + +function transform( + code: string, + { + filename = APP_FILE, + platform = 'ios', + }: {filename?: string, platform?: ?string} = {}, +): string { + const result = transformSync(code, { + babelrc: false, + configFile: false, + compact: true, + filename, + plugins: [ + // $FlowFixMe[untyped-import] + require('@babel/plugin-syntax-flow'), + [inlinePlatformPlugin, {platform}], + ], + sourceType: 'module', + }); + return result.code; +} + +// Asserts the code is unchanged by the plugin, modulo formatting. +function expectUnchanged( + code: string, + options?: {filename?: string, platform?: ?string}, +) { + expect(transform(code, options)).toBe( + transform(code, {...options, platform: null}), + ); +} + +describe('Platform.OS from an ESM import', () => { + test('inlines a named import from react-native', () => { + expect( + transform(` + import {Platform} from 'react-native'; + const os = Platform.OS; + `), + ).toMatchInlineSnapshot( + `"import{Platform}from'react-native';const os=\\"ios\\";"`, + ); + }); + + test('inlines an aliased named import', () => { + expect( + transform(` + import {Platform as P} from 'react-native'; + const os = P.OS; + `), + ).toMatchInlineSnapshot( + `"import{Platform as P}from'react-native';const os=\\"ios\\";"`, + ); + }); + + test('inlines through a namespace import', () => { + expect( + transform(` + import * as RN from 'react-native'; + const os = RN.Platform.OS; + `), + ).toMatchInlineSnapshot( + `"import*as RN from'react-native';const os=\\"ios\\";"`, + ); + }); + + test('inlines a public deep default import', () => { + expect( + transform(` + import P from 'react-native/Libraries/Utilities/Platform'; + const os = P.OS; + `), + ).toMatchInlineSnapshot( + `"import P from'react-native/Libraries/Utilities/Platform';const os=\\"ios\\";"`, + ); + }); + + test('inlines a default import from the react-native barrel', () => { + // `react-native` is CommonJS, so the default import is the barrel object. + expect( + transform(` + import ReactNative from 'react-native'; + const os = ReactNative.Platform.OS; + `), + ).toMatchInlineSnapshot( + `"import ReactNative from'react-native';const os=\\"ios\\";"`, + ); + }); + + test('respects the requested platform', () => { + expect( + transform( + ` + import {Platform} from 'react-native'; + const os = Platform.OS; + `, + {platform: 'android'}, + ), + ).toContain('"android"'); + }); + + test('does not inline a type-only import', () => { + expectUnchanged(` + import type {Platform} from 'react-native'; + const os = Platform.OS; + `); + }); +}); + +describe('Platform.OS from CommonJS', () => { + test('inlines a direct require of the barrel', () => { + expect( + transform(` + const os = require('react-native').Platform.OS; + `), + ).toMatchInlineSnapshot(`"const os=\\"ios\\";"`); + }); + + test('inlines a bound require of the barrel', () => { + expect( + transform(` + const RN = require('react-native'); + const os = RN.Platform.OS; + `), + ).toMatchInlineSnapshot( + `"const RN=require('react-native');const os=\\"ios\\";"`, + ); + }); + + test('inlines a deep require with .default', () => { + expect( + transform(` + const P = require('react-native/Libraries/Utilities/Platform').default; + const os = P.OS; + `), + ).toMatchInlineSnapshot( + `"const P=require('react-native/Libraries/Utilities/Platform').default;const os=\\"ios\\";"`, + ); + }); + + test('inlines a destructured require', () => { + expect( + transform(` + const {Platform} = require('react-native'); + const os = Platform.OS; + `), + ).toMatchInlineSnapshot( + `"const{Platform}=require('react-native');const os=\\"ios\\";"`, + ); + }); + + test('inlines a renamed destructured require', () => { + expect( + transform(` + const {Platform: P} = require('react-native'); + const os = P.OS; + `), + ).toMatchInlineSnapshot( + `"const{Platform:P}=require('react-native');const os=\\"ios\\";"`, + ); + }); + + test('follows an immutable alias', () => { + expect( + transform(` + const {Platform} = require('react-native'); + const P = Platform; + const os = P.OS; + `), + ).toMatchInlineSnapshot( + `"const{Platform}=require('react-native');const P=Platform;const os=\\"ios\\";"`, + ); + }); + + test('does not inline when require is shadowed', () => { + expectUnchanged(` + function f(require) { + const P = require('react-native').Platform; + return P.OS; + } + `); + }); + + test('does not follow a reassigned binding', () => { + expectUnchanged(` + let P = require('react-native').Platform; + P = somethingElse; + const os = P.OS; + `); + }); + + test('does not inline a require with a non-literal specifier', () => { + expectUnchanged(` + const os = require(dynamicName).Platform.OS; + `); + }); +}); + +describe('provenance is required', () => { + test('does not inline a bare global Platform', () => { + // Metro's late pass still handles this historical form. + expectUnchanged('const os = Platform.OS;'); + }); + + test('does not inline React.Platform.OS', () => { + expectUnchanged('const os = React.Platform.OS;'); + }); + + test('does not inline a same-named import from another package', () => { + expectUnchanged(` + import Platform from 'other-package'; + const os = Platform.OS; + `); + expectUnchanged(` + import {Platform} from 'other-package'; + const os = Platform.OS; + `); + }); + + test('does not inline a locally declared Platform', () => { + expectUnchanged(` + const Platform = {OS: 'web'}; + const os = Platform.OS; + `); + }); + + test('does not inline a parameter named Platform', () => { + expectUnchanged(` + function f(Platform) { + return Platform.OS; + } + `); + }); + + test('does not inline a shadowing local inside a function', () => { + const code = ` + import {Platform} from 'react-native'; + function f() { + const Platform = {OS: 'web'}; + return Platform.OS; + } + const outer = Platform.OS; + `; + const output = transform(code); + expect(output).toContain('Platform.OS'); + expect(output).toContain('const outer="ios"'); + }); + + test('does not inline a non-Platform member of the barrel', () => { + expectUnchanged(` + import {View} from 'react-native'; + const os = View.OS; + `); + }); + + test('does not inline a different module named Platform', () => { + expectUnchanged( + ` + import P from '../Utilities/Platform'; + const os = P.OS; + `, + {filename: '/app/src/components/Thing.js'}, + ); + }); +}); + +describe('unsafe positions', () => { + test('does not replace an assignment target', () => { + const output = transform(` + import {Platform} from 'react-native'; + Platform.OS = 'web'; + `); + expect(output).toContain("Platform.OS='web'"); + }); + + test('does not replace an update target', () => { + const output = transform(` + import {Platform} from 'react-native'; + Platform.OS++; + `); + expect(output).toContain('Platform.OS++'); + }); + + test('does not replace a delete target', () => { + const output = transform(` + import {Platform} from 'react-native'; + delete Platform.OS; + `); + expect(output).toContain('delete Platform.OS'); + }); + + test('does not inline computed access', () => { + const output = transform(` + import {Platform} from 'react-native'; + const os = Platform['OS']; + `); + expect(output).toContain("Platform['OS']"); + }); +}); + +describe('React Native internal relative imports', () => { + test('inlines from Libraries/', () => { + expect( + transform( + ` + import Platform from '../../Utilities/Platform'; + const os = Platform.OS; + `, + { + filename: `${RN_ROOT}/Libraries/Components/ScrollView/ScrollView.js`, + }, + ), + ).toContain('"ios"'); + }); + + test('inlines from src/private/', () => { + expect( + transform( + ` + import Platform from '../../../Libraries/Utilities/Platform'; + const os = Platform.OS; + `, + { + filename: `/app/packages/react-native/src/private/animated/NativeAnimatedHelper.js`, + }, + ), + ).toContain('"ios"'); + }); + + test('inlines a relative CommonJS require with .default', () => { + expect( + transform( + ` + const P = require('../../Utilities/Platform').default; + const os = P.OS; + `, + {filename: `${RN_ROOT}/Libraries/Components/View/View.js`}, + ), + ).toContain('"ios"'); + }); + + test('inlines a relative import with an explicit extension', () => { + expect( + transform( + ` + import Platform from '../../Utilities/Platform.js'; + const os = Platform.OS; + `, + {filename: `${RN_ROOT}/Libraries/Components/View/View.js`}, + ), + ).toContain('"ios"'); + }); + + test('inlines under a pnpm-style layout', () => { + expect( + transform( + ` + import Platform from '../../Utilities/Platform'; + const os = Platform.OS; + `, + { + filename: + '/app/node_modules/.pnpm/react-native@0.87.0/node_modules/react-native/Libraries/Components/View/View.js', + }, + ), + ).toContain('"ios"'); + }); + + test('does not inline when the package root is react-native-something', () => { + expectUnchanged( + ` + import Platform from '../../Utilities/Platform'; + const os = Platform.OS; + `, + { + filename: + '/app/node_modules/react-native-web/Libraries/Components/View/View.js', + }, + ); + }); + + test('does not inline when the importer is outside the resolved RN root', () => { + // Resolves into react-native, but the importer is not part of it. + expectUnchanged( + ` + import Platform from '../node_modules/react-native/Libraries/Utilities/Platform'; + const os = Platform.OS; + `, + {filename: '/app/src/App.js'}, + ); + }); + + test('does not inline a relative path that escapes into another package', () => { + expectUnchanged( + ` + import Platform from '../../../other-package/Libraries/Utilities/Platform'; + const os = Platform.OS; + `, + {filename: `${RN_ROOT}/Libraries/Components/View/View.js`}, + ); + }); + + if (path.sep === '\\') { + test('normalizes Windows separators', () => { + expect( + transform( + ` + import Platform from '../../Utilities/Platform'; + const os = Platform.OS; + `, + { + filename: + 'C:\\app\\node_modules\\react-native\\Libraries\\Components\\View\\View.js', + }, + ), + ).toContain('"ios"'); + }); + } +}); + +describe('Platform.select', () => { + const select = (spec: string, platform: string = 'ios') => + transform( + ` + import {Platform} from 'react-native'; + const value = Platform.select(${spec}); + `, + {platform}, + ); + + test('picks the exact platform', () => { + expect(select('{ios: 1, android: 2}')).toContain('const value=1'); + }); + + test('falls back to native', () => { + expect(select('{ios: 1, native: 2}', 'android')).toContain('const value=2'); + }); + + test('falls back to default', () => { + expect(select('{ios: 1, default: 3}', 'android')).toContain( + 'const value=3', + ); + }); + + test('prefers native over default', () => { + expect(select('{ios: 1, native: 2, default: 3}', 'android')).toContain( + 'const value=2', + ); + }); + + test('yields undefined when nothing matches', () => { + expect(select('{ios: 1}', 'android')).toContain('const value=undefined'); + }); + + test('accepts string keys', () => { + expect(select("{'ios': 1, 'android': 2}")).toContain('const value=1'); + }); + + test('accepts object methods', () => { + expect(select('{ios() { return 1; }}')).toContain('function'); + }); + + test('does not inline computed keys', () => { + expect(select('{[key]: 1, default: 2}')).toContain('Platform.select'); + }); + + test('does not inline spreads', () => { + expect(select('{...rest, default: 2}')).toContain('Platform.select'); + }); + + test('does not inline getters', () => { + expect(select('{get ios() { return 1; }}')).toContain('Platform.select'); + }); + + test('does not inline a non-object argument', () => { + expect(select('spec')).toContain('Platform.select'); + }); + + test('does not inline an unproven Platform.select', () => { + expectUnchanged('const value = Platform.select({ios: 1});'); + }); +}); + +describe('platform option', () => { + const code = ` + import {Platform} from 'react-native'; + const os = Platform.OS; + const value = Platform.select({ios: 1}); + `; + + test('is a no-op when platform is null', () => { + const output = transform(code, {platform: null}); + expect(output).toContain('Platform.OS'); + expect(output).toContain('Platform.select'); + }); + + test('is a no-op when platform is the empty string', () => { + // React Native's Jest preprocessor passes `platform: ''` for every file it + // transforms; inlining `Platform.OS` to `""` there would break the RN test + // suite wholesale. + const output = transform(code, {platform: ''}); + expect(output).toContain('Platform.OS'); + expect(output).toContain('Platform.select'); + expect(output).not.toContain('""'); + }); +}); diff --git a/packages/react-native-babel-preset/src/__tests__/plugin-warn-on-deep-imports-test.js b/packages/react-native-babel-preset/src/__tests__/plugin-warn-on-deep-imports-test.js index 820fc9c59eae..66f247d7112a 100644 --- a/packages/react-native-babel-preset/src/__tests__/plugin-warn-on-deep-imports-test.js +++ b/packages/react-native-babel-preset/src/__tests__/plugin-warn-on-deep-imports-test.js @@ -82,17 +82,3 @@ test('import from other package', () => { `"import { foo } from 'react-native-foo';"`, ); }); - -test('import react-native/Libraries/Core/InitializeCore', () => { - const code = ` - import 'react-native/Libraries/Core/InitializeCore'; - require('react-native/Libraries/Core/InitializeCore'); - export * from 'react-native/Libraries/Core/InitializeCore'; - `; - - expect(transform(code, [rnDeepImportsWarningPlugin])).toMatchInlineSnapshot(` - "import 'react-native/Libraries/Core/InitializeCore'; - require('react-native/Libraries/Core/InitializeCore'); - export * from 'react-native/Libraries/Core/InitializeCore';" - `); -}); diff --git a/packages/react-native-babel-preset/src/__tests__/transform-snapshot-test.js b/packages/react-native-babel-preset/src/__tests__/transform-snapshot-test.js index 93c3173165fd..1e972039ee5e 100644 --- a/packages/react-native-babel-preset/src/__tests__/transform-snapshot-test.js +++ b/packages/react-native-babel-preset/src/__tests__/transform-snapshot-test.js @@ -13,8 +13,8 @@ // $FlowExpectedError[untyped-import] - Preset is untyped const preset = require('../index'); const babel = require('@babel/core'); -const fs = require('fs'); -const path = require('path'); +const fs = require('node:fs'); +const path = require('node:path'); const FIXTURES_DIR = path.join(__dirname, '__fixtures__'); const OUTPUT_DIR = path.join(FIXTURES_DIR, 'output'); @@ -26,34 +26,35 @@ const inputCode = fs.readFileSync(INPUT_FILE, 'utf-8'); const testConfigs = [ { - name: 'default-dev', + name: 'hermes-stable-dev', options: { dev: true, + unstable_transformProfile: 'hermes-stable', }, - description: 'Default transform profile in development mode', + description: 'Hermes stable transform profile in development mode', }, { - name: 'default-prod', + name: 'hermes-stable-prod', options: { dev: false, }, - description: 'Default transform profile in production mode', + description: 'Hermes stable transform profile in production mode', }, { - name: 'hermes-stable-dev', + name: 'hermes-legacy-dev', options: { dev: true, - unstable_transformProfile: 'hermes-stable', + unstable_transformProfile: 'hermes-legacy', }, - description: 'Hermes stable transform profile in development mode', + description: 'Default transform profile in development mode', }, { - name: 'hermes-stable-prod', + name: 'hermes-legacy-prod', options: { dev: false, - unstable_transformProfile: 'hermes-stable', + unstable_transformProfile: 'hermes-legacy', }, - description: 'Hermes stable transform profile in production mode', + description: 'Default transform profile in production mode', }, { name: 'hermes-canary-dev', @@ -266,18 +267,6 @@ describe('react-native-babel-preset transform snapshots', () => { ); describe('specific feature transformations', () => { - it('handles private class fields', () => { - const code = ` - class Counter { - #count = 0; - increment() { this.#count++; } - get value() { return this.#count; } - } - `; - const result = transformCode(code, {dev: false}); - expect(result).not.toContain('#count'); - }); - it('handles async generators', () => { const code = ` async function* gen() { @@ -347,10 +336,28 @@ describe('react-native-babel-preset transform snapshots', () => { } } `; - const result = transformCode(code, {dev: false}); + const result = transformCode(code, { + dev: false, + unstable_transformProfile: 'hermes-legacy', + }); expect(result).not.toContain('class Animal'); }); + it('does not transform classes with default profile', () => { + const code = ` + class Animal { + constructor(name) { + this.name = name; + } + speak() { + return this.name; + } + } + `; + const result = transformCode(code, {dev: false}); + expect(result).toContain('class Animal'); + }); + it('handles named capturing groups in regex', () => { const code = `const match = str.match(/(?\\d{4})-(?\\d{2})/);`; const result = transformCode(code, {dev: false}); diff --git a/packages/react-native-babel-preset/src/configs/main.js b/packages/react-native-babel-preset/src/configs/main.js index 836d00b651c8..a48b126ca8b8 100644 --- a/packages/react-native-babel-preset/src/configs/main.js +++ b/packages/react-native-babel-preset/src/configs/main.js @@ -45,7 +45,19 @@ function isFirstParty(fileName) { // getPreset, which is otherwise cached based on `options`. This must be pure, // and should be cheap. function getTransformProfile(caller) { - return caller?.unstable_transformProfile ?? 'default'; + return caller?.unstable_transformProfile ?? 'hermes-stable'; +} + +// The target platform, currently only used for platform inlining. +function getPlatform(caller) { + return caller?.platform ?? null; +} + +// Boolean, whether to inline `Platform`. Separate from `platform` (string) +// because a platform already reaches the preset and may be used for other +// purposes. +function getInlinePlatform(caller) { + return caller?.inlinePlatform ?? false; } // use `this.foo = bar` instead of `this.defineProperty('foo', ...)` @@ -57,6 +69,11 @@ const getPreset = (src, options, babel) => { const dev = options?.dev ?? babel?.env('development') ?? false; + const platform = options?.platform ?? babel?.caller(getPlatform); + + const inlinePlatform = + options?.inlinePlatform ?? babel?.caller(getInlinePlatform) ?? false; + // Hermes V1 uses more optimised transform profiles. There is currently no // difference between stable and canary, but canary may in future be used to // test features in pre-prod Hermes V1 versions. @@ -103,6 +120,16 @@ const getPreset = (src, options, babel) => { const extraPlugins = []; const firstPartyPlugins = []; + // Inline `Platform.OS` and `Platform.select(...)` for provably React + // Native-owned `Platform` imports. This must run before the CommonJS module + // transform below (and before Metro's own import lowering when + // `disableImportExportTransform` is set), while the source-level import that + // proves provenance is still intact. It is a no-op when `platform` is null or + // the empty string. + if (inlinePlatform) { + extraPlugins.push([require('../inline-platform-plugin'), {platform}]); + } + if (!options.useTransformReactJSXExperimental) { extraPlugins.push([ require('@babel/plugin-transform-react-jsx'), @@ -231,7 +258,7 @@ const getPreset = (src, options, babel) => { { plugins: [ [ - require('babel-plugin-syntax-hermes-parser'), + require('flow-parser/babel-plugin'), { parseLangTypes: 'flow', reactRuntimeTarget: '19', diff --git a/packages/react-native-babel-preset/src/index.js b/packages/react-native-babel-preset/src/index.js index e785c9759386..27e558a1f7ec 100644 --- a/packages/react-native-babel-preset/src/index.js +++ b/packages/react-native-babel-preset/src/index.js @@ -31,8 +31,8 @@ module.exports.getCacheKey = () => { // For anyone working with a `-main` version, contents may vary over time // even though the version does not. Hash the relevant contents of this // package. Lazy-load dependencies we only need on this slow path. - const {createHash} = require('crypto'); - const {readFileSync} = require('fs'); + const {createHash} = require('node:crypto'); + const {readFileSync} = require('node:fs'); const key = createHash('md5'); [ readFileSync(__filename), @@ -41,10 +41,12 @@ module.exports.getCacheKey = () => { readFileSync(require.resolve('./configs/lazy-imports.js')), readFileSync(require.resolve('./passthrough-syntax-plugins.js')), readFileSync(require.resolve('./plugin-warn-on-deep-imports.js')), + readFileSync(require.resolve('./inline-platform-plugin.js')), ].forEach(part => key.update(part)); cacheKey = key.digest('hex'); return cacheKey; }; module.exports.getPreset = main.getPreset; +module.exports.inlinePlatformPlugin = require('./inline-platform-plugin'); module.exports.passthroughSyntaxPlugins = require('./passthrough-syntax-plugins'); diff --git a/packages/react-native-babel-preset/src/inline-platform-plugin.js b/packages/react-native-babel-preset/src/inline-platform-plugin.js new file mode 100644 index 000000000000..c818ff3331d5 --- /dev/null +++ b/packages/react-native-babel-preset/src/inline-platform-plugin.js @@ -0,0 +1,531 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict + * @format + */ + +// This file uses Flow comment syntax so that it may be used from source as part +// of a transformer without itself requiring transformation, matching +// ./index.js. + +'use strict'; + +/*:: +import type {PluginObj} from '@babel/core'; +import type {Binding, NodePath} from '@babel/traverse'; +import type { + CallExpression, + MemberExpression, + Node, + ObjectExpression, + ObjectPattern, +} from '@babel/types'; +// Type-only import. No runtime dependency. +// eslint-disable-next-line import/no-extraneous-dependencies +import typeof * as Types from '@babel/types'; + +export type Options = { + platform: ?string, +}; + +// What a proven expression refers to. +// +// PLATFORM the Platform object itself +// RN_BARREL the `react-native` module's exports object +// PLATFORM_MODULE the exports object of Libraries/Utilities/Platform +type Provenance = 'platform' | 'rn-barrel' | 'platform-module'; + +type State = { + opts: Options, + filename?: ?string, + ... +}; +*/ + +const nodePath = require('node:path'); + +const RN_PACKAGE_NAME = 'react-native'; +const PLATFORM_MODULE_PATH = 'Libraries/Utilities/Platform'; +const RN_PLATFORM_SPECIFIER = RN_PACKAGE_NAME + '/' + PLATFORM_MODULE_PATH; +const SOURCE_EXTENSIONS = ['.js', '.jsx', '.ts', '.tsx']; + +const PLATFORM /*: Provenance */ = 'platform'; +const RN_BARREL /*: Provenance */ = 'rn-barrel'; +const PLATFORM_MODULE /*: Provenance */ = 'platform-module'; + +// Sentinel stored while a binding is being resolved, to break alias cycles. +const RESOLVING = 'resolving'; + +function toPosix(filePath /*: string */) /*: string */ { + return filePath.split(nodePath.sep).join('/').split('\\').join('/'); +} + +function stripSourceExtension(filePath /*: string */) /*: string */ { + for (const extension of SOURCE_EXTENSIONS) { + if (filePath.endsWith(extension)) { + return filePath.slice(0, -extension.length); + } + } + return filePath; +} + +/** + * Whether a relative specifier in `filename` logically refers to React + * Native's own Platform module. + * + * This is a purely lexical judgement - we never touch the filesystem, and we + * never resolve the platform-specific implementation (Platform.ios.js, + * Platform.android.js). Metro does that later; the identity we care about here + * is the extension-less module `/Libraries/Utilities/Platform`. + * + * `filename` may be absolute or project-root-relative: Metro passes + * `path.relative(projectRoot, filePath)`, while Babel callers generally pass an + * absolute path. Both work, because everything below is relative arithmetic on + * the importer's own path. It does mean a relative importer path is interpreted + * as being rooted at the project root, so this assumes the project root is not + * itself inside the react-native package - true for any real app, and for RN's + * own repo, where the project root is the monorepo root. + * + * The React Native package root is identified by its directory name, which + * holds for every layout we need to support: + * + * node_modules/react-native/... + * packages/react-native/... + * node_modules/.pnpm/react-native@x.y.z/node_modules/react-native/... + * + * We deliberately do not accept a path that merely ends in + * `Libraries/Utilities/Platform`: an app with its own module of that name must + * not be inlined. + */ +function isRelativeReactNativePlatformImport( + specifier /*: string */, + filename /*: ?string */, +) /*: boolean */ { + if (filename == null || filename === '') { + return false; + } + + const importer = toPosix(filename); + // Resolve with posix semantics against the importer's directory, so that a + // relative importer path stays relative rather than being resolved against + // the process cwd (which has nothing to do with the bundle). + const target = stripSourceExtension( + nodePath.posix.join(nodePath.posix.dirname(importer), specifier), + ); + const suffix = '/' + PLATFORM_MODULE_PATH; + + if (!target.endsWith(suffix)) { + return false; + } + + const reactNativeRoot = target.slice(0, -suffix.length); + + // A specifier that climbs above the root it was resolved against cannot be + // trusted; `join` leaves the leading `..` segments in place. + if (reactNativeRoot.startsWith('..')) { + return false; + } + + // The importer must live inside the same React Native package. + if (!importer.startsWith(reactNativeRoot + '/')) { + return false; + } + + return nodePath.posix.basename(reactNativeRoot) === RN_PACKAGE_NAME; +} + +function isRelativeSpecifier(specifier /*: string */) /*: boolean */ { + return specifier.startsWith('./') || specifier.startsWith('../'); +} + +/** + * Non-computed, identifier-keyed property name, or null. + */ +function getStaticPropertyName( + node /*: MemberExpression */, +) /*: string | null */ { + if (node.computed === true) { + return null; + } + if (node.property.type === 'Identifier') { + return node.property.name; + } + return null; +} + +module.exports = function inlinePlatformPlugin( + {types: t} /*: {types: Types} */, +) /*: PluginObj */ { + // Per-file cache of resolved binding provenance, reset in `pre()`. Held in a + // closure rather than on the plugin pass so the visitor need not reference + // `this`. + let rnBindingCache /*: WeakMap */ = + new WeakMap(); + + /** + * What module a specifier resolves to, from React Native's point of view. + */ + function getModuleProvenance( + specifier /*: string */, + state /*: State */, + ) /*: Provenance | null */ { + if (specifier === RN_PACKAGE_NAME) { + return RN_BARREL; + } + if (specifier === RN_PLATFORM_SPECIFIER) { + return PLATFORM_MODULE; + } + if (!isRelativeSpecifier(specifier)) { + return null; + } + return isRelativeReactNativePlatformImport(specifier, state.filename) + ? PLATFORM_MODULE + : null; + } + + /** + * Reading `propertyName` off an expression with `objectProvenance`. + */ + function getMemberProvenance( + objectProvenance /*: Provenance | null */, + propertyName /*: string */, + ) /*: Provenance | null */ { + if (objectProvenance === RN_BARREL && propertyName === 'Platform') { + return PLATFORM; + } + if (objectProvenance === PLATFORM_MODULE && propertyName === 'default') { + return PLATFORM; + } + return null; + } + + function getRequireCallProvenance( + path /*: NodePath */, + state /*: State */, + ) /*: Provenance | null */ { + if (!path.get('callee').isIdentifier({name: 'require'})) { + return null; + } + // Only a free `require` is a module import. A local binding named + // `require` may be anything at all. + if (path.scope.getBinding('require') != null) { + return null; + } + const args = path.node.arguments; + if (args.length !== 1 || args[0].type !== 'StringLiteral') { + return null; + } + return getModuleProvenance(args[0].value, state); + } + + function getExpressionProvenance( + path /*: NodePath<$FlowFixMe> */, + state /*: State */, + ) /*: Provenance | null */ { + if (path.isIdentifier()) { + const binding = path.scope.getBinding(path.node.name); + return binding == null ? null : getBindingProvenance(binding, state); + } + if (path.isMemberExpression()) { + const propertyName = getStaticPropertyName(path.node); + if (propertyName == null) { + return null; + } + return getMemberProvenance( + getExpressionProvenance(path.get('object'), state), + propertyName, + ); + } + if (path.isCallExpression()) { + return getRequireCallProvenance(path, state); + } + return null; + } + + function getImportBindingProvenance( + binding /*: Binding */, + state /*: State */, + ) /*: Provenance | null */ { + const specifierPath = binding.path; + const declaration = specifierPath.parent; + + if (declaration.type !== 'ImportDeclaration') { + return null; + } + // `import type {Platform} from ...` binds nothing at runtime. + if ( + declaration.importKind === 'type' || + declaration.importKind === 'typeof' + ) { + return null; + } + + const moduleProvenance = getModuleProvenance( + declaration.source.value, + state, + ); + if (moduleProvenance == null) { + return null; + } + + switch (specifierPath.node.type) { + case 'ImportNamespaceSpecifier': + // A namespace object stands in for the module's exports. + return moduleProvenance; + case 'ImportDefaultSpecifier': + // `react-native` is CommonJS, so interop hands back the barrel itself. + return moduleProvenance === RN_BARREL + ? RN_BARREL + : getMemberProvenance(moduleProvenance, 'default'); + case 'ImportSpecifier': { + if (specifierPath.node.importKind === 'type') { + return null; + } + const imported = specifierPath.node.imported; + const importedName = + imported.type === 'Identifier' ? imported.name : imported.value; + return getMemberProvenance(moduleProvenance, importedName); + } + default: + return null; + } + } + + /** + * Provenance of a `const {Platform} = require('react-native')` style + * binding. + */ + function getDestructuredProvenance( + binding /*: Binding */, + pattern /*: ObjectPattern */, + initProvenance /*: Provenance | null */, + ) /*: Provenance | null */ { + if (initProvenance == null) { + return null; + } + for (const property of pattern.properties) { + if (property.type !== 'ObjectProperty' || property.computed === true) { + continue; + } + // Identity, not name: `const {Platform: P}` binds `P`. + if (property.value !== binding.identifier) { + continue; + } + const key = property.key; + const keyName = + key.type === 'Identifier' + ? key.name + : key.type === 'StringLiteral' + ? key.value + : null; + return keyName == null + ? null + : getMemberProvenance(initProvenance, keyName); + } + return null; + } + + function getVariableBindingProvenance( + binding /*: Binding */, + state /*: State */, + ) /*: Provenance | null */ { + const declaratorPath = binding.path; + const declarator = declaratorPath.node; + if (declarator == null || declarator.type !== 'VariableDeclarator') { + return null; + } + const initPath = declaratorPath.get('init'); + if (Array.isArray(initPath) || initPath.node == null) { + return null; + } + + const id = declarator.id; + if (id.type === 'ObjectPattern') { + return getDestructuredProvenance( + binding, + id, + getExpressionProvenance(initPath, state), + ); + } + if (id.type !== 'Identifier') { + return null; + } + return getExpressionProvenance(initPath, state); + } + + function getBindingProvenance( + binding /*: Binding */, + state /*: State */, + ) /*: Provenance | null */ { + const cache = rnBindingCache; + const cached = cache.get(binding); + if (cached !== undefined) { + // An alias cycle is not resolvable. + return cached === RESOLVING ? null : cached; + } + cache.set(binding, RESOLVING); + + let provenance = null; + if (binding.kind === 'module') { + provenance = getImportBindingProvenance(binding, state); + } else if (binding.constant && binding.constantViolations.length === 0) { + // Only immutable bindings can be followed - a reassignable one may hold + // something else by the time it is read. + provenance = getVariableBindingProvenance(binding, state); + } + + cache.set(binding, provenance); + return provenance; + } + + function isPlatform( + path /*: NodePath<$FlowFixMe> */, + state /*: State */, + ) /*: boolean */ { + return getExpressionProvenance(path, state) === PLATFORM; + } + + /** + * Contexts in which replacing an expression with a literal is invalid. + */ + function isWriteTarget( + path /*: NodePath */, + ) /*: boolean */ { + const {parent, node} = path; + if (parent.type === 'AssignmentExpression' && parent.left === node) { + return true; + } + if (parent.type === 'UpdateExpression' && parent.argument === node) { + return true; + } + if (parent.type === 'UnaryExpression' && parent.operator === 'delete') { + return true; + } + return false; + } + + // The following two helpers intentionally mirror Metro's inline-plugin so + // that a Platform.select call inlines identically whichever pass reaches it + // first. + function hasStaticProperties( + objectExpression /*: ObjectExpression */, + ) /*: boolean */ { + return objectExpression.properties.every(property => { + if (property.computed === true || t.isSpreadElement(property)) { + return false; + } + if (t.isObjectMethod(property) && property.kind !== 'method') { + return false; + } + return t.isIdentifier(property.key) || t.isStringLiteral(property.key); + }); + } + + function findProperty( + objectExpression /*: ObjectExpression */, + key /*: string */, + fallback /*: () => Node */, + ) /*: Node */ { + for (const property of objectExpression.properties) { + if (!t.isObjectProperty(property) && !t.isObjectMethod(property)) { + continue; + } + if ( + (t.isIdentifier(property.key) && property.key.name === key) || + (t.isStringLiteral(property.key) && property.key.value === key) + ) { + if (t.isObjectProperty(property)) { + return property.value; + } + return t.toExpression(property); + } + } + return fallback(); + } + + /** + * The target platform, or null if there is nothing safe to inline to. + * + * Callers without a concrete platform are not consistent about how they say + * so: Metro passes `null` for platform-agnostic builds, while React Native's + * own Jest preprocessor passes the empty string. Inlining to `""` in either + * case would be actively wrong, so treat both as "no platform". + */ + function getTargetPlatform(state /*: State */) /*: string | null */ { + const platform = state.opts.platform; + return platform == null || platform === '' ? null : platform; + } + + return { + name: 'inline-platform', + pre() /*: void */ { + rnBindingCache = new WeakMap(); + }, + visitor: { + MemberExpression( + path /*: NodePath */, + state /*: State */, + ) /*: void */ { + const platform = getTargetPlatform(state); + if (platform == null) { + return; + } + if (getStaticPropertyName(path.node) !== 'OS') { + return; + } + if (isWriteTarget(path)) { + return; + } + if (!isPlatform(path.get('object'), state)) { + return; + } + path.replaceWith(t.stringLiteral(platform)); + }, + CallExpression( + path /*: NodePath */, + state /*: State */, + ) /*: void */ { + const platform = getTargetPlatform(state); + if (platform == null) { + return; + } + const callee = path.get('callee'); + const calleeNode = callee.node; + if (calleeNode.type !== 'MemberExpression') { + return; + } + if (getStaticPropertyName(calleeNode) !== 'select') { + return; + } + const args = path.node.arguments; + const spec = args[0]; + if ( + args.length !== 1 || + spec == null || + spec.type !== 'ObjectExpression' + ) { + return; + } + if (!hasStaticProperties(spec)) { + return; + } + const calleeObject = callee.get('object'); + if (Array.isArray(calleeObject) || !isPlatform(calleeObject, state)) { + return; + } + + path.replaceWith( + findProperty(spec, platform, () => + findProperty(spec, 'native', () => + findProperty(spec, 'default', () => t.identifier('undefined')), + ), + ), + ); + }, + }, + }; +}; diff --git a/packages/react-native-babel-preset/src/plugin-warn-on-deep-imports.js b/packages/react-native-babel-preset/src/plugin-warn-on-deep-imports.js index 98f317586fa4..5e98ed59ad74 100644 --- a/packages/react-native-babel-preset/src/plugin-warn-on-deep-imports.js +++ b/packages/react-native-babel-preset/src/plugin-warn-on-deep-imports.js @@ -38,10 +38,6 @@ function isDeepReactNativeImport(source) { return parts.length > 1 && parts[0] === 'react-native'; } -function isInitializeCoreImport(source) { - return source === 'react-native/Libraries/Core/InitializeCore'; -} - function withLocation(node, loc) { if (!node.loc) { return {...node, loc}; @@ -55,7 +51,7 @@ module.exports = ({types: t}) => ({ ImportDeclaration(path, state) { const source = path.node.source.value; - if (isDeepReactNativeImport(source) && !isInitializeCoreImport(source)) { + if (isDeepReactNativeImport(source)) { const loc = path.node.loc; state.import.push({source, loc}); } @@ -71,10 +67,7 @@ module.exports = ({types: t}) => ({ ) { const source = args[0].node.type === 'StringLiteral' ? args[0].node.value : ''; - if ( - isDeepReactNativeImport(source) && - !isInitializeCoreImport(source) - ) { + if (isDeepReactNativeImport(source)) { const loc = path.node.loc; state.require.push({source, loc}); } @@ -83,11 +76,7 @@ module.exports = ({types: t}) => ({ ExportNamedDeclaration(path, state) { const source = path.node.source; - if ( - source && - isDeepReactNativeImport(source.value) && - !isInitializeCoreImport(source) - ) { + if (source && isDeepReactNativeImport(source.value)) { const loc = path.node.loc; state.export.push({source: source.value, loc}); } diff --git a/packages/react-native-babel-transformer/README.md b/packages/react-native-babel-transformer/README.md new file mode 100644 index 000000000000..ca5a8744d6f5 --- /dev/null +++ b/packages/react-native-babel-transformer/README.md @@ -0,0 +1,8 @@ +# @react-native/metro-babel-transformer + +[![npm]](https://www.npmjs.com/package/@react-native/metro-babel-transformer) [![npm downloads]](https://www.npmjs.com/package/@react-native/metro-babel-transformer) + +[npm]: https://img.shields.io/npm/v/@react-native/metro-babel-transformer.svg?color=blue +[npm downloads]: https://img.shields.io/npm/dm/@react-native/metro-babel-transformer.svg + +Metro Babel transformer for React Native applications. Applies [`@react-native/babel-preset`](https://www.npmjs.com/package/@react-native/babel-preset) when transforming source files during bundling. diff --git a/packages/react-native-babel-transformer/package.json b/packages/react-native-babel-transformer/package.json index cffaffd96b47..e061ad661702 100644 --- a/packages/react-native-babel-transformer/package.json +++ b/packages/react-native-babel-transformer/package.json @@ -4,7 +4,7 @@ "description": "Babel transformer for React Native applications.", "repository": { "type": "git", - "url": "git+ssh://git@github.com/facebook/react-native.git", + "url": "git+ssh://git@github.com/react/react-native.git", "directory": "packages/react-native-babel-transformer" }, "keywords": [ @@ -28,7 +28,7 @@ "dependencies": { "@babel/core": "^7.25.2", "@react-native/babel-preset": "0.87.0-main", - "hermes-parser": "0.36.1", + "flow-parser": "0.327.0", "nullthrows": "^1.1.1" }, "peerDependencies": { diff --git a/packages/react-native-babel-transformer/src/__tests__/inline-platform-integration-test.js b/packages/react-native-babel-transformer/src/__tests__/inline-platform-integration-test.js new file mode 100644 index 000000000000..dfbf52083153 --- /dev/null +++ b/packages/react-native-babel-transformer/src/__tests__/inline-platform-integration-test.js @@ -0,0 +1,200 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + */ + +'use strict'; + +const generate = require('@babel/generator').default; +const path = require('node:path'); + +const PROJECT_ROOT = path.sep === '/' ? '/my/project' : 'C:\\my\\project'; +const RN_ROOT = path.join(PROJECT_ROOT, 'node_modules', 'react-native'); + +// The transformer memoizes its resolved Babel config in a module-level +// closure, keyed on nothing - so a fresh module instance is required for every +// distinct `options` shape, or later variants silently reuse the first +// variant's config. +beforeEach(() => { + jest.resetModules(); +}); + +function transformToCode( + src: string, + { + filename = path.join(PROJECT_ROOT, 'App.js'), + platform = 'ios', + experimentalImportSupport = false, + inlinePlatform = true, + }: { + filename?: string, + platform?: ?string, + experimentalImportSupport?: boolean, + inlinePlatform?: boolean, + } = {}, +): string { + const {transform} = require('../index.js'); + const {ast} = transform({ + filename, + src, + plugins: [], + options: { + dev: true, + enableBabelRuntime: false, + enableBabelRCLookup: false, + experimentalImportSupport, + globalPrefix: '__metro__', + hot: false, + inlinePlatform, + minify: false, + platform, + publicPath: 'test', + projectRoot: PROJECT_ROOT, + }, + }); + return generate(ast).code; +} + +// Each of these must inline during RN's own Babel pass, before ESM lowering +// destroys the evidence that the value came from React Native. +const IMPORT_FORMS = [ + { + name: 'named import from react-native', + src: "import {Platform} from 'react-native';\nconst os = Platform.OS;", + }, + { + name: 'aliased named import from react-native', + src: "import {Platform as P} from 'react-native';\nconst os = P.OS;", + }, + { + name: 'namespace import from react-native', + src: "import * as RN from 'react-native';\nconst os = RN.Platform.OS;", + }, + { + name: 'public deep default import', + src: "import P from 'react-native/Libraries/Utilities/Platform';\nconst os = P.OS;", + }, + { + name: 'destructured require of react-native', + src: "const {Platform} = require('react-native');\nconst os = Platform.OS;", + }, +]; + +describe.each([false, true])( + 'with experimentalImportSupport=%s', + experimentalImportSupport => { + test.each(IMPORT_FORMS)('inlines Platform.OS for a $name', ({src}) => { + const code = transformToCode(src, {experimentalImportSupport}); + + expect(code).toContain('"ios"'); + expect(code).not.toMatch(/\.OS\b/); + }); + + test('inlines Platform.select', () => { + const code = transformToCode( + "import {Platform} from 'react-native';\n" + + 'const value = Platform.select({ios: 1, android: 2});', + {experimentalImportSupport}, + ); + + expect(code).not.toContain('select'); + expect(code).toMatch(/[=]\s*1/); + }); + + test('inlines an RN-internal relative import', () => { + const code = transformToCode( + "import Platform from '../../Utilities/Platform';\nconst os = Platform.OS;", + { + filename: path.join( + RN_ROOT, + 'Libraries', + 'Components', + 'ScrollView', + 'ScrollView.js', + ), + experimentalImportSupport, + }, + ); + + expect(code).toContain('"ios"'); + expect(code).not.toMatch(/\.OS\b/); + }); + + test('leaves the import in place after inlining', () => { + // Removing it would change dependency collection; that is out of scope + // here and handled by a separate opt-in pass. + const code = transformToCode( + "import {Platform} from 'react-native';\nconst os = Platform.OS;", + {experimentalImportSupport}, + ); + + expect(code).toContain('react-native'); + }); + + test('does not inline a same-named import from another package', () => { + const code = transformToCode( + "import Platform from 'other-package';\nconst os = Platform.OS;", + {experimentalImportSupport}, + ); + + expect(code).toMatch(/\.OS\b/); + expect(code).not.toContain('"ios"'); + }); + + test('does not inline when no platform is given', () => { + const code = transformToCode( + "import {Platform} from 'react-native';\nconst os = Platform.OS;", + {platform: null, experimentalImportSupport}, + ); + + expect(code).toMatch(/\.OS\b/); + }); + + test('does not inline without the inlinePlatform opt-in', () => { + // Metro sets this per build; consumers that only need platform-correct + // resolution (Jest) pass a platform without it and must keep `Platform` + // observable so it can be mocked. + const code = transformToCode( + "import {Platform} from 'react-native';\nconst os = Platform.OS;", + {inlinePlatform: false, experimentalImportSupport}, + ); + + expect(code).toMatch(/\.OS\b/); + expect(code).not.toContain('"ios"'); + }); + }, +); + +test('the two import-support modes really do produce different output', () => { + // Guards the test setup itself: without a module reset between variants the + // memoized config leaks and the parameterized suite above would silently run + // the same configuration twice. + const src = "import {Platform} from 'react-native';\nconst x = Other.thing;"; + + const lowered = transformToCode(src, {experimentalImportSupport: false}); + jest.resetModules(); + const preserved = transformToCode(src, {experimentalImportSupport: true}); + + expect(lowered).toContain('require'); + expect(preserved).toContain('import'); + expect(preserved).not.toContain('require'); +}); + +test('inlines before the preset lowers ESM to CommonJS interop', () => { + // Guards the ordering contract: if the plugin ran after the RN preset's + // import transform, it would see `_reactNative.Platform.OS` and the + // specifier proving RN provenance would be gone. + const code = transformToCode( + "import {Platform} from 'react-native';\nconst os = Platform.OS;", + {experimentalImportSupport: false}, + ); + + expect(code).toContain('require'); + expect(code).toContain('"ios"'); + expect(code).not.toMatch(/_reactNative\.Platform/); +}); diff --git a/packages/react-native-babel-transformer/src/__tests__/transform-test.js b/packages/react-native-babel-transformer/src/__tests__/transform-test.js index bdf4e79c7c52..dd262f664111 100644 --- a/packages/react-native-babel-transformer/src/__tests__/transform-test.js +++ b/packages/react-native-babel-transformer/src/__tests__/transform-test.js @@ -11,7 +11,7 @@ 'use strict'; const {transform} = require('../index.js'); -const path = require('path'); +const path = require('node:path'); const PROJECT_ROOT = path.sep === '/' ? '/my/project' : 'C:\\my\\project'; diff --git a/packages/react-native-babel-transformer/src/index.js b/packages/react-native-babel-transformer/src/index.js index d2297ea461b7..a830c9cd1072 100644 --- a/packages/react-native-babel-transformer/src/index.js +++ b/packages/react-native-babel-transformer/src/index.js @@ -16,6 +16,7 @@ /*:: import type {BabelCoreOptions, Plugins, TransformResult} from '@babel/core'; +import type {File as BabelNodeFile} from '@babel/types'; import type { BabelTransformer, MetroBabelFileMetadata, @@ -25,10 +26,10 @@ import type { const {parseSync, transformFromAstSync} = require('@babel/core'); const {getCacheKey: getPresetCacheKey} = require('@react-native/babel-preset'); const makeHMRConfig = require('@react-native/babel-preset/src/configs/hmr'); -const crypto = require('crypto'); -const fs = require('fs'); +const crypto = require('node:crypto'); +const fs = require('node:fs'); +const path = require('node:path'); const nullthrows = require('nullthrows'); -const path = require('path'); const cacheKeyParts = [getPresetCacheKey(), fs.readFileSync(__filename)]; @@ -196,6 +197,8 @@ const transform /*: BabelTransformer['transform'] */ = ({ name: 'metro', bundler: 'metro', platform: options.platform, + // $FlowFixMe[prop-missing] Remove suppression after next Metro release + inlinePlatform: options.inlinePlatform, unstable_transformProfile: options.unstable_transformProfile, }, ast: true, @@ -212,7 +215,7 @@ const transform /*: BabelTransformer['transform'] */ = ({ !options.hermesParser ? parseSync(src, babelConfig) : // $FlowFixMe[incompatible-exact] - require('hermes-parser').parse(src, { + require('flow-parser').parse(src, { babel: true, reactRuntimeTarget: '19', sourceType: babelConfig.sourceType, diff --git a/packages/react-native-codegen/.babelrc b/packages/react-native-codegen/.babelrc index 48f52627f8b6..d2b80640078d 100644 --- a/packages/react-native-codegen/.babelrc +++ b/packages/react-native-codegen/.babelrc @@ -1,6 +1,6 @@ { "plugins": [ - "babel-plugin-syntax-hermes-parser", + "flow-parser/babel-plugin", "@babel/plugin-transform-flow-strip-types", "@babel/plugin-syntax-dynamic-import", "@babel/plugin-transform-class-properties", diff --git a/packages/react-native-codegen/README.md b/packages/react-native-codegen/README.md index 8f6856b1c8f0..f598c58e9136 100644 --- a/packages/react-native-codegen/README.md +++ b/packages/react-native-codegen/README.md @@ -1,21 +1,8 @@ # @react-native/codegen -[![Version][version-badge]][package] +[![npm]](https://www.npmjs.com/package/@react-native/codegen) [![npm downloads]](https://www.npmjs.com/package/@react-native/codegen) -## Installation +[npm]: https://img.shields.io/npm/v/@react-native/codegen.svg?color=blue +[npm downloads]: https://img.shields.io/npm/dm/@react-native/codegen.svg -``` -yarn add --dev @react-native/codegen -``` - -*Note: We're using `yarn` to install deps. Feel free to change commands to use `npm` 3+ and `npx` if you like* - -[version-badge]: https://img.shields.io/npm/v/@react-native/codegen?style=flat-square -[package]: https://www.npmjs.com/package/@react-native/codegen - -## Testing - -To run the tests in this package, run the following commands from the React Native root folder: - -1. `yarn` to install the dependencies. You just need to run this once -2. `yarn jest packages/react-native-codegen`. +Code generation tools for React Native. Parses TypeScript and Flow NativeModule and Component specs and generates the native binding code used by the New Architecture. diff --git a/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GenerateComponentDescriptorH-test.js b/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GenerateComponentDescriptorH-test.js index 9f2eed58d9c0..cfda239a7631 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GenerateComponentDescriptorH-test.js +++ b/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GenerateComponentDescriptorH-test.js @@ -12,7 +12,7 @@ const generator = require('../../../../src/generators/components/GenerateComponentDescriptorH'); const {FlowParser} = require('../../../../src/parsers/flow/parser'); -const fs = require('fs'); +const fs = require('node:fs'); const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; diff --git a/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GenerateComponentHObjCpp-test.js b/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GenerateComponentHObjCpp-test.js index a209210416f0..431567afc2de 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GenerateComponentHObjCpp-test.js +++ b/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GenerateComponentHObjCpp-test.js @@ -12,7 +12,7 @@ const generator = require('../../../../src/generators/components/GenerateComponentHObjCpp'); const {FlowParser} = require('../../../../src/parsers/flow/parser'); -const fs = require('fs'); +const fs = require('node:fs'); const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; diff --git a/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GenerateEventEmitterCpp-test.js b/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GenerateEventEmitterCpp-test.js index 3029bfe839ea..741f03569f20 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GenerateEventEmitterCpp-test.js +++ b/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GenerateEventEmitterCpp-test.js @@ -12,7 +12,7 @@ const generator = require('../../../../src/generators/components/GenerateEventEmitterCpp'); const {FlowParser} = require('../../../../src/parsers/flow/parser'); -const fs = require('fs'); +const fs = require('node:fs'); const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; diff --git a/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GenerateEventEmitterH-test.js b/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GenerateEventEmitterH-test.js index 975cee695adf..505e40e15158 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GenerateEventEmitterH-test.js +++ b/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GenerateEventEmitterH-test.js @@ -12,7 +12,7 @@ const generator = require('../../../../src/generators/components/GenerateEventEmitterH'); const {FlowParser} = require('../../../../src/parsers/flow/parser'); -const fs = require('fs'); +const fs = require('node:fs'); const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; diff --git a/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GeneratePropsCpp-test.js b/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GeneratePropsCpp-test.js index f4f94f01ab2e..11bb59fab676 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GeneratePropsCpp-test.js +++ b/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GeneratePropsCpp-test.js @@ -12,7 +12,7 @@ const generator = require('../../../../src/generators/components/GeneratePropsCpp'); const {FlowParser} = require('../../../../src/parsers/flow/parser'); -const fs = require('fs'); +const fs = require('node:fs'); const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; diff --git a/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GeneratePropsH-test.js b/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GeneratePropsH-test.js index 1522971a181b..4e6f126182ad 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GeneratePropsH-test.js +++ b/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GeneratePropsH-test.js @@ -12,7 +12,7 @@ const generator = require('../../../../src/generators/components/GeneratePropsH'); const {FlowParser} = require('../../../../src/parsers/flow/parser'); -const fs = require('fs'); +const fs = require('node:fs'); const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; diff --git a/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GeneratePropsJavaDelegate-test.js b/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GeneratePropsJavaDelegate-test.js index 1d0cdb8ff44c..fe884344f342 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GeneratePropsJavaDelegate-test.js +++ b/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GeneratePropsJavaDelegate-test.js @@ -12,7 +12,7 @@ const generator = require('../../../../src/generators/components/GeneratePropsJavaDelegate'); const {FlowParser} = require('../../../../src/parsers/flow/parser'); -const fs = require('fs'); +const fs = require('node:fs'); const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; diff --git a/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GeneratePropsJavaInterface-test.js b/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GeneratePropsJavaInterface-test.js index f21cca747107..eaca27336be8 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GeneratePropsJavaInterface-test.js +++ b/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GeneratePropsJavaInterface-test.js @@ -12,7 +12,7 @@ const generator = require('../../../../src/generators/components/GeneratePropsJavaInterface'); const {FlowParser} = require('../../../../src/parsers/flow/parser'); -const fs = require('fs'); +const fs = require('node:fs'); const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; const fixtures = fs.readdirSync(FIXTURE_DIR); diff --git a/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GenerateShadowNodeCpp-test.js b/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GenerateShadowNodeCpp-test.js index fcadc24082b8..ac1050157546 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GenerateShadowNodeCpp-test.js +++ b/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GenerateShadowNodeCpp-test.js @@ -12,7 +12,7 @@ const generator = require('../../../../src/generators/components/GenerateShadowNodeCpp'); const {FlowParser} = require('../../../../src/parsers/flow/parser'); -const fs = require('fs'); +const fs = require('node:fs'); const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; const fixtures = fs.readdirSync(FIXTURE_DIR); diff --git a/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GenerateShadowNodeH-test.js b/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GenerateShadowNodeH-test.js index 6b2f235e36ed..42fa92225f99 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GenerateShadowNodeH-test.js +++ b/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GenerateShadowNodeH-test.js @@ -12,7 +12,7 @@ const generator = require('../../../../src/generators/components/GenerateShadowNodeH'); const {FlowParser} = require('../../../../src/parsers/flow/parser'); -const fs = require('fs'); +const fs = require('node:fs'); const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; const fixtures = fs.readdirSync(FIXTURE_DIR); diff --git a/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GenerateViewConfigJs-test.js b/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GenerateViewConfigJs-test.js index c760d39dd18d..36d3c7e06295 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GenerateViewConfigJs-test.js +++ b/packages/react-native-codegen/e2e/deep_imports/__tests__/components/GenerateViewConfigJs-test.js @@ -12,7 +12,7 @@ const generator = require('../../../../src/generators/components/GenerateViewConfigJs'); const {FlowParser} = require('../../../../src/parsers/flow/parser'); -const fs = require('fs'); +const fs = require('node:fs'); const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; diff --git a/packages/react-native-codegen/e2e/deep_imports/__tests__/modules/GenerateModuleH-test.js b/packages/react-native-codegen/e2e/deep_imports/__tests__/modules/GenerateModuleH-test.js index 2d90018c849d..bc3d58f82b5d 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__tests__/modules/GenerateModuleH-test.js +++ b/packages/react-native-codegen/e2e/deep_imports/__tests__/modules/GenerateModuleH-test.js @@ -14,7 +14,7 @@ import type {SchemaType} from '../../../../src/CodegenSchema'; const generator = require('../../../../src/generators/modules/GenerateModuleH'); const {FlowParser} = require('../../../../src/parsers/flow/parser'); -const fs = require('fs'); +const fs = require('node:fs'); const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/modules`; diff --git a/packages/react-native-codegen/e2e/deep_imports/__tests__/modules/GenerateModuleObjCpp-test.js b/packages/react-native-codegen/e2e/deep_imports/__tests__/modules/GenerateModuleObjCpp-test.js index 2ec90f56f724..6a5782b6e488 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__tests__/modules/GenerateModuleObjCpp-test.js +++ b/packages/react-native-codegen/e2e/deep_imports/__tests__/modules/GenerateModuleObjCpp-test.js @@ -14,7 +14,7 @@ import type {SchemaType} from '../../../../src/CodegenSchema'; const generator = require('../../../../src/generators/modules/GenerateModuleObjCpp'); const {FlowParser} = require('../../../../src/parsers/flow/parser'); -const fs = require('fs'); +const fs = require('node:fs'); const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/modules`; diff --git a/packages/react-native-codegen/e2e/deep_imports/__tests__/modules/__snapshots__/GenerateModuleObjCpp-test.js.snap b/packages/react-native-codegen/e2e/deep_imports/__tests__/modules/__snapshots__/GenerateModuleObjCpp-test.js.snap index 9bf2025a3a4f..e0bd0c195c0e 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__tests__/modules/__snapshots__/GenerateModuleObjCpp-test.js.snap +++ b/packages/react-native-codegen/e2e/deep_imports/__tests__/modules/__snapshots__/GenerateModuleObjCpp-test.js.snap @@ -26,6 +26,7 @@ exports[`GenerateModuleObjCpp can generate a header file NativeModule specs 1`] #import #import #import +#import #import #import #import @@ -1578,6 +1579,7 @@ exports[`GenerateModuleObjCpp can generate a header file NativeModule specs with #import #import #import +#import #import #import #import diff --git a/packages/react-native-codegen/e2e/namespaced/__tests__/components/GenerateComponentDescriptorH-test.js b/packages/react-native-codegen/e2e/namespaced/__tests__/components/GenerateComponentDescriptorH-test.js index 3dfc73d56d99..529929d0a811 100644 --- a/packages/react-native-codegen/e2e/namespaced/__tests__/components/GenerateComponentDescriptorH-test.js +++ b/packages/react-native-codegen/e2e/namespaced/__tests__/components/GenerateComponentDescriptorH-test.js @@ -12,7 +12,7 @@ const generator = require('../../../../src/generators/components/GenerateComponentDescriptorH'); const {FlowParser} = require('../../../../src/parsers/flow/parser'); -const fs = require('fs'); +const fs = require('node:fs'); const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; diff --git a/packages/react-native-codegen/e2e/namespaced/__tests__/components/GenerateComponentHObjCpp-test.js b/packages/react-native-codegen/e2e/namespaced/__tests__/components/GenerateComponentHObjCpp-test.js index efd2887d6f2a..ee12bd82bcbc 100644 --- a/packages/react-native-codegen/e2e/namespaced/__tests__/components/GenerateComponentHObjCpp-test.js +++ b/packages/react-native-codegen/e2e/namespaced/__tests__/components/GenerateComponentHObjCpp-test.js @@ -12,7 +12,7 @@ const generator = require('../../../../src/generators/components/GenerateComponentHObjCpp'); const {FlowParser} = require('../../../../src/parsers/flow/parser'); -const fs = require('fs'); +const fs = require('node:fs'); const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; diff --git a/packages/react-native-codegen/e2e/namespaced/__tests__/components/GenerateEventEmitterCpp-test.js b/packages/react-native-codegen/e2e/namespaced/__tests__/components/GenerateEventEmitterCpp-test.js index 0c866a062f62..9d6993d71a36 100644 --- a/packages/react-native-codegen/e2e/namespaced/__tests__/components/GenerateEventEmitterCpp-test.js +++ b/packages/react-native-codegen/e2e/namespaced/__tests__/components/GenerateEventEmitterCpp-test.js @@ -12,7 +12,7 @@ const generator = require('../../../../src/generators/components/GenerateEventEmitterCpp'); const {FlowParser} = require('../../../../src/parsers/flow/parser'); -const fs = require('fs'); +const fs = require('node:fs'); const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; diff --git a/packages/react-native-codegen/e2e/namespaced/__tests__/components/GenerateEventEmitterH-test.js b/packages/react-native-codegen/e2e/namespaced/__tests__/components/GenerateEventEmitterH-test.js index 897bd6dfc3ef..2c86aaa84b03 100644 --- a/packages/react-native-codegen/e2e/namespaced/__tests__/components/GenerateEventEmitterH-test.js +++ b/packages/react-native-codegen/e2e/namespaced/__tests__/components/GenerateEventEmitterH-test.js @@ -12,7 +12,7 @@ const generator = require('../../../../src/generators/components/GenerateEventEmitterH'); const {FlowParser} = require('../../../../src/parsers/flow/parser'); -const fs = require('fs'); +const fs = require('node:fs'); const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; diff --git a/packages/react-native-codegen/e2e/namespaced/__tests__/components/GeneratePropsCpp-test.js b/packages/react-native-codegen/e2e/namespaced/__tests__/components/GeneratePropsCpp-test.js index 23341bf1ae66..dedd7a2c3577 100644 --- a/packages/react-native-codegen/e2e/namespaced/__tests__/components/GeneratePropsCpp-test.js +++ b/packages/react-native-codegen/e2e/namespaced/__tests__/components/GeneratePropsCpp-test.js @@ -12,7 +12,7 @@ const generator = require('../../../../src/generators/components/GeneratePropsCpp'); const {FlowParser} = require('../../../../src/parsers/flow/parser'); -const fs = require('fs'); +const fs = require('node:fs'); const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; diff --git a/packages/react-native-codegen/e2e/namespaced/__tests__/components/GeneratePropsH-test.js b/packages/react-native-codegen/e2e/namespaced/__tests__/components/GeneratePropsH-test.js index f5737e381c6e..0971e7b58285 100644 --- a/packages/react-native-codegen/e2e/namespaced/__tests__/components/GeneratePropsH-test.js +++ b/packages/react-native-codegen/e2e/namespaced/__tests__/components/GeneratePropsH-test.js @@ -12,7 +12,7 @@ const generator = require('../../../../src/generators/components/GeneratePropsH'); const {FlowParser} = require('../../../../src/parsers/flow/parser'); -const fs = require('fs'); +const fs = require('node:fs'); const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; diff --git a/packages/react-native-codegen/e2e/namespaced/__tests__/components/GeneratePropsJavaDelegate-test.js b/packages/react-native-codegen/e2e/namespaced/__tests__/components/GeneratePropsJavaDelegate-test.js index f0fcb25f7364..b4c672fcb6d6 100644 --- a/packages/react-native-codegen/e2e/namespaced/__tests__/components/GeneratePropsJavaDelegate-test.js +++ b/packages/react-native-codegen/e2e/namespaced/__tests__/components/GeneratePropsJavaDelegate-test.js @@ -12,7 +12,7 @@ const generator = require('../../../../src/generators/components/GeneratePropsJavaDelegate'); const {FlowParser} = require('../../../../src/parsers/flow/parser'); -const fs = require('fs'); +const fs = require('node:fs'); const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; diff --git a/packages/react-native-codegen/e2e/namespaced/__tests__/components/GeneratePropsJavaInterface-test.js b/packages/react-native-codegen/e2e/namespaced/__tests__/components/GeneratePropsJavaInterface-test.js index f21cca747107..eaca27336be8 100644 --- a/packages/react-native-codegen/e2e/namespaced/__tests__/components/GeneratePropsJavaInterface-test.js +++ b/packages/react-native-codegen/e2e/namespaced/__tests__/components/GeneratePropsJavaInterface-test.js @@ -12,7 +12,7 @@ const generator = require('../../../../src/generators/components/GeneratePropsJavaInterface'); const {FlowParser} = require('../../../../src/parsers/flow/parser'); -const fs = require('fs'); +const fs = require('node:fs'); const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; const fixtures = fs.readdirSync(FIXTURE_DIR); diff --git a/packages/react-native-codegen/e2e/namespaced/__tests__/components/GenerateShadowNodeCpp-test.js b/packages/react-native-codegen/e2e/namespaced/__tests__/components/GenerateShadowNodeCpp-test.js index 11e9d4ced8f6..be895a26a6bf 100644 --- a/packages/react-native-codegen/e2e/namespaced/__tests__/components/GenerateShadowNodeCpp-test.js +++ b/packages/react-native-codegen/e2e/namespaced/__tests__/components/GenerateShadowNodeCpp-test.js @@ -12,7 +12,7 @@ const generator = require('../../../../src/generators/components/GenerateShadowNodeCpp'); const {FlowParser} = require('../../../../src/parsers/flow/parser'); -const fs = require('fs'); +const fs = require('node:fs'); const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; const fixtures = fs.readdirSync(FIXTURE_DIR); diff --git a/packages/react-native-codegen/e2e/namespaced/__tests__/components/GenerateShadowNodeH-test.js b/packages/react-native-codegen/e2e/namespaced/__tests__/components/GenerateShadowNodeH-test.js index 5e550adcdbb6..7b249dcfa3a1 100644 --- a/packages/react-native-codegen/e2e/namespaced/__tests__/components/GenerateShadowNodeH-test.js +++ b/packages/react-native-codegen/e2e/namespaced/__tests__/components/GenerateShadowNodeH-test.js @@ -12,7 +12,7 @@ const generator = require('../../../../src/generators/components/GenerateShadowNodeH'); const {FlowParser} = require('../../../../src/parsers/flow/parser'); -const fs = require('fs'); +const fs = require('node:fs'); const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; const fixtures = fs.readdirSync(FIXTURE_DIR); diff --git a/packages/react-native-codegen/e2e/namespaced/__tests__/components/GenerateViewConfigJs-test.js b/packages/react-native-codegen/e2e/namespaced/__tests__/components/GenerateViewConfigJs-test.js index 1f75c77c665e..d67bf6d54bd0 100644 --- a/packages/react-native-codegen/e2e/namespaced/__tests__/components/GenerateViewConfigJs-test.js +++ b/packages/react-native-codegen/e2e/namespaced/__tests__/components/GenerateViewConfigJs-test.js @@ -12,7 +12,7 @@ const generator = require('../../../../src/generators/components/GenerateViewConfigJs'); const {FlowParser} = require('../../../../src/parsers/flow/parser'); -const fs = require('fs'); +const fs = require('node:fs'); const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; diff --git a/packages/react-native-codegen/package.json b/packages/react-native-codegen/package.json index 0e28eb221680..7429b718c2f4 100644 --- a/packages/react-native-codegen/package.json +++ b/packages/react-native-codegen/package.json @@ -5,10 +5,10 @@ "license": "MIT", "repository": { "type": "git", - "url": "git+https://github.com/facebook/react-native.git", + "url": "git+https://github.com/react/react-native.git", "directory": "packages/react-native-codegen" }, - "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/react-native-codegen#readme", + "homepage": "https://github.com/react/react-native/tree/HEAD/packages/react-native-codegen#readme", "keywords": [ "code", "generation", @@ -16,7 +16,7 @@ "tools", "react-native" ], - "bugs": "https://github.com/facebook/react-native/issues", + "bugs": "https://github.com/react/react-native/issues", "engines": { "node": "^22.13.0 || ^24.3.0 || >= 26.0.0" }, @@ -31,7 +31,7 @@ "dependencies": { "@babel/core": "^7.25.2", "@babel/parser": "^7.29.0", - "hermes-parser": "0.36.1", + "flow-parser": "0.327.0", "invariant": "^2.2.4", "nullthrows": "^1.1.1", "tinyglobby": "^0.2.15", @@ -45,10 +45,9 @@ "@babel/plugin-transform-nullish-coalescing-operator": "^7.24.7", "@babel/plugin-transform-optional-chaining": "^7.24.8", "@babel/preset-env": "^7.25.3", - "babel-plugin-syntax-hermes-parser": "0.36.1", - "hermes-estree": "0.36.1", + "flow-estree": "0.327.0", "micromatch": "^4.0.4", - "prettier": "3.6.2", + "prettier": "3.9.4", "rimraf": "^3.0.2" }, "peerDependencies": { diff --git a/packages/react-native-codegen/scripts/build.js b/packages/react-native-codegen/scripts/build.js index 5b0d668fd56d..93460bfb000f 100644 --- a/packages/react-native-codegen/scripts/build.js +++ b/packages/react-native-codegen/scripts/build.js @@ -24,12 +24,12 @@ 'use strict'; const babel = require('@babel/core'); -const fs = require('fs'); const micromatch = require('micromatch'); -const path = require('path'); +const fs = require('node:fs'); +const path = require('node:path'); +const {styleText} = require('node:util'); const prettier = require('prettier'); const {globSync} = require('tinyglobby'); -const {styleText} = require('util'); const prettierConfig = JSON.parse( fs.readFileSync(path.resolve(__dirname, '..', 'build.prettierrc'), 'utf8'), diff --git a/packages/react-native-codegen/scripts/oss/build.sh b/packages/react-native-codegen/scripts/oss/build.sh index 64c22f5a0a64..b390da38098f 100755 --- a/packages/react-native-codegen/scripts/oss/build.sh +++ b/packages/react-native-codegen/scripts/oss/build.sh @@ -24,7 +24,12 @@ fi YARN_BINARY="${YARN_BINARY:-$YARN_OR_NPM}" # mv command to use when copying files into the working directory -EDEN_SAFE_MV="mv" +SAFE_MV="mv" + +# Detect if we are on a VirtioFS volume via Apple Virtualization.framework +if [[ "$OSTYPE" == "darwin"* ]] && /sbin/mount | /usr/bin/awk -v dev="$(/bin/df -P "$CODEGEN_DIR" | /usr/bin/awk 'NR==2 {print $1}')" '$1 == dev && /AppleVirtIOFS/ { found=1 } END { exit !found }'; then + SAFE_MV="/bin/cp -R -X" +fi if [ -x "$(command -v eden)" ]; then pushd "$THIS_DIR" @@ -32,7 +37,7 @@ if [ -x "$(command -v eden)" ]; then # Detect if we are in an EdenFS checkout with `eden info` (we ignore the output as it creates noise on CI/IDE logs) # Also be sure to use /bin/cp in case users have GNU coreutils installed which is incompatible with -X if [[ "$OSTYPE" == "darwin"* ]] && eden info 2>/dev/null; then - EDEN_SAFE_MV="/bin/cp -R -X" + SAFE_MV="/bin/cp -R -X" fi popd >/dev/null @@ -71,7 +76,7 @@ else popd >/dev/null - $EDEN_SAFE_MV "$TMP_DIR/lib" "$CODEGEN_DIR" - $EDEN_SAFE_MV "$TMP_DIR/node_modules" "$CODEGEN_DIR" + $SAFE_MV "$TMP_DIR/lib" "$CODEGEN_DIR" + $SAFE_MV "$TMP_DIR/node_modules" "$CODEGEN_DIR" rm -rf "$TMP_DIR" fi diff --git a/packages/react-native-codegen/src/CodegenSchema.js b/packages/react-native-codegen/src/CodegenSchema.js index 41b8edabf542..1c383704fd72 100644 --- a/packages/react-native-codegen/src/CodegenSchema.js +++ b/packages/react-native-codegen/src/CodegenSchema.js @@ -270,8 +270,7 @@ export type ReservedTypeAnnotation = Readonly<{ * NativeModule Types */ export type Nullable = - | NullableTypeAnnotation - | T; + NullableTypeAnnotation | T; export type NullableTypeAnnotation = Readonly<{ @@ -345,8 +344,7 @@ export type NativeModuleEnumMember = { }; export type NativeModuleEnumMemberType = - | 'NumberTypeAnnotation' - | 'StringTypeAnnotation'; + 'NumberTypeAnnotation' | 'StringTypeAnnotation'; export type NativeModuleEnumDeclaration = Readonly<{ name: string, @@ -436,12 +434,10 @@ export type NativeModuleBaseTypeAnnotation = | NativeModuleMixedTypeAnnotation; export type NativeModuleParamTypeAnnotation = - | NativeModuleBaseTypeAnnotation - | NativeModuleParamOnlyTypeAnnotation; + NativeModuleBaseTypeAnnotation | NativeModuleParamOnlyTypeAnnotation; export type NativeModuleReturnTypeAnnotation = - | NativeModuleBaseTypeAnnotation - | NativeModuleReturnOnlyTypeAnnotation; + NativeModuleBaseTypeAnnotation | NativeModuleReturnOnlyTypeAnnotation; export type NativeModuleTypeAnnotation = | NativeModuleBaseTypeAnnotation @@ -452,8 +448,7 @@ export type NativeModuleTypeAnnotation = type NativeModuleParamOnlyTypeAnnotation = NativeModuleFunctionTypeAnnotation; type NativeModuleReturnOnlyTypeAnnotation = - | NativeModulePromiseTypeAnnotation - | VoidTypeAnnotation; + NativeModulePromiseTypeAnnotation | VoidTypeAnnotation; // Add the allowed component reserved types to the native module union export type CompleteReservedTypeAnnotation = diff --git a/packages/react-native-codegen/src/cli/combine/combine-js-to-schema.js b/packages/react-native-codegen/src/cli/combine/combine-js-to-schema.js index c8cec5079b0f..7af04ed24471 100644 --- a/packages/react-native-codegen/src/cli/combine/combine-js-to-schema.js +++ b/packages/react-native-codegen/src/cli/combine/combine-js-to-schema.js @@ -14,8 +14,8 @@ import type {SchemaType} from '../../CodegenSchema.js'; const {FlowParser} = require('../../parsers/flow/parser'); const {TypeScriptParser} = require('../../parsers/typescript/parser'); const {filterJSFile} = require('./combine-utils'); -const fs = require('fs'); -const path = require('path'); +const fs = require('node:fs'); +const path = require('node:path'); const {globSync} = require('tinyglobby'); const flowParser = new FlowParser(); diff --git a/packages/react-native-codegen/src/cli/combine/combine-schemas-cli.js b/packages/react-native-codegen/src/cli/combine/combine-schemas-cli.js index 4603e7cac90c..a11b5b94fab0 100644 --- a/packages/react-native-codegen/src/cli/combine/combine-schemas-cli.js +++ b/packages/react-native-codegen/src/cli/combine/combine-schemas-cli.js @@ -16,8 +16,8 @@ import type { SchemaType, } from '../../CodegenSchema.js'; -const assert = require('assert'); -const fs = require('fs'); +const assert = require('node:assert'); +const fs = require('node:fs'); const yargs = require('yargs'); const argv = yargs diff --git a/packages/react-native-codegen/src/cli/combine/combine-utils.js b/packages/react-native-codegen/src/cli/combine/combine-utils.js index fccd2773d314..26c157ae7256 100644 --- a/packages/react-native-codegen/src/cli/combine/combine-utils.js +++ b/packages/react-native-codegen/src/cli/combine/combine-utils.js @@ -10,7 +10,7 @@ 'use strict'; -const path = require('path'); +const path = require('node:path'); /** * This function is used by the CLI to decide whether a JS/TS file has to be diff --git a/packages/react-native-codegen/src/cli/generators/generate-all.js b/packages/react-native-codegen/src/cli/generators/generate-all.js index 0724e23acd18..ed63a275907a 100644 --- a/packages/react-native-codegen/src/cli/generators/generate-all.js +++ b/packages/react-native-codegen/src/cli/generators/generate-all.js @@ -15,7 +15,7 @@ 'use strict'; const RNCodegen = require('../../generators/RNCodegen.js'); -const fs = require('fs'); +const fs = require('node:fs'); const args = process.argv.slice(2); if (args.length < 3) { diff --git a/packages/react-native-codegen/src/cli/parser/parser.js b/packages/react-native-codegen/src/cli/parser/parser.js index 850e27fff4c8..ebfdf29fb1cc 100644 --- a/packages/react-native-codegen/src/cli/parser/parser.js +++ b/packages/react-native-codegen/src/cli/parser/parser.js @@ -12,7 +12,7 @@ const {FlowParser} = require('../../parsers/flow/parser'); const {TypeScriptParser} = require('../../parsers/typescript/parser'); -const path = require('path'); +const path = require('node:path'); const flowParser = new FlowParser(); const typescriptParser = new TypeScriptParser(); diff --git a/packages/react-native-codegen/src/generators/RNCodegen.js b/packages/react-native-codegen/src/generators/RNCodegen.js index face426d207a..032f0bc45cd2 100644 --- a/packages/react-native-codegen/src/generators/RNCodegen.js +++ b/packages/react-native-codegen/src/generators/RNCodegen.js @@ -35,8 +35,8 @@ const generateModuleJavaSpec = require('./modules/GenerateModuleJavaSpec.js'); const generateModuleJniCpp = require('./modules/GenerateModuleJniCpp.js'); const generateModuleJniH = require('./modules/GenerateModuleJniH.js'); const generateModuleObjCpp = require('./modules/GenerateModuleObjCpp'); -const fs = require('fs'); -const path = require('path'); +const fs = require('node:fs'); +const path = require('node:path'); const ALL_GENERATORS = { generateComponentDescriptorH: generateComponentDescriptorH.generate, diff --git a/packages/react-native-codegen/src/generators/__tests__/RNCodegen-test.js b/packages/react-native-codegen/src/generators/__tests__/RNCodegen-test.js index 4949a94d780c..128658483a56 100644 --- a/packages/react-native-codegen/src/generators/__tests__/RNCodegen-test.js +++ b/packages/react-native-codegen/src/generators/__tests__/RNCodegen-test.js @@ -21,7 +21,7 @@ describe('RNCodegen.generate', () => { }); it('when type `all`, with default paths', () => { - jest.mock('fs', () => ({ + jest.mock('node:fs', () => ({ existsSync: location => { return true; }, @@ -29,7 +29,7 @@ describe('RNCodegen.generate', () => { // Jest in the OSS does not allow to capture variables in closures. // Therefore, we have to bring the variables inside the closure. // see: https://github.com/facebook/jest/issues/2567 - const path = require('path'); + const path = require('node:path'); const outputDirectory = 'tmp/out/'; const componentsOutputDir = 'react/renderer/components/library'; const modulesOutputDir = 'library'; diff --git a/packages/react-native-codegen/src/generators/components/GenerateViewConfigJs.js b/packages/react-native-codegen/src/generators/components/GenerateViewConfigJs.js index a91773c12d04..50d8d53b0f9c 100644 --- a/packages/react-native-codegen/src/generators/components/GenerateViewConfigJs.js +++ b/packages/react-native-codegen/src/generators/components/GenerateViewConfigJs.js @@ -15,6 +15,11 @@ import type { PropTypeAnnotation, } from '../../CodegenSchema'; import type {SchemaType} from '../../CodegenSchema'; +import type { + ObjectMethod as BabelNodeObjectMethod, + ObjectProperty as BabelNodeObjectProperty, + SpreadElement as BabelNodeSpreadElement, +} from '@babel/types'; const core = require('@babel/core'); diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js index 58331fb2651f..9dc0b42ce8f6 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js @@ -25,7 +25,11 @@ import type {AliasResolver} from './Utils'; const {unwrapNullable} = require('../../parsers/parsers-commons'); const {wrapOptional} = require('../TypeUtils/Java'); const {parseValidUnionType, toPascalCase} = require('../Utils'); -const {createAliasResolver, getModules} = require('./Utils'); +const { + createAliasResolver, + getModules, + throwIfUnsupportedPromiseArrayBuffer, +} = require('./Utils'); type FilesOutput = Map; @@ -78,16 +82,25 @@ function EventEmitterTemplate( eventEmitter: NativeModuleEventEmitterShape, imports: Set, ): string { + imports.add('com.facebook.react.bridge.CxxCallbackImpl'); + // mEventEmitterCallback is set from JNI by configureEventEmitterCallback(), + // which the generated SpecJSI constructor calls when JS first looks the module + // up. Emitting before that would hit a null field, so the emitted code no-ops + // instead. The local is for readability: reference reads are already atomic, + // and the field is never reset to null. return ` protected final void emit${toPascalCase(eventEmitter.name)}(${ eventEmitter.typeAnnotation.typeAnnotation.type !== 'VoidTypeAnnotation' ? `${translateEventEmitterTypeToJavaType(eventEmitter, imports)} value` : '' }) { - mEventEmitterCallback.invoke("${eventEmitter.name}"${ - eventEmitter.typeAnnotation.typeAnnotation.type !== 'VoidTypeAnnotation' - ? ', value' - : '' - }); + CxxCallbackImpl eventEmitterCallback = mEventEmitterCallback; + if (eventEmitterCallback != null) { + eventEmitterCallback.invoke("${eventEmitter.name}"${ + eventEmitter.typeAnnotation.typeAnnotation.type !== 'VoidTypeAnnotation' + ? ', value' + : '' + }); + } }`; } @@ -170,6 +183,7 @@ function translateEventEmitterTypeToJavaType( case 'FloatTypeAnnotation': case 'Int32TypeAnnotation': case 'VoidTypeAnnotation': + case 'ArrayBufferTypeAnnotation': // TODO: Add support for these types throw new Error( `Unsupported eventType for ${eventEmitter.name}. Found: ${eventEmitter.typeAnnotation.typeAnnotation.type}`, @@ -268,9 +282,8 @@ function translateFunctionParamToJavaType( imports.add('com.facebook.react.bridge.Callback'); return wrapOptional('Callback', isRequired); case 'ArrayBufferTypeAnnotation': - throw new Error( - `${createErrorMessage(realTypeAnnotation.type)} ArrayBuffer is only supported for C++ TurboModules.`, - ); + imports.add('com.facebook.react.bridge.ArrayBuffer'); + return wrapOptional('ArrayBuffer', isRequired); default: realTypeAnnotation.type as 'MixedTypeAnnotation'; throw new Error(createErrorMessage(realTypeAnnotation.type)); @@ -366,9 +379,8 @@ function translateFunctionReturnTypeToJavaType( imports.add('com.facebook.react.bridge.WritableArray'); return wrapOptional('WritableArray', isRequired); case 'ArrayBufferTypeAnnotation': - throw new Error( - `${createErrorMessage(realTypeAnnotation.type)} ArrayBuffer is only supported for C++ TurboModules.`, - ); + imports.add('com.facebook.react.bridge.ArrayBuffer'); + return wrapOptional('ArrayBuffer', isRequired); default: realTypeAnnotation.type as 'MixedTypeAnnotation'; throw new Error(createErrorMessage(realTypeAnnotation.type)); @@ -452,9 +464,7 @@ function getFalsyReturnStatementFromReturnType( case 'ArrayTypeAnnotation': return 'return null;'; case 'ArrayBufferTypeAnnotation': - throw new Error( - `${createErrorMessage(realTypeAnnotation.type)} ArrayBuffer is only supported for C++ TurboModules.`, - ); + return 'return null;'; default: realTypeAnnotation.type as 'MixedTypeAnnotation'; throw new Error(createErrorMessage(realTypeAnnotation.type)); @@ -589,6 +599,11 @@ module.exports = { method.typeAnnotation, ); + throwIfUnsupportedPromiseArrayBuffer( + method.name, + methodTypeAnnotation.returnTypeAnnotation, + ); + // Handle return type const translatedReturnType = translateFunctionReturnTypeToJavaType( methodTypeAnnotation.returnTypeAnnotation, diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleJniCpp.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleJniCpp.js index c05b97f0b2d6..7c088461107c 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleJniCpp.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleJniCpp.js @@ -24,7 +24,11 @@ import type {AliasResolver} from './Utils'; const {unwrapNullable} = require('../../parsers/parsers-commons'); const {parseValidUnionType} = require('../Utils'); -const {createAliasResolver, getModules} = require('./Utils'); +const { + createAliasResolver, + getModules, + throwIfUnsupportedPromiseArrayBuffer, +} = require('./Utils'); type FilesOutput = Map; @@ -35,7 +39,8 @@ type JSReturnType = | 'NumberKind' | 'PromiseKind' | 'ObjectKind' - | 'ArrayKind'; + | 'ArrayKind' + | 'ArrayBufferKind'; const HostFunctionTemplate = ({ hasteModuleName, @@ -217,7 +222,7 @@ function translateReturnTypeToKind( case 'ArrayTypeAnnotation': return 'ArrayKind'; case 'ArrayBufferTypeAnnotation': - throw new Error('ArrayBuffer is only supported for C++ TurboModules.'); + return 'ArrayBufferKind'; default: realTypeAnnotation.type as 'MixedTypeAnnotation'; throw new Error( @@ -306,7 +311,7 @@ function translateParamTypeToJniType( case 'FunctionTypeAnnotation': return 'Lcom/facebook/react/bridge/Callback;'; case 'ArrayBufferTypeAnnotation': - throw new Error('ArrayBuffer is only supported for C++ TurboModules.'); + return 'Lcom/facebook/react/bridge/ArrayBuffer;'; default: realTypeAnnotation.type as 'MixedTypeAnnotation'; throw new Error( @@ -392,7 +397,7 @@ function translateReturnTypeToJniType( case 'ArrayTypeAnnotation': return 'Lcom/facebook/react/bridge/WritableArray;'; case 'ArrayBufferTypeAnnotation': - throw new Error('ArrayBuffer is only supported for C++ TurboModules.'); + return 'Lcom/facebook/react/bridge/ArrayBuffer;'; default: realTypeAnnotation.type as 'MixedTypeAnnotation'; throw new Error( @@ -448,6 +453,8 @@ function translateMethodForImplementation( unwrapNullable(property.typeAnnotation); const {returnTypeAnnotation} = propertyTypeAnnotation; + throwIfUnsupportedPromiseArrayBuffer(property.name, returnTypeAnnotation); + if ( property.name === 'getConstants' && returnTypeAnnotation.type === 'ObjectTypeAnnotation' && diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/index.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/index.js index 8d93d9ad29c2..1bf4e32b3275 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/index.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/index.js @@ -97,6 +97,7 @@ const HeaderFileTemplate = ({ #import #import #import +#import #import #import #import diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/serializeEventEmitter.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/serializeEventEmitter.js index 72582c12bf7c..b5ea25048fef 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/serializeEventEmitter.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/serializeEventEmitter.js @@ -78,20 +78,28 @@ function EventEmitterHeaderTemplate( function EventEmitterImplementationTemplate( eventEmitter: NativeModuleEventEmitterShape, ): string { + // _eventEmitterCallback is installed by the generated SpecJSI constructor, + // which runs when JS first looks the module up. Emitting before that would + // call an empty std::function, so the emitted code no-ops instead. The local + // copy is for readability; it does not synchronize against a concurrent + // install. return `- (void)emit${toPascalCase(eventEmitter.name)}${ eventEmitter.typeAnnotation.typeAnnotation.type !== 'VoidTypeAnnotation' ? `:(${getEventEmitterTypeObjCType(eventEmitter)})value` : '' } { - _eventEmitterCallback("${eventEmitter.name}", ${ - eventEmitter.typeAnnotation.typeAnnotation.type !== 'VoidTypeAnnotation' - ? eventEmitter.typeAnnotation.typeAnnotation.type !== - 'BooleanTypeAnnotation' - ? 'value' - : '[NSNumber numberWithBool:value]' - : 'nil' - }); + auto eventEmitterCallback = _eventEmitterCallback; + if (eventEmitterCallback) { + eventEmitterCallback("${eventEmitter.name}", ${ + eventEmitter.typeAnnotation.typeAnnotation.type !== 'VoidTypeAnnotation' + ? eventEmitter.typeAnnotation.typeAnnotation.type !== + 'BooleanTypeAnnotation' + ? 'value' + : '[NSNumber numberWithBool:value]' + : 'nil' + }); + } }`; } diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/serializeMethod.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/serializeMethod.js index ce1fdfef0c6c..397516dc5c22 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/serializeMethod.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/serializeMethod.js @@ -26,6 +26,7 @@ const { } = require('../../../parsers/parsers-commons'); const {wrapOptional} = require('../../TypeUtils/Objective-C'); const {capitalize, parseValidUnionType} = require('../../Utils'); +const {throwIfUnsupportedPromiseArrayBuffer} = require('../Utils'); const {getNamespacedStructName} = require('./Utils'); const invariant = require('invariant'); @@ -51,7 +52,8 @@ type ReturnJSType = | 'ObjectKind' | 'ArrayKind' | 'NumberKind' - | 'StringKind'; + | 'StringKind' + | 'ArrayBufferKind'; export type MethodSerializationOutput = Readonly<{ methodName: string, @@ -102,6 +104,11 @@ function serializeMethod( } }); + throwIfUnsupportedPromiseArrayBuffer( + methodName, + propertyTypeAnnotation.returnTypeAnnotation, + ); + // Unwrap returnTypeAnnotation, so we check if the return type is Promise // TODO(T76719514): Disallow nullable PromiseTypeAnnotations const [returnTypeAnnotation] = unwrapNullable( @@ -219,6 +226,9 @@ function getParamObjCType( */ return notStruct(wrapOptional('NSArray *', !nullable)); } + case 'ArrayBufferTypeAnnotation': { + return notStruct(wrapOptional('RCTArrayBuffer *', !nullable)); + } } const [structTypeAnnotation] = unwrapNullable( @@ -388,9 +398,7 @@ function getReturnObjCType( case 'GenericObjectTypeAnnotation': return wrapOptional('NSDictionary *', isRequired); case 'ArrayBufferTypeAnnotation': - throw new Error( - `Unsupported return type for ${methodName}: ArrayBuffer is only supported for C++ TurboModules.`, - ); + return wrapOptional('RCTArrayBuffer *', isRequired); default: typeAnnotation.type as 'MixedTypeAnnotation'; throw new Error( @@ -464,9 +472,7 @@ function getReturnJSType( throw new Error(`Unsupported union member types`); } case 'ArrayBufferTypeAnnotation': - throw new Error( - `Unsupported return type for ${methodName}: ArrayBuffer is only supported for C++ TurboModules.`, - ); + return 'ArrayBufferKind'; default: typeAnnotation.type as 'MixedTypeAnnotation'; throw new Error( diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/source/serializeModule.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/source/serializeModule.js index 8898f3294720..371f640fb82b 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/source/serializeModule.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/source/serializeModule.js @@ -83,10 +83,17 @@ namespace facebook::react { .join('') : '' }${ + // The callback outlives this module, so it captures a copy of the map + // instead of referencing eventEmitterMap_. Every emitter is registered + // directly above, so the copy is complete; an emitter registered after + // construction would not be reachable from the callback. eventEmitters.length > 0 ? ` - setEventEmitterCallback([&](const std::string &name, id value) { - static_cast &>(*eventEmitterMap_[name]).emit(value); + setEventEmitterCallback([eventEmitterMap = eventEmitterMap_](const std::string &name, id value) { + auto it = eventEmitterMap.find(name); + if (it != eventEmitterMap.end() && it->second) { + static_cast &>(*it->second).emit(value); + } });` : '' } diff --git a/packages/react-native-codegen/src/generators/modules/Utils.js b/packages/react-native-codegen/src/generators/modules/Utils.js index ce6b63398417..8cd8d37ff096 100644 --- a/packages/react-native-codegen/src/generators/modules/Utils.js +++ b/packages/react-native-codegen/src/generators/modules/Utils.js @@ -13,6 +13,7 @@ import type { NativeModuleAliasMap, NativeModuleObjectTypeAnnotation, + NativeModuleReturnTypeAnnotation, NativeModuleSchema, NativeModuleTypeAnnotation, Nullable, @@ -77,9 +78,50 @@ function isArrayRecursiveMember( ); } +// Platform-native (Java/Kotlin and ObjC) TurboModules copy ArrayBuffer +// arguments and return ArrayBuffers zero-copy from synchronous methods, but +// `Promise` is not part of their contract. +// +// On Android it cannot work: the resolve path serializes through +// folly::dynamic, which cannot carry raw bytes. On iOS the resolve path is a +// direct ObjC->jsi conversion that would in fact produce an ArrayBuffer for an +// NSMutableData, so the limitation there is not technical โ€” the guard is +// applied to ObjC as well to keep one cross-platform contract, so a spec that +// compiles for iOS cannot fail to build for Android. +// +// Reject `Promise` at codegen time for both native platforms so +// the unsupported case surfaces as a build error rather than a runtime failure +// or a silent iOS/Android divergence. +function throwIfUnsupportedPromiseArrayBuffer( + methodName: string, + nullableReturnTypeAnnotation: Nullable, +): void { + const [returnTypeAnnotation] = + unwrapNullable( + nullableReturnTypeAnnotation, + ); + if (returnTypeAnnotation.type !== 'PromiseTypeAnnotation') { + return; + } + let elementType = returnTypeAnnotation.elementType; + if (elementType.type === 'NullableTypeAnnotation') { + elementType = elementType.typeAnnotation; + } + if (elementType.type === 'ArrayBufferTypeAnnotation') { + throw new Error( + `Unsupported return type for method "${methodName}": Promise is not ` + + 'supported for Android (Java/Kotlin) or iOS (ObjC) TurboModules. Use a C++ ' + + '(Cxx) TurboModule, return the ArrayBuffer from a synchronous method, or resolve ' + + 'the Promise with a different type. ArrayBuffer is still supported as a method ' + + 'argument and as a synchronous return value on all platforms.', + ); + } +} + module.exports = { createAliasResolver, getModules, isDirectRecursiveMember, isArrayRecursiveMember, + throwIfUnsupportedPromiseArrayBuffer, }; diff --git a/packages/react-native-codegen/src/generators/modules/__test_fixtures__/fixtures.js b/packages/react-native-codegen/src/generators/modules/__test_fixtures__/fixtures.js index 2b1db52e4ba9..83cc98bef054 100644 --- a/packages/react-native-codegen/src/generators/modules/__test_fixtures__/fixtures.js +++ b/packages/react-native-codegen/src/generators/modules/__test_fixtures__/fixtures.js @@ -2661,6 +2661,25 @@ const ARRAY_BUFFER_NATIVE_MODULE: SchemaType = { ], }, }, + ], + }, + moduleName: 'SampleTurboModule', + }, + }, +}; + +// Promise is only supported by C++ (Cxx) TurboModules (see +// throwIfUnsupportedPromiseArrayBuffer), so this fixture is excluded on both +// Android and iOS. It keeps C++ codegen coverage for the async-return case. +const ARRAY_BUFFER_PROMISE_NATIVE_MODULE: SchemaType = { + modules: { + NativeSampleTurboModule: { + type: 'NativeModule', + aliasMap: {}, + enumMap: {}, + spec: { + eventEmitters: [], + methods: [ { name: 'promiseArrayBuffer', optional: false, @@ -2678,7 +2697,7 @@ const ARRAY_BUFFER_NATIVE_MODULE: SchemaType = { ], }, moduleName: 'SampleTurboModule', - excludedPlatforms: ['iOS', 'android'], + excludedPlatforms: ['android', 'iOS'], }, }, }; @@ -2877,6 +2896,7 @@ const STRING_LITERALS: SchemaType = { module.exports = { array_buffer_native_module: ARRAY_BUFFER_NATIVE_MODULE, + array_buffer_promise_native_module: ARRAY_BUFFER_PROMISE_NATIVE_MODULE, complex_objects: COMPLEX_OBJECTS, two_modules_different_files: TWO_MODULES_DIFFERENT_FILES, empty_native_modules: EMPTY_NATIVE_MODULES, diff --git a/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleHObjCpp-test.js b/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleHObjCpp-test.js index bb50ae55a1ea..c151a4aa1cc1 100644 --- a/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleHObjCpp-test.js +++ b/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleHObjCpp-test.js @@ -10,6 +10,8 @@ 'use strict'; +import type {SchemaType} from '../../../CodegenSchema'; + const fixtures = require('../__test_fixtures__/fixtures.js'); const generator = require('../GenerateModuleObjCpp'); @@ -31,4 +33,42 @@ describe('GenerateModuleHObjCpp', () => { ).toMatchSnapshot(); }); }); + + it('throws for a method returning Promise (unsupported on iOS)', () => { + const schema: SchemaType = { + modules: { + NativeSampleTurboModule: { + type: 'NativeModule', + aliasMap: {}, + enumMap: {}, + spec: { + eventEmitters: [], + methods: [ + { + name: 'getAsyncBuffer', + optional: false, + typeAnnotation: { + type: 'FunctionTypeAnnotation', + returnTypeAnnotation: { + type: 'PromiseTypeAnnotation', + elementType: {type: 'ArrayBufferTypeAnnotation'}, + }, + params: [], + }, + }, + ], + }, + moduleName: 'SampleTurboModule', + }, + }, + }; + expect(() => + generator.generate( + 'array_buffer_promise_throws', + schema, + 'com.facebook.fbreact.specs', + false, + ), + ).toThrow(/Promise is not supported/); + }); }); diff --git a/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleJavaSpec-test.js b/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleJavaSpec-test.js index 45d7b0e58796..3cbcf9747179 100644 --- a/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleJavaSpec-test.js +++ b/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleJavaSpec-test.js @@ -10,6 +10,8 @@ 'use strict'; +import type {SchemaType} from '../../../CodegenSchema'; + const fixtures = require('../__test_fixtures__/fixtures.js'); const generator = require('../GenerateModuleJavaSpec.js'); @@ -29,4 +31,37 @@ describe('GenerateModuleJavaSpec', () => { ).toMatchSnapshot(); }); }); + + it('throws for a method returning Promise (unsupported on Android)', () => { + const schema: SchemaType = { + modules: { + NativeSampleTurboModule: { + type: 'NativeModule', + aliasMap: {}, + enumMap: {}, + spec: { + eventEmitters: [], + methods: [ + { + name: 'getAsyncBuffer', + optional: false, + typeAnnotation: { + type: 'FunctionTypeAnnotation', + returnTypeAnnotation: { + type: 'PromiseTypeAnnotation', + elementType: {type: 'ArrayBufferTypeAnnotation'}, + }, + params: [], + }, + }, + ], + }, + moduleName: 'SampleTurboModule', + }, + }, + }; + expect(() => + generator.generate('array_buffer_promise_throws', schema), + ).toThrow(/Promise is not supported/); + }); }); diff --git a/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleJniCpp-test.js b/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleJniCpp-test.js index 0e1fae7402eb..72e173904c6a 100644 --- a/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleJniCpp-test.js +++ b/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleJniCpp-test.js @@ -10,6 +10,8 @@ 'use strict'; +import type {SchemaType} from '../../../CodegenSchema'; + const fixtures = require('../__test_fixtures__/fixtures.js'); const generator = require('../GenerateModuleJniCpp.js'); @@ -29,4 +31,41 @@ describe('GenerateModuleJniCpp', () => { ).toMatchSnapshot(); }); }); + + it('throws for a method returning Promise (unsupported on Android)', () => { + const schema: SchemaType = { + modules: { + NativeSampleTurboModule: { + type: 'NativeModule', + aliasMap: {}, + enumMap: {}, + spec: { + eventEmitters: [], + methods: [ + { + name: 'getAsyncBuffer', + optional: false, + typeAnnotation: { + type: 'FunctionTypeAnnotation', + returnTypeAnnotation: { + type: 'PromiseTypeAnnotation', + elementType: {type: 'ArrayBufferTypeAnnotation'}, + }, + params: [], + }, + }, + ], + }, + moduleName: 'SampleTurboModule', + }, + }, + }; + expect(() => + generator.generate( + 'array_buffer_promise_throws', + schema, + 'com.facebook.fbreact.specs', + ), + ).toThrow(/Promise is not supported/); + }); }); diff --git a/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleH-test.js.snap b/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleH-test.js.snap index cdfaf66f4ef3..f2b1d6ad49ce 100644 --- a/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleH-test.js.snap +++ b/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleH-test.js.snap @@ -67,7 +67,6 @@ protected: methodMap_[\\"getArrayBuffer\\"] = MethodMetadata {.argCount = 0, .invoker = __getArrayBuffer}; methodMap_[\\"voidArrayBuffer\\"] = MethodMetadata {.argCount = 1, .invoker = __voidArrayBuffer}; methodMap_[\\"voidNullableArrayBuffer\\"] = MethodMetadata {.argCount = 1, .invoker = __voidNullableArrayBuffer}; - methodMap_[\\"promiseArrayBuffer\\"] = MethodMetadata {.argCount = 0, .invoker = __promiseArrayBuffer}; } private: @@ -93,7 +92,43 @@ private: bridging::callFromJs(rt, &T::voidNullableArrayBuffer, static_cast(&turboModule)->jsInvoker_, static_cast(&turboModule), count <= 0 || args[0].isNull() || args[0].isUndefined() ? std::nullopt : std::make_optional(args[0].asObject(rt).getArrayBuffer(rt)));return jsi::Value::undefined(); } +}; + +} // namespace facebook::react +", +} +`; + +exports[`GenerateModuleH can generate fixture array_buffer_promise_native_module 1`] = ` +Map { + "array_buffer_promise_native_moduleJSI.h" => "/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateModuleH.js + */ + +#pragma once +#include +#include + +namespace facebook::react { + + +template +class JSI_EXPORT NativeSampleTurboModuleCxxSpec : public TurboModule { +public: + static constexpr std::string_view kModuleName = \\"SampleTurboModule\\"; + +protected: + NativeSampleTurboModuleCxxSpec(std::shared_ptr jsInvoker) : TurboModule(std::string{NativeSampleTurboModuleCxxSpec::kModuleName}, jsInvoker) { + methodMap_[\\"promiseArrayBuffer\\"] = MethodMetadata {.argCount = 0, .invoker = __promiseArrayBuffer}; + } + +private: static jsi::Value __promiseArrayBuffer(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* /*args*/, size_t /*count*/) { static_assert( bridging::getParameterCount(&T::promiseArrayBuffer) == 1, diff --git a/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleHObjCpp-test.js.snap b/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleHObjCpp-test.js.snap index 229db766e450..4726cdcd0d96 100644 --- a/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleHObjCpp-test.js.snap +++ b/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleHObjCpp-test.js.snap @@ -27,6 +27,7 @@ Map { #import #import #import +#import #import #import #import @@ -92,6 +93,7 @@ Map { #import #import #import +#import #import #import #import @@ -100,12 +102,80 @@ Map { #import +@protocol NativeSampleTurboModuleSpec + +- (RCTArrayBuffer *)getArrayBuffer; +- (void)voidArrayBuffer:(RCTArrayBuffer *)arg; +- (void)voidNullableArrayBuffer:(RCTArrayBuffer * _Nullable)arg; + +@end + +@interface NativeSampleTurboModuleSpecBase : NSObject { +@protected +facebook::react::EventEmitterCallback _eventEmitterCallback; +} +- (void)setEventEmitterCallback:(EventEmitterCallbackWrapper *)eventEmitterCallbackWrapper; + + +@end + +namespace facebook::react { + /** + * ObjC++ class for module 'NativeSampleTurboModule' + */ + class JSI_EXPORT NativeSampleTurboModuleSpecJSI : public ObjCTurboModule { + public: + NativeSampleTurboModuleSpecJSI(const ObjCTurboModule::InitParams ¶ms); + }; +} // namespace facebook::react #endif // array_buffer_native_module_H ", } `; +exports[`GenerateModuleHObjCpp can generate fixture array_buffer_promise_native_module 1`] = ` +Map { + "array_buffer_promise_native_module.h" => "/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateModuleObjCpp + * + * We create an umbrella header (and corresponding implementation) here since + * Cxx compilation in BUCK has a limitation: source-code producing genrule()s + * must have a single output. More files => more genrule()s => slower builds. + */ + +#ifndef __cplusplus +#error This file must be compiled as Obj-C++. If you are importing it, you must change your file extension to .mm. +#endif + +// Avoid multiple includes of array_buffer_promise_native_module symbols +#ifndef array_buffer_promise_native_module_H +#define array_buffer_promise_native_module_H + +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import + + + +#endif // array_buffer_promise_native_module_H +", +} +`; + exports[`GenerateModuleHObjCpp can generate fixture complex_objects 1`] = ` Map { "complex_objects.h" => "/** @@ -133,6 +203,7 @@ Map { #import #import #import +#import #import #import #import @@ -408,6 +479,7 @@ Map { #import #import #import +#import #import #import #import @@ -449,6 +521,7 @@ Map { #import #import #import +#import #import #import #import @@ -514,6 +587,7 @@ Map { #import #import #import +#import #import #import #import @@ -584,6 +658,7 @@ Map { #import #import #import +#import #import #import #import @@ -769,6 +844,7 @@ Map { #import #import #import +#import #import #import #import @@ -1037,6 +1113,7 @@ Map { #import #import #import +#import #import #import #import @@ -1166,6 +1243,7 @@ Map { #import #import #import +#import #import #import #import @@ -1231,6 +1309,7 @@ Map { #import #import #import +#import #import #import #import @@ -1322,6 +1401,7 @@ Map { #import #import #import +#import #import #import #import diff --git a/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleJavaSpec-test.js.snap b/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleJavaSpec-test.js.snap index dc2df9db0645..14722e2179f5 100644 --- a/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleJavaSpec-test.js.snap +++ b/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleJavaSpec-test.js.snap @@ -41,7 +41,60 @@ public abstract class NativeSampleTurboModuleSpec extends ReactContextBaseJavaMo } `; -exports[`GenerateModuleJavaSpec can generate fixture array_buffer_native_module 1`] = `Map {}`; +exports[`GenerateModuleJavaSpec can generate fixture array_buffer_native_module 1`] = ` +Map { + "java/com/facebook/fbreact/specs/NativeSampleTurboModuleSpec.java" => " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateModuleJavaSpec.js + * + * @nolint + */ + +package com.facebook.fbreact.specs; + +import com.facebook.proguard.annotations.DoNotStrip; +import com.facebook.react.bridge.ArrayBuffer; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.turbomodule.core.interfaces.TurboModule; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +public abstract class NativeSampleTurboModuleSpec extends ReactContextBaseJavaModule implements TurboModule { + public static final String NAME = \\"SampleTurboModule\\"; + + public NativeSampleTurboModuleSpec(ReactApplicationContext reactContext) { + super(reactContext); + } + + @Override + public @Nonnull String getName() { + return NAME; + } + + @ReactMethod(isBlockingSynchronousMethod = true) + @DoNotStrip + public abstract ArrayBuffer getArrayBuffer(); + + @ReactMethod + @DoNotStrip + public abstract void voidArrayBuffer(ArrayBuffer arg); + + @ReactMethod + @DoNotStrip + public abstract void voidNullableArrayBuffer(@Nullable ArrayBuffer arg); +} +", +} +`; + +exports[`GenerateModuleJavaSpec can generate fixture array_buffer_promise_native_module 1`] = `Map {}`; exports[`GenerateModuleJavaSpec can generate fixture complex_objects 1`] = ` Map { @@ -176,6 +229,7 @@ Map { package com.facebook.fbreact.specs; import com.facebook.proguard.annotations.DoNotStrip; +import com.facebook.react.bridge.CxxCallbackImpl; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.ReactContextBaseJavaModule; import com.facebook.react.bridge.ReactMethod; @@ -197,27 +251,45 @@ public abstract class NativeSampleTurboModuleSpec extends ReactContextBaseJavaMo } protected final void emitOnEvent1() { - mEventEmitterCallback.invoke(\\"onEvent1\\"); + CxxCallbackImpl eventEmitterCallback = mEventEmitterCallback; + if (eventEmitterCallback != null) { + eventEmitterCallback.invoke(\\"onEvent1\\"); + } } protected final void emitOnEvent2(String value) { - mEventEmitterCallback.invoke(\\"onEvent2\\", value); + CxxCallbackImpl eventEmitterCallback = mEventEmitterCallback; + if (eventEmitterCallback != null) { + eventEmitterCallback.invoke(\\"onEvent2\\", value); + } } protected final void emitOnEvent3(double value) { - mEventEmitterCallback.invoke(\\"onEvent3\\", value); + CxxCallbackImpl eventEmitterCallback = mEventEmitterCallback; + if (eventEmitterCallback != null) { + eventEmitterCallback.invoke(\\"onEvent3\\", value); + } } protected final void emitOnEvent4(boolean value) { - mEventEmitterCallback.invoke(\\"onEvent4\\", value); + CxxCallbackImpl eventEmitterCallback = mEventEmitterCallback; + if (eventEmitterCallback != null) { + eventEmitterCallback.invoke(\\"onEvent4\\", value); + } } protected final void emitOnEvent5(ReadableMap value) { - mEventEmitterCallback.invoke(\\"onEvent5\\", value); + CxxCallbackImpl eventEmitterCallback = mEventEmitterCallback; + if (eventEmitterCallback != null) { + eventEmitterCallback.invoke(\\"onEvent5\\", value); + } } protected final void emitOnEvent6(ReadableArray value) { - mEventEmitterCallback.invoke(\\"onEvent6\\", value); + CxxCallbackImpl eventEmitterCallback = mEventEmitterCallback; + if (eventEmitterCallback != null) { + eventEmitterCallback.invoke(\\"onEvent6\\", value); + } } @ReactMethod @@ -530,6 +602,7 @@ Map { package com.facebook.fbreact.specs; import com.facebook.proguard.annotations.DoNotStrip; +import com.facebook.react.bridge.CxxCallbackImpl; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.ReactContextBaseJavaModule; import com.facebook.react.bridge.ReactMethod; @@ -549,7 +622,10 @@ public abstract class NativeSampleTurboModuleSpec extends ReactContextBaseJavaMo } protected final void emitLiteralEvent(String value) { - mEventEmitterCallback.invoke(\\"literalEvent\\", value); + CxxCallbackImpl eventEmitterCallback = mEventEmitterCallback; + if (eventEmitterCallback != null) { + eventEmitterCallback.invoke(\\"literalEvent\\", value); + } } @ReactMethod(isBlockingSynchronousMethod = true) diff --git a/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleJniCpp-test.js.snap b/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleJniCpp-test.js.snap index c4285ae56f65..547344fda403 100644 --- a/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleJniCpp-test.js.snap +++ b/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleJniCpp-test.js.snap @@ -51,9 +51,59 @@ Map { namespace facebook::react { +static facebook::jsi::Value __hostFunction_NativeSampleTurboModuleSpecJSI_getArrayBuffer(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + static jmethodID cachedMethodId = nullptr; + return static_cast(turboModule).invokeJavaMethod(rt, ArrayBufferKind, \\"getArrayBuffer\\", \\"()Lcom/facebook/react/bridge/ArrayBuffer;\\", args, count, cachedMethodId); +} + +static facebook::jsi::Value __hostFunction_NativeSampleTurboModuleSpecJSI_voidArrayBuffer(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + static jmethodID cachedMethodId = nullptr; + return static_cast(turboModule).invokeJavaMethod(rt, VoidKind, \\"voidArrayBuffer\\", \\"(Lcom/facebook/react/bridge/ArrayBuffer;)V\\", args, count, cachedMethodId); +} +static facebook::jsi::Value __hostFunction_NativeSampleTurboModuleSpecJSI_voidNullableArrayBuffer(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + static jmethodID cachedMethodId = nullptr; + return static_cast(turboModule).invokeJavaMethod(rt, VoidKind, \\"voidNullableArrayBuffer\\", \\"(Lcom/facebook/react/bridge/ArrayBuffer;)V\\", args, count, cachedMethodId); +} + +NativeSampleTurboModuleSpecJSI::NativeSampleTurboModuleSpecJSI(const JavaTurboModule::InitParams ¶ms) + : JavaTurboModule(params) { + methodMap_[\\"getArrayBuffer\\"] = MethodMetadata {0, __hostFunction_NativeSampleTurboModuleSpecJSI_getArrayBuffer}; + methodMap_[\\"voidArrayBuffer\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleSpecJSI_voidArrayBuffer}; + methodMap_[\\"voidNullableArrayBuffer\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleSpecJSI_voidNullableArrayBuffer}; +} std::shared_ptr array_buffer_native_module_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms) { + if (moduleName == \\"SampleTurboModule\\") { + return std::make_shared(params); + } + return nullptr; +} + +} // namespace facebook::react +", +} +`; + +exports[`GenerateModuleJniCpp can generate fixture array_buffer_promise_native_module 1`] = ` +Map { + "jni/array_buffer_promise_native_module-generated.cpp" => " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateModuleJniCpp.js + */ + +#include \\"array_buffer_promise_native_module.h\\" + +namespace facebook::react { + + + +std::shared_ptr array_buffer_promise_native_module_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms) { return nullptr; } diff --git a/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleJniH-test.js.snap b/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleJniH-test.js.snap index c46009a84e33..fed0ac2033fd 100644 --- a/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleJniH-test.js.snap +++ b/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleJniH-test.js.snap @@ -86,6 +86,13 @@ Map { namespace facebook::react { +/** + * JNI C++ class for module 'NativeSampleTurboModule' + */ +class JSI_EXPORT NativeSampleTurboModuleSpecJSI : public JavaTurboModule { +public: + NativeSampleTurboModuleSpecJSI(const JavaTurboModule::InitParams ¶ms); +}; JSI_EXPORT @@ -125,6 +132,65 @@ target_compile_reactnative_options(react_codegen_array_buffer_native_module PRIV } `; +exports[`GenerateModuleJniH can generate fixture array_buffer_promise_native_module 1`] = ` +Map { + "jni/array_buffer_promise_native_module.h" => " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateModuleJniH.js + */ + +#pragma once + +#include +#include +#include + +namespace facebook::react { + + + +JSI_EXPORT +std::shared_ptr array_buffer_promise_native_module_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms); + +} // namespace facebook::react +", + "jni/CMakeLists.txt" => "# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +cmake_minimum_required(VERSION 3.13) +set(CMAKE_VERBOSE_MAKEFILE on) + +file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/array_buffer_promise_native_module/*.cpp) + +add_library( + react_codegen_array_buffer_promise_native_module + OBJECT + \${react_codegen_SRCS} +) + +target_include_directories(react_codegen_array_buffer_promise_native_module PUBLIC . react/renderer/components/array_buffer_promise_native_module) + +target_link_libraries( + react_codegen_array_buffer_promise_native_module + fbjni + jsi + # We need to link different libraries based on whether we are building rncore or not, that's necessary + # because we want to break a circular dependency between react_codegen_rncore and reactnative + reactnative +) + +target_compile_reactnative_options(react_codegen_array_buffer_promise_native_module PRIVATE) +", +} +`; + exports[`GenerateModuleJniH can generate fixture complex_objects 1`] = ` Map { "jni/complex_objects.h" => " diff --git a/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleMm-test.js.snap b/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleMm-test.js.snap index e8ff005d5866..f70403ac89b6 100644 --- a/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleMm-test.js.snap +++ b/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleMm-test.js.snap @@ -58,6 +58,65 @@ Map { #import \\"array_buffer_native_module.h\\" +@implementation NativeSampleTurboModuleSpecBase + + +- (void)setEventEmitterCallback:(EventEmitterCallbackWrapper *)eventEmitterCallbackWrapper +{ + _eventEmitterCallback = std::move(eventEmitterCallbackWrapper->_eventEmitterCallback); +} +@end + + +namespace facebook::react { + + static facebook::jsi::Value __hostFunction_NativeSampleTurboModuleSpecJSI_getArrayBuffer(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, ArrayBufferKind, \\"getArrayBuffer\\", @selector(getArrayBuffer), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeSampleTurboModuleSpecJSI_voidArrayBuffer(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, \\"voidArrayBuffer\\", @selector(voidArrayBuffer:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeSampleTurboModuleSpecJSI_voidNullableArrayBuffer(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, VoidKind, \\"voidNullableArrayBuffer\\", @selector(voidNullableArrayBuffer:), args, count); + } + + NativeSampleTurboModuleSpecJSI::NativeSampleTurboModuleSpecJSI(const ObjCTurboModule::InitParams ¶ms) + : ObjCTurboModule(params) { + + methodMap_[\\"getArrayBuffer\\"] = MethodMetadata {0, __hostFunction_NativeSampleTurboModuleSpecJSI_getArrayBuffer}; + + + methodMap_[\\"voidArrayBuffer\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleSpecJSI_voidArrayBuffer}; + + + methodMap_[\\"voidNullableArrayBuffer\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleSpecJSI_voidNullableArrayBuffer}; + + } +} // namespace facebook::react +", +} +`; + +exports[`GenerateModuleMm can generate fixture array_buffer_promise_native_module 1`] = ` +Map { + "array_buffer_promise_native_module-generated.mm" => "/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateModuleObjCpp + * + * We create an umbrella header (and corresponding implementation) here since + * Cxx compilation in BUCK has a limitation: source-code producing genrule()s + * must have a single output. More files => more genrule()s => slower builds. + */ + +#import \\"array_buffer_promise_native_module.h\\" + + ", } `; @@ -267,27 +326,45 @@ Map { @implementation NativeSampleTurboModuleSpecBase - (void)emitOnEvent1 { - _eventEmitterCallback(\\"onEvent1\\", nil); + auto eventEmitterCallback = _eventEmitterCallback; + if (eventEmitterCallback) { + eventEmitterCallback(\\"onEvent1\\", nil); + } } - (void)emitOnEvent2:(NSString *_Nonnull)value { - _eventEmitterCallback(\\"onEvent2\\", value); + auto eventEmitterCallback = _eventEmitterCallback; + if (eventEmitterCallback) { + eventEmitterCallback(\\"onEvent2\\", value); + } } - (void)emitOnEvent3:(NSNumber *_Nonnull)value { - _eventEmitterCallback(\\"onEvent3\\", value); + auto eventEmitterCallback = _eventEmitterCallback; + if (eventEmitterCallback) { + eventEmitterCallback(\\"onEvent3\\", value); + } } - (void)emitOnEvent4:(BOOL)value { - _eventEmitterCallback(\\"onEvent4\\", [NSNumber numberWithBool:value]); + auto eventEmitterCallback = _eventEmitterCallback; + if (eventEmitterCallback) { + eventEmitterCallback(\\"onEvent4\\", [NSNumber numberWithBool:value]); + } } - (void)emitOnEvent5:(NSDictionary *)value { - _eventEmitterCallback(\\"onEvent5\\", value); + auto eventEmitterCallback = _eventEmitterCallback; + if (eventEmitterCallback) { + eventEmitterCallback(\\"onEvent5\\", value); + } } - (void)emitOnEvent6:(NSArray> *)value { - _eventEmitterCallback(\\"onEvent6\\", value); + auto eventEmitterCallback = _eventEmitterCallback; + if (eventEmitterCallback) { + eventEmitterCallback(\\"onEvent6\\", value); + } } - (void)setEventEmitterCallback:(EventEmitterCallbackWrapper *)eventEmitterCallbackWrapper @@ -314,8 +391,11 @@ namespace facebook::react { eventEmitterMap_[\\"onEvent4\\"] = std::make_shared>(); eventEmitterMap_[\\"onEvent5\\"] = std::make_shared>(); eventEmitterMap_[\\"onEvent6\\"] = std::make_shared>(); - setEventEmitterCallback([&](const std::string &name, id value) { - static_cast &>(*eventEmitterMap_[name]).emit(value); + setEventEmitterCallback([eventEmitterMap = eventEmitterMap_](const std::string &name, id value) { + auto it = eventEmitterMap.find(name); + if (it != eventEmitterMap.end() && it->second) { + static_cast &>(*it->second).emit(value); + } }); } } // namespace facebook::react @@ -675,7 +755,10 @@ Map { @implementation NativeSampleTurboModuleSpecBase - (void)emitLiteralEvent:(NSString *_Nonnull)value { - _eventEmitterCallback(\\"literalEvent\\", value); + auto eventEmitterCallback = _eventEmitterCallback; + if (eventEmitterCallback) { + eventEmitterCallback(\\"literalEvent\\", value); + } } - (void)setEventEmitterCallback:(EventEmitterCallbackWrapper *)eventEmitterCallbackWrapper @@ -697,8 +780,11 @@ namespace facebook::react { methodMap_[\\"getStringLiteral\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleSpecJSI_getStringLiteral}; eventEmitterMap_[\\"literalEvent\\"] = std::make_shared>(); - setEventEmitterCallback([&](const std::string &name, id value) { - static_cast &>(*eventEmitterMap_[name]).emit(value); + setEventEmitterCallback([eventEmitterMap = eventEmitterMap_](const std::string &name, id value) { + auto it = eventEmitterMap.find(name); + if (it != eventEmitterMap.end() && it->second) { + static_cast &>(*it->second).emit(value); + } }); } } // namespace facebook::react diff --git a/packages/react-native-codegen/src/parsers/flow/components/__tests__/component-parser-test.js b/packages/react-native-codegen/src/parsers/flow/components/__tests__/component-parser-test.js index 5abe85fd7656..920a3b34ea68 100644 --- a/packages/react-native-codegen/src/parsers/flow/components/__tests__/component-parser-test.js +++ b/packages/react-native-codegen/src/parsers/flow/components/__tests__/component-parser-test.js @@ -14,7 +14,7 @@ const failureFixtures = require('../__test_fixtures__/failures.js'); const fixtures = require('../__test_fixtures__/fixtures.js'); const {FlowParser} = require('../../parser'); -jest.mock('fs', () => ({ +jest.mock('node:fs', () => ({ readFileSync: filename => { // Jest in the OSS does not allow to capture variables in closures. // Therefore, we have to bring the variables inside the closure. diff --git a/packages/react-native-codegen/src/parsers/flow/components/commands.js b/packages/react-native-codegen/src/parsers/flow/components/commands.js index 8800427a6157..381fef3c88dd 100644 --- a/packages/react-native-codegen/src/parsers/flow/components/commands.js +++ b/packages/react-native-codegen/src/parsers/flow/components/commands.js @@ -49,14 +49,12 @@ function buildCommandSchema( const firstParam = value.params[0].typeAnnotation; - if ( - !( - firstParam.id != null && - firstParam.id.type === 'QualifiedTypeIdentifier' && - firstParam.id.qualification.name === 'React' && - firstParam.id.id.name === 'ElementRef' - ) - ) { + if (!( + firstParam.id != null && + firstParam.id.type === 'QualifiedTypeIdentifier' && + firstParam.id.qualification.name === 'React' && + firstParam.id.id.name === 'ElementRef' + )) { throw new Error( `The first argument of method ${name} must be of type React.ElementRef<>`, ); diff --git a/packages/react-native-codegen/src/parsers/flow/modules/__test_fixtures__/fixtures.js b/packages/react-native-codegen/src/parsers/flow/modules/__test_fixtures__/fixtures.js index f95c067d3b03..53605cbe10ea 100644 --- a/packages/react-native-codegen/src/parsers/flow/modules/__test_fixtures__/fixtures.js +++ b/packages/react-native-codegen/src/parsers/flow/modules/__test_fixtures__/fixtures.js @@ -946,6 +946,34 @@ export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); `; +const NAMESPACED_NATIVE_MODULE_WITH_LOCAL_TYPE_ALIASES = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + */ + +'use strict'; + +import type {TurboModule} from '../RCTExport'; +import * as TurboModuleRegistry from '../TurboModuleRegistry'; +import type {CodegenTypes} from 'react-native'; + +type Double = CodegenTypes.Double; +type MyFloat = CodegenTypes.Float; + +export interface Spec extends TurboModule { + +getDouble: (arg: Double) => Double; + +getFloat: (arg: MyFloat) => MyFloat; +} + +export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); +`; + const NAMESPACED_NATIVE_MODULE_WITH_EVENT_EMITTERS = ` /** * Copyright (c) Meta Platforms, Inc. and affiliates. @@ -1046,4 +1074,5 @@ module.exports = { NAMESPACED_NATIVE_MODULE_WITH_FLOAT_AND_INT32, NAMESPACED_NATIVE_MODULE_WITH_UNSAFE_OBJECT, NAMESPACED_NATIVE_MODULE_WITH_EVENT_EMITTERS, + NAMESPACED_NATIVE_MODULE_WITH_LOCAL_TYPE_ALIASES, }; diff --git a/packages/react-native-codegen/src/parsers/flow/modules/__tests__/__snapshots__/module-parser-snapshot-test.js.snap b/packages/react-native-codegen/src/parsers/flow/modules/__tests__/__snapshots__/module-parser-snapshot-test.js.snap index 8e462cdf6452..5309c7d0c616 100644 --- a/packages/react-native-codegen/src/parsers/flow/modules/__tests__/__snapshots__/module-parser-snapshot-test.js.snap +++ b/packages/react-native-codegen/src/parsers/flow/modules/__tests__/__snapshots__/module-parser-snapshot-test.js.snap @@ -4,14 +4,7 @@ exports[`RN Codegen Flow Parser Fails with error message EMPTY_ENUM_NATIVE_MODUL exports[`RN Codegen Flow Parser Fails with error message MAP_WITH_EXTRA_KEYS_NATIVE_MODULE 1`] = `"Module NativeSampleTurboModule: 'ObjectTypeAnnotation' cannot contain both an indexer and properties."`; -exports[`RN Codegen Flow Parser Fails with error message MIXED_VALUES_ENUM_NATIVE_MODULE 1`] = ` -"Syntax error in path/NativeSampleTurboModule.js: cannot use string initializer in number enum (19:2) - STR = 'str', - ^~~~~~~~~~~ -note: start of enum body (17:21) -export enum SomeEnum { - ^" -`; +exports[`RN Codegen Flow Parser Fails with error message MIXED_VALUES_ENUM_NATIVE_MODULE 1`] = `"Module NativeSampleTurboModule: Failed parsing the enum SomeEnum in NativeSampleTurboModule with the error: Enums can not be mixed- they all must be either blank, number, or string values."`; exports[`RN Codegen Flow Parser Fails with error message NATIVE_MODULES_WITH_ARRAY_BUFFER_IN_OBJECT_PROPERTY 1`] = `"Module NativeSampleTurboModule: Object property '[object Object]' cannot have type 'ArrayBuffer'."`; @@ -27,15 +20,11 @@ exports[`RN Codegen Flow Parser Fails with error message NATIVE_MODULES_WITH_REA exports[`RN Codegen Flow Parser Fails with error message NATIVE_MODULES_WITH_UNNAMED_PARAMS 1`] = `"Module NativeSampleTurboModule: All function parameters must be named."`; -exports[`RN Codegen Flow Parser Fails with error message NUMERIC_VALUES_ENUM_NATIVE_MODULE 1`] = ` -"Syntax error in path/NativeSampleTurboModule.js: 'true', 'false', 'string', 'number' or 'bigint' expected in enum member initializer (20:17) - SUBFACTORIAL = !5, - ~~~~~~~~~~~~~~~^" -`; +exports[`RN Codegen Flow Parser Fails with error message NUMERIC_VALUES_ENUM_NATIVE_MODULE 1`] = `"Syntax error in path/NativeSampleTurboModule.js: The enum member initializer for \`SUBFACTORIAL\` needs to be a literal (either a boolean, number, bigint, or string) in enum \`SomeEnum\`. (20:17)"`; exports[`RN Codegen Flow Parser Fails with error message TWO_NATIVE_EXTENDING_TURBO_MODULE 1`] = `"Module NativeSampleTurboModule: Every NativeModule spec file must declare exactly one NativeModule Flow interface. This file declares 2: 'Spec', and 'Spec2'. Please remove the extraneous Flow interface declarations."`; -exports[`RN Codegen Flow Parser Fails with error message TWO_NATIVE_MODULES_EXPORTED_WITH_DEFAULT 1`] = `"Module NativeSampleTurboModule: No Flow interfaces extending TurboModule were detected in this NativeModule spec."`; +exports[`RN Codegen Flow Parser Fails with error message TWO_NATIVE_MODULES_EXPORTED_WITH_DEFAULT 1`] = `"Syntax error in path/NativeSampleTurboModule.js: Duplicate export for \`default\` (19:7)"`; exports[`RN Codegen Flow Parser can generate fixture ANDROID_ONLY_NATIVE_MODULE 1`] = ` "{ @@ -856,6 +845,62 @@ exports[`RN Codegen Flow Parser can generate fixture NAMESPACED_NATIVE_MODULE_WI }" `; +exports[`RN Codegen Flow Parser can generate fixture NAMESPACED_NATIVE_MODULE_WITH_LOCAL_TYPE_ALIASES 1`] = ` +"{ + 'modules': { + 'NativeSampleTurboModule': { + 'type': 'NativeModule', + 'aliasMap': {}, + 'enumMap': {}, + 'spec': { + 'eventEmitters': [], + 'methods': [ + { + 'name': 'getDouble', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'returnTypeAnnotation': { + 'type': 'DoubleTypeAnnotation' + }, + 'params': [ + { + 'name': 'arg', + 'optional': false, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'getFloat', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'returnTypeAnnotation': { + 'type': 'FloatTypeAnnotation' + }, + 'params': [ + { + 'name': 'arg', + 'optional': false, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + } + ] + }, + 'moduleName': 'SampleTurboModule' + } + } +}" +`; + exports[`RN Codegen Flow Parser can generate fixture NAMESPACED_NATIVE_MODULE_WITH_UNSAFE_OBJECT 1`] = ` "{ 'modules': { diff --git a/packages/react-native-codegen/src/parsers/flow/modules/__tests__/module-parser-snapshot-test.js b/packages/react-native-codegen/src/parsers/flow/modules/__tests__/module-parser-snapshot-test.js index 8971838bd2de..c7f129b93d09 100644 --- a/packages/react-native-codegen/src/parsers/flow/modules/__tests__/module-parser-snapshot-test.js +++ b/packages/react-native-codegen/src/parsers/flow/modules/__tests__/module-parser-snapshot-test.js @@ -16,7 +16,7 @@ const {FlowParser} = require('../../parser'); const flowParser = new FlowParser(); -jest.mock('fs', () => ({ +jest.mock('node:fs', () => ({ readFileSync: filename => { // Jest in the OSS does not allow to capture variables in closures. // Therefore, we have to bring the variables inside the closure. diff --git a/packages/react-native-codegen/src/parsers/flow/parseFlowAndThrowErrors.js b/packages/react-native-codegen/src/parsers/flow/parseFlowAndThrowErrors.js index 7e0f61bd3e0f..7db5ae4b5f72 100644 --- a/packages/react-native-codegen/src/parsers/flow/parseFlowAndThrowErrors.js +++ b/packages/react-native-codegen/src/parsers/flow/parseFlowAndThrowErrors.js @@ -10,9 +10,9 @@ 'use strict'; -import type {Program as ESTreeProgram} from 'hermes-estree'; +import type {Program as ESTreeProgram} from 'flow-estree'; -const hermesParser = require('hermes-parser'); +const flowParser = require('flow-parser'); function parseFlowAndThrowErrors( code: string, @@ -20,7 +20,7 @@ function parseFlowAndThrowErrors( ): ESTreeProgram { let ast; try { - ast = hermesParser.parse(code, { + ast = flowParser.parse(code, { // Produce an ESTree-compliant AST babel: false, // Parse Flow without a pragma diff --git a/packages/react-native-codegen/src/parsers/flow/parser.js b/packages/react-native-codegen/src/parsers/flow/parser.js index bf3c77b2ffe7..e8c81c68c1f1 100644 --- a/packages/react-native-codegen/src/parsers/flow/parser.js +++ b/packages/react-native-codegen/src/parsers/flow/parser.js @@ -56,8 +56,8 @@ const { } = require('./components/componentsUtils'); const {flowTranslateTypeAnnotation} = require('./modules'); const {parseFlowAndThrowErrors} = require('./parseFlowAndThrowErrors'); -const fs = require('fs'); const invariant = require('invariant'); +const fs = require('node:fs'); type ExtendsForProp = null | { type: 'ReactNativeBuiltInType', @@ -418,6 +418,7 @@ class FlowParser implements Parser { let typeResolutionStatus: TypeResolutionStatus = { successful: false, }; + const resolvedTypeAliases = new Set(); for (;;) { if (node.type === 'NullableTypeAnnotation') { @@ -430,11 +431,21 @@ class FlowParser implements Parser { break; } + // A qualified name (e.g. CodegenTypes.Double) refers to a namespace + // member, not to the local type alias of the same unqualified name. + if (node.id.type === 'QualifiedTypeIdentifier') { + break; + } + const typeAnnotationName = this.getTypeAnnotationName(node); const resolvedTypeAnnotation = types[typeAnnotationName]; - if (resolvedTypeAnnotation == null) { + if ( + resolvedTypeAnnotation == null || + resolvedTypeAliases.has(typeAnnotationName) + ) { break; } + resolvedTypeAliases.add(typeAnnotationName); const {typeAnnotation: typeAnnotationNode, typeResolutionStatus: status} = handleGenericTypeAnnotation(node, resolvedTypeAnnotation, this); typeResolutionStatus = status; diff --git a/packages/react-native-codegen/src/parsers/typescript/components/__tests__/typescript-component-parser-test.js b/packages/react-native-codegen/src/parsers/typescript/components/__tests__/typescript-component-parser-test.js index c96953a0c4fb..fada0a279033 100644 --- a/packages/react-native-codegen/src/parsers/typescript/components/__tests__/typescript-component-parser-test.js +++ b/packages/react-native-codegen/src/parsers/typescript/components/__tests__/typescript-component-parser-test.js @@ -14,7 +14,7 @@ const failureFixtures = require('../__test_fixtures__/failures.js'); const fixtures = require('../__test_fixtures__/fixtures.js'); const {TypeScriptParser} = require('../../parser'); -jest.mock('fs', () => ({ +jest.mock('node:fs', () => ({ readFileSync: filename => { // Jest in the OSS does not allow to capture variables in closures. // Therefore, we have to bring the variables inside the closure. diff --git a/packages/react-native-codegen/src/parsers/typescript/components/commands.js b/packages/react-native-codegen/src/parsers/typescript/components/commands.js index f51d7ccede32..f097b2b9314b 100644 --- a/packages/react-native-codegen/src/parsers/typescript/components/commands.js +++ b/packages/react-native-codegen/src/parsers/typescript/components/commands.js @@ -33,15 +33,13 @@ function buildCommandSchemaInternal( parser: Parser, ): NamedShape { const firstParam = parameters[0].typeAnnotation; - if ( - !( - firstParam.typeAnnotation != null && - firstParam.typeAnnotation.type === 'TSTypeReference' && - firstParam.typeAnnotation.typeName.left?.name === 'React' && - (firstParam.typeAnnotation.typeName.right?.name === 'ElementRef' || - firstParam.typeAnnotation.typeName.right?.name === 'ComponentRef') - ) - ) { + if (!( + firstParam.typeAnnotation != null && + firstParam.typeAnnotation.type === 'TSTypeReference' && + firstParam.typeAnnotation.typeName.left?.name === 'React' && + (firstParam.typeAnnotation.typeName.right?.name === 'ElementRef' || + firstParam.typeAnnotation.typeName.right?.name === 'ComponentRef') + )) { throw new Error( `The first argument of method ${name} must be of type React.ElementRef<> or React.ComponentRef<>`, ); diff --git a/packages/react-native-codegen/src/parsers/typescript/components/componentsUtils.js b/packages/react-native-codegen/src/parsers/typescript/components/componentsUtils.js index 23d16906883b..407327d24c17 100644 --- a/packages/react-native-codegen/src/parsers/typescript/components/componentsUtils.js +++ b/packages/react-native-codegen/src/parsers/typescript/components/componentsUtils.js @@ -354,8 +354,7 @@ function setDefaultValue( /* $FlowFixMe[invalid-compare] Error discovered during Constant Condition * roll out. See https://fburl.com/workplace/5whu3i34. */ (defaultValue === null ? null : defaultValue ? defaultValue : 0) as - | number - | null; + number | null; break; case 'BooleanTypeAnnotation': /* $FlowFixMe[invalid-compare] Error discovered during Constant Condition @@ -364,8 +363,7 @@ function setDefaultValue( break; case 'StringTypeAnnotation': common.default = (defaultValue === undefined ? null : defaultValue) as - | string - | null; + string | null; break; } } diff --git a/packages/react-native-codegen/src/parsers/typescript/modules/__test_fixtures__/fixtures.js b/packages/react-native-codegen/src/parsers/typescript/modules/__test_fixtures__/fixtures.js index 8359f02909bc..c405627b93e4 100644 --- a/packages/react-native-codegen/src/parsers/typescript/modules/__test_fixtures__/fixtures.js +++ b/packages/react-native-codegen/src/parsers/typescript/modules/__test_fixtures__/fixtures.js @@ -959,6 +959,31 @@ export interface Spec extends TurboModule { export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); `; +const NAMESPACED_NATIVE_MODULE_WITH_LOCAL_TYPE_ALIASES = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {CodegenTypes} from 'react-native'; +import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; + +type Double = CodegenTypes.Double; +type MyFloat = CodegenTypes.Float; + +export interface Spec extends TurboModule { + readonly getDouble: (arg: Double) => Double; + readonly getFloat: (arg: MyFloat) => MyFloat; +} + +export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); +`; + const NAMESPACED_NATIVE_MODULE_WITH_EVENT_EMITTERS = ` /** * Copyright (c) Meta Platforms, Inc. and affiliates. @@ -1057,4 +1082,5 @@ module.exports = { NAMESPACED_NATIVE_MODULE_WITH_FLOAT_AND_INT32, NAMESPACED_NATIVE_MODULE_WITH_UNSAFE_OBJECT, NAMESPACED_NATIVE_MODULE_WITH_EVENT_EMITTERS, + NAMESPACED_NATIVE_MODULE_WITH_LOCAL_TYPE_ALIASES, }; diff --git a/packages/react-native-codegen/src/parsers/typescript/modules/__tests__/__snapshots__/typescript-module-parser-snapshot-test.js.snap b/packages/react-native-codegen/src/parsers/typescript/modules/__tests__/__snapshots__/typescript-module-parser-snapshot-test.js.snap index c46a47e6db10..4b098b27af55 100644 --- a/packages/react-native-codegen/src/parsers/typescript/modules/__tests__/__snapshots__/typescript-module-parser-snapshot-test.js.snap +++ b/packages/react-native-codegen/src/parsers/typescript/modules/__tests__/__snapshots__/typescript-module-parser-snapshot-test.js.snap @@ -843,6 +843,62 @@ exports[`RN Codegen TypeScript Parser can generate fixture NAMESPACED_NATIVE_MOD }" `; +exports[`RN Codegen TypeScript Parser can generate fixture NAMESPACED_NATIVE_MODULE_WITH_LOCAL_TYPE_ALIASES 1`] = ` +"{ + 'modules': { + 'NativeSampleTurboModule': { + 'type': 'NativeModule', + 'aliasMap': {}, + 'enumMap': {}, + 'spec': { + 'eventEmitters': [], + 'methods': [ + { + 'name': 'getDouble', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'returnTypeAnnotation': { + 'type': 'DoubleTypeAnnotation' + }, + 'params': [ + { + 'name': 'arg', + 'optional': false, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'getFloat', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'returnTypeAnnotation': { + 'type': 'FloatTypeAnnotation' + }, + 'params': [ + { + 'name': 'arg', + 'optional': false, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + } + ] + }, + 'moduleName': 'SampleTurboModule' + } + } +}" +`; + exports[`RN Codegen TypeScript Parser can generate fixture NAMESPACED_NATIVE_MODULE_WITH_UNSAFE_OBJECT 1`] = ` "{ 'modules': { diff --git a/packages/react-native-codegen/src/parsers/typescript/modules/__tests__/typescript-module-parser-snapshot-test.js b/packages/react-native-codegen/src/parsers/typescript/modules/__tests__/typescript-module-parser-snapshot-test.js index 39963c295fcc..36adb7e8f9df 100644 --- a/packages/react-native-codegen/src/parsers/typescript/modules/__tests__/typescript-module-parser-snapshot-test.js +++ b/packages/react-native-codegen/src/parsers/typescript/modules/__tests__/typescript-module-parser-snapshot-test.js @@ -16,7 +16,7 @@ const {TypeScriptParser} = require('../../parser'); const typeScriptParser = new TypeScriptParser(); -jest.mock('fs', () => ({ +jest.mock('node:fs', () => ({ readFileSync: filename => { // Jest in the OSS does not allow to capture variables in closures. // Therefore, we have to bring the variables inside the closure. diff --git a/packages/react-native-codegen/src/parsers/typescript/parser.js b/packages/react-native-codegen/src/parsers/typescript/parser.js index 86c9bdfade58..7c85a0349601 100644 --- a/packages/react-native-codegen/src/parsers/typescript/parser.js +++ b/packages/react-native-codegen/src/parsers/typescript/parser.js @@ -59,8 +59,8 @@ const {typeScriptTranslateTypeAnnotation} = require('./modules'); const {parseTopLevelType} = require('./parseTopLevelType'); // $FlowFixMe[untyped-import] Use flow-types for @babel/parser const babelParser = require('@babel/parser'); -const fs = require('fs'); const invariant = require('invariant'); +const fs = require('node:fs'); class TypeScriptParser implements Parser { typeParameterInstantiation: string = 'TSTypeParameterInstantiation'; @@ -455,6 +455,7 @@ class TypeScriptParser implements Parser { let typeResolutionStatus: TypeResolutionStatus = { successful: false, }; + const resolvedTypeAliases = new Set(); for (;;) { const topLevelType = parseTopLevelType(node, parser); @@ -465,11 +466,21 @@ class TypeScriptParser implements Parser { break; } + // A qualified name (e.g. CodegenTypes.Double) refers to a namespace + // member, not to the local type alias of the same unqualified name. + if (node.typeName.type === 'TSQualifiedName') { + break; + } + const typeAnnotationName = this.getTypeAnnotationName(node); const resolvedTypeAnnotation = types[typeAnnotationName]; - if (resolvedTypeAnnotation == null) { + if ( + resolvedTypeAnnotation == null || + resolvedTypeAliases.has(typeAnnotationName) + ) { break; } + resolvedTypeAliases.add(typeAnnotationName); const {typeAnnotation: typeAnnotationNode, typeResolutionStatus: status} = handleGenericTypeAnnotation(node, resolvedTypeAnnotation, this); diff --git a/packages/react-native-codegen/src/parsers/utils.js b/packages/react-native-codegen/src/parsers/utils.js index 851450b0b181..207f357bea2a 100644 --- a/packages/react-native-codegen/src/parsers/utils.js +++ b/packages/react-native-codegen/src/parsers/utils.js @@ -11,7 +11,7 @@ 'use strict'; const {ParserError} = require('./errors'); -const path = require('path'); +const path = require('node:path'); export type TypeDeclarationMap = {[declarationName: string]: $FlowFixMe}; @@ -177,22 +177,18 @@ function isModuleRegistryCall(node: $FlowFixMe): boolean { } const memberExpression = callExpression.callee; - if ( - !( - memberExpression.object.type === 'Identifier' && - memberExpression.object.name === 'TurboModuleRegistry' - ) - ) { + if (!( + memberExpression.object.type === 'Identifier' && + memberExpression.object.name === 'TurboModuleRegistry' + )) { return false; } - if ( - !( - memberExpression.property.type === 'Identifier' && - (memberExpression.property.name === 'get' || - memberExpression.property.name === 'getEnforcing') - ) - ) { + if (!( + memberExpression.property.type === 'Identifier' && + (memberExpression.property.name === 'get' || + memberExpression.property.name === 'getEnforcing') + )) { return false; } diff --git a/packages/react-native-compatibility-check/README.md b/packages/react-native-compatibility-check/README.md index 0e727aaf8857..de19ae3892e6 100644 --- a/packages/react-native-compatibility-check/README.md +++ b/packages/react-native-compatibility-check/README.md @@ -1,4 +1,9 @@ -# **React Native compatibility-check** +# @react-native/compatibility-check + +[![npm]](https://www.npmjs.com/package/@react-native/compatibility-check) [![npm downloads]](https://www.npmjs.com/package/@react-native/compatibility-check) + +[npm]: https://img.shields.io/npm/v/@react-native/compatibility-check.svg?color=blue +[npm downloads]: https://img.shields.io/npm/dm/@react-native/compatibility-check.svg Status: Experimental (stage 1) diff --git a/packages/react-native-compatibility-check/package.json b/packages/react-native-compatibility-check/package.json index 7751de0f57c1..174f09aef012 100644 --- a/packages/react-native-compatibility-check/package.json +++ b/packages/react-native-compatibility-check/package.json @@ -5,10 +5,10 @@ "license": "MIT", "repository": { "type": "git", - "url": "git+https://github.com/facebook/react-native.git", + "url": "git+https://github.com/react/react-native.git", "directory": "packages/react-native-compatibility-check" }, - "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/react-native-compatibility-check#readme", + "homepage": "https://github.com/react/react-native/tree/HEAD/packages/react-native-compatibility-check#readme", "keywords": [ "boundary", "crashes", @@ -17,7 +17,7 @@ "tools", "react-native" ], - "bugs": "https://github.com/facebook/react-native/issues", + "bugs": "https://github.com/react/react-native/issues", "engines": { "node": "^22.13.0 || ^24.3.0 || >= 26.0.0" }, diff --git a/packages/react-native-compatibility-check/src/ComparisonResult.js b/packages/react-native-compatibility-check/src/ComparisonResult.js index 40b4d9343953..967206eaef61 100644 --- a/packages/react-native-compatibility-check/src/ComparisonResult.js +++ b/packages/react-native-compatibility-check/src/ComparisonResult.js @@ -120,8 +120,7 @@ export type UnionMembersComparisonResult = { }>, }; export type MembersComparisonResult = - | EnumMembersComparisonResult - | UnionMembersComparisonResult; + EnumMembersComparisonResult | UnionMembersComparisonResult; export type NullableComparisonResult = { /* Four possible cases of change: void goes to T? :: typeRefined !optionsReduced diff --git a/packages/react-native-compatibility-check/src/DiffResults.js b/packages/react-native-compatibility-check/src/DiffResults.js index 22f75d196cdf..1257c6b0c5b0 100644 --- a/packages/react-native-compatibility-check/src/DiffResults.js +++ b/packages/react-native-compatibility-check/src/DiffResults.js @@ -87,9 +87,7 @@ type ExportableSchemaDiffers = { }; export type SchemaDiffCategory = 'new' | 'deprecated' | SchemaDiffers; type ExportableSchemaDiffCategory = - | 'new' - | 'deprecated' - | ExportableSchemaDiffers; + 'new' | 'deprecated' | ExportableSchemaDiffers; export type SchemaDiff = { name: string, framework: Framework, diff --git a/packages/react-native-compatibility-check/src/__tests__/utilities/getTestSchema.js b/packages/react-native-compatibility-check/src/__tests__/utilities/getTestSchema.js index de2f26fc2685..c58c7fc8f412 100644 --- a/packages/react-native-compatibility-check/src/__tests__/utilities/getTestSchema.js +++ b/packages/react-native-compatibility-check/src/__tests__/utilities/getTestSchema.js @@ -11,7 +11,7 @@ import type {SchemaType} from '@react-native/codegen/src/CodegenSchema'; import {FlowParser} from '@react-native/codegen/src/parsers/flow/parser'; -import path from 'path'; +import path from 'node:path'; const flowParser = new FlowParser(); diff --git a/packages/react-native-popup-menu-android/README.md b/packages/react-native-popup-menu-android/README.md new file mode 100644 index 000000000000..42b2e22784f6 --- /dev/null +++ b/packages/react-native-popup-menu-android/README.md @@ -0,0 +1,8 @@ +# @react-native/popup-menu-android + +[![npm]](https://www.npmjs.com/package/@react-native/popup-menu-android) [![npm downloads]](https://www.npmjs.com/package/@react-native/popup-menu-android) + +[npm]: https://img.shields.io/npm/v/@react-native/popup-menu-android.svg?color=blue +[npm downloads]: https://img.shields.io/npm/dm/@react-native/popup-menu-android.svg + +`PopupMenuAndroid` component for React Native, exposing the Android platform's [`PopupMenu`](https://developer.android.com/reference/android/widget/PopupMenu) for displaying a menu anchored to a view. diff --git a/packages/react-native-popup-menu-android/android/src/main/java/com/facebook/react/popupmenu/PopupMenuPackage.kt b/packages/react-native-popup-menu-android/android/src/main/java/com/facebook/react/popupmenu/PopupMenuPackage.kt index 199713731adf..93a4bfc50a9f 100644 --- a/packages/react-native-popup-menu-android/android/src/main/java/com/facebook/react/popupmenu/PopupMenuPackage.kt +++ b/packages/react-native-popup-menu-android/android/src/main/java/com/facebook/react/popupmenu/PopupMenuPackage.kt @@ -18,11 +18,9 @@ import com.facebook.react.uimanager.ViewManager @ReactModuleList(nativeModules = arrayOf()) public class PopupMenuPackage() : BaseReactPackage(), ViewManagerOnDemandReactPackage { - private val viewManagersMap: Map = - mapOf( - ReactPopupMenuManager.REACT_CLASS to - ModuleSpec.viewManagerSpec({ ReactPopupMenuManager() }), - ) + private val viewManagersMap: Map = mapOf( + ReactPopupMenuManager.REACT_CLASS to ModuleSpec.viewManagerSpec({ ReactPopupMenuManager() }), + ) override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? { return null diff --git a/packages/react-native-popup-menu-android/android/src/main/java/com/facebook/react/popupmenu/ReactPopupMenuManager.kt b/packages/react-native-popup-menu-android/android/src/main/java/com/facebook/react/popupmenu/ReactPopupMenuManager.kt index 17b3376d558d..756bfa702ab4 100644 --- a/packages/react-native-popup-menu-android/android/src/main/java/com/facebook/react/popupmenu/ReactPopupMenuManager.kt +++ b/packages/react-native-popup-menu-android/android/src/main/java/com/facebook/react/popupmenu/ReactPopupMenuManager.kt @@ -53,11 +53,10 @@ public class ReactPopupMenuManager : public companion object { public const val REACT_CLASS: String = "AndroidPopupMenu" private const val REGISTRATION_NAME = "registrationName" - private val DIRECT_EVENT_TYPE_CONSTANT = - mapOf( - PopupMenuSelectionEvent.EVENT_NAME to - mapOf(REGISTRATION_NAME to "onPopupMenuSelectionChange"), - PopupMenuDismissEvent.EVENT_NAME to mapOf(REGISTRATION_NAME to "onPopupMenuDismiss"), - ) + private val DIRECT_EVENT_TYPE_CONSTANT = mapOf( + PopupMenuSelectionEvent.EVENT_NAME to + mapOf(REGISTRATION_NAME to "onPopupMenuSelectionChange"), + PopupMenuDismissEvent.EVENT_NAME to mapOf(REGISTRATION_NAME to "onPopupMenuDismiss"), + ) } } diff --git a/packages/react-native-popup-menu-android/package.json b/packages/react-native-popup-menu-android/package.json index 73406983cd62..9962d4d115f3 100644 --- a/packages/react-native-popup-menu-android/package.json +++ b/packages/react-native-popup-menu-android/package.json @@ -2,6 +2,11 @@ "name": "@react-native/popup-menu-android", "version": "0.87.0-main", "description": "PopupMenu for the Android platform", + "repository": { + "type": "git", + "url": "git+https://github.com/react/react-native.git", + "directory": "packages/react-native-popup-menu-android" + }, "main": "index.js", "files": [ "js", diff --git a/packages/react-native-popup-menu-android/scripts/prepublish-popup-menu-android.js b/packages/react-native-popup-menu-android/scripts/prepublish-popup-menu-android.js index a6cf3f07c609..28d27db5333c 100644 --- a/packages/react-native-popup-menu-android/scripts/prepublish-popup-menu-android.js +++ b/packages/react-native-popup-menu-android/scripts/prepublish-popup-menu-android.js @@ -24,7 +24,7 @@ function extractVersion(tomlContent, regex) { return match && match[1] ? match[1] : null; } -const fs = require('fs'); +const fs = require('node:fs'); const buildGradleKtsPath = 'android/build.gradle.kts'; const libsVersionsTomlPath = '../react-native/gradle/libs.versions.toml'; diff --git a/packages/react-native-test-library/.gitignore b/packages/react-native-test-library/.gitignore new file mode 100644 index 000000000000..531ed06a6fec --- /dev/null +++ b/packages/react-native-test-library/.gitignore @@ -0,0 +1,11 @@ +# Generated SPM artifacts (written by setup-ios-spm.js's earlier in-place +# layout). The current autolinker emits these under the consumer app's +# build/generated/autolinking/ tree instead, so any copy that lands here is +# stale and should not be committed. +Package.swift +Package.resolved +include/ + +# SwiftPM caches +.build/ +.swiftpm/ diff --git a/packages/react-native-test-library/apple/TestLibraryApple.h b/packages/react-native-test-library/apple/TestLibraryApple.h new file mode 100644 index 000000000000..fe19590fdc6d --- /dev/null +++ b/packages/react-native-test-library/apple/TestLibraryApple.h @@ -0,0 +1,11 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import + +@interface TestLibraryApple : NSObject +@end diff --git a/packages/react-native-test-library/apple/TestLibraryApple.mm b/packages/react-native-test-library/apple/TestLibraryApple.mm new file mode 100644 index 000000000000..2fa7f1fcefb1 --- /dev/null +++ b/packages/react-native-test-library/apple/TestLibraryApple.mm @@ -0,0 +1,27 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import "TestLibraryApple.h" + +// Synth library products are emitted as .library(type: .dynamic, ...), so SPM +// wraps each autolinked dep as a Foo.framework under PackageFrameworks/. That +// gives angle-bracket imports the standard resolution path, +// matching how most React Native libraries already organize their headers. +#import + +@implementation TestLibraryApple + +RCT_EXPORT_MODULE() + +RCT_EXPORT_METHOD( + echo : (NSString *)message resolve : (RCTPromiseResolveBlock)resolve reject : (RCTPromiseRejectBlock)reject) +{ + NSString *prefix = [TestLibraryCommon defaultPrefix]; + resolve([NSString stringWithFormat:@"%@apple: %@", prefix, message]); +} + +@end diff --git a/packages/react-native-test-library/apple/TestLibraryApple.podspec b/packages/react-native-test-library/apple/TestLibraryApple.podspec new file mode 100644 index 000000000000..02cef6573b26 --- /dev/null +++ b/packages/react-native-test-library/apple/TestLibraryApple.podspec @@ -0,0 +1,29 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +require "json" + +package = JSON.parse(File.read(File.join(__dir__, "package.json"))) + +Pod::Spec.new do |s| + s.name = "TestLibraryApple" + s.version = package["version"] + s.summary = package["description"] + s.homepage = "https://github.com/facebook/react-native" + s.license = "MIT" + s.platforms = min_supported_versions + s.author = "Meta Platforms, Inc. and its affiliates" + s.source = { :git => "https://github.com/facebook/react-native.git", :tag => "#{s.version}" } + s.source_files = "*.{h,m,mm,swift}" + s.requires_arc = true + + # TestLibraryApple.mm imports . + # CocoaPods resolves it leniently through the shared Public headers dir, but the + # dependency edge must be declared for SwiftPM (the scaffolder wires sibling + # packages from podspec dependencies). + s.dependency "TestLibraryCommon" + + install_modules_dependencies(s) +end diff --git a/packages/react-native-test-library/apple/__tests__/TestLibraryAppleTests.cpp b/packages/react-native-test-library/apple/__tests__/TestLibraryAppleTests.cpp new file mode 100644 index 000000000000..a9c5b63cca3d --- /dev/null +++ b/packages/react-native-test-library/apple/__tests__/TestLibraryAppleTests.cpp @@ -0,0 +1,12 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#include + +static_assert( + false, + "TestLibraryAppleTests.cpp must not be compiled by the SPM autolinker"); diff --git a/packages/react-native-test-library/apple/index.d.ts b/packages/react-native-test-library/apple/index.d.ts new file mode 100644 index 000000000000..9c911b2d99b7 --- /dev/null +++ b/packages/react-native-test-library/apple/index.d.ts @@ -0,0 +1,10 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import type {Greeting} from '../common'; + +export function greet(g: Greeting): Promise; diff --git a/packages/react-native-test-library/apple/index.js b/packages/react-native-test-library/apple/index.js new file mode 100644 index 000000000000..028d0e9450fa --- /dev/null +++ b/packages/react-native-test-library/apple/index.js @@ -0,0 +1,28 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + */ + +'use strict'; + +import type {Greeting} from '../common'; + +import {formatGreeting} from '../common'; +import {NativeModules, Platform} from 'react-native'; + +export function greet(g: Greeting): Promise { + const TestLibraryApple = NativeModules.TestLibraryApple; + if (TestLibraryApple == null) { + return Promise.reject( + new Error( + `react-native-test-library-apple: native module unavailable on ${Platform.OS}. This package is iOS-only; install a platform-specific sibling (e.g. react-native-test-library-android) for cross-platform coverage.`, + ), + ); + } + return TestLibraryApple.echo(formatGreeting(g)); +} diff --git a/packages/react-native-test-library/apple/package.json b/packages/react-native-test-library/apple/package.json new file mode 100644 index 000000000000..8dda511cbefa --- /dev/null +++ b/packages/react-native-test-library/apple/package.json @@ -0,0 +1,31 @@ +{ + "name": "react-native-test-library-apple", + "version": "0.87.0-main", + "description": "Apple platform implementation for the React Native autolinking fixture. Depends on react-native-test-library-common; used to validate iOS/macOS autolinking discovery and transitive native dependency resolution.", + "private": true, + "main": "index.js", + "types": "index.d.ts", + "license": "MIT", + "files": [ + "index.js", + "index.d.ts", + "react-native.config.js", + "TestLibraryApple.podspec", + "TestLibraryApple.h", + "TestLibraryApple.mm" + ], + "keywords": [ + "react-native", + "fixture", + "autolinking", + "ios", + "macos" + ], + "dependencies": { + "react-native-test-library-common": "0.87.0-main" + }, + "peerDependencies": { + "react": "*", + "react-native": "1000.0.0" + } +} diff --git a/packages/react-native-test-library/apple/react-native.config.js b/packages/react-native-test-library/apple/react-native.config.js new file mode 100644 index 000000000000..982ed353de95 --- /dev/null +++ b/packages/react-native-test-library/apple/react-native.config.js @@ -0,0 +1,22 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + * @noflow + */ + +'use strict'; + +module.exports = { + dependency: { + platforms: { + ios: {}, + }, + }, + spm: { + dependencies: ['react-native-test-library-common'], + }, +}; diff --git a/packages/react-native-test-library/common/TestLibraryCommon.h b/packages/react-native-test-library/common/TestLibraryCommon.h new file mode 100644 index 000000000000..a84f31084b51 --- /dev/null +++ b/packages/react-native-test-library/common/TestLibraryCommon.h @@ -0,0 +1,15 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import + +@interface TestLibraryCommon : NSObject + +/** Shared prefix used by other test-library packages that depend on common. */ ++ (NSString *)defaultPrefix; + +@end diff --git a/packages/react-native-test-library/common/TestLibraryCommon.mm b/packages/react-native-test-library/common/TestLibraryCommon.mm new file mode 100644 index 000000000000..19ced66cde8c --- /dev/null +++ b/packages/react-native-test-library/common/TestLibraryCommon.mm @@ -0,0 +1,24 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import "TestLibraryCommon.h" + +@implementation TestLibraryCommon + +RCT_EXPORT_MODULE() + ++ (NSString *)defaultPrefix +{ + return @"[common] "; +} + +RCT_EXPORT_METHOD(version : (RCTPromiseResolveBlock)resolve reject : (RCTPromiseRejectBlock)reject) +{ + resolve(@"common@0.87.0-main"); +} + +@end diff --git a/packages/react-native-test-library/common/TestLibraryCommon.podspec b/packages/react-native-test-library/common/TestLibraryCommon.podspec new file mode 100644 index 000000000000..4218183fb657 --- /dev/null +++ b/packages/react-native-test-library/common/TestLibraryCommon.podspec @@ -0,0 +1,23 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +require "json" + +package = JSON.parse(File.read(File.join(__dir__, "package.json"))) + +Pod::Spec.new do |s| + s.name = "TestLibraryCommon" + s.version = package["version"] + s.summary = package["description"] + s.homepage = "https://github.com/facebook/react-native" + s.license = "MIT" + s.platforms = min_supported_versions + s.author = "Meta Platforms, Inc. and its affiliates" + s.source = { :git => "https://github.com/facebook/react-native.git", :tag => "#{s.version}" } + s.source_files = "*.{h,m,mm,swift}" + s.requires_arc = true + + install_modules_dependencies(s) +end diff --git a/packages/react-native-test-library/common/index.d.ts b/packages/react-native-test-library/common/index.d.ts new file mode 100644 index 000000000000..c765deb0688f --- /dev/null +++ b/packages/react-native-test-library/common/index.d.ts @@ -0,0 +1,14 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +export type Greeting = Readonly<{ + name: string; + language: string; +}>; + +export function formatGreeting(g: Greeting): string; +export function getVersion(): Promise; diff --git a/packages/react-native-test-library/common/index.js b/packages/react-native-test-library/common/index.js new file mode 100644 index 000000000000..71eeefcf1ba2 --- /dev/null +++ b/packages/react-native-test-library/common/index.js @@ -0,0 +1,34 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + */ + +'use strict'; + +import {NativeModules, Platform} from 'react-native'; + +export type Greeting = Readonly<{ + name: string, + language: string, +}>; + +export function formatGreeting(g: Greeting): string { + return `[${g.language}] Hello, ${g.name}!`; +} + +export function getVersion(): Promise { + const TestLibraryCommon = NativeModules.TestLibraryCommon; + if (TestLibraryCommon == null) { + return Promise.reject( + new Error( + `react-native-test-library-common: native module unavailable on ${Platform.OS}.`, + ), + ); + } + return TestLibraryCommon.version(); +} diff --git a/packages/react-native-test-library/common/package.json b/packages/react-native-test-library/common/package.json new file mode 100644 index 000000000000..0a911df6a303 --- /dev/null +++ b/packages/react-native-test-library/common/package.json @@ -0,0 +1,24 @@ +{ + "name": "react-native-test-library-common", + "version": "0.87.0-main", + "description": "Shared JS utilities consumed by react-native-test-library-apple. Used as a fixture for validating autolinking discovery and transitive native dependency resolution in the React Native monorepo.", + "private": true, + "main": "index.js", + "types": "index.d.ts", + "license": "MIT", + "files": [ + "index.js", + "index.d.ts", + "react-native.config.js", + "TestLibraryCommon.podspec", + "TestLibraryCommon.h", + "TestLibraryCommon.mm" + ], + "keywords": [ + "react-native", + "fixture", + "autolinking", + "ios", + "macos" + ] +} diff --git a/packages/react-native/rn-get-polyfills.js b/packages/react-native-test-library/common/react-native.config.js similarity index 70% rename from packages/react-native/rn-get-polyfills.js rename to packages/react-native-test-library/common/react-native.config.js index bf0d0428de37..3de9a9829be7 100644 --- a/packages/react-native/rn-get-polyfills.js +++ b/packages/react-native-test-library/common/react-native.config.js @@ -4,10 +4,16 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @flow strict-local * @format + * @noflow */ 'use strict'; -module.exports = require('@react-native/js-polyfills'); +module.exports = { + dependency: { + platforms: { + ios: {}, + }, + }, +}; diff --git a/packages/react-native/.doxygen.config.template b/packages/react-native/.doxygen.config.template index f06eeddd9b57..03e2e697a524 100644 --- a/packages/react-native/.doxygen.config.template +++ b/packages/react-native/.doxygen.config.template @@ -653,7 +653,7 @@ INTERNAL_DOCS = NO # Possible values are: SYSTEM, NO and YES. # The default value is: SYSTEM. -CASE_SENSE_NAMES = SYSTEM +CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO then Doxygen will show members with # their full class and namespace scopes in the documentation. If set to YES, the diff --git a/packages/react-native/Libraries/ActionSheetIOS/ActionSheetIOS.js b/packages/react-native/Libraries/ActionSheetIOS/ActionSheetIOS.js index 78b6cda1bf11..4cb8fcf51460 100644 --- a/packages/react-native/Libraries/ActionSheetIOS/ActionSheetIOS.js +++ b/packages/react-native/Libraries/ActionSheetIOS/ActionSheetIOS.js @@ -38,6 +38,10 @@ export type ShareActionSheetIOSOptions = Readonly<{ tintColor?: ?number, cancelButtonTintColor?: ?number, disabledButtonTintColor?: ?number, + /** + * The activities to exclude from the ActionSheet. + * For example: ['com.apple.UIKit.activity.PostToTwitter'] + */ excludedActivityTypes?: ?Array, userInterfaceStyle?: ?string, }>; @@ -50,9 +54,10 @@ export type ShareActionSheetError = Readonly<{ }>; /** - * Display action sheets and share sheets on iOS. + * Displays native iOS action sheets and share sheets. * - * See https://reactnative.dev/docs/actionsheetios + * @see https://reactnative.dev/docs/actionsheetios + * @platform ios */ const ActionSheetIOS = { /** @@ -62,15 +67,13 @@ const ActionSheetIOS = { * * - `options` (array of strings) - a list of button titles (required) * - `cancelButtonIndex` (int) - index of cancel button in `options` - * - `destructiveButtonIndex` (int or array of ints) - index or indices of destructive buttons in `options` + * - `destructiveButtonIndex` (int or array of ints) - indices of destructive buttons in `options` * - `title` (string) - a title to show above the action sheet * - `message` (string) - a message to show below the title * - `disabledButtonIndices` (array of numbers) - a list of button indices which should be disabled * - * The 'callback' function takes one parameter, the zero-based index - * of the selected item. - * - * See https://reactnative.dev/docs/actionsheetios#showactionsheetwithoptions + * The `callback` function receives the zero-based index of the selected + * item. */ showActionSheetWithOptions( options: ActionSheetIOSOptions, @@ -136,27 +139,19 @@ const ActionSheetIOS = { }, /** - * Display the iOS share sheet. The `options` object should contain - * one or both of `message` and `url` and can additionally have - * a `subject` or `excludedActivityTypes`: + * Display the iOS share sheet. The `options` object should contain one or + * both of `message` and `url` and can additionally have a `subject` or + * `excludedActivityTypes`: * * - `url` (string) - a URL to share * - `message` (string) - a message to share * - `subject` (string) - a subject for the message - * - `excludedActivityTypes` (array) - the activities to exclude from - * the ActionSheet + * - `excludedActivityTypes` (array) - the activities to exclude from the ActionSheet * - `tintColor` (color) - tint color of the buttons * - * The 'failureCallback' function takes one parameter, an error object. - * The only property defined on this object is an optional `stack` property - * of type `string`. - * - * The 'successCallback' function takes two parameters: - * - * - a boolean value signifying success or failure - * - a string that, in the case of success, indicates the method of sharing - * - * See https://reactnative.dev/docs/actionsheetios#showshareactionsheetwithoptions + * The `failureCallback` function receives an error object. The + * `successCallback` function receives a boolean indicating success and a + * string describing the sharing method used. */ showShareActionSheetWithOptions( options: ShareActionSheetIOSOptions, @@ -186,8 +181,8 @@ const ActionSheetIOS = { }, /** - * Dismisses the most upper iOS action sheet presented, if no action sheet is - * present a warning is displayed. + * Dismiss the most upper action sheet currently presented. Displays a + * warning if no action sheet is present. */ dismissActionSheet: () => { invariant(RCTActionSheetManager, "ActionSheetManager doesn't exist"); diff --git a/packages/react-native/Libraries/ActionSheetIOS/React-RCTActionSheet.podspec b/packages/react-native/Libraries/ActionSheetIOS/React-RCTActionSheet.podspec index 06852c0a06eb..5993899241eb 100644 --- a/packages/react-native/Libraries/ActionSheetIOS/React-RCTActionSheet.podspec +++ b/packages/react-native/Libraries/ActionSheetIOS/React-RCTActionSheet.podspec @@ -31,4 +31,6 @@ Pod::Spec.new do |s| s.header_dir = "RCTActionSheet" s.dependency "React-Core/RCTActionSheetHeaders", version + + mark_as_react_native_build(s) end diff --git a/packages/react-native/Libraries/Alert/Alert.js b/packages/react-native/Libraries/Alert/Alert.js index df9908ebd15b..4130ec511438 100644 --- a/packages/react-native/Libraries/Alert/Alert.js +++ b/packages/react-native/Libraries/Alert/Alert.js @@ -17,10 +17,7 @@ import {alertWithArgs} from './RCTAlertManager'; * @platform ios */ export type AlertType = - | 'default' - | 'plain-text' - | 'secure-text' - | 'login-password'; + 'default' | 'plain-text' | 'secure-text' | 'login-password'; /** * @platform ios @@ -57,9 +54,43 @@ export type AlertOptions = { * alerts. On iOS, you can show an alert that prompts the user to enter * some information. * - * See https://reactnative.dev/docs/alert + * ## iOS + * + * On iOS you can specify any number of buttons. Each button can optionally + * specify a style, which is one of 'default', 'cancel' or 'destructive'. + * + * ## Android + * + * On Android at most three buttons can be specified. Android has a concept + * of a neutral, negative and a positive button: + * + * - If you specify one button, it will be the 'positive' one (such as 'OK') + * - Two buttons mean 'negative', 'positive' (such as 'Cancel', 'OK') + * - Three buttons mean 'neutral', 'negative', 'positive' (such as 'Later', 'Cancel', 'OK') + * + * Example: + * + * ```tsx + * // Works on both iOS and Android + * Alert.alert( + * 'Alert Title', + * 'My Alert Msg', + * [ + * {text: 'Ask me later', onPress: () => console.log('Ask me later pressed')}, + * {text: 'Cancel', onPress: () => console.log('Cancel Pressed'), style: 'cancel'}, + * {text: 'OK', onPress: () => console.log('OK Pressed')}, + * ] + * ) + * ``` + * + * @see https://reactnative.dev/docs/alert */ class Alert { + /** + * Display an alert dialog with the specified title, message, and buttons. + * On Android, at most three buttons can be specified. On iOS, any number of + * buttons can be used. + */ static alert( title: ?string, message?: ?string, @@ -140,6 +171,9 @@ class Alert { } /** + * Create and display a prompt to enter text. Accepts a title, message, + * callback or buttons, input type, default value, keyboard type, and options. + * * @platform ios */ static prompt( diff --git a/packages/react-native/Libraries/Animated/AnimatedEvent.js b/packages/react-native/Libraries/Animated/AnimatedEvent.js index 3f1245e3fd27..4704a87e4216 100644 --- a/packages/react-native/Libraries/Animated/AnimatedEvent.js +++ b/packages/react-native/Libraries/Animated/AnimatedEvent.js @@ -21,9 +21,7 @@ import AnimatedValueXY from './nodes/AnimatedValueXY'; import invariant from 'invariant'; export type Mapping = - | {[key: string]: Mapping, ...} - | AnimatedValue - | AnimatedValueXY; + {[key: string]: Mapping, ...} | AnimatedValue | AnimatedValueXY; export type EventConfig = { listener?: ?(NativeSyntheticEvent) => unknown, useNativeDriver: boolean, @@ -199,7 +197,7 @@ export class AnimatedEvent { this._attachedEvent && this._attachedEvent.detach(); } - __getHandler(): any | ((...args: any) => void) { + __getHandler(): (...args: any) => void { if (this.__isNative) { if (__DEV__) { let validatedMapping = false; diff --git a/packages/react-native/Libraries/Animated/AnimatedExports.js b/packages/react-native/Libraries/Animated/AnimatedExports.js index d767e8a15bc7..55940d81c39e 100644 --- a/packages/react-native/Libraries/Animated/AnimatedExports.js +++ b/packages/react-native/Libraries/Animated/AnimatedExports.js @@ -24,21 +24,43 @@ const Animated: typeof AnimatedImplementation = Platform.isDisableAnimations : AnimatedImplementation; export default { + /** + * FlatList and SectionList infer generic Type defined under their `data` and `section` props. + */ get FlatList(): AnimatedFlatList { return require('./components/AnimatedFlatList').default; }, + /** + * Animated variants of the basic native views. Accepts Animated.Value for + * props and style. + */ get Image(): AnimatedImage { return require('./components/AnimatedImage').default; }, + /** + * Animated variants of the basic native views. Accepts Animated.Value for + * props and style. + */ get ScrollView(): AnimatedScrollView { return require('./components/AnimatedScrollView').default; }, + /** + * FlatList and SectionList infer generic Type defined under their `data` and `section` props. + */ get SectionList(): AnimatedSectionList { return require('./components/AnimatedSectionList').default; }, + /** + * Animated variants of the basic native views. Accepts Animated.Value for + * props and style. + */ get Text(): AnimatedText { return require('./components/AnimatedText').default; }, + /** + * Animated variants of the basic native views. Accepts Animated.Value for + * props and style. + */ get View(): AnimatedView { return require('./components/AnimatedView').default; }, diff --git a/packages/react-native/Libraries/Animated/AnimatedExports.js.flow b/packages/react-native/Libraries/Animated/AnimatedExports.js.flow index cacd8c2248a9..7880f98f97af 100644 --- a/packages/react-native/Libraries/Animated/AnimatedExports.js.flow +++ b/packages/react-native/Libraries/Animated/AnimatedExports.js.flow @@ -10,7 +10,7 @@ import AnimatedImplementation from './AnimatedImplementation'; -export type {CompositeAnimation} from './AnimatedImplementation'; +export type {CompositeAnimation, Numeric} from './AnimatedImplementation'; export type {DecayAnimationConfig} from './animations/DecayAnimation'; export type {SpringAnimationConfig} from './animations/SpringAnimation'; export type {TimingAnimationConfig} from './animations/TimingAnimation'; diff --git a/packages/react-native/Libraries/Animated/AnimatedImplementation.js b/packages/react-native/Libraries/Animated/AnimatedImplementation.js index 46a08d2e8954..7fc01bb27249 100644 --- a/packages/react-native/Libraries/Animated/AnimatedImplementation.js +++ b/packages/react-native/Libraries/Animated/AnimatedImplementation.js @@ -20,6 +20,7 @@ import type {DecayAnimationConfig} from './animations/DecayAnimation'; import type {SpringAnimationConfig} from './animations/SpringAnimation'; import type {TimingAnimationConfig} from './animations/TimingAnimation'; +import NativeAnimatedHelper from '../../src/private/animated/NativeAnimatedHelper'; import {AnimatedEvent, attachNativeEventImpl} from './AnimatedEvent'; import DecayAnimation from './animations/DecayAnimation'; import SpringAnimation from './animations/SpringAnimation'; @@ -39,8 +40,29 @@ import AnimatedValue from './nodes/AnimatedValue'; import AnimatedValueXY from './nodes/AnimatedValueXY'; export type CompositeAnimation = { + /** + * Animations are started by calling start() on your animation. + * start() takes a completion callback that will be called when the + * animation is done or when the animation is done because stop() was + * called on it before it could finish. + * + * @param callback - Optional function that will be called + * after the animation finished running normally or when the animation + * is done because stop() was called on it before it could finish + * + * @example + * Animated.timing({}).start(({ finished }) => { + * // completion callback + * }); + */ start: (callback?: ?EndCallback, isLooping?: boolean) => void, + /** + * Stops any running animation. + */ stop: () => void, + /** + * Stops any running animation and resets the value to its original. + */ reset: () => void, _startNativeLoop: (iterations?: number) => void, _isUsingNativeDriver: () => boolean, @@ -200,7 +222,11 @@ const springImpl = function ( }, _isUsingNativeDriver: function (): boolean { - return config.useNativeDriver || false; + return ( + NativeAnimatedHelper.isNativeDriverForced() || + config.useNativeDriver || + false + ); }, } ); @@ -254,7 +280,11 @@ const timingImpl = function ( }, _isUsingNativeDriver: function (): boolean { - return config.useNativeDriver || false; + return ( + NativeAnimatedHelper.isNativeDriverForced() || + config.useNativeDriver || + false + ); }, } ); @@ -296,7 +326,11 @@ const decayImpl = function ( }, _isUsingNativeDriver: function (): boolean { - return config.useNativeDriver || false; + return ( + NativeAnimatedHelper.isNativeDriverForced() || + config.useNativeDriver || + false + ); }, } ); @@ -542,10 +576,14 @@ function unforkEventImpl( } } -const eventImpl = function ( +// NOTE: With `useNativeDriver: true` this returns an `AnimatedEvent` instance +// rather than a callable handler. That object is only ever meant to be handed +// straight back to an animated component's event prop, so the declared type +// describes the handler shape both branches are consumed as. +const eventImpl: ( argMapping: ReadonlyArray, config: EventConfig, -): any { +) => (...args: Array) => void = function (argMapping, config): any { const animatedEvent = new AnimatedEvent(argMapping, config); if (animatedEvent.__isNative) { return animatedEvent; @@ -608,21 +646,104 @@ export default { * See https://reactnative.dev/docs/animated#node */ Node: AnimatedNode, + /** + * Animates a value from an initial velocity to zero based on a decay + * coefficient. + */ decay: decayImpl, + /** + * Animates a value along a timed easing curve. The `Easing` module has tons + * of pre-defined curves, or you can use your own function. + */ timing: timingImpl, + /** + * Spring animation based on Rebound and Origami. Tracks velocity state to + * create fluid motions as the `toValue` updates, and can be chained together. + */ spring: springImpl, + /** + * Creates a new Animated value composed from two Animated values added + * together. + */ add: addImpl, + /** + * Creates a new Animated value composed by subtracting the second Animated + * value from the first Animated value. + */ subtract: subtractImpl, + /** + * Creates a new Animated value composed by dividing the first Animated + * value by the second Animated value. + */ divide: divideImpl, + /** + * Creates a new Animated value composed from two Animated values multiplied + * together. + */ multiply: multiplyImpl, + /** + * Creates a new Animated value that is the (non-negative) modulo of the + * provided Animated value + */ modulo: moduloImpl, + /** + * Create a new Animated value that is limited between 2 values. It uses the + * difference between the last value so even if the value is far from the bounds + * it will start changing when the value starts getting closer again. + * (`value = clamp(value + diff, min, max)`). + * + * This is useful with scroll events, for example, to show the navbar when + * scrolling up and to hide it when scrolling down. + */ diffClamp: diffClampImpl, + /** + * Starts an animation after the given delay. + */ delay: delayImpl, + /** + * Starts an array of animations in order, waiting for each to complete + * before starting the next. If the current running animation is stopped, no + * following animations will be started. + */ sequence: sequenceImpl, + /** + * Starts an array of animations all at the same time. By default, if one + * of the animations is stopped, they will all be stopped. You can override + * this with the `stopTogether` flag. + */ parallel: parallelImpl, + /** + * Array of animations may run in parallel (overlap), but are started in + * sequence with successive delays. Nice for doing trailing effects. + */ stagger: staggerImpl, + /** + * Loops a given animation continuously, so that each time it reaches the end, + * it resets and begins again from the start. Can specify number of times to + * loop using the key 'iterations' in the config. Will loop without blocking + * the UI thread if the child animation is set to 'useNativeDriver'. + */ loop: loopImpl, + /** + * Takes an array of mappings and extracts values from each arg accordingly, + * then calls `setValue` on the mapped outputs. e.g. + * + *```javascript + * onScroll={Animated.event( + * [{nativeEvent: {contentOffset: {x: this._scrollX}}}] + * {listener}, // Optional async listener + * ) + * ... + * onPanResponderMove: Animated.event([ + * null, // raw event arg ignored + * {dx: this._panX}, // gestureState arg + * ]), + *``` + */ event: eventImpl, + /** + * Make any React component Animatable. Used to create `Animated.View`, etc. + */ createAnimatedComponent, attachNativeEvent: attachNativeEventImpl, forkEvent: forkEventImpl, diff --git a/packages/react-native/Libraries/Animated/AnimationTimingUtils.js b/packages/react-native/Libraries/Animated/AnimationTimingUtils.js new file mode 100644 index 000000000000..d153a622dee7 --- /dev/null +++ b/packages/react-native/Libraries/Animated/AnimationTimingUtils.js @@ -0,0 +1,39 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + */ + +'use strict'; + +export type AnimationTimeProvider = () => number; + +const defaultAnimationTimeProvider: AnimationTimeProvider = () => Date.now(); + +let animationTimeProvider: AnimationTimeProvider = defaultAnimationTimeProvider; + +/** + * Returns the current time, in milliseconds, used to drive JavaScript-based + * animations (timing, spring and decay). + * + * Defaults to `Date.now()`. The value can be overridden with + * `setAnimationTimeProvider`, e.g. to drive animations from a controlled clock + * in tests. + */ +export function getCurrentAnimationTime(): number { + return animationTimeProvider(); +} + +/** + * Overrides the time source used by `getCurrentAnimationTime`. Pass `null` to restore + * the default `Date.now()`-based provider. + */ +export function setAnimationTimeProvider( + provider: ?AnimationTimeProvider, +): void { + animationTimeProvider = provider ?? defaultAnimationTimeProvider; +} diff --git a/packages/react-native/Libraries/Animated/Easing.js b/packages/react-native/Libraries/Animated/Easing.js index 7b17de424d14..31956a8c3eb8 100644 --- a/packages/react-native/Libraries/Animated/Easing.js +++ b/packages/react-native/Libraries/Animated/Easing.js @@ -15,9 +15,8 @@ let ease; export type EasingFunction = (t: number) => number; /** - * The `Easing` module implements common easing functions. This module is used - * by [Animate.timing()](docs/animate.html#timing) to convey physically - * believable motion in animations. + * Implements common easing functions for use with `Animated.timing()` to convey + * physically believable motion in animations. * * You can find a visualization of some common easing functions at * http://easings.net/ @@ -58,6 +57,8 @@ export type EasingFunction = (t: number) => number; * - [`in`](docs/easing.html#in) runs an easing function forwards * - [`inOut`](docs/easing.html#inout) makes any easing function symmetrical * - [`out`](docs/easing.html#out) runs an easing function backwards + * + * @see https://reactnative.dev/docs/easing */ const EasingStatic = { /** diff --git a/packages/react-native/Libraries/Animated/NativeAnimatedAllowlist.js b/packages/react-native/Libraries/Animated/NativeAnimatedAllowlist.js index c5cecfc828c6..2c1fab7ac13a 100644 --- a/packages/react-native/Libraries/Animated/NativeAnimatedAllowlist.js +++ b/packages/react-native/Libraries/Animated/NativeAnimatedAllowlist.js @@ -78,6 +78,42 @@ const SUPPORTED_STYLES: {[string]: true} = { top: true, /* flex */ flex: true, + flexGrow: true, + flexShrink: true, + flexBasis: true, + aspectRatio: true, + /* margin */ + margin: true, + marginLeft: true, + marginRight: true, + marginTop: true, + marginBottom: true, + marginStart: true, + marginEnd: true, + marginHorizontal: true, + marginVertical: true, + /* padding */ + padding: true, + paddingLeft: true, + paddingRight: true, + paddingTop: true, + paddingBottom: true, + paddingStart: true, + paddingEnd: true, + paddingHorizontal: true, + paddingVertical: true, + /* border width */ + borderWidth: true, + borderLeftWidth: true, + borderRightWidth: true, + borderTopWidth: true, + borderBottomWidth: true, + borderStartWidth: true, + borderEndWidth: true, + /* gap */ + gap: true, + rowGap: true, + columnGap: true, } : {}), }; @@ -106,6 +142,7 @@ const SUPPORTED_INTERPOLATION_PARAMS: {[string]: true} = { extrapolate: true, extrapolateRight: true, extrapolateLeft: true, + easing: true, }; /** diff --git a/packages/react-native/Libraries/Animated/__tests__/Animated-itest.js b/packages/react-native/Libraries/Animated/__tests__/Animated-itest.js index ad9a1d8c4eca..0b9023e2a81c 100644 --- a/packages/react-native/Libraries/Animated/__tests__/Animated-itest.js +++ b/packages/react-native/Libraries/Animated/__tests__/Animated-itest.js @@ -13,13 +13,13 @@ import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment'; import type {HostInstance} from 'react-native'; -import ensureInstance from '../../../src/private/__tests__/utilities/ensureInstance'; import * as ReactNativeFeatureFlags from '../../../src/private/featureflags/ReactNativeFeatureFlags'; import * as Fantom from '@react-native/fantom'; +import nullthrows from 'nullthrows'; +import * as React from 'react'; import {createRef} from 'react'; -import {Animated, View, useAnimatedValue} from 'react-native'; +import {Animated, Easing, View, useAnimatedValue} from 'react-native'; import {allowStyleProp} from 'react-native/Libraries/Animated/NativeAnimatedAllowlist'; -import ReactNativeElement from 'react-native/src/private/webapis/dom/nodes/ReactNativeElement'; // Deferred start outputs the initial value on the first animation frame and // re-anchors timing on the second. This delays animation progress by one @@ -54,7 +54,7 @@ test('moving box by 100 points', () => { root.render(); }); - const viewElement = ensureInstance(viewRef.current, ReactNativeElement); + const viewElement = nullthrows(viewRef.current); expect(viewElement.getBoundingClientRect().x).toBe(0); @@ -87,6 +87,123 @@ test('moving box by 100 points', () => { expect(viewElement.getBoundingClientRect().x).toBe(100); }); +// A native-driven interpolation with a custom `easing` should follow the easing +// curve, not run linearly. The driver animates linearly 0 -> 1; the eased +// interpolation maps it to translateX 0 -> 100 with Easing.quad (t^2). At the +// midpoint (driver = 0.5) the eased value is 0.5^2 * 100 = 25 (a linear mapping +// would be 50). The easing is baked into the native interpolation config as an +// `easingStops` lookup table, so the native driver reproduces the curve. +test('native-driven interpolation honors custom easing', () => { + let _progress; + const viewRef = createRef(); + + function MyApp() { + const progress = useAnimatedValue(0); + _progress = progress; + const translateX = progress.interpolate({ + inputRange: [0, 1], + outputRange: [0, 100], + easing: Easing.quad, + }); + return ( + + ); + } + + const root = Fantom.createRoot(); + + Fantom.runTask(() => { + root.render(); + }); + + const viewElement = nullthrows(viewRef.current); + + Fantom.runTask(() => { + Animated.timing(_progress, { + toValue: 1, + duration: 1000, // 1 second + easing: Easing.linear, + useNativeDriver: true, + }).start(); + }); + + Fantom.unstable_produceFramesForDuration(500 + DEFERRED_START_MS); + + const transform = + // $FlowFixMe[incompatible-use] + Fantom.unstable_getDirectManipulationProps(viewElement).transform[0]; + + // Driver is 50% through (linear timing), but the interpolation's quad easing + // reshapes it: 0.5^2 * 100 = 25, not the linear 50. + expect(transform.translateX).toBeCloseTo(25, 0.001); + + Fantom.unstable_produceFramesForDuration(500); + + // Animation complete; final committed position is the full 100. + Fantom.runWorkLoop(); + expect(viewElement.getBoundingClientRect().x).toBe(100); +}); + +// When the easing leaves [0, 1] (Easing.back dips below 0 early), that excursion +// must be preserved even under `extrapolate: 'clamp'`. The driver runs 0 -> 1, so +// the input is always in range โ€” `clamp` should only affect out-of-range *input*, +// never the easing's own excursion. Pre-fix the native driver clamped it away +// (translateX pinned to 0); JS keeps it negative. This guards that parity. +test('native-driven interpolation preserves easing overshoot under clamp', () => { + let _progress; + const viewRef = createRef(); + + function MyApp() { + const progress = useAnimatedValue(0); + _progress = progress; + const translateX = progress.interpolate({ + inputRange: [0, 1], + outputRange: [0, 100], + easing: Easing.back(), + extrapolate: 'clamp', + }); + return ( + + ); + } + + const root = Fantom.createRoot(); + + Fantom.runTask(() => { + root.render(); + }); + + const viewElement = nullthrows(viewRef.current); + + Fantom.runTask(() => { + Animated.timing(_progress, { + toValue: 1, + duration: 1000, + easing: Easing.linear, + useNativeDriver: true, + }).start(); + }); + + // ~20% through: Easing.back(0.2) โ‰ˆ -0.046 -> translateX โ‰ˆ -4.6, i.e. negative. + // If the excursion were clamped (the bug), translateX would stay at 0. + Fantom.unstable_produceFramesForDuration(200 + DEFERRED_START_MS); + const transform = + // $FlowFixMe[incompatible-use] + Fantom.unstable_getDirectManipulationProps(viewElement).transform[0]; + expect(transform.translateX).toBeLessThan(0); + + // Completes at the in-range endpoint (Easing.back(1) === 1 -> 100). + Fantom.unstable_produceFramesForDuration(800); + Fantom.runWorkLoop(); + expect(viewElement.getBoundingClientRect().x).toBe(100); +}); + // Validate that a `useNativeDriver` timing animation does not begin progressing // until the end of the event loop tick it was started in. // @@ -114,7 +231,7 @@ function startTimingAnimationAndGetTranslateXAfterFirstFrame(): number { root.render(); }); - const viewElement = ensureInstance(viewRef.current, ReactNativeElement); + const viewElement = nullthrows(viewRef.current); Fantom.runTask(() => { Animated.timing(_translateX, { @@ -209,11 +326,8 @@ test('animation driven by onScroll event', () => { root.render(); }); - const scrollViewelement = ensureInstance( - scrollViewRef.current, - ReactNativeElement, - ); - const viewElement = ensureInstance(viewRef.current, ReactNativeElement); + const scrollViewelement = nullthrows(scrollViewRef.current); + const viewElement = nullthrows(viewRef.current); Fantom.scrollTo(scrollViewelement, { x: 0, @@ -280,10 +394,7 @@ test('animation driven by onScroll event when animated view is unmounted', () => root.render(); }); - const scrollViewelement = ensureInstance( - scrollViewRef.current, - ReactNativeElement, - ); + const scrollViewelement = nullthrows(scrollViewRef.current); Fantom.scrollTo(scrollViewelement, { x: 0, @@ -321,7 +432,7 @@ test('animated opacity', () => { root.render(); }); - const viewElement = ensureInstance(viewRef.current, ReactNativeElement); + const viewElement = nullthrows(viewRef.current); expect(viewElement.getBoundingClientRect().x).toBe(0); @@ -375,7 +486,7 @@ test('moving box by 50 points with offset 10', () => { root.render(); }); - const viewElement = ensureInstance(viewRef.current, ReactNativeElement); + const viewElement = nullthrows(viewRef.current); expect(viewElement.getBoundingClientRect().x).toBe(0); @@ -475,11 +586,8 @@ describe('Value.flattenOffset', () => { _onScroll.addListener(fn); }); - const scrollViewelement = ensureInstance( - scrollViewRef.current, - ReactNativeElement, - ); - const viewElement = ensureInstance(viewRef.current, ReactNativeElement); + const scrollViewelement = nullthrows(scrollViewRef.current); + const viewElement = nullthrows(viewRef.current); Fantom.scrollTo(scrollViewelement, { x: 0, @@ -559,11 +667,8 @@ describe('Value.extractOffset', () => { _onScroll.addListener(fn); }); - const scrollViewelement = ensureInstance( - scrollViewRef.current, - ReactNativeElement, - ); - const viewElement = ensureInstance(viewRef.current, ReactNativeElement); + const scrollViewelement = nullthrows(scrollViewRef.current); + const viewElement = nullthrows(viewRef.current); Fantom.scrollTo(scrollViewelement, { x: 0, @@ -634,7 +739,7 @@ test('animate layout props', () => { root.render(); }); - const viewElement = ensureInstance(viewRef.current, ReactNativeElement); + const viewElement = nullthrows(viewRef.current); Fantom.runTask(() => { _heightAnimation = Animated.timing(_animatedHeight, { @@ -702,7 +807,7 @@ test('AnimatedValue.interpolate', () => { root.render(); }); - const viewElement = ensureInstance(viewRef.current, ReactNativeElement); + const viewElement = nullthrows(viewRef.current); expect(_valueX?.__getValue()).toBe(0.5); expect(_interpolatedValueX?.__getValue()).toBe(50); @@ -774,7 +879,7 @@ test('Animated.sequence', () => { root.render(); }); - const element = ensureInstance(elementRef.current, ReactNativeElement); + const element = nullthrows(elementRef.current); expect(element.getBoundingClientRect().y).toBe(0); diff --git a/packages/react-native/Libraries/Animated/__tests__/Animated-test.js b/packages/react-native/Libraries/Animated/__tests__/Animated-test.js index e99c9a90acbe..3d4b8c70fdc7 100644 --- a/packages/react-native/Libraries/Animated/__tests__/Animated-test.js +++ b/packages/react-native/Libraries/Animated/__tests__/Animated-test.js @@ -1102,6 +1102,39 @@ describe('Animated', () => { value1.setValue(7); expect(listener.mock.calls.length).toBe(4); }); + + it('should keep listeners when the last attached node detaches', () => { + const value1 = new Animated.Value(0); + const listener = jest.fn(); + value1.addListener(listener); + + const node = new AnimatedProps({style: {opacity: value1}}, () => {}); + node.__attach(); + node.__detach(); + + expect(value1.__getChildren().length).toBe(0); + expect(value1.hasListeners()).toBe(true); + + value1.setValue(42); + expect(listener).toBeCalledWith({value: 42}); + expect(listener.mock.calls.length).toBe(1); + }); + + it('should keep listeners when a bound component unmounts', async () => { + const value1 = new Animated.Value(0); + const listener = jest.fn(); + value1.addListener(listener); + + const root = await create( + , + ); + await unmount(root); + jest.runAllTicks(); + + value1.setValue(42); + expect(listener).toBeCalledWith({value: 42}); + expect(listener.mock.calls.length).toBe(1); + }); }); describe('Animated Diff Clamp', () => { diff --git a/packages/react-native/Libraries/Animated/__tests__/AnimatedBackend-itest.js b/packages/react-native/Libraries/Animated/__tests__/AnimatedBackend-itest.js index adeaf7e485cf..59515ac1eaa0 100644 --- a/packages/react-native/Libraries/Animated/__tests__/AnimatedBackend-itest.js +++ b/packages/react-native/Libraries/Animated/__tests__/AnimatedBackend-itest.js @@ -13,13 +13,71 @@ import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment'; import type {HostInstance} from 'react-native'; -import ensureInstance from '../../../src/private/__tests__/utilities/ensureInstance'; import * as Fantom from '@react-native/fantom'; +import nullthrows from 'nullthrows'; import * as React from 'react'; import {Component, createRef, memo, useEffect, useMemo, useState} from 'react'; import {Animated, View, useAnimatedValue} from 'react-native'; import {allowStyleProp} from 'react-native/Libraries/Animated/NativeAnimatedAllowlist'; -import ReactNativeElement from 'react-native/src/private/webapis/dom/nodes/ReactNativeElement'; + +// marginLeft (and the other margin props) are only on the native animated +// allowlist when the shared backend is enabled. This test deliberately does NOT +// call allowStyleProp('marginLeft') โ€” it verifies the prop is supported natively +// out of the box under useSharedAnimatedBackend. +test('animate marginLeft layout prop', () => { + const viewRef = createRef(); + + let _animatedMarginLeft; + let _marginLeftAnimation; + + function MyApp() { + const animatedMarginLeft = useAnimatedValue(0); + _animatedMarginLeft = animatedMarginLeft; + return ( + + ); + } + + const root = Fantom.createRoot(); + + Fantom.runTask(() => { + root.render(); + }); + + Fantom.runTask(() => { + _marginLeftAnimation = Animated.timing(_animatedMarginLeft, { + toValue: 100, + duration: 200, + useNativeDriver: true, + }).start(); + }); + + Fantom.unstable_produceFramesForDuration(100); + + expect(root.getRenderedOutput({props: ['marginLeft']}).toJSX()).toEqual( + , + ); + + Fantom.unstable_produceFramesForDuration(100); + + // TODO: this shouldn't be necessary since animation should be stopped after duration + Fantom.runTask(() => { + _marginLeftAnimation?.stop(); + }); + + expect(root.getRenderedOutput({props: ['marginLeft']}).toJSX()).toEqual( + , + ); +}); test('animated opacity', () => { let _opacity; @@ -49,7 +107,7 @@ test('animated opacity', () => { root.render(); }); - const viewElement = ensureInstance(viewRef.current, ReactNativeElement); + const viewElement = nullthrows(viewRef.current); expect(viewElement.getBoundingClientRect().x).toBe(0); @@ -355,7 +413,7 @@ test('animate non-layout props and rerender', () => { root.render(); }); - const viewElement = ensureInstance(viewRef.current, ReactNativeElement); + const viewElement = nullthrows(viewRef.current); Fantom.runTask(() => { _opacityAnimation = Animated.timing(_animatedOpacity, { diff --git a/packages/react-native/Libraries/Animated/__tests__/AnimatedColor-itest.js b/packages/react-native/Libraries/Animated/__tests__/AnimatedColor-itest.js new file mode 100644 index 000000000000..651811587b5b --- /dev/null +++ b/packages/react-native/Libraries/Animated/__tests__/AnimatedColor-itest.js @@ -0,0 +1,195 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + */ + +import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment'; + +import {DRIVERS} from './AnimatedFantomTestUtils'; +import * as Fantom from '@react-native/fantom'; +import * as React from 'react'; +import {Animated} from 'react-native'; + +// Renders `color` as a View's backgroundColor so it can be observed through the +// public rendered output rather than private state. +function renderColor(color: Animated.Color): Fantom.Root { + const root = Fantom.createRoot(); + Fantom.runTask(() => { + root.render( + , + ); + }); + return root; +} + +function mountedBackgroundColor(color: Animated.Color): string { + return renderColor(color) + .getRenderedOutput({props: ['backgroundColor']}) + .toJSONObject().props.backgroundColor; +} + +describe('Animated.Color', () => { + it('defaults to opaque black', () => { + expect(mountedBackgroundColor(new Animated.Color())).toBe( + 'rgba(0, 0, 0, 1)', + ); + }); + + it('parses an rgba() string', () => { + expect( + mountedBackgroundColor(new Animated.Color('rgba(255, 128, 0, 1)')), + ).toBe('rgba(255, 128, 0, 1)'); + }); + + it('parses a hex string', () => { + expect(mountedBackgroundColor(new Animated.Color('#ff0000'))).toBe( + 'rgba(255, 0, 0, 1)', + ); + }); + + it('accepts an rgba object', () => { + // The rendered color quantizes alpha to 8 bits (0.5 -> 128/255). + expect( + mountedBackgroundColor(new Animated.Color({r: 10, g: 20, b: 30, a: 0.5})), + ).toBe('rgba(10, 20, 30, 0.501961)'); + }); + + it('accepts individual AnimatedValues for each channel', () => { + expect( + mountedBackgroundColor( + new Animated.Color({ + r: new Animated.Value(1), + g: new Animated.Value(2), + b: new Animated.Value(3), + a: new Animated.Value(1), + }), + ), + ).toBe('rgba(1, 2, 3, 1)'); + }); + + it('updates all channels via setValue', () => { + const color = new Animated.Color('rgba(0, 0, 0, 1)'); + const root = renderColor(color); + + Fantom.runTask(() => { + color.setValue({r: 5, g: 6, b: 7, a: 1}); + }); + + expect( + root.getRenderedOutput({props: ['backgroundColor']}).toJSX(), + ).toEqual(); + }); + + it('applies an offset on top of the base value', () => { + const color = new Animated.Color({r: 10, g: 10, b: 10, a: 1}); + const root = renderColor(color); + + // `setOffset` on its own does not flush to a connected view (unlike the + // native driver, which does); the following value update flushes the + // composed color, which includes the offset (base 20 + offset 5). + Fantom.runTask(() => { + color.setOffset({r: 5, g: 5, b: 5, a: 0}); + color.setValue({r: 20, g: 20, b: 20, a: 1}); + }); + + expect( + root.getRenderedOutput({props: ['backgroundColor']}).toJSX(), + ).toEqual(); + }); + + it('flattenOffset and extractOffset preserve the composed value', () => { + const color = new Animated.Color({r: 10, g: 10, b: 10, a: 1}); + renderColor(color); + + let afterFlatten: string = ''; + let afterExtract: string = ''; + Fantom.runTask(() => { + color.setOffset({r: 5, g: 5, b: 5, a: 0}); + // Merges the offset (5) into the base (10) -> base 15, offset 0. + color.flattenOffset(); + color.stopAnimation(value => { + afterFlatten = String(value); + }); + // Moves the base (15) into the offset -> base 0, offset 15. + color.extractOffset(); + color.stopAnimation(value => { + afterExtract = String(value); + }); + }); + + expect(afterFlatten).toBe('rgba(15, 15, 15, 1)'); + expect(afterExtract).toBe('rgba(15, 15, 15, 1)'); + }); + + it('resetAnimation restores the value and reports it to the callback', () => { + const color = new Animated.Color('rgba(1, 2, 3, 1)'); + renderColor(color); + + let reported: string = ''; + Fantom.runTask(() => { + color.resetAnimation(value => { + reported = String(value); + }); + }); + + expect(reported).toBe('rgba(1, 2, 3, 1)'); + }); + + it('updates a native-driven color via setValue', () => { + const color = new Animated.Color('rgba(0, 0, 0, 1)', { + useNativeDriver: true, + }); + renderColor(color); + + // A native-driven color applies via direct manipulation rather than the + // committed tree, so observe the value through the animation callback. + let reported: string = ''; + Fantom.runTask(() => { + color.setValue({r: 5, g: 6, b: 7, a: 1}); + color.stopAnimation(value => { + reported = String(value); + }); + }); + Fantom.unstable_produceFramesForDuration(16); + Fantom.runWorkLoop(); + + expect(reported).toBe('rgba(5, 6, 7, 1)'); + }); + + for (const {name, useNativeDriver} of DRIVERS) { + it(`animates to a target color (${name})`, () => { + const color = new Animated.Color('rgba(255, 0, 0, 1)'); + const root = renderColor(color); + + expect( + root.getRenderedOutput({props: ['backgroundColor']}).toJSX(), + ).toEqual(); + + let finished = false; + Fantom.runTask(() => { + Animated.timing(color, { + toValue: {r: 0, g: 0, b: 255, a: 1}, + duration: 100, + useNativeDriver, + }).start(result => { + finished = result.finished; + }); + }); + + Fantom.unstable_produceFramesForDuration(200); + Fantom.runWorkLoop(); + + // The final driven color is flushed to the committed tree and observed + // through the public rendered output. + expect(finished).toBe(true); + expect( + root.getRenderedOutput({props: ['backgroundColor']}).toJSX(), + ).toEqual(); + }); + } +}); diff --git a/packages/react-native/Libraries/Animated/__tests__/AnimatedComponents-itest.js b/packages/react-native/Libraries/Animated/__tests__/AnimatedComponents-itest.js new file mode 100644 index 000000000000..caff0460ffba --- /dev/null +++ b/packages/react-native/Libraries/Animated/__tests__/AnimatedComponents-itest.js @@ -0,0 +1,102 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + * @oncall react_native + */ + +import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment'; + +import * as Fantom from '@react-native/fantom'; +import * as React from 'react'; +import {Animated, Text} from 'react-native'; + +describe('Animated.Text', () => { + it('renders its children and applies an animated style prop', () => { + const root = Fantom.createRoot(); + const opacity = new Animated.Value(0.5); + + Fantom.runTask(() => { + root.render( + Hello Animated, + ); + }); + + expect(root.getRenderedOutput({props: ['opacity']}).toJSX()).toEqual( + Hello Animated, + ); + }); + + it('drives a text style prop with an animation', () => { + const root = Fantom.createRoot(); + const opacity = new Animated.Value(0); + + Fantom.runTask(() => { + root.render(Fade); + }); + + // The animation starts from the initial value. + expect(root.getRenderedOutput({props: ['opacity']}).toJSX()).toEqual( + Fade, + ); + + let finished = false; + Fantom.runTask(() => { + Animated.timing(opacity, { + toValue: 0.25, + duration: 100, + useNativeDriver: false, + }).start(result => { + finished = result.finished; + }); + }); + Fantom.unstable_produceFramesForDuration(200); + Fantom.runWorkLoop(); + + expect(finished).toBe(true); + expect(root.getRenderedOutput({props: ['opacity']}).toJSX()).toEqual( + Fade, + ); + }); +}); + +describe('Animated.SectionList', () => { + it('renders section headers and items through the animated wrapper', () => { + const root = Fantom.createRoot({viewportWidth: 400, viewportHeight: 400}); + + Fantom.runTask(() => { + root.render( + {item}} + renderSectionHeader={({ + section, + }: { + section: {title: string, ...}, + ... + }) => {section.title}} + keyExtractor={(item: string) => item} + />, + ); + }); + + expect(root.getRenderedOutput({props: []}).toJSON()).toEqual({ + type: 'ScrollView', + props: {}, + children: [ + { + type: 'View', + props: {}, + children: [ + {type: 'Paragraph', props: {}, children: ['A']}, + {type: 'Paragraph', props: {}, children: ['x']}, + ], + }, + ], + }); + }); +}); diff --git a/packages/react-native/Libraries/Animated/__tests__/AnimatedComposition-itest.js b/packages/react-native/Libraries/Animated/__tests__/AnimatedComposition-itest.js new file mode 100644 index 000000000000..ba97eacec7f9 --- /dev/null +++ b/packages/react-native/Libraries/Animated/__tests__/AnimatedComposition-itest.js @@ -0,0 +1,381 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + */ + +import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment'; + +import type {HostInstance} from 'react-native'; + +import * as Fantom from '@react-native/fantom'; +import nullthrows from 'nullthrows'; +import * as React from 'react'; +import {createRef} from 'react'; +import {Animated, useAnimatedValue} from 'react-native'; + +// Renders an whose translateX is driven by `makeNode(base)` and +// returns the base AnimatedValue plus the mounted element so tests can mutate the +// base and observe the derived value on the shadow tree. +function renderWithDerivedTranslateX( + makeNode: (base: Animated.Value) => Animated.WithAnimatedValue, +): { + base: Animated.Value, + element: HostInstance, + root: Fantom.Root, +} { + let base: ?Animated.Value; + const viewRef = createRef(); + + function MyApp() { + const value = useAnimatedValue(0); + base = value; + return ( + + ); + } + + const root = Fantom.createRoot(); + Fantom.runTask(() => { + root.render(); + }); + + const element = nullthrows(viewRef.current); + return {base: nullthrows(base), element, root}; +} + +function getTranslateX(root: Fantom.Root): number { + const output = root.getRenderedOutput({props: ['transform']}).toJSONObject(); + const transform = JSON.parse(output.props.transform); + return transform[0].translateX; +} + +describe('Animated.subtract', () => { + it('computes the difference of two values and reacts to updates', () => { + const {base, root} = renderWithDerivedTranslateX(value => + Animated.subtract(100, value), + ); + + expect(getTranslateX(root)).toBe(100); + + Fantom.runTask(() => { + base.setValue(30); + }); + + expect(getTranslateX(root)).toBe(70); + }); +}); + +describe('Animated.divide', () => { + it('computes the quotient of two values and reacts to updates', () => { + const {base, root} = renderWithDerivedTranslateX(value => + Animated.divide(value, 2), + ); + + Fantom.runTask(() => { + base.setValue(20); + }); + expect(getTranslateX(root)).toBe(10); + + Fantom.runTask(() => { + base.setValue(80); + }); + + expect(getTranslateX(root)).toBe(40); + }); + + it('returns 0 instead of Infinity when dividing by zero', () => { + const root = Fantom.createRoot(); + Fantom.runTask(() => { + root.render( + , + ); + }); + expect( + Number( + root.getRenderedOutput({props: ['width']}).toJSONObject().props.width, + ), + ).toBe(0); + }); +}); + +describe('Animated.modulo', () => { + it('wraps values into the [0, modulus) range for positive and negative inputs', () => { + const {base, root} = renderWithDerivedTranslateX(value => + Animated.modulo(value, 10), + ); + + Fantom.runTask(() => { + base.setValue(25); + }); + expect(getTranslateX(root)).toBe(5); + + Fantom.runTask(() => { + base.setValue(-3); + }); + // ((-3 % 10) + 10) % 10 === 7 + expect(getTranslateX(root)).toBe(7); + }); +}); + +describe('Animated.diffClamp', () => { + it('clamps the accumulated delta between min and max', () => { + const base = new Animated.Value(0); + const root = Fantom.createRoot(); + Fantom.runTask(() => { + root.render( + , + ); + }); + + // `width` (unlike a zero `translateX`) is preserved in the rendered output, + // so the accumulated, clamped value is observed publicly. + const getWidth = () => + Number( + root.getRenderedOutput({props: ['width']}).toJSONObject().props.width, + ); + + expect(getWidth()).toBe(0); + + // Increase beyond max: 0 + 100 clamped to 20. + Fantom.runTask(() => base.setValue(100)); + expect(getWidth()).toBe(20); + + // Decrease by 30: 20 + (70 - 100) = -10, clamped to 0. + Fantom.runTask(() => base.setValue(70)); + expect(getWidth()).toBe(0); + + // Increase by 5: 0 + (75 - 70) = 5, within range. + Fantom.runTask(() => base.setValue(75)); + expect(getWidth()).toBe(5); + }); +}); + +describe('Animated.add and Animated.multiply', () => { + it('compose additions and multiplications', () => { + const {base, root} = renderWithDerivedTranslateX(value => + Animated.add(Animated.multiply(value, 2), 10), + ); + + Fantom.runTask(() => { + base.setValue(20); + }); + + // 20 * 2 + 10 = 50 + expect(getTranslateX(root)).toBe(50); + }); +}); + +describe('Animated tracking (toValue is an AnimatedNode)', () => { + it('follows the target value when animating toward another AnimatedValue', () => { + let follower: ?Animated.Value; + let leader: ?Animated.Value; + const viewRef = createRef(); + + function MyApp() { + const followerValue = useAnimatedValue(0); + const leaderValue = useAnimatedValue(0); + follower = followerValue; + leader = leaderValue; + return ( + + ); + } + + const root = Fantom.createRoot(); + Fantom.runTask(() => { + root.render(); + }); + + Fantom.runTask(() => { + Animated.timing(nullthrows(follower), { + toValue: nullthrows(leader), + duration: 100, + useNativeDriver: false, + }).start(); + }); + + Fantom.runTask(() => { + nullthrows(leader).setValue(50); + }); + + Fantom.unstable_produceFramesForDuration(200); + Fantom.runWorkLoop(); + + expect(getTranslateX(root)).toBeCloseTo(50, 1); + }); + + it('follows the target value on the native driver', () => { + let follower: ?Animated.Value; + let leader: ?Animated.Value; + let animation: ?Animated.CompositeAnimation; + const viewRef = createRef(); + + function MyApp() { + const followerValue = useAnimatedValue(0); + const leaderValue = useAnimatedValue(0); + follower = followerValue; + leader = leaderValue; + return ( + + ); + } + + const root = Fantom.createRoot(); + Fantom.runTask(() => { + root.render(); + }); + const element = nullthrows(viewRef.current); + + Fantom.runTask(() => { + animation = Animated.timing(nullthrows(follower), { + toValue: nullthrows(leader), + duration: 100, + useNativeDriver: true, + }); + animation.start(); + }); + + Fantom.runTask(() => { + nullthrows(leader).setValue(50); + }); + + Fantom.unstable_produceFramesForDuration(200); + Fantom.runWorkLoop(); + + expect(element.getBoundingClientRect().x).toBeCloseTo(50, 0); + + Fantom.runTask(() => { + nullthrows(animation).stop(); + }); + Fantom.runTask(() => { + root.render(); + }); + Fantom.unstable_produceFramesForDuration(16); + Fantom.runWorkLoop(); + }); +}); + +// Exercises the native-config, interpolation and detach paths of the +// composition nodes (the JS `__getValue` path is covered by the tests above). +describe('composition nodes: native driver, interpolation and detach', () => { + const factories = [ + { + name: 'add', + make: (base: Animated.Value) => Animated.add(base, 10), + expected: 60, + }, + { + name: 'subtract', + make: (base: Animated.Value) => Animated.subtract(base, 10), + expected: 40, + }, + { + name: 'multiply', + make: (base: Animated.Value) => Animated.multiply(base, 2), + expected: 100, + }, + { + name: 'divide', + make: (base: Animated.Value) => Animated.divide(base, 2), + expected: 25, + }, + { + name: 'modulo', + make: (base: Animated.Value) => Animated.modulo(base, 7), + expected: 50 % 7, + }, + { + name: 'diffClamp', + make: (base: Animated.Value) => Animated.diffClamp(base, 0, 100), + expected: 50, + }, + ]; + + for (const {name, make, expected} of factories) { + it(`${name} runs on the native driver, interpolates, and detaches`, () => { + let base: ?Animated.Value; + const viewRef = createRef(); + + function MyApp() { + const value = useAnimatedValue(0); + base = value; + const node = make(value); + return ( + + ); + } + + const root = Fantom.createRoot(); + Fantom.runTask(() => { + root.render(); + }); + const element = nullthrows(viewRef.current); + + let animation: ?Animated.CompositeAnimation; + Fantom.runTask(() => { + animation = Animated.timing(nullthrows(base), { + toValue: 50, + duration: 100, + useNativeDriver: true, + }); + animation.start(); + }); + Fantom.unstable_produceFramesForDuration(200); + Fantom.runWorkLoop(); + + expect(element.getBoundingClientRect().x).toBeCloseTo(expected, 0); + + // Stop the animation and re-render without the node to detach the + // composition graph and drain pending work. + Fantom.runTask(() => { + nullthrows(animation).stop(); + }); + Fantom.runTask(() => { + root.render(); + }); + Fantom.unstable_produceFramesForDuration(16); + Fantom.runWorkLoop(); + }); + } +}); diff --git a/packages/react-native/Libraries/Animated/__tests__/AnimatedFantomTestUtils.js b/packages/react-native/Libraries/Animated/__tests__/AnimatedFantomTestUtils.js new file mode 100644 index 000000000000..0a94e454275f --- /dev/null +++ b/packages/react-native/Libraries/Animated/__tests__/AnimatedFantomTestUtils.js @@ -0,0 +1,100 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + * @oncall react_native + */ + +import * as Fantom from '@react-native/fantom'; +import {Animated} from 'react-native'; +import {setAnimationTimeProvider} from 'react-native/Libraries/Animated/AnimationTimingUtils'; + +export type Driver = {readonly name: string, readonly useNativeDriver: boolean}; + +// Every animation is exercised with both drivers. The JS driver runs the +// closed-form integration in JavaScript; the native driver hands the config to +// the C++ backend, which drives the view on each frame. +export const DRIVERS: ReadonlyArray = [ + {name: 'JS driver', useNativeDriver: false}, + {name: 'native driver', useNativeDriver: true}, +]; + +// Fantom's `produceFramesForDuration` advances its frame clock in fixed +// ~16.333ms (60fps) steps. We advance the JS animation clock by the same step +// so both drivers step at the same cadence. +export const FRAME_STEP_MS = 16333 / 1000; + +/** + * Runs `createAnimation(useNativeDriver)` on `value` to completion and returns + * the per-frame trajectory recorded from `value`'s listener. + * + * Both drivers step at the same frame cadence, driven by two clocks advanced + * together: + * - frame timing: `unstable_produceFramesForDuration` advances Fantom's frame + * clock (drives the native driver and flushes each frame's work), and + * - animation timing: `getCurrentAnimationTime` is overridden with a clock + * that advances one frame step per read, driving the JS driver + * deterministically (the native driver ignores it and reads the frame clock + * in C++). + * + * This makes the JS and native drivers produce the same trajectory, so tests + * can assert one curve for both. + */ +export function collectAnimationTrajectory( + value: Animated.Value, + createAnimation: (useNativeDriver: boolean) => Animated.CompositeAnimation, + useNativeDriver: boolean, + durationMs: number, +): {samples: Array, finished: boolean} { + const samples: Array = []; + const listenerId = value.addListener(state => { + samples.push(state.value); + }); + + let animationTime = 0; + setAnimationTimeProvider(() => { + const current = animationTime; + animationTime += FRAME_STEP_MS; + return current; + }); + + let finished = false; + try { + Fantom.runTask(() => { + createAnimation(useNativeDriver).start(result => { + finished = result.finished; + }); + }); + Fantom.unstable_produceFramesForDuration(durationMs); + Fantom.runWorkLoop(); + } finally { + setAnimationTimeProvider(null); + value.removeListener(listenerId); + } + + return {samples, finished}; +} + +/** Diffs between consecutive samples. */ +export function deltas(samples: ReadonlyArray): Array { + const result: Array = []; + for (let i = 1; i < samples.length; i++) { + result.push(samples[i] - samples[i - 1]); + } + return result; +} + +/** + * Asserts the samples rise monotonically to their peak (allowing tiny + * floating-point noise), i.e. no dips on the way up. + */ +export function expectMonotonicToPeak(samples: ReadonlyArray): void { + const peakIndex = samples.indexOf(Math.max(...samples)); + for (let i = 1; i <= peakIndex; i++) { + expect(samples[i]).toBeGreaterThanOrEqual(samples[i - 1] - 1e-6); + } +} diff --git a/packages/react-native/Libraries/Animated/__tests__/AnimatedMock-itest.js b/packages/react-native/Libraries/Animated/__tests__/AnimatedMock-itest.js new file mode 100644 index 000000000000..65933b0c4390 --- /dev/null +++ b/packages/react-native/Libraries/Animated/__tests__/AnimatedMock-itest.js @@ -0,0 +1,49 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + */ + +import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment'; + +import AnimatedImplementation from '../AnimatedImplementation'; +import AnimatedMock from '../AnimatedMock'; + +describe('Animated Mock', () => { + it('matches implementation keys', () => { + expect(Object.keys(AnimatedMock)).toEqual( + Object.keys(AnimatedImplementation), + ); + }); + it('matches implementation params', () => { + Object.keys(AnimatedImplementation).forEach(key => { + if (AnimatedImplementation[key].length !== AnimatedMock[key].length) { + throw new Error( + 'key ' + + key + + ' had different lengths: ' + + JSON.stringify( + { + impl: { + len: AnimatedImplementation[key].length, + type: typeof AnimatedImplementation[key], + val: AnimatedImplementation[key].toString(), + }, + mock: { + len: AnimatedMock[key].length, + type: typeof AnimatedMock[key], + val: AnimatedMock[key].toString(), + }, + }, + null, + 2, + ), + ); + } + }); + }); +}); diff --git a/packages/react-native/Libraries/Animated/__tests__/AnimatedMock-test.js b/packages/react-native/Libraries/Animated/__tests__/AnimatedMock-test.js deleted file mode 100644 index 066986799f02..000000000000 --- a/packages/react-native/Libraries/Animated/__tests__/AnimatedMock-test.js +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow strict-local - * @format - */ - -'use strict'; - -import AnimatedImplementation from '../AnimatedImplementation'; -import AnimatedMock from '../AnimatedMock'; - -describe('Animated Mock', () => { - it('matches implementation keys', () => { - expect(Object.keys(AnimatedMock)).toEqual( - Object.keys(AnimatedImplementation), - ); - }); - it('matches implementation params', done => { - Object.keys(AnimatedImplementation).forEach(key => { - if (AnimatedImplementation[key].length !== AnimatedMock[key].length) { - done( - new Error( - 'key ' + - key + - ' had different lengths: ' + - JSON.stringify( - { - impl: { - len: AnimatedImplementation[key].length, - type: typeof AnimatedImplementation[key], - val: AnimatedImplementation[key].toString(), - }, - mock: { - len: AnimatedMock[key].length, - type: typeof AnimatedMock[key], - val: AnimatedMock[key].toString(), - }, - }, - null, - 2, - ), - ), - ); - } - }); - done(); - }); -}); diff --git a/packages/react-native/Libraries/Animated/__tests__/AnimatedObject-test.js b/packages/react-native/Libraries/Animated/__tests__/AnimatedObject-itest.js similarity index 91% rename from packages/react-native/Libraries/Animated/__tests__/AnimatedObject-test.js rename to packages/react-native/Libraries/Animated/__tests__/AnimatedObject-itest.js index ef4dacd042f5..3eb452700ff1 100644 --- a/packages/react-native/Libraries/Animated/__tests__/AnimatedObject-test.js +++ b/packages/react-native/Libraries/Animated/__tests__/AnimatedObject-itest.js @@ -8,19 +8,13 @@ * @format */ +import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment'; + +import Animated from '../Animated'; +import AnimatedObject from '../nodes/AnimatedObject'; import nullthrows from 'nullthrows'; describe('AnimatedObject', () => { - let Animated; - let AnimatedObject; - - beforeEach(() => { - jest.resetModules(); - - Animated = require('../Animated').default; - AnimatedObject = require('../nodes/AnimatedObject').default; - }); - it('should get the proper value', () => { const anim = new Animated.Value(0); const translateAnim = anim.interpolate({ diff --git a/packages/react-native/Libraries/Animated/__tests__/AnimatedProps-test.js b/packages/react-native/Libraries/Animated/__tests__/AnimatedProps-test.js deleted file mode 100644 index 3759ac2bfe62..000000000000 --- a/packages/react-native/Libraries/Animated/__tests__/AnimatedProps-test.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow strict-local - * @format - */ - -import AnimatedProps from '../nodes/AnimatedProps'; - -describe('AnimatedProps', () => { - function getValue(inputProps: {[string]: unknown}) { - const animatedProps = new AnimatedProps(inputProps, jest.fn()); - return animatedProps.__getValue(); - } - - it('returns original `style` if it has no nodes', () => { - const style = {color: 'red'}; - expect(getValue({style}).style).toBe(style); - }); - - it('returns original `style` for invalid style values', () => { - const values = [undefined, null, function () {}, true, 123, 'foo']; - for (const value of values) { - expect(getValue({style: value})).toEqual({style: value}); - } - }); -}); diff --git a/packages/react-native/Libraries/Animated/__tests__/AnimatedValue-test.js b/packages/react-native/Libraries/Animated/__tests__/AnimatedValue-itest.js similarity index 73% rename from packages/react-native/Libraries/Animated/__tests__/AnimatedValue-test.js rename to packages/react-native/Libraries/Animated/__tests__/AnimatedValue-itest.js index a77f0123b2ad..b0781d4f865e 100644 --- a/packages/react-native/Libraries/Animated/__tests__/AnimatedValue-test.js +++ b/packages/react-native/Libraries/Animated/__tests__/AnimatedValue-itest.js @@ -4,13 +4,39 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * + * @fantom_flags animatedKeepListenersOnDetach:* * @flow strict-local * @format */ +import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment'; + +import NativeAnimatedHelper from '../../../src/private/animated/NativeAnimatedHelper'; +import * as ReactNativeFeatureFlags from '../../../src/private/featureflags/ReactNativeFeatureFlags'; +import AnimatedValue from '../nodes/AnimatedValue'; + describe('AnimatedValue', () => { - let NativeAnimatedHelper; - let AnimatedValue; + // Fantom uses the real native animated module and does not support + // `jest.spyOn`, so we wrap the relevant `NativeAnimatedHelper.API` methods + // with call-through mocks that count invocations and restore them afterwards. + const restoreAPI: Array<() => void> = []; + + function spyOnAPI(name: string) { + // $FlowFixMe[invalid-computed-prop] + const original = NativeAnimatedHelper.API[name]; + const spy = jest.fn((...args: Array) => + original.apply(NativeAnimatedHelper.API, args), + ); + // $FlowFixMe[prop-missing] + // $FlowFixMe[cannot-write] + NativeAnimatedHelper.API[name] = spy; + restoreAPI.push(() => { + // $FlowFixMe[prop-missing] + // $FlowFixMe[cannot-write] + NativeAnimatedHelper.API[name] = original; + }); + return spy; + } function createNativeAnimatedValue(): AnimatedValue { return new AnimatedValue(0, {useNativeDriver: true}); @@ -32,31 +58,17 @@ describe('AnimatedValue', () => { } beforeEach(() => { - jest.resetModules(); - - jest.mock('../NativeAnimatedTurboModule', () => ({ - __esModule: true, - default: { - addListener: jest.fn(), - createAnimatedNode: jest.fn(), - dropAnimatedNode: jest.fn(), - removeListeners: jest.fn(), - startListeningToAnimatedNodeValue: jest.fn(), - stopListeningToAnimatedNodeValue: jest.fn(), - extractAnimatedNodeOffset: jest.fn(), - // ... - }, - })); - - NativeAnimatedHelper = - require('../../../src/private/animated/NativeAnimatedHelper').default; - AnimatedValue = require('../nodes/AnimatedValue').default; - - jest.spyOn(NativeAnimatedHelper.API, 'createAnimatedNode'); - jest.spyOn(NativeAnimatedHelper.API, 'dropAnimatedNode'); - jest.spyOn(NativeAnimatedHelper.API, 'startListeningToAnimatedNodeValue'); - jest.spyOn(NativeAnimatedHelper.API, 'setWaitingForIdentifier'); - jest.spyOn(NativeAnimatedHelper.API, 'unsetWaitingForIdentifier'); + spyOnAPI('createAnimatedNode'); + spyOnAPI('dropAnimatedNode'); + spyOnAPI('startListeningToAnimatedNodeValue'); + spyOnAPI('setWaitingForIdentifier'); + spyOnAPI('unsetWaitingForIdentifier'); + }); + + afterEach(() => { + while (restoreAPI.length > 0) { + restoreAPI.pop()?.(); + } }); it('emits update events for listeners added', () => { @@ -118,7 +130,12 @@ describe('AnimatedValue', () => { node.addListener(callbackB); emitMockUpdate(node, 456, 60); - expect(callbackA).toBeCalledTimes(1); + if (ReactNativeFeatureFlags.animatedKeepListenersOnDetach()) { + // `callbackA` survives the detach and is resubscribed on re-attach. + expect(callbackA).toBeCalledTimes(2); + } else { + expect(callbackA).toBeCalledTimes(1); + } expect(callbackB).toBeCalledTimes(1); }); @@ -217,7 +234,13 @@ describe('AnimatedValue', () => { emitMockUpdate(node, 123, 50); - const spy = jest.spyOn(node, '__onAnimatedValueUpdateReceived'); + // $FlowFixMe[method-unbinding] + const original = node.__onAnimatedValueUpdateReceived; + const spy = jest.fn((...args: Array) => + original.apply(node, args), + ); + // $FlowFixMe[cannot-write] + node.__onAnimatedValueUpdateReceived = spy; const mockValue = 100; const mockOffset = 50; @@ -225,7 +248,8 @@ describe('AnimatedValue', () => { emitMockUpdate(node, mockValue, mockOffset); expect(spy).toHaveBeenCalledWith(mockValue, mockOffset); - spy.mockRestore(); + // $FlowFixMe[cannot-write] + node.__onAnimatedValueUpdateReceived = original; }); }); }); diff --git a/packages/react-native/Libraries/Animated/__tests__/AnimatedValueHooks-itest.js b/packages/react-native/Libraries/Animated/__tests__/AnimatedValueHooks-itest.js new file mode 100644 index 000000000000..0d7fdbbc02a0 --- /dev/null +++ b/packages/react-native/Libraries/Animated/__tests__/AnimatedValueHooks-itest.js @@ -0,0 +1,102 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + * @oncall react_native + */ + +import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment'; + +import * as Fantom from '@react-native/fantom'; +import nullthrows from 'nullthrows'; +import * as React from 'react'; +import {useState} from 'react'; +import {Animated, useAnimatedColor, useAnimatedValueXY} from 'react-native'; + +describe('useAnimatedColor', () => { + it('drives backgroundColor and returns a stable value across re-renders', () => { + const colors: Array = []; + let forceRender: ?() => void; + + function MyApp() { + const [, setTick] = useState(0); + forceRender = () => setTick(tick => tick + 1); + const color = useAnimatedColor('rgba(1, 2, 3, 1)'); + colors.push(color); + return ( + + ); + } + + const root = Fantom.createRoot(); + Fantom.runTask(() => { + root.render(); + }); + + expect( + root.getRenderedOutput({props: ['backgroundColor']}).toJSX(), + ).toEqual(); + + // Re-render: the hook must return the same memoized instance. + Fantom.runTask(() => { + nullthrows(forceRender)(); + }); + + expect(colors.length).toBeGreaterThan(1); + expect(colors[colors.length - 1]).toBe(colors[0]); + }); +}); + +describe('useAnimatedValueXY', () => { + it('drives a translate transform and returns a stable value across re-renders', () => { + const values: Array = []; + let value: ?Animated.ValueXY; + let forceRender: ?() => void; + + function MyApp() { + const [, setTick] = useState(0); + forceRender = () => setTick(tick => tick + 1); + const xy = useAnimatedValueXY({x: 0, y: 0}); + value = xy; + values.push(xy); + return ( + + ); + } + + const root = Fantom.createRoot(); + Fantom.runTask(() => { + root.render(); + }); + + // Stable instance across re-renders. + Fantom.runTask(() => { + nullthrows(forceRender)(); + }); + expect(values.length).toBeGreaterThan(1); + expect(values[values.length - 1]).toBe(values[0]); + + // Updating the value updates both translate axes. + Fantom.runTask(() => { + nullthrows(value).setValue({x: 50, y: 20}); + }); + + const transform = JSON.parse( + root.getRenderedOutput({props: ['transform']}).toJSONObject().props + .transform, + ); + expect(transform).toEqual([{translateX: 50}, {translateY: 20}]); + }); +}); diff --git a/packages/react-native/Libraries/Animated/__tests__/DecayAnimation-itest.js b/packages/react-native/Libraries/Animated/__tests__/DecayAnimation-itest.js new file mode 100644 index 000000000000..6863a40b66c3 --- /dev/null +++ b/packages/react-native/Libraries/Animated/__tests__/DecayAnimation-itest.js @@ -0,0 +1,106 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + * @oncall react_native + */ + +import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment'; + +import type {HostInstance} from 'react-native'; + +import { + DRIVERS, + collectAnimationTrajectory, + deltas, + expectMonotonicToPeak, +} from './AnimatedFantomTestUtils'; +import * as Fantom from '@react-native/fantom'; +import nullthrows from 'nullthrows'; +import * as React from 'react'; +import {createRef} from 'react'; +import {Animated, useAnimatedValue} from 'react-native'; + +function renderTranslateX(): Animated.Value { + let value: ?Animated.Value; + const viewRef = createRef(); + + function MyApp() { + const translateX = useAnimatedValue(0); + value = translateX; + return ( + + ); + } + + const root = Fantom.createRoot(); + Fantom.runTask(() => { + root.render(); + }); + + return nullthrows(value); +} + +const VELOCITY = 2; +const DECELERATION = 0.99; +// value(t) = v0 / (1 - deceleration) * (1 - deceleration^t): the asymptote is +// v0 / (1 - deceleration). +const ASYMPTOTE = VELOCITY / (1 - DECELERATION); + +for (const {name, useNativeDriver} of DRIVERS) { + describe(`Animated.decay (${name})`, () => { + it('decelerates exponentially to a resting position', () => { + const value = renderTranslateX(); + + const {samples, finished} = collectAnimationTrajectory( + value, + driver => + Animated.decay(value, { + velocity: VELOCITY, + deceleration: DECELERATION, + useNativeDriver: driver, + }), + useNativeDriver, + 3000, + ); + + expect(finished).toBe(true); + expect(samples.length).toBeGreaterThan(10); + + // Comes to rest just below the analytical asymptote. + const rest = samples[samples.length - 1]; + expect(rest).toBeGreaterThan(ASYMPTOTE * 0.97); + expect(rest).toBeLessThanOrEqual(ASYMPTOTE + 1e-6); + + // Monotonically increasing to its resting position (no dips), which for + // decay is also the peak. + expectMonotonicToPeak(samples); + + // Exponential deceleration has two signatures over the early frames + // (before it converges into floating-point noise): + // 1. each per-frame step is strictly smaller than the previous one, and + // 2. the ratio between consecutive steps is (nearly) constant โ€” the + // defining property of geometric/exponential decay, which a linear + // ramp (constant deltas, ratio 1) or an accelerating curve (ratio + // > 1) would fail. + const frameDeltas = deltas(samples); + const ratios: Array = []; + for (let i = 1; i < 9; i++) { + expect(frameDeltas[i]).toBeLessThan(frameDeltas[i - 1]); + ratios.push(frameDeltas[i] / frameDeltas[i - 1]); + } + for (const ratio of ratios) { + expect(ratio).toBeGreaterThan(0.75); + expect(ratio).toBeLessThan(0.95); + } + expect(Math.max(...ratios) - Math.min(...ratios)).toBeLessThan(0.1); + }); + }); +} diff --git a/packages/react-native/Libraries/Animated/__tests__/Easing-test.js b/packages/react-native/Libraries/Animated/__tests__/Easing-itest.js similarity index 99% rename from packages/react-native/Libraries/Animated/__tests__/Easing-test.js rename to packages/react-native/Libraries/Animated/__tests__/Easing-itest.js index 9581ae1310b4..d71a68d28c65 100644 --- a/packages/react-native/Libraries/Animated/__tests__/Easing-test.js +++ b/packages/react-native/Libraries/Animated/__tests__/Easing-itest.js @@ -8,7 +8,7 @@ * @format */ -'use strict'; +import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment'; import Easing from '../Easing'; diff --git a/packages/react-native/Libraries/Animated/__tests__/Interpolation-test.js b/packages/react-native/Libraries/Animated/__tests__/Interpolation-itest.js similarity index 65% rename from packages/react-native/Libraries/Animated/__tests__/Interpolation-test.js rename to packages/react-native/Libraries/Animated/__tests__/Interpolation-itest.js index fc0fb879264d..a2d7f506915d 100644 --- a/packages/react-native/Libraries/Animated/__tests__/Interpolation-test.js +++ b/packages/react-native/Libraries/Animated/__tests__/Interpolation-itest.js @@ -8,6 +8,8 @@ * @format */ +import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment'; + import type { InterpolationConfigSupportedOutputType, InterpolationConfigType, @@ -33,6 +35,13 @@ function createInterpolation( } describe('Interpolation', () => { + const originalConsoleWarn = console.warn; + + afterEach(() => { + // $FlowFixMe[cannot-write] + console.warn = originalConsoleWarn; + }); + it('should work with defaults', () => { const interpolation = createInterpolation({ inputRange: [0, 1], @@ -365,7 +374,10 @@ describe('Interpolation', () => { }); it('should work with PlatformColor', () => { - jest.spyOn(console, 'warn').mockImplementationOnce(() => {}); + const mockWarn = jest.fn(); + // $FlowFixMe[cannot-write] + console.warn = mockWarn; + const interpolation = createInterpolation({ inputRange: [0, 1], outputRange: [ @@ -381,7 +393,7 @@ describe('Interpolation', () => { expect(interpolation(2 / 3)).toStrictEqual( PlatformColor('@android:color/white'), ); - expect(console.warn).toBeCalledWith( + expect(mockWarn).toBeCalledWith( 'PlatformColor interpolation should happen natively, here we fallback to the closest color', ); expect(interpolation(1)).toStrictEqual( @@ -389,20 +401,201 @@ describe('Interpolation', () => { ); }); - it.each([ + for (const [label, outputRange, expected] of [ ['radians', ['1rad', '2rad'], [1, 2]], ['degrees', ['90deg', '180deg'], [Math.PI / 2, Math.PI]], ['numbers', [1024, Math.PI], [1024, Math.PI]], ['unknown', ['5foo', '10foo'], ['5foo', '10foo']], - ])( - 'should convert %s to numbers in the native config', - (_, outputRange, expected) => { + ]) { + it(`should convert ${label} to numbers in the native config`, () => { const config = new AnimatedInterpolation( // $FlowFixMe[incompatible-type] {}, + // $FlowFixMe[incompatible-call] {inputRange: [0, 1], outputRange}, ).__getNativeConfig(); expect(config.outputRange).toEqual(expected); - }, - ); + }); + } +}); + +describe('Interpolation easingStops (native easing baking)', () => { + // Returns the non-uniform [position, value] easing stops emitted in the native + // config for an eased numeric interpolation (or undefined when no easing). + function getEasingStops( + config: InterpolationConfigType, + ): ?Array<[number, number]> { + return new AnimatedInterpolation( + // $FlowFixMe[incompatible-type] + {}, + config, + ).__getNativeConfig().easingStops; + } + + // Mirrors the native easeRatio(): binary-search the bracketing stops and + // linearly interpolate. Out-of-[0,1] ratios pass through (extrapolation). + function reconstructEaseRatio( + stops: Array<[number, number]>, + ): (ratio: number) => number { + return ratio => { + if (stops.length < 2 || ratio < 0 || ratio > 1) { + return ratio; + } + const upper = stops.findIndex(stop => stop[0] > ratio); + if (upper === -1) { + return stops[stops.length - 1][1]; + } + if (upper === 0) { + return stops[0][1]; + } + const [xLo, yLo] = stops[upper - 1]; + const [xHi, yHi] = stops[upper]; + if (xHi === xLo) { + return yHi; + } + return yLo + (yHi - yLo) * ((ratio - xLo) / (xHi - xLo)); + }; + } + + // Max error, in OUTPUT units, between the baked stops and the true easing + // curve across the [0, 1] domain (sampled finely). This is what actually + // shows up on screen, e.g. pixels for a translate. + function maxOutputError( + easing: (input: number) => number, + span: number, + ): number { + const stops = getEasingStops({ + inputRange: [0, 1], + outputRange: [0, span], + easing, + }); + if (stops == null) { + throw new Error('expected easingStops to be emitted'); + } + const approx = reconstructEaseRatio(stops); + let maxErr = 0; + for (let i = 0; i <= 1000; i++) { + const t = i / 1000; + const err = Math.abs(approx(t) - easing(t)) * span; + if (err > maxErr) { + maxErr = err; + } + } + return maxErr; + } + + // Computed once; reused for both the exact-output and the stop-count assertions. + const customLinear = getEasingStops({ + inputRange: [0, 1], + outputRange: [0, 100], + easing: (t: number) => t, + }); + const quad = getEasingStops({ + inputRange: [0, 1], + outputRange: [0, 100], + easing: Easing.quad, + }); + const bounce = getEasingStops({ + inputRange: [0, 1], + outputRange: [0, 100], + easing: Easing.bounce, + }); + const sine = getEasingStops({ + inputRange: [0, 1], + outputRange: [0, 10], + easing: Easing.inOut(Easing.sin), + }); + + it('omits easingStops when easing is linear by identity or absent', () => { + const base = {inputRange: [0, 1], outputRange: [0, 100]}; + expect(getEasingStops(base)).toBe(undefined); + expect(getEasingStops({...base, easing: Easing.linear})).toBe(undefined); + }); + + it('bakes the curve into exact stops whose count adapts to curvature', () => { + // A custom linear fn (not the Easing.linear reference, so not short-circuited) + // collapses to the two endpoints: every interior sample lies on the chord. + expect(customLinear).toEqual([ + [0, 0], + [1, 1], + ]); + + // Constant-curvature quad -> RDP's midpoint splitting yields uniform 1/16 + // spacing; each value is the eased ratio (k/16)^2, independent of span. + expect(quad).toEqual([ + [0, 0], + [0.0625, 0.00390625], + [0.125, 0.015625], + [0.1875, 0.03515625], + [0.25, 0.0625], + [0.3125, 0.09765625], + [0.375, 0.140625], + [0.4375, 0.19140625], + [0.5, 0.25], + [0.5625, 0.31640625], + [0.625, 0.390625], + [0.6875, 0.47265625], + [0.75, 0.5625], + [0.8125, 0.66015625], + [0.875, 0.765625], + [0.9375, 0.87890625], + [1, 1], + ]); + + // A sine S-curve is placed non-uniformly: stops cluster at the two bends and + // leave a large gap across the near-linear middle (0.35 -> 0.62). + expect(sine).toEqual([ + [0, 0], + [0.10546875, 0.02719633730973936], + [0.21875, 0.1134947733186315], + [0.34765625, 0.26973064452088], + [0.62109375, 0.6856585969759188], + [0.7421875, 0.8447702723685335], + [0.875, 0.9619397662556434], + [1, 1], + ]); + + // Stop count rises with curvature โ€” 2 (flat) -> 17 (quad) -> 45 (bounce) โ€” + // and is always bounded by the dense-sample budget (256 + 1 = 257). + expect(bounce?.length).toBe(45); + expect(bounce?.length).toBeLessThanOrEqual(257); + }); + + it('grows the stop count with output span, capped by the tolerance floor', () => { + // Bigger span -> smaller tolerance -> more stops for the same curve... + expect( + getEasingStops({ + inputRange: [0, 1], + outputRange: [0, 10], + easing: Easing.quad, + })?.length, + ).toBe(9); + expect(quad?.length).toBe(17); // span 100, computed once above + expect( + getEasingStops({ + inputRange: [0, 1], + outputRange: [0, 1000], + easing: Easing.quad, + })?.length, + ).toBe(33); + // ...until epsilon hits its floor: a smooth curve caps out (65) rather than + // densifying toward the dense-sample budget. + expect( + getEasingStops({ + inputRange: [0, 1], + outputRange: [0, 100000], + easing: Easing.quad, + })?.length, + ).toBe(65); + }); + + it('keeps on-screen error ~sub-pixel until the tolerance floor', () => { + // Below the floor (span up to ~2500) error stays sub-pixel as span grows. + for (const span of [1, 10, 100, 1000]) { + expect(maxOutputError(Easing.quad, span)).toBeLessThan(0.3); + } + // Past the floor the error grows only with the floor tolerance (1e-4): ~1px + // at span 10000, not the tens a fixed-resolution LUT would accumulate. + expect(maxOutputError(Easing.quad, 10000)).toBeLessThan(1.5); + }); }); diff --git a/packages/react-native/Libraries/Animated/__tests__/SpringAnimation-itest.js b/packages/react-native/Libraries/Animated/__tests__/SpringAnimation-itest.js new file mode 100644 index 000000000000..5d26452130de --- /dev/null +++ b/packages/react-native/Libraries/Animated/__tests__/SpringAnimation-itest.js @@ -0,0 +1,214 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + * @oncall react_native + */ + +import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment'; + +import type {HostInstance} from 'react-native'; + +import { + DRIVERS, + collectAnimationTrajectory, + expectMonotonicToPeak, +} from './AnimatedFantomTestUtils'; +import * as Fantom from '@react-native/fantom'; +import nullthrows from 'nullthrows'; +import * as React from 'react'; +import {createRef} from 'react'; +import {Animated, useAnimatedValue} from 'react-native'; + +// Springs are observed through an 's opacity. The animation is +// bound to a mounted view (required for the native driver) and its per-frame +// trajectory is recorded from the value's listener. +function renderOpacity(): Animated.Value { + let value: ?Animated.Value; + const viewRef = createRef(); + + function MyApp() { + const opacity = useAnimatedValue(0); + value = opacity; + return ( + + ); + } + + const root = Fantom.createRoot(); + Fantom.runTask(() => { + root.render(); + }); + + return nullthrows(value); +} + +function expectSettledAtTarget(sample: number, target: number): void { + expect(Math.abs(sample - target)).toBeLessThan(0.02); +} + +for (const {name, useNativeDriver} of DRIVERS) { + describe(`Animated.spring (${name})`, () => { + it('follows an underdamped curve that overshoots then settles', () => { + const value = renderOpacity(); + + // zeta = c / (2 * sqrt(k * m)) = 20 / (2 * sqrt(200)) ~= 0.707, which + // overshoots the target by exp(-zeta * pi / sqrt(1 - zeta^2)) ~= 4.3%. + const {samples, finished} = collectAnimationTrajectory( + value, + driver => + Animated.spring(value, { + toValue: 1, + stiffness: 200, + damping: 20, + mass: 1, + useNativeDriver: driver, + }), + useNativeDriver, + 3000, + ); + + expect(finished).toBe(true); + expect(samples.length).toBeGreaterThan(3); + // Rises smoothly through the full range (not a snap to the end). + expect(samples.some(v => v > 0.2 && v < 0.4)).toBe(true); + expect(samples.some(v => v > 0.6 && v < 0.8)).toBe(true); + expectMonotonicToPeak(samples); + + // Overshoots the target by the amount the damping ratio predicts. + const peak = Math.max(...samples); + expect(peak).toBeGreaterThan(1.02); + expect(peak).toBeLessThan(1.07); + + // Oscillates back down from the peak and settles at the target. + const last = samples[samples.length - 1]; + expect(last).toBeLessThan(peak); + expectSettledAtTarget(last, 1); + }); + + it('follows an overdamped curve that approaches the target without overshoot', () => { + const value = renderOpacity(); + + // zeta = 30 / (2 * sqrt(100)) = 1.5 > 1 (overdamped): a smooth sigmoid to + // the target with no overshoot. + const {samples, finished} = collectAnimationTrajectory( + value, + driver => + Animated.spring(value, { + toValue: 1, + stiffness: 100, + damping: 30, + mass: 1, + useNativeDriver: driver, + }), + useNativeDriver, + 3000, + ); + + expect(finished).toBe(true); + expect(samples.some(v => v > 0.2 && v < 0.4)).toBe(true); + expect(samples.some(v => v > 0.6 && v < 0.8)).toBe(true); + expectMonotonicToPeak(samples); + + // No meaningful overshoot for an overdamped spring. + expect(Math.max(...samples)).toBeLessThan(1.005); + expectSettledAtTarget(samples[samples.length - 1], 1); + }); + + it('does not overshoot past toValue when overshootClamping is enabled', () => { + const value = renderOpacity(); + + // Same underdamped config as the overshoot test, but clamping must + // suppress the overshoot entirely. + const {samples} = collectAnimationTrajectory( + value, + driver => + Animated.spring(value, { + toValue: 1, + stiffness: 200, + damping: 20, + mass: 1, + overshootClamping: true, + useNativeDriver: driver, + }), + useNativeDriver, + 3000, + ); + + expectMonotonicToPeak(samples); + // Clamped: overshoot is suppressed to well under the ~4.3% the same + // unclamped config produces (peak ~1.043). + expect(Math.max(...samples)).toBeLessThan(1.02); + expectSettledAtTarget(samples[samples.length - 1], 1); + }); + + it('settles at the target when configured via tension/friction', () => { + const value = renderOpacity(); + + // Exercises the Origami tension/friction -> stiffness/damping conversion + // in SpringConfig (`fromOrigamiTensionAndFriction`). + const {samples, finished} = collectAnimationTrajectory( + value, + driver => + Animated.spring(value, { + toValue: 1, + tension: 40, + friction: 7, + useNativeDriver: driver, + }), + useNativeDriver, + 3000, + ); + + expect(finished).toBe(true); + expectMonotonicToPeak(samples); + expectSettledAtTarget(samples[samples.length - 1], 1); + }); + + // `speed` values chosen so the bounciness/speed -> stiffness/damping + // conversion exercises all three friction regimes in SpringConfig + // (bouncyTension <= 18, 18 < bouncyTension <= 44, and > 44). + for (const speed of [2, 5, 12]) { + it(`settles at the target when configured via bounciness/speed (speed ${speed})`, () => { + const value = renderOpacity(); + + const {samples, finished} = collectAnimationTrajectory( + value, + driver => + Animated.spring(value, { + toValue: 1, + bounciness: 12, + speed, + useNativeDriver: driver, + }), + useNativeDriver, + 3000, + ); + + expect(finished).toBe(true); + expectSettledAtTarget(samples[samples.length - 1], 1); + }); + } + }); +} + +describe('Animated.spring config validation', () => { + it('throws when combining mutually exclusive config groups', () => { + const value = renderOpacity(); + + expect(() => { + Fantom.runTask(() => { + Animated.spring(value, { + toValue: 1, + stiffness: 100, + bounciness: 10, + useNativeDriver: true, + }).start(); + }); + }).toThrow(); + }); +}); diff --git a/packages/react-native/Libraries/Animated/__tests__/TimingAnimation-test.js b/packages/react-native/Libraries/Animated/__tests__/TimingAnimation-itest.js similarity index 93% rename from packages/react-native/Libraries/Animated/__tests__/TimingAnimation-test.js rename to packages/react-native/Libraries/Animated/__tests__/TimingAnimation-itest.js index 0d2213462fd8..0a15db495f57 100644 --- a/packages/react-native/Libraries/Animated/__tests__/TimingAnimation-test.js +++ b/packages/react-native/Libraries/Animated/__tests__/TimingAnimation-itest.js @@ -8,7 +8,7 @@ * @format */ -'use strict'; +import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment'; import TimingAnimation from '../animations/TimingAnimation'; diff --git a/packages/react-native/Libraries/Animated/__tests__/bezier-test.js b/packages/react-native/Libraries/Animated/__tests__/bezier-itest.js similarity index 98% rename from packages/react-native/Libraries/Animated/__tests__/bezier-test.js rename to packages/react-native/Libraries/Animated/__tests__/bezier-itest.js index c7969246478d..38d71ce61f5c 100644 --- a/packages/react-native/Libraries/Animated/__tests__/bezier-test.js +++ b/packages/react-native/Libraries/Animated/__tests__/bezier-itest.js @@ -14,7 +14,7 @@ * @copyright 2014-2015 Gaetan Renaudeau. MIT License. */ -'use strict'; +import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment'; import bezier from '../bezier'; diff --git a/packages/react-native/Libraries/Animated/animations/Animation.js b/packages/react-native/Libraries/Animated/animations/Animation.js index 7322ec03c6b3..83e1a715379a 100644 --- a/packages/react-native/Libraries/Animated/animations/Animation.js +++ b/packages/react-native/Libraries/Animated/animations/Animation.js @@ -70,6 +70,7 @@ export default class Animation { previousAnimation: ?Animation, animatedValue: AnimatedValue, ): void { + // TODO: T274006331 - Remove js-only animation once shared backend is fully rolled out if (!this._useNativeDriver && animatedValue.__isNative === true) { throw new Error( 'Attempting to run JS driven animation on animated node ' + diff --git a/packages/react-native/Libraries/Animated/animations/DecayAnimation.js b/packages/react-native/Libraries/Animated/animations/DecayAnimation.js index 35eb106f5a2b..07dc60372058 100644 --- a/packages/react-native/Libraries/Animated/animations/DecayAnimation.js +++ b/packages/react-native/Libraries/Animated/animations/DecayAnimation.js @@ -12,6 +12,7 @@ import type {PlatformConfig} from '../AnimatedPlatformConfig'; import type AnimatedValue from '../nodes/AnimatedValue'; import type {AnimationConfig, EndCallback} from './Animation'; +import {getCurrentAnimationTime} from '../AnimationTimingUtils'; import Animation from './Animation'; export type DecayAnimationConfig = Readonly<{ @@ -82,16 +83,17 @@ export default class DecayAnimation extends Animation { this._lastValue = fromValue; this._fromValue = fromValue; this._onUpdate = onUpdate; - this._startTime = Date.now(); + this._startTime = getCurrentAnimationTime(); const useNativeDriver = this.__startAnimationIfNative(animatedValue); + // TODO: T274006331 - Remove js-only animation once shared backend is fully rolled out if (!useNativeDriver) { this._animationFrame = requestAnimationFrame(() => this.onUpdate()); } } onUpdate(): void { - const now = Date.now(); + const now = getCurrentAnimationTime(); const value = this._fromValue + diff --git a/packages/react-native/Libraries/Animated/animations/SpringAnimation.js b/packages/react-native/Libraries/Animated/animations/SpringAnimation.js index cb70e4454117..62ede656adce 100644 --- a/packages/react-native/Libraries/Animated/animations/SpringAnimation.js +++ b/packages/react-native/Libraries/Animated/animations/SpringAnimation.js @@ -14,6 +14,7 @@ import type AnimatedValue from '../nodes/AnimatedValue'; import type AnimatedValueXY from '../nodes/AnimatedValueXY'; import type {AnimationConfig, EndCallback} from './Animation'; +import {getCurrentAnimationTime} from '../AnimationTimingUtils'; import AnimatedColor from '../nodes/AnimatedColor'; import * as SpringConfig from '../SpringConfig'; import Animation from './Animation'; @@ -211,7 +212,7 @@ export default class SpringAnimation extends Animation { this._lastPosition = this._startPosition; this._onUpdate = onUpdate; - this._lastTime = Date.now(); + this._lastTime = getCurrentAnimationTime(); this._frameTime = 0.0; if (previousAnimation instanceof SpringAnimation) { @@ -225,6 +226,7 @@ export default class SpringAnimation extends Animation { const start = () => { const useNativeDriver = this.__startAnimationIfNative(animatedValue); + // TODO: T274006331 - Remove js-only animation once shared backend is fully rolled out if (!useNativeDriver) { this.onUpdate(); } @@ -273,7 +275,7 @@ export default class SpringAnimation extends Animation { // computation and will continue on the next frame. It's better to have it // running at faster speed than jumping to the end. const MAX_STEPS = 64; - let now = Date.now(); + let now = getCurrentAnimationTime(); if (now > this._lastTime + MAX_STEPS) { now = this._lastTime + MAX_STEPS; } diff --git a/packages/react-native/Libraries/Animated/animations/TimingAnimation.js b/packages/react-native/Libraries/Animated/animations/TimingAnimation.js index c464334cc376..e83d1a449a05 100644 --- a/packages/react-native/Libraries/Animated/animations/TimingAnimation.js +++ b/packages/react-native/Libraries/Animated/animations/TimingAnimation.js @@ -16,6 +16,7 @@ import type AnimatedValueXY from '../nodes/AnimatedValueXY'; import type {AnimationConfig, EndCallback} from './Animation'; import * as ReactNativeFeatureFlags from '../../../src/private/featureflags/ReactNativeFeatureFlags'; +import {getCurrentAnimationTime} from '../AnimationTimingUtils'; import AnimatedColor from '../nodes/AnimatedColor'; import Animation from './Animation'; @@ -126,9 +127,10 @@ export default class TimingAnimation extends Animation { } const start = () => { - this._startTime = Date.now(); + this._startTime = getCurrentAnimationTime(); const useNativeDriver = this.__startAnimationIfNative(animatedValue); + // TODO: T274006331 - Remove js-only animation once shared backend is fully rolled out if (!useNativeDriver) { // Animations that sometimes have 0 duration and sometimes do not // still need to use the native driver when duration is 0 so as to @@ -149,7 +151,7 @@ export default class TimingAnimation extends Animation { } onUpdate(): void { - const now = Date.now(); + const now = getCurrentAnimationTime(); if (now >= this._startTime + this._duration) { if (this._duration === 0) { this._onUpdate(this._toValue); diff --git a/packages/react-native/Libraries/Animated/components/AnimatedFlatList.js b/packages/react-native/Libraries/Animated/components/AnimatedFlatList.js index c6fa0365504f..877d5bf68bc4 100644 --- a/packages/react-native/Libraries/Animated/components/AnimatedFlatList.js +++ b/packages/react-native/Libraries/Animated/components/AnimatedFlatList.js @@ -14,10 +14,12 @@ import FlatList, {type FlatListProps} from '../../Lists/FlatList'; import createAnimatedComponent from '../createAnimatedComponent'; import * as React from 'react'; -export default createAnimatedComponent(FlatList) as $FlowFixMe as component< +const AnimatedFlatList: component< // $FlowExpectedError[unclear-type] ItemT = any, >( ref?: React.RefSetter>, ...props: AnimatedProps> -); +) = createAnimatedComponent(FlatList) as $FlowFixMe; + +export default AnimatedFlatList; diff --git a/packages/react-native/Libraries/Animated/components/AnimatedSectionList.js b/packages/react-native/Libraries/Animated/components/AnimatedSectionList.js index 2c187836b206..65d8accefe40 100644 --- a/packages/react-native/Libraries/Animated/components/AnimatedSectionList.js +++ b/packages/react-native/Libraries/Animated/components/AnimatedSectionList.js @@ -15,7 +15,7 @@ import createAnimatedComponent from '../createAnimatedComponent'; import * as React from 'react'; // $FlowFixMe[incompatible-type] -export default createAnimatedComponent(SectionList) as $FlowFixMe as component< +const AnimatedSectionList: component< // $FlowExpectedError[unclear-type] ItemT = any, // $FlowExpectedError[unclear-type] @@ -23,4 +23,6 @@ export default createAnimatedComponent(SectionList) as $FlowFixMe as component< >( ref?: React.RefSetter>, ...props: AnimatedProps> -); +) = createAnimatedComponent(SectionList) as $FlowFixMe; + +export default AnimatedSectionList; diff --git a/packages/react-native/Libraries/Animated/createAnimatedComponent.js b/packages/react-native/Libraries/Animated/createAnimatedComponent.js index b6b3953b429d..922e95ec9f6c 100644 --- a/packages/react-native/Libraries/Animated/createAnimatedComponent.js +++ b/packages/react-native/Libraries/Animated/createAnimatedComponent.js @@ -34,20 +34,19 @@ type Builtin = (...ReadonlyArray) => unknown | Date | Error | RegExp; export type WithAnimatedValue = T extends Builtin | Nullable ? T : T extends Primitive - ? - | T - | AnimatedNode - | AnimatedAddition - | AnimatedSubtraction - | AnimatedDivision - | AnimatedMultiplication - | AnimatedModulo - | AnimatedDiffClamp - | AnimatedValue - | AnimatedInterpolation - | AnimatedInterpolation - | AnimatedInterpolation - | AnimatedInterpolation + ? | T + | AnimatedNode + | AnimatedAddition + | AnimatedSubtraction + | AnimatedDivision + | AnimatedMultiplication + | AnimatedModulo + | AnimatedDiffClamp + | AnimatedValue + | AnimatedInterpolation + | AnimatedInterpolation + | AnimatedInterpolation + | AnimatedInterpolation : T extends ReadonlyArray ? ReadonlyArray> : T extends {...} diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedInterpolation.js b/packages/react-native/Libraries/Animated/nodes/AnimatedInterpolation.js index 891d4393b340..b6a0d4d3b5f5 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedInterpolation.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedInterpolation.js @@ -28,9 +28,7 @@ import invariant from 'invariant'; type ExtrapolateType = 'extend' | 'identity' | 'clamp'; export type InterpolationConfigSupportedOutputType = - | number - | string - | NativeColorValue; + number | string | NativeColorValue; export type InterpolationConfigType< OutputT extends InterpolationConfigSupportedOutputType, @@ -349,6 +347,100 @@ function checkInfiniteRange< ); } +// Ramerโ€“Douglasโ€“Peucker simplification using vertical distance (the curve's +// independent axis is the input position `t`). Keeps the endpoints and any point +// whose removal would push the piecewise-linear approximation more than +// `epsilon` away from the sampled curve. Produces non-uniform stops โ€” dense +// where the curve bends, sparse where it is near-linear. +function simplifyByVerticalDistance( + points: Array<[number, number]>, + epsilon: number, +): Array<[number, number]> { + if (points.length < 3) { + return points; + } + const [x0, y0] = points[0]; + const [x1, y1] = points[points.length - 1]; + const dx = x1 - x0; + let maxDistance = 0; + let maxIndex = -1; + for (let i = 1; i < points.length - 1; i++) { + const [x, y] = points[i]; + const chordY = dx === 0 ? y0 : y0 + ((y1 - y0) * (x - x0)) / dx; + const distance = Math.abs(y - chordY); + if (distance > maxDistance) { + maxDistance = distance; + maxIndex = i; + } + } + if (maxDistance > epsilon) { + const left = simplifyByVerticalDistance( + points.slice(0, maxIndex + 1), + epsilon, + ); + const right = simplifyByVerticalDistance(points.slice(maxIndex), epsilon); + // Drop the duplicated shared point at the split. + return left.slice(0, -1).concat(right); + } + return [points[0], points[points.length - 1]]; +} + +// Samples an `easing` function and simplifies it (RDP) into a compact set of +// non-uniform `[position, value]` stops that the native interpolation node +// applies to each segment's normalized ratio (binary search + linear interp). +// This mirrors the CSS `linear()` easing representation. The tolerance targets a +// sub-pixel error using the interpolation's numeric output span when known. +function sampleEasingStops( + easing: (input: number) => number, + outputRange: ReadonlyArray, +): Array<[number, number]> { + // Dense sampling resolution of the easing curve before simplification. + const DENSE_SAMPLES = 256; + // Target approximation error, in output units (โ‰ˆ sub-pixel for layout/ + // transform props). Used to derive the simplification tolerance from the span. + const TARGET_ERROR = 0.25; + // Bounds on the (ratio-space) simplification tolerance. + const MIN_TOLERANCE = 1e-4; + const MAX_TOLERANCE = 1e-2; + + // Evenly spaced [t, easing(t)] samples. + // e.g. quad samples: [[0, 0], [0.25, 0.0625], [0.5, 0.25], [0.75, 0.5625], [1, 1]]. + const dense: Array<[number, number]> = []; + for (let i = 0; i <= DENSE_SAMPLES; i++) { + const t = i / DENSE_SAMPLES; + dense.push([t, easing(t)]); + } + + let epsilon = MAX_TOLERANCE; + if (typeof outputRange[0] === 'number') { + let min = outputRange[0]; + let max = outputRange[0]; + for (const value of outputRange) { + if (typeof value === 'number') { + if (value < min) { + min = value; + } + if (value > max) { + max = value; + } + } + } + const span = max - min; + if (span > 0) { + epsilon = TARGET_ERROR / span; + } + } else { + // Non-numeric output (e.g. colors): components live in [0, 255]. + epsilon = TARGET_ERROR / 255; + } + epsilon = Math.min(MAX_TOLERANCE, Math.max(MIN_TOLERANCE, epsilon)); + + // Drops samples within `epsilon` of the chord, keeping a sparse subset. E.g. for + // epsilon in [0.0625, 0.25) the quad samples [[0, 0], [0.25, 0.0625], [0.5, 0.25], [0.75, 0.5625], [1, 1]] + // is trimmed to [[0, 0], [0.5, 0.25], [1, 1]]. + return simplifyByVerticalDistance(dense, epsilon); +} + export default class AnimatedInterpolation< OutputT extends InterpolationConfigSupportedOutputType, > extends AnimatedWithChildren { @@ -439,6 +531,17 @@ export default class AnimatedInterpolation< outputType = 'platform_color'; } + // An interpolation `easing` is a JS-only function. Rather than drop it (the + // native driver would run the segment linearly), sample + simplify it into a + // set of `[position, value]` stops the native node applies per segment. Works + // for every output type since easing acts on the normalized ratio, not the + // output values. + const easing = this._config.easing; + const easingStops = + easing != null && easing !== Easing.linear + ? sampleEasingStops(easing, this._config.outputRange) + : undefined; + return { inputRange: this._config.inputRange, outputRange, @@ -448,6 +551,7 @@ export default class AnimatedInterpolation< extrapolateRight: this._config.extrapolateRight || this._config.extrapolate || 'extend', type: 'interpolation', + easingStops, debugID: this.__getDebugID(), }; } diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedNode.js b/packages/react-native/Libraries/Animated/nodes/AnimatedNode.js index b10fe9da8bee..a7414bd48218 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedNode.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedNode.js @@ -11,9 +11,10 @@ import type {PlatformConfig} from '../AnimatedPlatformConfig'; import NativeAnimatedHelper from '../../../src/private/animated/NativeAnimatedHelper'; +import * as ReactNativeFeatureFlags from '../../../src/private/featureflags/ReactNativeFeatureFlags'; import invariant from 'invariant'; -type ValueListenerCallback = (state: {value: number, ...}) => unknown; +export type ValueListenerCallback = (state: {value: number}) => unknown; export type AnimatedNodeConfig = Readonly<{ debugID?: string, @@ -49,7 +50,9 @@ export default class AnimatedNode { __attach(): void {} __detach(): void { - this.removeAllListeners(); + if (!ReactNativeFeatureFlags.animatedKeepListenersOnDetach()) { + this.removeAllListeners(); + } if (this.__isNative && this.__nativeTag != null) { NativeAnimatedHelper.API.dropAnimatedNode(this.__nativeTag); this.__nativeTag = undefined; diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedValue.js b/packages/react-native/Libraries/Animated/nodes/AnimatedValue.js index 76dba2196f48..74ce65ae3649 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedValue.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedValue.js @@ -17,7 +17,7 @@ import type { InterpolationConfigType, } from './AnimatedInterpolation'; import type AnimatedNode from './AnimatedNode'; -import type {AnimatedNodeConfig} from './AnimatedNode'; +import type {AnimatedNodeConfig, ValueListenerCallback} from './AnimatedNode'; import type AnimatedTracking from './AnimatedTracking'; import NativeAnimatedHelper from '../../../src/private/animated/NativeAnimatedHelper'; @@ -124,6 +124,9 @@ export default class AnimatedValue extends AnimatedWithChildren { }); } this.stopAnimation(); + if (ReactNativeFeatureFlags.animatedKeepListenersOnDetach()) { + this._updateSubscription?.remove(); + } super.__detach(); } @@ -138,7 +141,7 @@ export default class AnimatedValue extends AnimatedWithChildren { } } - addListener(callback: (value: any) => unknown): string { + addListener(callback: ValueListenerCallback): string { const id = super.addListener(callback); this._listenerCount++; if (this.__isNative) { diff --git a/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.h b/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.h index 4c2423772ba3..4a4eb3fa1756 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.h +++ b/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.h @@ -19,8 +19,12 @@ NS_ASSUME_NONNULL_BEGIN /** - * @deprecated RCTAppDelegate is deprecated and will be removed in a future version of React Native. Use - `RCTReactNativeFactory` instead. + * @deprecated RCTAppDelegate is deprecated and will be removed in a future version of React Native. For new apps + * using the UIScene lifecycle, implement your own `SceneDelegate` with `RCTReactNativeFactory` (see integration + * docs). For AppDelegate-only apps, use `RCTReactNativeFactory` directly. + * + * Scene-based apps must keep `UIApplicationSupportsMultipleScenes` set to `false` in Info.plist. Define + * `RN_ALLOW_MULTIPLE_SCENES` on the app target to downgrade the unsupported-configuration crash to a warning. * * The RCTAppDelegate is an utility class that implements some base configurations for all the React Native apps. * It is not mandatory to use it, but it could simplify your AppDelegate code. @@ -55,19 +59,12 @@ NS_ASSUME_NONNULL_BEGIN * - (id)getModuleInstanceFromClass:(Class)moduleClass */ __attribute__((deprecated( - "RCTAppDelegate is deprecated and will be removed in a future version of React Native. Use `RCTReactNativeFactory` instead."))) + "RCTAppDelegate is deprecated and will be removed in a future version of React Native. For UIScene apps implement your own SceneDelegate with RCTReactNativeFactory; otherwise use RCTReactNativeFactory."))) @interface RCTAppDelegate : RCTDefaultReactNativeFactoryDelegate /// The window object, used to render the UViewControllers @property (nonatomic, strong, nonnull) UIWindow *window; -#if !defined(RCT_REMOVE_LEGACY_ARCH) -@property (nonatomic, nullable) RCTBridge *bridge - __attribute__((deprecated("The bridge is deprecated and will be removed when removing the legacy architecture."))); -@property (nonatomic, nullable) RCTSurfacePresenterBridgeAdapter *bridgeAdapter __attribute__(( - deprecated("The bridge adapter is deprecated and will be removed when removing the legacy architecture."))); -#endif - @property (nonatomic, strong, nullable) NSString *moduleName; @property (nonatomic, strong, nullable) NSDictionary *initialProps; @property (nonatomic, strong) RCTReactNativeFactory *reactNativeFactory; diff --git a/packages/react-native/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm b/packages/react-native/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm index e6f77aad652b..df121982cd3d 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm +++ b/packages/react-native/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm @@ -66,7 +66,7 @@ - (RCTColorSpace)defaultColorSpace - (NSURL *_Nullable)bundleURL { - [NSException raise:@"RCTAppDelegate::bundleURL not implemented" + [NSException raise:@"RCTReactNativeFactoryDelegate::bundleURL not implemented" format:@"Subclasses must implement a valid getBundleURL method"]; return nullptr; } diff --git a/packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.h b/packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.h index 9665e6975eaf..617de978b185 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.h +++ b/packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.h @@ -58,6 +58,15 @@ typedef NS_ENUM(NSInteger, RCTReleaseLevel) { Canary, Experimental, Stable }; @interface RCTReactNativeFactory : NSObject +/** + * Bootstrap entrypoints: + * - **AppDelegate path**: `startReactNativeWithModuleName:inWindow:launchOptions:` โ€” call from + * `application:didFinishLaunchingWithOptions:` or `RCTAppDelegate`. + * - **SceneDelegate path**: `startReactNativeWithModuleName:inWindow:connectionOptions:` โ€” call from + * `scene:willConnectToSession:options:` in your app-owned `SceneDelegate` (subclass + * `RCTDefaultReactNativeFactoryDelegate` and conform to `UIWindowSceneDelegate`). + */ + - (instancetype)initWithDelegate:(id)delegate; - (instancetype)initWithDelegate:(id)delegate releaseLevel:(RCTReleaseLevel)releaseLevel; @@ -73,9 +82,33 @@ typedef NS_ENUM(NSInteger, RCTReleaseLevel) { Canary, Experimental, Stable }; initialProperties:(NSDictionary *_Nullable)initialProperties launchOptions:(NSDictionary *_Nullable)launchOptions; +/** + * SceneDelegate entrypoint to start a React Native instance with the specified module name, window, and connection + * options for linking and user activity information. Only the first item in `URLContexts` and `userActivities` is used. + * @param moduleName name of the JS module to load + * @param window the window to launch in + * @param connectionOptions the scene's connection options + */ +- (void)startReactNativeWithModuleName:(NSString *)moduleName + inWindow:(UIWindow *_Nullable)window + connectionOptions:(UISceneConnectionOptions *_Nullable)connectionOptions; + +/** + * SceneDelegate entrypoint to start a React Native instance with the specified module name, window, initial properties, + * and connection options. Only the first item in `URLContexts` and `userActivities` is used. + * @param moduleName name of the JS module to load + * @param window the window to launch in + * @param initialProperties the initial root properties + * @param connectionOptions the scene's connection options + */ +- (void)startReactNativeWithModuleName:(NSString *)moduleName + inWindow:(UIWindow *_Nullable)window + initialProperties:(NSDictionary *_Nullable)initialProperties + connectionOptions:(UISceneConnectionOptions *_Nullable)connectionOptions; + #if !defined(RCT_REMOVE_LEGACY_ARCH) -@property (nonatomic, nullable) RCTSurfacePresenterBridgeAdapter *bridgeAdapter __attribute__(( - deprecated("The bridgeAdapter is deprecated and will be removed when removing the legacy architecture."))); +@property (nonatomic, nullable) RCTBridge *bridge + __attribute__((deprecated("The bridge is deprecated and will be removed when removing the legacy architecture."))); #endif @property (nonatomic, strong, nonnull) RCTRootViewFactory *rootViewFactory; diff --git a/packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.mm b/packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.mm index a407a722ad51..7f2a346bf849 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.mm +++ b/packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.mm @@ -9,7 +9,6 @@ #import #import #import -#import #import #import #import @@ -40,8 +39,36 @@ @interface RCTReactNativeFactory () < RCTHostDelegate, RCTJSRuntimeConfiguratorProtocol, RCTTurboModuleManagerDelegate> + @end +static NSDictionary *RCTConvertConnectionOptionsToLaunchOptions(UISceneConnectionOptions *connectionOptions) +{ + NSMutableDictionary *launchOptions = [NSMutableDictionary dictionary]; + + if (connectionOptions.URLContexts.count > 0) { + UIOpenURLContext *urlContext = connectionOptions.URLContexts.allObjects.firstObject; + + if (urlContext.URL != nil) { + launchOptions[UIApplicationLaunchOptionsURLKey] = urlContext.URL; + } + } + + if (connectionOptions.userActivities.count > 0) { + NSUserActivity *activity = connectionOptions.userActivities.allObjects.firstObject; + + if (activity != nil) { + NSMutableDictionary *userActivityDict = [NSMutableDictionary dictionary]; + userActivityDict[UIApplicationLaunchOptionsUserActivityTypeKey] = activity.activityType; + userActivityDict[@"UIApplicationLaunchOptionsUserActivityKey"] = activity; + + launchOptions[UIApplicationLaunchOptionsUserActivityDictionaryKey] = userActivityDict; + } + } + + return launchOptions; +} + @implementation RCTReactNativeFactory @synthesize bundleConfiguration = _bundleConfiguration; @@ -95,6 +122,29 @@ - (void)startReactNativeWithModuleName:(NSString *)moduleName [window makeKeyAndVisible]; } +#pragma mark - UIScene.ConnectionOptions + +- (void)startReactNativeWithModuleName:(NSString *)moduleName + inWindow:(UIWindow *_Nullable)window + connectionOptions:(UISceneConnectionOptions *_Nullable)connectionOptions +{ + [self startReactNativeWithModuleName:moduleName + inWindow:window + initialProperties:nil + launchOptions:RCTConvertConnectionOptionsToLaunchOptions(connectionOptions)]; +} + +- (void)startReactNativeWithModuleName:(NSString *)moduleName + inWindow:(UIWindow *_Nullable)window + initialProperties:(NSDictionary *_Nullable)initialProperties + connectionOptions:(UISceneConnectionOptions *_Nullable)connectionOptions +{ + [self startReactNativeWithModuleName:moduleName + inWindow:window + initialProperties:initialProperties + launchOptions:RCTConvertConnectionOptionsToLaunchOptions(connectionOptions)]; +} + #pragma mark - RCTUIConfiguratorProtocol - (RCTColorSpace)defaultColorSpace @@ -212,6 +262,13 @@ - (void)hostDidStart:(RCTHost *)host } } +- (void)host:(RCTHost *)host didInitializeRuntime:(facebook::jsi::Runtime &)runtime +{ + if ([_delegate respondsToSelector:@selector(host:didInitializeRuntime:)]) { + [_delegate host:host didInitializeRuntime:runtime]; + } +} + - (NSArray *)unstableModulesRequiringMainQueueSetup { #if RN_DISABLE_OSS_PLUGIN_HEADER diff --git a/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.h b/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.h index ddd3c09ebfbf..c78844c6c334 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.h +++ b/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.h @@ -184,11 +184,6 @@ typedef void (^RCTLoadSourceForBridgeBlock)(RCTBridge *bridge, RCTSourceLoadBloc */ @interface RCTRootViewFactory : NSObject -#if !defined(RCT_REMOVE_LEGACY_ARCH) -@property (nonatomic, strong, nullable) RCTBridge *bridge; -@property (nonatomic, strong, nullable) RCTSurfacePresenterBridgeAdapter *bridgeAdapter; -#endif - @property (nonatomic, strong, nullable) RCTHost *reactHost; - (instancetype)initWithConfiguration:(RCTRootViewFactoryConfiguration *)configuration diff --git a/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.mm b/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.mm index 8e12055adf38..4ca48c3b70ef 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.mm +++ b/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.mm @@ -11,7 +11,6 @@ #import #import #import -#import "RCTAppDelegate.h" #import "RCTAppSetupUtils.h" #if RN_DISABLE_OSS_PLUGIN_HEADER diff --git a/packages/react-native/Libraries/AppDelegate/RCTUIConfiguratorProtocol.h b/packages/react-native/Libraries/AppDelegate/RCTUIConfiguratorProtocol.h index 9e76c5b54d82..3a97e122620e 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTUIConfiguratorProtocol.h +++ b/packages/react-native/Libraries/AppDelegate/RCTUIConfiguratorProtocol.h @@ -20,8 +20,8 @@ NS_ASSUME_NONNULL_BEGIN /** * This method can be used to customize the rootView that is passed to React Native. - * A typical example is to override this method in the AppDelegate to change the background color. - * To achieve this, add in your `AppDelegate.mm`: + * Override on your `RCTReactNativeFactoryDelegate` (e.g. in AppDelegate, SceneDelegate, or + * `RCTAppDelegate` subclass). Example: * ``` * - (void)customizeRootView:(RCTRootView *)rootView * { diff --git a/packages/react-native/Libraries/AppDelegate/React-RCTAppDelegate.podspec b/packages/react-native/Libraries/AppDelegate/React-RCTAppDelegate.podspec index c4322bc2c36b..cdc7703c1103 100644 --- a/packages/react-native/Libraries/AppDelegate/React-RCTAppDelegate.podspec +++ b/packages/react-native/Libraries/AppDelegate/React-RCTAppDelegate.podspec @@ -59,6 +59,7 @@ Pod::Spec.new do |s| s.dependency "RCTTypeSafety" s.dependency "React-RCTNetwork" s.dependency "React-RCTImage" + s.dependency "React-RCTLinking" s.dependency "React-CoreModules" s.dependency "React-RCTFBReactNativeSpec" s.dependency "React-defaultsnativemodule" @@ -86,4 +87,6 @@ Pod::Spec.new do |s| depend_on_js_engine(s) add_rn_third_party_dependencies(s) add_rncore_dependency(s) + + mark_as_react_native_build(s) end diff --git a/packages/react-native/Libraries/AppState/AppState.js b/packages/react-native/Libraries/AppState/AppState.js index ed7909a54c66..b46ea05b82e0 100644 --- a/packages/react-native/Libraries/AppState/AppState.js +++ b/packages/react-native/Libraries/AppState/AppState.js @@ -15,26 +15,32 @@ import {type EventSubscription} from '../vendor/emitter/EventEmitter'; import NativeAppState from './NativeAppState'; /** - * active - The app is running in the foreground - * background - The app is running in the background. The user is either: - * - in another app - * - on the home screen - * - [Android only] on another Activity, including temporary system activities such - * as autofill credential pickers (even if launched by your app or the system) - * @platform ios - inactive - This is a state that occurs when transitioning between foreground & background, and during periods of inactivity such as entering the multitasking view, opening the Notification Center or in the event of an incoming call. + * The app's current state. + * + * - `active` โ€” The app is running in the foreground. + * - `background` โ€” The app is running in the background. The user is either + * in another app, on the home screen, or (Android only) on another Activity, + * including temporary system activities such as autofill credential pickers. + * - `inactive` โ€” A transitional state that occurs when moving between + * foreground and background, and during periods of inactivity such as + * entering the multitasking view, opening the Notification Center, or in the + * event of an incoming call. + * + * @platform ios `inactive` */ export type AppStateStatus = - | 'inactive' - | 'background' - | 'active' - | 'extension' - | 'unknown'; + 'inactive' | 'background' | 'active' | 'extension' | 'unknown'; /** - * change - This even is received when the app state has changed. - * memoryWarning - This event is used in the need of throwing memory warning or releasing it. - * @platform android - focus - Received when the app gains focus (the user is interacting with the app). - * @platform android - blur - Received when the user is not actively interacting with the app. + * Events emitted by `AppState`. + * + * - `change` โ€” Received when the app state has changed. + * - `memoryWarning` โ€” Received when the system issues a memory warning. + * - `focus` โ€” Received when the app gains focus (the user is interacting + * with the app). + * - `blur` โ€” Received when the user is not actively interacting with the app. + * + * @platform android `focus`, `blur` */ type AppStateEventDefinitions = { change: [AppStateStatus], @@ -52,13 +58,18 @@ type NativeAppStateEventDefinitions = { }; /** - * `AppState` can tell you if the app is in the foreground or background, - * and notify you when the state changes. + * Reports the app's current state (`active`, `background`, or `inactive`) and + * notifies when it changes. Frequently used to handle push notification + * behavior. * - * See https://reactnative.dev/docs/appstate + * @see https://reactnative.dev/docs/appstate */ class AppStateImpl { + /** + * The current app state. Can be `null` until the initial value is set. + */ currentState: ?string = null; + isAvailable: boolean; _emitter: ?NativeEventEmitter; @@ -106,10 +117,9 @@ class AppStateImpl { } /** - * Add a handler to AppState changes by listening to the `change` event type - * and providing the handler. - * - * See https://reactnative.dev/docs/appstate#addeventlistener + * Add a handler to `AppState` changes by listening to the `change` event + * type and providing the handler. See `AppStateEvent` for the list of + * available events. */ addEventListener( type: K, diff --git a/packages/react-native/Libraries/BatchedBridge/MessageQueue.js b/packages/react-native/Libraries/BatchedBridge/MessageQueue.js index 137233be1dfa..2d0a98f26010 100644 --- a/packages/react-native/Libraries/BatchedBridge/MessageQueue.js +++ b/packages/react-native/Libraries/BatchedBridge/MessageQueue.js @@ -130,8 +130,7 @@ class MessageQueue { } flushedQueue(): - | null - | [Array, Array, Array, number] { + null | [Array, Array, Array, number] { this.__guard(() => { this.__callReactNativeMicrotasks(); }); diff --git a/packages/react-native/Libraries/BatchedBridge/NativeModules.js b/packages/react-native/Libraries/BatchedBridge/NativeModules.js index c38eab148e98..3e16553e26d1 100644 --- a/packages/react-native/Libraries/BatchedBridge/NativeModules.js +++ b/packages/react-native/Libraries/BatchedBridge/NativeModules.js @@ -180,6 +180,13 @@ function updateErrorWithErrorData( return Object.assign(error, errorData || {}); } +/** + * Native Modules written in ObjectiveC/Swift/Java exposed via the RCTBridge + * Define lazy getters for each module. These will return the module if already loaded, or load it if not. + * See https://reactnative.dev/docs/native-modules-ios + * @example + * const MyModule = NativeModules.ModuleName + */ /* $FlowFixMe[unclear-type] unclear type of NativeModules */ let NativeModules: {[moduleName: string]: any, ...} = {}; if (global.nativeModuleProxy) { diff --git a/packages/react-native/Libraries/BatchedBridge/__tests__/MessageQueue-test.js b/packages/react-native/Libraries/BatchedBridge/__tests__/MessageQueue-itest.js similarity index 91% rename from packages/react-native/Libraries/BatchedBridge/__tests__/MessageQueue-test.js rename to packages/react-native/Libraries/BatchedBridge/__tests__/MessageQueue-itest.js index 196c788fb708..af908a232848 100644 --- a/packages/react-native/Libraries/BatchedBridge/__tests__/MessageQueue-test.js +++ b/packages/react-native/Libraries/BatchedBridge/__tests__/MessageQueue-itest.js @@ -8,10 +8,11 @@ * @format */ -'use strict'; +import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment'; + +const MessageQueueTestModule = require('../__mocks__/MessageQueueTestModule'); +const MessageQueue = require('../MessageQueue').default; -let MessageQueue; -let MessageQueueTestModule; let queue; const MODULE_IDS = 0; @@ -41,9 +42,6 @@ const assertQueue = ( // local callbacks stored by IDs are cleaned up. describe('MessageQueue', () => { beforeEach(() => { - jest.resetModules(); - MessageQueue = require('../MessageQueue').default; - MessageQueueTestModule = require('../__mocks__/MessageQueueTestModule'); queue = new MessageQueue(); queue.registerCallableModule( 'MessageQueueTestModule', @@ -117,9 +115,16 @@ describe('MessageQueue', () => { it('should throw when calling with unknown module', () => { const unknownModule = 'UnknownModule', unknownMethod = 'UnknownMethod'; - expect(() => - queue.__callFunction(unknownModule, unknownMethod, []), - ).toThrow( + let thrownError: ?Error; + try { + queue.__callFunction(unknownModule, unknownMethod, []); + } catch (e: unknown) { + if (e instanceof Error) { + thrownError = e; + } + } + expect(thrownError).toBeInstanceOf(Error); + expect(thrownError?.message).toContain( `Failed to call into JavaScript module method ${unknownModule}.${unknownMethod}()`, ); }); diff --git a/packages/react-native/Libraries/Blob/Blob.js b/packages/react-native/Libraries/Blob/Blob.js index dc6939860f72..90a4e5800813 100644 --- a/packages/react-native/Libraries/Blob/Blob.js +++ b/packages/react-native/Libraries/Blob/Blob.js @@ -86,6 +86,11 @@ class Blob { let {offset, size} = this.data; if (typeof start === 'number') { + if (start < 0) { + // A negative start is relative to the end of the blob. + // $FlowFixMe[reassign-const] + start = Math.max(this.size + start, 0); + } if (start > size) { // $FlowFixMe[reassign-const] start = size; @@ -102,7 +107,8 @@ class Blob { // $FlowFixMe[reassign-const] end = this.size; } - size = end - start; + // Clamp to 0 so an end that precedes start yields an empty blob. + size = Math.max(end - start, 0); } } return BlobManager.createFromOptions({ diff --git a/packages/react-native/Libraries/Blob/FileReader.js b/packages/react-native/Libraries/Blob/FileReader.js index 9cb37e5ca487..d76df9308e39 100644 --- a/packages/react-native/Libraries/Blob/FileReader.js +++ b/packages/react-native/Libraries/Blob/FileReader.js @@ -17,6 +17,7 @@ import { setEventHandlerAttribute, } from '../../src/private/webapis/dom/events/EventHandlerAttributes'; import EventTarget from '../../src/private/webapis/dom/events/EventTarget'; +import DOMException from '../../src/private/webapis/errors/DOMException'; import NativeFileReaderModule from './NativeFileReaderModule'; import {toByteArray} from 'base64-js'; @@ -41,9 +42,15 @@ class FileReader extends EventTarget { DONE: number = DONE; _readyState: ReadyState; - _error: ?Error; + _error: ?DOMException; _result: ?ReaderResult; _aborted: boolean = false; + _readId: number = 0; + // Keep the Blob strongly referenced until the native read settles. If the + // caller drops its own reference the Blob can be GC'd mid-read. Its + // BlobCollector finalizer then frees the native buffer and the read fails + // with "The specified blob is invalid". + _blob: ?Blob; constructor() { super(); @@ -54,12 +61,30 @@ class FileReader extends EventTarget { this._readyState = EMPTY; this._error = null; this._result = null; + this._blob = null; + } + + _startRead(methodName: string): number { + if (this._readyState === LOADING) { + throw new DOMException( + `Failed to execute '${methodName}' on 'FileReader': The object is already busy reading Blobs.`, + 'InvalidStateError', + ); + } + this._aborted = false; + this._error = null; + this._result = null; + const readId = ++this._readId; + this._setReadyState(LOADING); + return readId; } _setReadyState(newState: ReadyState) { this._readyState = newState; this.dispatchEvent(new Event('readystatechange')); - if (newState === DONE) { + if (newState === LOADING) { + this.dispatchEvent(new Event('loadstart')); + } else if (newState === DONE) { if (this._aborted) { this.dispatchEvent(new Event('abort')); } else if (this._error) { @@ -67,24 +92,43 @@ class FileReader extends EventTarget { } else { this.dispatchEvent(new Event('load')); } - this.dispatchEvent(new Event('loadend')); + if (this._readyState !== LOADING) { + this.dispatchEvent(new Event('loadend')); + } } } - readAsArrayBuffer(blob: ?Blob): void { - this._aborted = false; + _toDOMException(error: unknown): DOMException { + if (error instanceof DOMException) { + return error; + } + if (error instanceof Error) { + return new DOMException(error.message, 'NotReadableError'); + } + return new DOMException(String(error), 'NotReadableError'); + } + readAsArrayBuffer(blob: ?Blob): void { if (blob == null) { throw new TypeError( "Failed to execute 'readAsArrayBuffer' on 'FileReader': parameter 1 is not of type 'Blob'", ); } + const readId = this._startRead('readAsArrayBuffer'); + // Skip if this read is no longer current: a synchronous loadstart or + // readystatechange handler may have aborted or started another read during + // _startRead, so setting _blob here would leak or clobber the newer read's. + if (readId === this._readId) { + this._blob = blob; + } + NativeFileReaderModule.readAsDataURL(blob.data).then( (text: string) => { - if (this._aborted) { + if (readId !== this._readId) { return; } + this._blob = null; const base64 = text.split(',')[1]; const typedArray = toByteArray(base64); @@ -93,85 +137,98 @@ class FileReader extends EventTarget { this._setReadyState(DONE); }, error => { - if (this._aborted) { + if (readId !== this._readId) { return; } - this._error = error; + this._blob = null; + this._error = this._toDOMException(error); this._setReadyState(DONE); }, ); } readAsDataURL(blob: ?Blob): void { - this._aborted = false; - if (blob == null) { throw new TypeError( "Failed to execute 'readAsDataURL' on 'FileReader': parameter 1 is not of type 'Blob'", ); } + const readId = this._startRead('readAsDataURL'); + if (readId === this._readId) { + this._blob = blob; + } + NativeFileReaderModule.readAsDataURL(blob.data).then( (text: string) => { - if (this._aborted) { + if (readId !== this._readId) { return; } + this._blob = null; this._result = text; this._setReadyState(DONE); }, error => { - if (this._aborted) { + if (readId !== this._readId) { return; } - this._error = error; + this._blob = null; + this._error = this._toDOMException(error); this._setReadyState(DONE); }, ); } readAsText(blob: ?Blob, encoding: string = 'UTF-8'): void { - this._aborted = false; - if (blob == null) { throw new TypeError( "Failed to execute 'readAsText' on 'FileReader': parameter 1 is not of type 'Blob'", ); } + const readId = this._startRead('readAsText'); + if (readId === this._readId) { + this._blob = blob; + } + NativeFileReaderModule.readAsText(blob.data, encoding).then( (text: string) => { - if (this._aborted) { + if (readId !== this._readId) { return; } + this._blob = null; this._result = text; this._setReadyState(DONE); }, error => { - if (this._aborted) { + if (readId !== this._readId) { return; } - this._error = error; + this._blob = null; + this._error = this._toDOMException(error); this._setReadyState(DONE); }, ); } abort() { - this._aborted = true; - // only call onreadystatechange if there is something to abort, as per spec - if (this._readyState !== EMPTY && this._readyState !== DONE) { - this._reset(); + this._result = null; + if (this._readyState === LOADING) { + this._aborted = true; + this._readId++; + // The abandoned read's callbacks bail out on the readId check without + // clearing _blob, so release it here, before dispatching the abort event + // whose handler may start a new read that sets _blob again. + this._blob = null; this._setReadyState(DONE); } - // Reset again after, in case modified in handler - this._reset(); } get readyState(): ReadyState { return this._readyState; } - get error(): ?Error { + get error(): ?DOMException { return this._error; } diff --git a/packages/react-native/Libraries/Blob/RCTBlobManager.mm b/packages/react-native/Libraries/Blob/RCTBlobManager.mm index c7035d8a0ea1..8a4b6740ea15 100755 --- a/packages/react-native/Libraries/Blob/RCTBlobManager.mm +++ b/packages/react-native/Libraries/Blob/RCTBlobManager.mm @@ -148,7 +148,7 @@ - (void)remove:(NSString *)blobId [_blobs removeObjectForKey:blobId]; } -RCT_EXPORT_METHOD(addNetworkingHandler) +- (void)addNetworkingHandler { RCTNetworking *const networking = [_moduleRegistry moduleForName:"Networking"]; @@ -164,32 +164,29 @@ - (void)remove:(NSString *)blobId }); } -RCT_EXPORT_METHOD(addWebSocketHandler : (double)socketID) +- (void)addWebSocketHandler:(double)socketID { dispatch_async(((RCTWebSocketModule *)[_moduleRegistry moduleForName:"WebSocketModule"]).methodQueue, ^{ - [[self->_moduleRegistry moduleForName:"WebSocketModule"] setContentHandler:self - forSocketID:[NSNumber numberWithDouble:socketID]]; + [[self->_moduleRegistry moduleForName:"WebSocketModule"] setContentHandler:self forSocketID:@(socketID)]; }); } -RCT_EXPORT_METHOD(removeWebSocketHandler : (double)socketID) +- (void)removeWebSocketHandler:(double)socketID { dispatch_async(((RCTWebSocketModule *)[_moduleRegistry moduleForName:"WebSocketModule"]).methodQueue, ^{ - [[self->_moduleRegistry moduleForName:"WebSocketModule"] setContentHandler:nil - forSocketID:[NSNumber numberWithDouble:socketID]]; + [[self->_moduleRegistry moduleForName:"WebSocketModule"] setContentHandler:nil forSocketID:@(socketID)]; }); } // @lint-ignore FBOBJCUNTYPEDCOLLECTION1 -RCT_EXPORT_METHOD(sendOverSocket : (NSDictionary *)blob socketID : (double)socketID) +- (void)sendOverSocket:(NSDictionary *)blob socketID:(double)socketID { dispatch_async(((RCTWebSocketModule *)[_moduleRegistry moduleForName:"WebSocketModule"]).methodQueue, ^{ - [[self->_moduleRegistry moduleForName:"WebSocketModule"] sendData:[self resolve:blob] - forSocketID:[NSNumber numberWithDouble:socketID]]; + [[self->_moduleRegistry moduleForName:"WebSocketModule"] sendData:[self resolve:blob] forSocketID:@(socketID)]; }); } -RCT_EXPORT_METHOD(createFromParts : (NSArray *> *)parts withId : (NSString *)blobId) +- (void)createFromParts:(NSArray *> *)parts withId:(NSString *)blobId { NSMutableData *data = [NSMutableData new]; for (NSDictionary *part in parts) { @@ -211,7 +208,7 @@ - (void)remove:(NSString *)blobId }); } -RCT_EXPORT_METHOD(release : (NSString *)blobId) +- (void)release:(NSString *)blobId { dispatch_async(_methodQueue, ^{ [self remove:blobId]; diff --git a/packages/react-native/Libraries/Blob/RCTFileReaderModule.mm b/packages/react-native/Libraries/Blob/RCTFileReaderModule.mm index 02180144f281..c33e1c05893b 100644 --- a/packages/react-native/Libraries/Blob/RCTFileReaderModule.mm +++ b/packages/react-native/Libraries/Blob/RCTFileReaderModule.mm @@ -24,9 +24,10 @@ @implementation RCTFileReaderModule @synthesize moduleRegistry = _moduleRegistry; -RCT_EXPORT_METHOD( - readAsText : (NSDictionary *)blob encoding : (NSString *)encoding resolve : (RCTPromiseResolveBlock) - resolve reject : (RCTPromiseRejectBlock)reject) +- (void)readAsText:(NSDictionary *)blob + encoding:(NSString *)encoding + resolve:(RCTPromiseResolveBlock)resolve + reject:(RCTPromiseRejectBlock)reject { RCTBlobManager *blobManager = [_moduleRegistry moduleForName:"BlobModule"]; dispatch_async(blobManager.methodQueue, ^{ @@ -54,9 +55,9 @@ @implementation RCTFileReaderModule }); } -RCT_EXPORT_METHOD( - readAsDataURL : (NSDictionary *)blob resolve : (RCTPromiseResolveBlock) - resolve reject : (RCTPromiseRejectBlock)reject) +- (void)readAsDataURL:(NSDictionary *)blob + resolve:(RCTPromiseResolveBlock)resolve + reject:(RCTPromiseRejectBlock)reject { RCTBlobManager *blobManager = [_moduleRegistry moduleForName:"BlobModule"]; dispatch_async(blobManager.methodQueue, ^{ diff --git a/packages/react-native/Libraries/Blob/React-RCTBlob.podspec b/packages/react-native/Libraries/Blob/React-RCTBlob.podspec index b0cab4521289..344e63726777 100644 --- a/packages/react-native/Libraries/Blob/React-RCTBlob.podspec +++ b/packages/react-native/Libraries/Blob/React-RCTBlob.podspec @@ -56,4 +56,6 @@ Pod::Spec.new do |s| add_rn_third_party_dependencies(s) add_rncore_dependency(s) + + mark_as_react_native_build(s) end diff --git a/packages/react-native/Libraries/Blob/__tests__/Blob-test.js b/packages/react-native/Libraries/Blob/__tests__/Blob-test.js index 36aee4969c74..3375467b4831 100644 --- a/packages/react-native/Libraries/Blob/__tests__/Blob-test.js +++ b/packages/react-native/Libraries/Blob/__tests__/Blob-test.js @@ -81,6 +81,38 @@ describe('Blob', function () { expect(sliceC.size).toBe(Math.min(blob.data.size, 34569) - 34543); }); + it('should slice a blob with a negative start', () => { + const blob = new Blob(); + blob.data.size = 34546; + + // A negative start is relative to the end of the blob. + const slice = blob.slice(-100); + + expect(slice.data.offset).toBe(34446); + expect(slice.size).toBe(100); + }); + + it('should slice a blob with a negative end', () => { + const blob = new Blob(); + blob.data.size = 34546; + + // A negative end is relative to the end of the blob. + const slice = blob.slice(0, -100); + + expect(slice.data.offset).toBe(0); + expect(slice.size).toBe(34446); + }); + + it('should return an empty slice when end precedes start', () => { + const blob = new Blob(); + blob.data.size = 34546; + + const slice = blob.slice(200, 100); + + expect(slice.data.offset).toBe(200); + expect(slice.size).toBe(0); + }); + it('should slice a blob and sets a contentType', () => { const blob = new Blob(); diff --git a/packages/react-native/Libraries/Blob/__tests__/BlobRegistry-test.js b/packages/react-native/Libraries/Blob/__tests__/BlobRegistry-itest.js similarity index 84% rename from packages/react-native/Libraries/Blob/__tests__/BlobRegistry-test.js rename to packages/react-native/Libraries/Blob/__tests__/BlobRegistry-itest.js index 8e6d70d126d3..86f779b3fca8 100644 --- a/packages/react-native/Libraries/Blob/__tests__/BlobRegistry-test.js +++ b/packages/react-native/Libraries/Blob/__tests__/BlobRegistry-itest.js @@ -8,14 +8,14 @@ * @format */ -'use strict'; +import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment'; const BlobRegistry = require('../BlobRegistry'); describe('BlobRegistry', () => { describe('register', () => { it('does not throw error', () => { - expect(() => BlobRegistry.register('id1')).not.toThrowError(); + expect(() => BlobRegistry.register('id1')).not.toThrow(); }); it('registers new id', () => { @@ -26,7 +26,7 @@ describe('BlobRegistry', () => { describe('unregister', () => { it('does not throw error', () => { - expect(() => BlobRegistry.unregister('id3')).not.toThrowError(); + expect(() => BlobRegistry.unregister('id3')).not.toThrow(); }); it('remove registered id', () => { diff --git a/packages/react-native/Libraries/Blob/__tests__/FileReader-test.js b/packages/react-native/Libraries/Blob/__tests__/FileReader-test.js index 549d027bc3a0..0f82773b844a 100644 --- a/packages/react-native/Libraries/Blob/__tests__/FileReader-test.js +++ b/packages/react-native/Libraries/Blob/__tests__/FileReader-test.js @@ -12,8 +12,12 @@ import type Event from '../../../src/private/webapis/dom/events/Event'; +import DOMException from '../../../src/private/webapis/errors/DOMException'; + +const FileReaderModuleMock = require('../__mocks__/FileReaderModule').default; const Blob = require('../Blob').default; const FileReader = require('../FileReader').default; +const NativeFileReaderModule = require('../NativeFileReaderModule').default; jest.mock('../../BatchedBridge/NativeModules', () => ({ __esModule: true, @@ -24,6 +28,10 @@ jest.mock('../../BatchedBridge/NativeModules', () => ({ })); describe('FileReader', function () { + afterEach(() => { + jest.restoreAllMocks(); + }); + it('should read blob as text', async () => { const e = await new Promise((resolve, reject) => { const reader = new FileReader(); @@ -46,6 +54,89 @@ describe('FileReader', function () { expect(e.target?.result).toBe('data:text/plain;base64,NDI='); }); + it('should be in the LOADING state while a read is in progress', () => { + const reader = new FileReader(); + expect(reader.readyState).toBe(FileReader.EMPTY); + reader.readAsText(new Blob()); + // The native read resolves on a later microtask, so the reader should + // report LOADING synchronously after the read starts. + expect(reader.readyState).toBe(FileReader.LOADING); + }); + + it('should dispatch abort and loadend when aborted during a read', () => { + const reader = new FileReader(); + let aborted = false; + let loadended = false; + reader.onabort = () => { + aborted = true; + }; + reader.onloadend = () => { + loadended = true; + }; + reader.readAsText(new Blob()); + reader.abort(); + expect(aborted).toBe(true); + expect(loadended).toBe(true); + expect(reader.readyState).toBe(FileReader.DONE); + expect(reader.result).toBe(null); + }); + + it('should preserve a read started by an abort handler', async () => { + const reader = new FileReader(); + let loadendCount = 0; + const replacementRead = new Promise(resolve => { + reader.onloadend = () => { + loadendCount++; + resolve(); + }; + }); + reader.onabort = () => { + reader.readAsText(new Blob()); + }; + + reader.readAsText(new Blob()); + reader.abort(); + + expect(reader.readyState).toBe(FileReader.LOADING); + expect(loadendCount).toBe(0); + + await replacementRead; + expect(reader.readyState).toBe(FileReader.DONE); + expect(reader.result).toBe(''); + expect(loadendCount).toBe(1); + }); + + it('should clear stale result and error when starting a read', async () => { + const reader = new FileReader(); + const readAsText = jest.spyOn(NativeFileReaderModule, 'readAsText'); + + const successfulRead = new Promise(resolve => { + reader.onloadend = () => resolve(); + }); + reader.readAsText(new Blob()); + await successfulRead; + expect(reader.result).toBe(''); + + const error = new Error('read failed'); + readAsText.mockRejectedValueOnce(error); + const failedRead = new Promise(resolve => { + reader.onloadend = () => resolve(); + }); + reader.readAsText(new Blob()); + expect(reader.result).toBe(null); + expect(reader.error).toBe(null); + await failedRead; + expect(reader.error).toBeInstanceOf(DOMException); + expect(reader.error?.message).toBe(error.message); + + readAsText.mockReturnValueOnce(new Promise(() => {})); + reader.readAsText(new Blob()); + expect(reader.result).toBe(null); + expect(reader.error).toBe(null); + + readAsText.mockRestore(); + }); + it('should read blob as ArrayBuffer', async () => { const e = await new Promise((resolve, reject) => { const reader = new FileReader(); @@ -59,4 +150,233 @@ describe('FileReader', function () { // $FlowFixMe[cannot-resolve-name] expect(new TextDecoder().decode(ab)).toBe('42'); }); + + it('fires lifecycle events in spec order for a successful read', async () => { + const reader = new FileReader(); + const events: Array = []; + const done = new Promise(resolve => { + for (const type of ['loadstart', 'load', 'loadend']) { + reader.addEventListener(type, () => { + events.push(type); + if (type === 'loadend') { + resolve(); + } + }); + } + reader.readAsText(new Blob()); + }); + await done; + expect(events).toEqual(['loadstart', 'load', 'loadend']); + }); + + it('fires loadstart with the reader in the LOADING state', async () => { + const reader = new FileReader(); + let stateAtLoadStart: ?number = null; + const done = new Promise(resolve => { + reader.onloadstart = () => { + stateAtLoadStart = reader.readyState; + }; + reader.onload = resolve; + reader.readAsText(new Blob()); + }); + await done; + expect(stateAtLoadStart).toBe(FileReader.LOADING); + }); + + it('does not dispatch a progress event (native reads are atomic)', async () => { + const reader = new FileReader(); + let progressed = false; + const done = new Promise((resolve, reject) => { + reader.onprogress = () => { + progressed = true; + }; + reader.onload = resolve; + reader.onerror = reject; + reader.readAsText(new Blob()); + }); + await done; + expect(progressed).toBe(false); + }); + + it('dispatches readystatechange for EMPTY -> LOADING -> DONE', async () => { + const reader = new FileReader(); + const states: Array = []; + const done = new Promise(resolve => { + reader.addEventListener('readystatechange', () => { + states.push(reader.readyState); + }); + reader.onload = resolve; + reader.readAsText(new Blob()); + }); + await done; + expect(states).toEqual([FileReader.LOADING, FileReader.DONE]); + }); + + it('fires error and loadend (not load) when the native read rejects', async () => { + jest + .spyOn(FileReaderModuleMock, 'readAsText') + .mockRejectedValueOnce(new Error('read failed')); + + const reader = new FileReader(); + let loaded = false; + let errored = false; + const done = new Promise(resolve => { + reader.onload = () => { + loaded = true; + }; + reader.onerror = () => { + errored = true; + }; + reader.onloadend = resolve; + reader.readAsText(new Blob()); + }); + await done; + expect(errored).toBe(true); + expect(loaded).toBe(false); + expect(reader.readyState).toBe(FileReader.DONE); + expect(reader.result).toBe(null); + }); + + it('exposes a read failure as a DOMException', async () => { + jest + .spyOn(FileReaderModuleMock, 'readAsText') + .mockRejectedValueOnce(new Error('read failed')); + + const reader = new FileReader(); + await new Promise(resolve => { + reader.onloadend = resolve; + reader.readAsText(new Blob()); + }); + expect(reader.error).toBeInstanceOf(DOMException); + expect(reader.error?.name).toBe('NotReadableError'); + }); + + it('throws InvalidStateError when a read starts while LOADING', () => { + const reader = new FileReader(); + reader.readAsText(new Blob()); + expect(reader.readyState).toBe(FileReader.LOADING); + + let thrown: unknown = null; + try { + reader.readAsText(new Blob()); + } catch (e) { + thrown = e; + } + expect(thrown).toBeInstanceOf(DOMException); + if (thrown instanceof DOMException) { + expect(thrown.name).toBe('InvalidStateError'); + } + // The in-flight read is untouched. + expect(reader.readyState).toBe(FileReader.LOADING); + }); + + it('throws a TypeError when the blob is null', () => { + const reader = new FileReader(); + expect(() => reader.readAsText(null)).toThrow(TypeError); + expect(reader.readyState).toBe(FileReader.EMPTY); + }); + + it('should retain the blob until the read resolves', async () => { + let resolveRead: string => void = () => {}; + const spy = jest + .spyOn(FileReaderModuleMock, 'readAsText') + .mockImplementation( + () => + new Promise(resolve => { + resolveRead = resolve; + }), + ); + + const reader = new FileReader(); + const blob = new Blob(); + const loadend = new Promise(resolve => { + reader.onloadend = resolve; + }); + reader.readAsText(blob); + // $FlowFixMe[prop-missing] - accessing private state for the test + expect(reader._blob).toBe(blob); + + resolveRead(''); + await loadend; + // $FlowFixMe[prop-missing] - accessing private state for the test + expect(reader._blob).toBe(null); + + spy.mockRestore(); + }); + + it('should release the blob when the read rejects', async () => { + let rejectRead: Error => void = () => {}; + const spy = jest + .spyOn(FileReaderModuleMock, 'readAsText') + .mockImplementation( + () => + new Promise((resolve, reject) => { + rejectRead = reject; + }), + ); + + const reader = new FileReader(); + const blob = new Blob(); + const loadend = new Promise(resolve => { + reader.onloadend = resolve; + }); + reader.readAsText(blob); + // $FlowFixMe[prop-missing] - accessing private state for the test + expect(reader._blob).toBe(blob); + + rejectRead(new Error('nope')); + await loadend; + // $FlowFixMe[prop-missing] - accessing private state for the test + expect(reader._blob).toBe(null); + + spy.mockRestore(); + }); + + it('should release the blob when a pending read is aborted', () => { + const spy = jest + .spyOn(FileReaderModuleMock, 'readAsText') + .mockImplementation(() => new Promise(() => {})); + + const reader = new FileReader(); + const blob = new Blob(); + reader.readAsText(blob); + // $FlowFixMe[prop-missing] - accessing private state for the test + expect(reader._blob).toBe(blob); + + reader.abort(); + // $FlowFixMe[prop-missing] - accessing private state for the test + expect(reader._blob).toBe(null); + + spy.mockRestore(); + }); + + it('should keep retaining the new blob when a stale read settles after abort', async () => { + const resolvers: Array<(string) => void> = []; + const spy = jest + .spyOn(FileReaderModuleMock, 'readAsText') + .mockImplementation( + () => + new Promise(resolve => { + resolvers.push(resolve); + }), + ); + + const reader = new FileReader(); + const staleBlob = new Blob(); + reader.readAsText(staleBlob); + reader.abort(); + + const newBlob = new Blob(); + reader.readAsText(newBlob); + // $FlowFixMe[prop-missing] - accessing private state for the test + expect(reader._blob).toBe(newBlob); + + // Settle the first (aborted) read; it must not drop the new blob. + resolvers[0](''); + await Promise.resolve(); + // $FlowFixMe[prop-missing] - accessing private state for the test + expect(reader._blob).toBe(newBlob); + + spy.mockRestore(); + }); }); diff --git a/packages/react-native/Libraries/Blob/__tests__/URL-test.js b/packages/react-native/Libraries/Blob/__tests__/URL-itest.js similarity index 95% rename from packages/react-native/Libraries/Blob/__tests__/URL-test.js rename to packages/react-native/Libraries/Blob/__tests__/URL-itest.js index 72467dc08ebb..2cf5e9d86924 100644 --- a/packages/react-native/Libraries/Blob/__tests__/URL-test.js +++ b/packages/react-native/Libraries/Blob/__tests__/URL-itest.js @@ -8,7 +8,7 @@ * @format */ -'use strict'; +import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment'; const URL = require('../URL').URL; const URLSearchParams = require('../URL').URLSearchParams; @@ -133,12 +133,9 @@ describe('URL', function () { expect(urlParams.has('query')).toBe(true); expect(urlParams.has('key')).toBe(false); - // Sorting URLSearchParams - const unsortedParams = new URLSearchParams( - '?z=last&b=second&c=third&a=first', - ); - unsortedParams.sort(); - expect(unsortedParams.toString()).toBe('a=first&b=second&c=third&z=last'); + // Sorting URLSearchParams is not exercised here: URLSearchParams.sort() + // relies on String.prototype.localeCompare, which requires ICU collation + // support that is unavailable in Fantom's Hermes build. // searchParams.set() should replace values not duplicate them const urlWithSearchParams = new URL( diff --git a/packages/react-native/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js b/packages/react-native/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js index 7f9a2224b1a2..b922c77f0626 100644 --- a/packages/react-native/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +++ b/packages/react-native/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js @@ -43,10 +43,7 @@ type AccessibilityEventDefinitions = { }; type AccessibilityEventTypes = - | 'click' - | 'focus' - | 'viewHoverEnter' - | 'windowStateChange'; + 'click' | 'focus' | 'viewHoverEnter' | 'windowStateChange'; // Mapping of public event names to platform-specific event names. const EventNames: Map = @@ -73,13 +70,9 @@ const EventNames: Map = ]); /** - * Sometimes it's useful to know whether or not the device has a screen reader - * that is currently active. The `AccessibilityInfo` API is designed for this - * purpose. You can use it to query the current state of the screen reader as - * well as to register to be notified when the state of the screen reader - * changes. + * Provides information about the device's accessibility features, such as whether a screen reader is active. Can be used to query the current state and register for change notifications. * - * See https://reactnative.dev/docs/accessibilityinfo + * @see https://reactnative.dev/docs/accessibilityinfo */ const AccessibilityInfo = { /** @@ -88,7 +81,7 @@ const AccessibilityInfo = { * Returns a promise which resolves to a boolean. * The result is `true` when bold text is enabled and `false` otherwise. * - * See https://reactnative.dev/docs/accessibilityinfo#isBoldTextEnabled + * @platform ios */ isBoldTextEnabled(): Promise { if (Platform.OS === 'android') { @@ -113,7 +106,7 @@ const AccessibilityInfo = { * Returns a promise which resolves to a boolean. * The result is `true` when grayscale is enabled and `false` otherwise. * - * See https://reactnative.dev/docs/accessibilityinfo#isGrayscaleEnabled + * @platform ios */ isGrayscaleEnabled(): Promise { if (Platform.OS === 'android') { @@ -148,7 +141,7 @@ const AccessibilityInfo = { * Returns a promise which resolves to a boolean. * The result is `true` when invert color is enabled and `false` otherwise. * - * See https://reactnative.dev/docs/accessibilityinfo#isInvertColorsEnabled + * @platform ios */ isInvertColorsEnabled(): Promise { if (Platform.OS === 'android') { @@ -182,8 +175,6 @@ const AccessibilityInfo = { * * Returns a promise which resolves to a boolean. * The result is `true` when a reduce motion is enabled and `false` otherwise. - * - * See https://reactnative.dev/docs/accessibilityinfo#isReduceMotionEnabled */ isReduceMotionEnabled(): Promise { return new Promise((resolve, reject) => { @@ -207,12 +198,12 @@ const AccessibilityInfo = { }, /** - * Query whether high text contrast is currently enabled. Android only. + * Query whether high text contrast is currently enabled. * * Returns a promise which resolves to a boolean. * The result is `true` when high text contrast is enabled and `false` otherwise. * - * See https://reactnative.dev/docs/accessibilityinfo#ishightextcontrastenabled-android + * @platform android */ isHighTextContrastEnabled(): Promise { if (Platform.OS === 'android') { @@ -233,12 +224,12 @@ const AccessibilityInfo = { }, /** - * Query whether dark system colors is currently enabled. iOS only. + * Query whether darker system colors is currently enabled. * * Returns a promise which resolves to a boolean. - * The result is `true` when dark system colors is enabled and `false` otherwise. + * The result is `true` when darker system colors is enabled and `false` otherwise. * - * See https://reactnative.dev/docs/accessibilityinfo#isdarkersystemcolorsenabled-ios + * @platform ios */ isDarkerSystemColorsEnabled(): Promise { if (Platform.OS === 'android') { @@ -265,12 +256,12 @@ const AccessibilityInfo = { }, /** - * Query whether reduce motion and prefer cross-fade transitions settings are currently enabled. + * Query whether cross-fade transitions are preferred over slide transitions. * * Returns a promise which resolves to a boolean. - * The result is `true` when prefer cross-fade transitions is enabled and `false` otherwise. + * The result is `true` when cross-fade transitions are preferred and `false` otherwise. * - * See https://reactnative.dev/docs/accessibilityinfo#prefersCrossFadeTransitions + * @platform ios */ prefersCrossFadeTransitions(): Promise { if (Platform.OS === 'android') { @@ -302,7 +293,7 @@ const AccessibilityInfo = { * Returns a promise which resolves to a boolean. * The result is `true` when a reduce transparency is enabled and `false` otherwise. * - * See https://reactnative.dev/docs/accessibilityinfo#isReduceTransparencyEnabled + * @platform ios */ isReduceTransparencyEnabled(): Promise { if (Platform.OS === 'android') { @@ -326,8 +317,6 @@ const AccessibilityInfo = { * * Returns a promise which resolves to a boolean. * The result is `true` when a screen reader is enabled and `false` otherwise. - * - * See https://reactnative.dev/docs/accessibilityinfo#isScreenReaderEnabled */ isScreenReaderEnabled(): Promise { return new Promise((resolve, reject) => { @@ -357,8 +346,6 @@ const AccessibilityInfo = { * The result is `true` when any service is enabled and `false` otherwise. * * @platform android - * - * See https://reactnative.dev/docs/accessibilityinfo/#isaccessibilityserviceenabled-android */ isAccessibilityServiceEnabled(): Promise { return new Promise((resolve, reject) => { @@ -425,8 +412,6 @@ const AccessibilityInfo = { * - `highTextContrastChanged`: Android-only event. Fires when the state of the high text contrast * toggle changes. The argument to the event handler is a boolean. The boolean is `true` when * high text contrast is enabled and `false` otherwise. - * - * See https://reactnative.dev/docs/accessibilityinfo#addeventlistener */ addEventListener( eventName: K, @@ -443,8 +428,6 @@ const AccessibilityInfo = { /** * Set accessibility focus to a React component. * - * See https://reactnative.dev/docs/accessibilityinfo#setaccessibilityfocus - * * @deprecated Use `sendAccessibilityEvent` with eventType `focus` instead. */ setAccessibilityFocus(reactTag: number): void { @@ -452,7 +435,8 @@ const AccessibilityInfo = { }, /** - * Send a named accessibility event to a HostComponent. + * Trigger an accessibility event on a host instance. The `eventType` can be + * `'focus'`, `'click'`, `'viewHoverEnter'`, or `'windowStateChange'`. */ sendAccessibilityEvent( handle: HostInstance, @@ -468,8 +452,6 @@ const AccessibilityInfo = { /** * Post a string to be announced by the screen reader. - * - * See https://reactnative.dev/docs/accessibilityinfo#announceforaccessibility */ announceForAccessibility(announcement: string): void { if (Platform.OS === 'android') { @@ -480,7 +462,8 @@ const AccessibilityInfo = { }, /** - * Post a string to be announced by the screen reader. + * Post a string to be announced by the screen reader with options. + * * - `announcement`: The string announced by the screen reader. * - `options`: An object that configures the reading options. * - `queue`: The announcement will be queued behind existing announcements. iOS only. @@ -509,9 +492,10 @@ const AccessibilityInfo = { }, /** - * Get the recommended timeout for changes to the UI needed by this user. + * Get the recommended timeout in milliseconds the user needs, as specified + * in the device's Accessibility settings. * - * See https://reactnative.dev/docs/accessibilityinfo#getrecommendedtimeoutmillis + * @platform android */ getRecommendedTimeoutMillis(originalTimeout: number): Promise { if (Platform.OS === 'android') { diff --git a/packages/react-native/Libraries/Components/ActivityIndicator/ActivityIndicator.js b/packages/react-native/Libraries/Components/ActivityIndicator/ActivityIndicator.js index 63bddf2e9504..3200bb8afc56 100644 --- a/packages/react-native/Libraries/Components/ActivityIndicator/ActivityIndicator.js +++ b/packages/react-native/Libraries/Components/ActivityIndicator/ActivityIndicator.js @@ -9,6 +9,7 @@ */ 'use strict'; + import type {HostInstance} from '../../../src/private/types/HostInstance'; import type {ViewProps} from '../View/ViewPropTypes'; @@ -30,39 +31,77 @@ type IndicatorSize = number | 'small' | 'large'; type ActivityIndicatorIOSProps = Readonly<{ /** - Whether the indicator should hide when not animating. - - @platform ios - */ + * Whether the indicator should hide when not animating. + * + * @platform ios + */ hidesWhenStopped?: ?boolean, }>; + /** @build-types emit-as-interface Uniwind compatibility */ export type ActivityIndicatorProps = Readonly<{ ...ViewProps, ...ActivityIndicatorIOSProps, /** - Whether to show the indicator (`true`) or hide it (`false`). + * Whether to show the indicator (`true`) or hide it (`false`). */ animating?: ?boolean, /** - The foreground color of the spinner. - - @default {@platform android} `null` (system accent default color) - @default {@platform ios} '#999999' - */ + * The foreground color of the spinner. + * + * @default {@platform android} `null` (system accent default color) + * @default {@platform ios} '#999999' + */ color?: ?ColorValue, /** - Size of the indicator. - - @type enum(`'small'`, `'large'`) - @type {@platform android} number - */ + * Size of the indicator. + * + * Small has a height of 20, large has a height of 36. + * + * @type enum(`'small'`, `'large'`) + * @type {@platform android} number + */ size?: ?IndicatorSize, }>; +/** + * Displays a circular loading indicator. + * + * Example: + * + * ```tsx + * import React from 'react'; + * import {ActivityIndicator, StyleSheet, View} from 'react-native'; + * + * const App = () => ( + * + * + * + * + * + * + * ); + * + * const styles = StyleSheet.create({ + * container: { + * flex: 1, + * justifyContent: 'center', + * }, + * horizontal: { + * flexDirection: 'row', + * justifyContent: 'space-around', + * padding: 10, + * }, + * }); + * + * export default App; + * ``` + * + * @see https://reactnative.dev/docs/activityindicator + */ const ActivityIndicator: component( ref?: React.RefSetter, ...props: ActivityIndicatorProps @@ -129,38 +168,6 @@ const ActivityIndicator: component( ); }; -/** - Displays a circular loading indicator. - - ```SnackPlayer name=ActivityIndicator%20Example - import React from 'react'; - import {ActivityIndicator, StyleSheet, View} from 'react-native'; - - const App = () => ( - - - - - - - ); - - const styles = StyleSheet.create({ - container: { - flex: 1, - justifyContent: 'center', - }, - horizontal: { - flexDirection: 'row', - justifyContent: 'space-around', - padding: 10, - }, - }); - - export default App; -``` -*/ - ActivityIndicator.displayName = 'ActivityIndicator'; const styles = StyleSheet.create({ diff --git a/packages/react-native/Libraries/Components/ActivityIndicator/ActivityIndicatorViewNativeComponent.js b/packages/react-native/Libraries/Components/ActivityIndicator/ActivityIndicatorViewNativeComponent.js index c38b088737b0..5c8b8c8810bc 100644 --- a/packages/react-native/Libraries/Components/ActivityIndicator/ActivityIndicatorViewNativeComponent.js +++ b/packages/react-native/Libraries/Components/ActivityIndicator/ActivityIndicatorViewNativeComponent.js @@ -8,5 +8,5 @@ * @format */ -export * from '../../../src/private/specs_DEPRECATED/components/ActivityIndicatorViewNativeComponent'; -export {default} from '../../../src/private/specs_DEPRECATED/components/ActivityIndicatorViewNativeComponent'; +export * from '../../../src/private/components/activityindicator/specs/ActivityIndicatorViewNativeComponent'; +export {default} from '../../../src/private/components/activityindicator/specs/ActivityIndicatorViewNativeComponent'; diff --git a/packages/react-native/Libraries/Components/ActivityIndicator/__tests__/ActivityIndicator-itest.js b/packages/react-native/Libraries/Components/ActivityIndicator/__tests__/ActivityIndicator-itest.js index 97c57e1a19f7..51636fc49de2 100644 --- a/packages/react-native/Libraries/Components/ActivityIndicator/__tests__/ActivityIndicator-itest.js +++ b/packages/react-native/Libraries/Components/ActivityIndicator/__tests__/ActivityIndicator-itest.js @@ -6,186 +6,53 @@ * * @flow strict-local * @format + * @oncall react_native */ import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment'; -import ensureInstance from '../../../../src/private/__tests__/utilities/ensureInstance'; import * as Fantom from '@react-native/fantom'; import * as React from 'react'; -import {createRef} from 'react'; import {ActivityIndicator} from 'react-native'; -import ReactNativeElement from 'react-native/src/private/webapis/dom/nodes/ReactNativeElement'; -describe('', () => { - describe('props', () => { - describe('size', () => { - it('defaults to "small" (20x20)', () => { - const root = Fantom.createRoot(); - - Fantom.runTask(() => { - root.render(); - }); - - expect(root.getRenderedOutput().toJSX()).toEqual( - , - ); - }); - - it('renders with size "small"', () => { - const root = Fantom.createRoot(); - - Fantom.runTask(() => { - root.render(); - }); - - expect(root.getRenderedOutput().toJSX()).toEqual( - , - ); - }); - - it('renders with size "large" (36x36)', () => { - const root = Fantom.createRoot(); - - Fantom.runTask(() => { - root.render(); - }); - - expect(root.getRenderedOutput().toJSX()).toEqual( - , - ); - }); - - it('renders with numeric size on Android', () => { - const root = Fantom.createRoot(); - - Fantom.runTask(() => { - root.render(); - }); - - expect(root.getRenderedOutput().toJSX()).toEqual( - , - ); - }); - }); - - describe('color', () => { - it('renders an AndroidProgressBar when color is set', () => { - const root = Fantom.createRoot(); - - Fantom.runTask(() => { - root.render(); - }); - - // Color is a native prop not serialized as a view attribute, - // but the component still renders correctly - expect(root.getRenderedOutput().toJSX()).toEqual( - , - ); - }); - }); - - describe('animating', () => { - it('defaults to true', () => { - const root = Fantom.createRoot(); - - Fantom.runTask(() => { - root.render(); - }); - - // Component renders normally when animating (default) - expect(root.getRenderedOutput().toJSX()).toEqual( - , - ); - }); - - it('renders when animating is false', () => { - const root = Fantom.createRoot(); - - Fantom.runTask(() => { - root.render(); - }); - - // Component still renders when not animating - expect(root.getRenderedOutput().toJSX()).toEqual( - , - ); - }); - }); - - describe('style', () => { - it('applies wrapper View style', () => { - const root = Fantom.createRoot(); - - Fantom.runTask(() => { - root.render(); - }); - - expect(root.getRenderedOutput({props: ['opacity']}).toJSX()).toEqual( - - - , - ); - }); - }); - - describe('accessibilityLabel', () => { - it('is propagated to the native component', () => { - const root = Fantom.createRoot(); - - Fantom.runTask(() => { - root.render( - , - ); - }); - - expect( - root.getRenderedOutput({props: ['accessibilityLabel']}).toJSX(), - ).toEqual( - , - ); - }); - }); - - describe('testID', () => { - it('is propagated to the native component', () => { - const root = Fantom.createRoot(); - - Fantom.runTask(() => { - root.render(); - }); - - expect(root.getRenderedOutput({props: ['testID']}).toJSX()).toEqual( - , - ); - }); - }); +function renderSizeOutput(element: React.MixedElement): React.Node { + const root = Fantom.createRoot(); + Fantom.runTask(() => { + root.render(element); + }); + return root.getRenderedOutput({props: ['width', 'height']}).toJSX(); +} + +describe('ActivityIndicator', () => { + it('renders the default (small) size', () => { + expect(renderSizeOutput()).toEqual( + , + ); }); - describe('ref', () => { - it('provides a valid ReactNativeElement instance', () => { - const elementRef = - createRef>(); - const root = Fantom.createRoot(); - - Fantom.runTask(() => { - root.render(); - }); - - expect(elementRef.current).toBeInstanceOf(ReactNativeElement); - }); - - it('has the correct tag name', () => { - const elementRef = - createRef>(); - const root = Fantom.createRoot(); + it('renders the large size', () => { + expect(renderSizeOutput()).toEqual( + , + ); + }); - Fantom.runTask(() => { - root.render(); - }); + it('renders a numeric size as an explicit width/height', () => { + expect(renderSizeOutput()).toEqual( + , + ); + }); - const element = ensureInstance(elementRef.current, ReactNativeElement); - expect(element.tagName).toBe('RN:AndroidProgressBar'); - }); + it('renders with color, animating and hidesWhenStopped props applied', () => { + // color/animating/hidesWhenStopped are forwarded to the native component; + // the mounted size still reflects the (default, small) size. + expect( + renderSizeOutput( + , + ), + ).toEqual(); }); }); diff --git a/packages/react-native/Libraries/Components/ActivityIndicator/__tests__/ActivityIndicator-test.js b/packages/react-native/Libraries/Components/ActivityIndicator/__tests__/ActivityIndicator-test.js deleted file mode 100644 index 523f6150310b..000000000000 --- a/packages/react-native/Libraries/Components/ActivityIndicator/__tests__/ActivityIndicator-test.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow strict-local - * @format - */ - -'use strict'; - -import * as React from 'react'; - -const ReactNativeTestTools = require('../../../Utilities/ReactNativeTestTools'); -const ActivityIndicator = require('../ActivityIndicator').default; - -describe('', () => { - it('should set displayName to prevent regressions', () => { - expect(ActivityIndicator.displayName).toBe('ActivityIndicator'); - }); - - it('should render as expected', async () => { - await ReactNativeTestTools.expectRendersMatchingSnapshot( - 'ActivityIndicator', - () => , - () => { - jest.dontMock('../ActivityIndicator'); - }, - ); - }); -}); diff --git a/packages/react-native/Libraries/Components/ActivityIndicator/__tests__/__snapshots__/ActivityIndicator-test.js.snap b/packages/react-native/Libraries/Components/ActivityIndicator/__tests__/__snapshots__/ActivityIndicator-test.js.snap deleted file mode 100644 index f0fa9f3980af..000000000000 --- a/packages/react-native/Libraries/Components/ActivityIndicator/__tests__/__snapshots__/ActivityIndicator-test.js.snap +++ /dev/null @@ -1,32 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[` should render as expected: should deep render when mocked (please verify output manually) 1`] = ` - -`; - -exports[` should render as expected: should deep render when not mocked (please verify output manually) 1`] = ` - - - -`; diff --git a/packages/react-native/Libraries/Components/Button.js b/packages/react-native/Libraries/Components/Button.js index 8ed215d6a6cb..c1bec4b65edf 100644 --- a/packages/react-native/Libraries/Components/Button.js +++ b/packages/react-native/Libraries/Components/Button.js @@ -30,132 +30,124 @@ import * as React from 'react'; /** @build-types emit-as-interface Uniwind compatibility */ export type ButtonProps = Readonly<{ /** - Text to display inside the button. On Android the given title will be - converted to the uppercased form. + * Text to display inside the button. On Android the given title will be + * converted to the uppercased form. */ title: string, /** - Handler to be called when the user taps the button. The first function - argument is an event in form of [GestureResponderEvent](pressevent). + * Handler called when the user taps the button. */ onPress?: (event?: GestureResponderEvent) => unknown, /** - If `true`, doesn't play system sound on touch. - - @platform android - - @default false + * If `true`, doesn't play system sound on touch. + * + * @platform android + * + * @default `false` */ touchSoundDisabled?: ?boolean, /** - Color of the text (iOS), or background color of the button (Android). - - @default {@platform android} '#2196F3' - @default {@platform ios} '#007AFF' + * Color of the text (iOS), or background color of the button (Android). + * + * @default {@platform android} `'#2196F3'` + * @default {@platform ios} `'#007AFF'` */ color?: ?ColorValue, /** - TV preferred focus. - - @platform tv - - @default false - @deprecated Use `focusable` instead + * TV preferred focus. + * + * @platform tv + * + * @default `false` + * @deprecated Use `focusable` instead */ hasTVPreferredFocus?: ?boolean, /** - Designates the next view to receive focus when the user navigates down. See - the [Android documentation][android:nextFocusDown]. - - [android:nextFocusDown]: - https://developer.android.com/reference/android/view/View.html#attr_android:nextFocusDown - - @platform android, tv + * Designates the next view to receive focus when the user navigates down. See + * the [Android documentation][android:nextFocusDown]. + * + * [android:nextFocusDown]: + * https://developer.android.com/reference/android/view/View.html#attr_android:nextFocusDown + * + * @platform android, tv */ nextFocusDown?: ?number, /** - Designates the next view to receive focus when the user navigates forward. - See the [Android documentation][android:nextFocusForward]. - - [android:nextFocusForward]: - https://developer.android.com/reference/android/view/View.html#attr_android:nextFocusForward - - @platform android, tv + * Designates the next view to receive focus when the user navigates forward. + * See the [Android documentation][android:nextFocusForward]. + * + * [android:nextFocusForward]: + * https://developer.android.com/reference/android/view/View.html#attr_android:nextFocusForward + * + * @platform android, tv */ nextFocusForward?: ?number, /** - Designates the next view to receive focus when the user navigates left. See - the [Android documentation][android:nextFocusLeft]. - - [android:nextFocusLeft]: - https://developer.android.com/reference/android/view/View.html#attr_android:nextFocusLeft - - @platform android, tv + * Designates the next view to receive focus when the user navigates left. See + * the [Android documentation][android:nextFocusLeft]. + * + * [android:nextFocusLeft]: + * https://developer.android.com/reference/android/view/View.html#attr_android:nextFocusLeft + * + * @platform android, tv */ nextFocusLeft?: ?number, /** - Designates the next view to receive focus when the user navigates right. See - the [Android documentation][android:nextFocusRight]. - - [android:nextFocusRight]: - https://developer.android.com/reference/android/view/View.html#attr_android:nextFocusRight - - @platform android, tv + * Designates the next view to receive focus when the user navigates right. See + * the [Android documentation][android:nextFocusRight]. + * + * [android:nextFocusRight]: + * https://developer.android.com/reference/android/view/View.html#attr_android:nextFocusRight + * + * @platform android, tv */ nextFocusRight?: ?number, /** - Designates the next view to receive focus when the user navigates up. See - the [Android documentation][android:nextFocusUp]. - - [android:nextFocusUp]: - https://developer.android.com/reference/android/view/View.html#attr_android:nextFocusUp - - @platform android, tv + * Designates the next view to receive focus when the user navigates up. See + * the [Android documentation][android:nextFocusUp]. + * + * [android:nextFocusUp]: + * https://developer.android.com/reference/android/view/View.html#attr_android:nextFocusUp + * + * @platform android, tv */ nextFocusUp?: ?number, /** - Text to display for blindness accessibility features. + * Text to display for blindness accessibility features. */ accessibilityLabel?: ?string, + /** - * Alias for accessibilityLabel https://reactnative.dev/docs/view#accessibilitylabel - * https://github.com/facebook/react-native/issues/34424 + * Alias for `accessibilityLabel`. */ 'aria-label'?: ?string, - /** - If `true`, disable all interactions for this component. - @default false + /** + * If `true`, disable all interactions for this component. + * + * @default `false` */ disabled?: ?boolean, - /** - Used to locate this view in end-to-end tests. - */ testID?: ?string, - /** - * Accessibility props. - */ accessible?: ?boolean, accessibilityActions?: ?ReadonlyArray, onAccessibilityAction?: ?(event: AccessibilityActionEvent) => unknown, accessibilityState?: ?AccessibilityState, /** - * alias for accessibilityState - * - * see https://reactnative.dev/docs/accessibility#accessibilitystate + * Alias for `accessibilityState`. */ 'aria-busy'?: ?boolean, 'aria-checked'?: ?boolean | 'mixed', @@ -163,129 +155,44 @@ export type ButtonProps = Readonly<{ 'aria-expanded'?: ?boolean, 'aria-selected'?: ?boolean, - /** - * [Android] Controlling if a view fires accessibility events and if it is reported to accessibility services. - */ importantForAccessibility?: ?('auto' | 'yes' | 'no' | 'no-hide-descendants'), accessibilityHint?: ?string, + + /** + * A BCP 47 language tag for the screen reader to use when reading text + * content. + * + * @platform ios + */ accessibilityLanguage?: ?Stringish, }>; -/** - A basic button component that should render nicely on any platform. Supports a - minimal level of customization. - - If this button doesn't look right for your app, you can build your own button - using [TouchableOpacity](touchableopacity) or - [TouchableWithoutFeedback](touchablewithoutfeedback). For inspiration, look at - the [source code for this button component][button:source]. Or, take a look at - the [wide variety of button components built by the community] - [button:examples]. - - [button:source]: - https://github.com/facebook/react-native/blob/HEAD/Libraries/Components/Button.js - - ```jsx -