rajt 0.0.102 → 0.0.103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/register.ts +4 -1
- package/src/utils/environment.ts +1 -1
- package/src/utils/resolve.ts +2 -0
package/package.json
CHANGED
package/src/register.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { isProd } from './utils/environment'
|
|
2
|
+
const isPrd = isProd()
|
|
3
|
+
|
|
1
4
|
export const handlers: Record<string, Function> = {}
|
|
2
5
|
|
|
3
6
|
export function registerHandler(id: string, handler: any) {
|
|
@@ -6,7 +9,7 @@ export function registerHandler(id: string, handler: any) {
|
|
|
6
9
|
|
|
7
10
|
export function getHandler(id: string): Function {
|
|
8
11
|
const handler = handlers[id] || null
|
|
9
|
-
if (!handler) throw new Error(`Handler ${id} not registered`)
|
|
12
|
+
if (isPrd && !handler) throw new Error(`Handler ${id} not registered`)
|
|
10
13
|
return handler
|
|
11
14
|
}
|
|
12
15
|
|
package/src/utils/environment.ts
CHANGED
|
@@ -11,7 +11,7 @@ export function detectEnvironment(): symbol {
|
|
|
11
11
|
try {
|
|
12
12
|
if (
|
|
13
13
|
process.env?.npm_lifecycle_event === 'dev'
|
|
14
|
-
|| process.env?.npm_lifecycle_script
|
|
14
|
+
|| process.env?.npm_lifecycle_script?.startsWith('rajt')
|
|
15
15
|
|| process.env?.AWS_SAM_LOCAL
|
|
16
16
|
// || process?.argv?.includes('--dev')
|
|
17
17
|
|| process?.argv?.some(arg => ['-port', '-platform', '--dev', '--development', '--watch'].includes(arg))
|