@aws-amplify/core
Version:
Core category of aws-amplify
1 lines • 1.76 kB
Source Map (JSON)
{"version":3,"file":"React.mjs","sources":["../../../../src/Platform/detection/React.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { documentExists, processExists } from './helpers';\n// Tested with react 18.2 - built using Vite\nexport function reactWebDetect() {\n const elementKeyPrefixedWithReact = (key) => {\n return key.startsWith('_react') || key.startsWith('__react');\n };\n const elementIsReactEnabled = (element) => {\n return Object.keys(element).find(elementKeyPrefixedWithReact);\n };\n const allElementsWithId = () => Array.from(document.querySelectorAll('[id]'));\n return documentExists() && allElementsWithId().some(elementIsReactEnabled);\n}\nexport function reactSSRDetect() {\n return (processExists() &&\n typeof process.env !== 'undefined' &&\n !!Object.keys(process.env).find(key => key.includes('react')));\n}\n// use the some\n"],"names":[],"mappings":";;AAAA;AACA;AAEA;AACO,SAAS,cAAc,GAAG;AACjC,IAAI,MAAM,2BAA2B,GAAG,CAAC,GAAG,KAAK;AACjD,QAAQ,OAAO,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AACrE,KAAK,CAAC;AACN,IAAI,MAAM,qBAAqB,GAAG,CAAC,OAAO,KAAK;AAC/C,QAAQ,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;AACtE,KAAK,CAAC;AACN,IAAI,MAAM,iBAAiB,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;AAClF,IAAI,OAAO,cAAc,EAAE,IAAI,iBAAiB,EAAE,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;AAC/E,CAAC;AACM,SAAS,cAAc,GAAG;AACjC,IAAI,QAAQ,aAAa,EAAE;AAC3B,QAAQ,OAAO,OAAO,CAAC,GAAG,KAAK,WAAW;AAC1C,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,EAAE;AACvE,CAAC;AACD;;;;"}