-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
45 changed files
with
1,928 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import Collection from './Collection' | ||
|
||
const devtoolsInProductionWarning = ` | ||
[@signaldb/core] !! WARNING !! | ||
You are running @signaldb/devtools in production mode. | ||
This can have a negative impact on performance and may expose sensitive information. | ||
Please move @signaldb/devtools to development dependencies to disable it in production. | ||
` | ||
|
||
async function loadDevtools() { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
return import('@signaldb/devtools') | ||
.then(() => true) | ||
.catch((error) => { | ||
if (error.code === 'MODULE_NOT_FOUND') return false | ||
throw error | ||
}) | ||
} | ||
|
||
/** | ||
* Loads the devtools in production mode and logs a warning if in production. | ||
*/ | ||
export default function loadDevtoolsInProduction() { | ||
const isProduction = process.env.NODE_ENV === 'production' | ||
void loadDevtools().then((devtoolsLoaded) => { | ||
if (!devtoolsLoaded) return | ||
|
||
Collection.enableDebugMode() | ||
|
||
// eslint-disable-next-line no-console | ||
if (isProduction) console.warn(devtoolsInProductionWarning) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.