@bugfender/rn-bugfender 2.0.0 → 2.1.1
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/README.md +16 -1
- package/RnBugfender.podspec +15 -0
- package/android/.gradle/7.4.2/checksums/checksums.lock +0 -0
- package/android/.gradle/7.4.2/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/{7.1 → 7.4.2}/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/{7.1 → 7.4.2}/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.4.2/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/{7.1 → 7.4.2}/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -2
- package/android/build.gradle +117 -40
- package/android/gradle.properties +5 -0
- package/android/src/main/java/com/{bugfender/react → bugfender.react}/RnBugfenderModule.java +2 -2
- package/android/src/main/java/com/{bugfender/react → bugfender.react}/RnBugfenderPackage.java +0 -0
- package/ios/{RnBugfender.m → RnBugfender.mm} +16 -4
- package/ios/RnBugfender.xcodeproj/project.pbxproj +4 -17
- package/lib/commonjs/bugfender.js +31 -35
- package/lib/commonjs/bugfender.js.map +1 -1
- package/lib/commonjs/index.js +2 -2
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.web.js +2 -2
- package/lib/commonjs/index.web.js.map +1 -1
- package/lib/commonjs/override-console-methods.js +9 -9
- package/lib/commonjs/override-console-methods.js.map +1 -1
- package/lib/commonjs/sdk-options.js +6 -34
- package/lib/commonjs/sdk-options.js.map +1 -1
- package/lib/commonjs/types/sdk-options.js +5 -4
- package/lib/commonjs/types/sdk-options.js.map +1 -1
- package/lib/commonjs/user-feedback.js.map +1 -1
- package/lib/module/bugfender.js +30 -31
- package/lib/module/bugfender.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js +1 -1
- package/lib/module/index.web.js.map +1 -1
- package/lib/module/override-console-methods.js +9 -9
- package/lib/module/override-console-methods.js.map +1 -1
- package/lib/module/sdk-options.js +6 -34
- package/lib/module/sdk-options.js.map +1 -1
- package/lib/module/types/sdk-options.js +5 -4
- package/lib/module/types/sdk-options.js.map +1 -1
- package/lib/module/user-feedback.js.map +1 -1
- package/lib/typescript/bugfender.d.ts +5 -6
- package/lib/typescript/index.d.ts +1 -1
- package/lib/typescript/index.web.d.ts +1 -1
- package/lib/typescript/override-console-methods.d.ts +1 -2
- package/lib/typescript/sdk-options.d.ts +2 -12
- package/lib/typescript/types/sdk-options.d.ts +2 -0
- package/lib/typescript/user-feedback.d.ts +2 -15
- package/package.json +26 -22
- package/src/bugfender.ts +37 -34
- package/src/index.tsx +1 -1
- package/src/index.web.tsx +1 -1
- package/src/override-console-methods.ts +8 -9
- package/src/sdk-options.ts +7 -35
- package/src/types/sdk-options.ts +5 -2
- package/src/user-feedback.ts +3 -16
- package/android/.gradle/7.1/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/7.1/executionHistory/executionHistory.bin +0 -0
- package/android/.gradle/7.1/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/7.1/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/7.1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/checksums/sha1-checksums.bin +0 -0
- package/android/.idea/compiler.xml +0 -6
- package/android/.idea/gradle.xml +0 -18
- package/android/.idea/jarRepositories.xml +0 -40
- package/android/.idea/misc.xml +0 -8
- package/android/.idea/runConfigurations.xml +0 -10
- package/android/.idea/uiDesigner.xml +0 -124
- package/android/.idea/vcs.xml +0 -6
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +0 -5
- package/android/gradlew +0 -185
- package/android/gradlew.bat +0 -89
- package/ios/RnBugfender.xcodeproj/project.xcworkspace/xcuserdata/fj.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/RnBugfender.xcodeproj/xcuserdata/fj.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
- package/lib/commonjs/print-to-console.js +0 -78
- package/lib/commonjs/print-to-console.js.map +0 -1
- package/lib/commonjs/string-formatter.js +0 -55
- package/lib/commonjs/string-formatter.js.map +0 -1
- package/lib/commonjs/types/device.js +0 -2
- package/lib/commonjs/types/device.js.map +0 -1
- package/lib/commonjs/types/log.js +0 -35
- package/lib/commonjs/types/log.js.map +0 -1
- package/lib/commonjs/utilities.js +0 -18
- package/lib/commonjs/utilities.js.map +0 -1
- package/lib/module/print-to-console.js +0 -67
- package/lib/module/print-to-console.js.map +0 -1
- package/lib/module/string-formatter.js +0 -45
- package/lib/module/string-formatter.js.map +0 -1
- package/lib/module/types/device.js +0 -2
- package/lib/module/types/device.js.map +0 -1
- package/lib/module/types/log.js +0 -24
- package/lib/module/types/log.js.map +0 -1
- package/lib/module/utilities.js +0 -11
- package/lib/module/utilities.js.map +0 -1
- package/lib/typescript/print-to-console.d.ts +0 -14
- package/lib/typescript/string-formatter.d.ts +0 -4
- package/lib/typescript/types/device.d.ts +0 -4
- package/lib/typescript/types/log.d.ts +0 -59
- package/lib/typescript/utilities.d.ts +0 -1
- package/src/print-to-console.ts +0 -67
- package/src/string-formatter.ts +0 -44
- package/src/types/device.ts +0 -4
- package/src/types/log.ts +0 -75
- package/src/utilities.ts +0 -8
package/android/gradlew
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env sh
|
|
2
|
-
|
|
3
|
-
#
|
|
4
|
-
# Copyright 2015 the original author or authors.
|
|
5
|
-
#
|
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
# you may not use this file except in compliance with the License.
|
|
8
|
-
# You may obtain a copy of the License at
|
|
9
|
-
#
|
|
10
|
-
# https://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
#
|
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
# See the License for the specific language governing permissions and
|
|
16
|
-
# limitations under the License.
|
|
17
|
-
#
|
|
18
|
-
|
|
19
|
-
##############################################################################
|
|
20
|
-
##
|
|
21
|
-
## Gradle start up script for UN*X
|
|
22
|
-
##
|
|
23
|
-
##############################################################################
|
|
24
|
-
|
|
25
|
-
# Attempt to set APP_HOME
|
|
26
|
-
# Resolve links: $0 may be a link
|
|
27
|
-
PRG="$0"
|
|
28
|
-
# Need this for relative symlinks.
|
|
29
|
-
while [ -h "$PRG" ] ; do
|
|
30
|
-
ls=`ls -ld "$PRG"`
|
|
31
|
-
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
32
|
-
if expr "$link" : '/.*' > /dev/null; then
|
|
33
|
-
PRG="$link"
|
|
34
|
-
else
|
|
35
|
-
PRG=`dirname "$PRG"`"/$link"
|
|
36
|
-
fi
|
|
37
|
-
done
|
|
38
|
-
SAVED="`pwd`"
|
|
39
|
-
cd "`dirname \"$PRG\"`/" >/dev/null
|
|
40
|
-
APP_HOME="`pwd -P`"
|
|
41
|
-
cd "$SAVED" >/dev/null
|
|
42
|
-
|
|
43
|
-
APP_NAME="Gradle"
|
|
44
|
-
APP_BASE_NAME=`basename "$0"`
|
|
45
|
-
|
|
46
|
-
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
47
|
-
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
|
48
|
-
|
|
49
|
-
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
|
50
|
-
MAX_FD="maximum"
|
|
51
|
-
|
|
52
|
-
warn () {
|
|
53
|
-
echo "$*"
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
die () {
|
|
57
|
-
echo
|
|
58
|
-
echo "$*"
|
|
59
|
-
echo
|
|
60
|
-
exit 1
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
# OS specific support (must be 'true' or 'false').
|
|
64
|
-
cygwin=false
|
|
65
|
-
msys=false
|
|
66
|
-
darwin=false
|
|
67
|
-
nonstop=false
|
|
68
|
-
case "`uname`" in
|
|
69
|
-
CYGWIN* )
|
|
70
|
-
cygwin=true
|
|
71
|
-
;;
|
|
72
|
-
Darwin* )
|
|
73
|
-
darwin=true
|
|
74
|
-
;;
|
|
75
|
-
MSYS* | MINGW* )
|
|
76
|
-
msys=true
|
|
77
|
-
;;
|
|
78
|
-
NONSTOP* )
|
|
79
|
-
nonstop=true
|
|
80
|
-
;;
|
|
81
|
-
esac
|
|
82
|
-
|
|
83
|
-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
# Determine the Java command to use to start the JVM.
|
|
87
|
-
if [ -n "$JAVA_HOME" ] ; then
|
|
88
|
-
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
|
89
|
-
# IBM's JDK on AIX uses strange locations for the executables
|
|
90
|
-
JAVACMD="$JAVA_HOME/jre/sh/java"
|
|
91
|
-
else
|
|
92
|
-
JAVACMD="$JAVA_HOME/bin/java"
|
|
93
|
-
fi
|
|
94
|
-
if [ ! -x "$JAVACMD" ] ; then
|
|
95
|
-
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
|
96
|
-
|
|
97
|
-
Please set the JAVA_HOME variable in your environment to match the
|
|
98
|
-
location of your Java installation."
|
|
99
|
-
fi
|
|
100
|
-
else
|
|
101
|
-
JAVACMD="java"
|
|
102
|
-
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
103
|
-
|
|
104
|
-
Please set the JAVA_HOME variable in your environment to match the
|
|
105
|
-
location of your Java installation."
|
|
106
|
-
fi
|
|
107
|
-
|
|
108
|
-
# Increase the maximum file descriptors if we can.
|
|
109
|
-
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
|
110
|
-
MAX_FD_LIMIT=`ulimit -H -n`
|
|
111
|
-
if [ $? -eq 0 ] ; then
|
|
112
|
-
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
|
113
|
-
MAX_FD="$MAX_FD_LIMIT"
|
|
114
|
-
fi
|
|
115
|
-
ulimit -n $MAX_FD
|
|
116
|
-
if [ $? -ne 0 ] ; then
|
|
117
|
-
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
|
118
|
-
fi
|
|
119
|
-
else
|
|
120
|
-
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
|
121
|
-
fi
|
|
122
|
-
fi
|
|
123
|
-
|
|
124
|
-
# For Darwin, add options to specify how the application appears in the dock
|
|
125
|
-
if $darwin; then
|
|
126
|
-
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
|
127
|
-
fi
|
|
128
|
-
|
|
129
|
-
# For Cygwin or MSYS, switch paths to Windows format before running java
|
|
130
|
-
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
|
131
|
-
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
|
132
|
-
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
|
133
|
-
|
|
134
|
-
JAVACMD=`cygpath --unix "$JAVACMD"`
|
|
135
|
-
|
|
136
|
-
# We build the pattern for arguments to be converted via cygpath
|
|
137
|
-
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
|
138
|
-
SEP=""
|
|
139
|
-
for dir in $ROOTDIRSRAW ; do
|
|
140
|
-
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
|
141
|
-
SEP="|"
|
|
142
|
-
done
|
|
143
|
-
OURCYGPATTERN="(^($ROOTDIRS))"
|
|
144
|
-
# Add a user-defined pattern to the cygpath arguments
|
|
145
|
-
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
|
146
|
-
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
|
147
|
-
fi
|
|
148
|
-
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
|
149
|
-
i=0
|
|
150
|
-
for arg in "$@" ; do
|
|
151
|
-
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
|
152
|
-
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
|
153
|
-
|
|
154
|
-
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
|
155
|
-
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
|
156
|
-
else
|
|
157
|
-
eval `echo args$i`="\"$arg\""
|
|
158
|
-
fi
|
|
159
|
-
i=`expr $i + 1`
|
|
160
|
-
done
|
|
161
|
-
case $i in
|
|
162
|
-
0) set -- ;;
|
|
163
|
-
1) set -- "$args0" ;;
|
|
164
|
-
2) set -- "$args0" "$args1" ;;
|
|
165
|
-
3) set -- "$args0" "$args1" "$args2" ;;
|
|
166
|
-
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
|
167
|
-
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
|
168
|
-
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
|
169
|
-
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
|
170
|
-
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
|
171
|
-
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
|
172
|
-
esac
|
|
173
|
-
fi
|
|
174
|
-
|
|
175
|
-
# Escape application args
|
|
176
|
-
save () {
|
|
177
|
-
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
|
178
|
-
echo " "
|
|
179
|
-
}
|
|
180
|
-
APP_ARGS=`save "$@"`
|
|
181
|
-
|
|
182
|
-
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
|
183
|
-
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
|
184
|
-
|
|
185
|
-
exec "$JAVACMD" "$@"
|
package/android/gradlew.bat
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
@rem
|
|
2
|
-
@rem Copyright 2015 the original author or authors.
|
|
3
|
-
@rem
|
|
4
|
-
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
@rem you may not use this file except in compliance with the License.
|
|
6
|
-
@rem You may obtain a copy of the License at
|
|
7
|
-
@rem
|
|
8
|
-
@rem https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
@rem
|
|
10
|
-
@rem Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
@rem See the License for the specific language governing permissions and
|
|
14
|
-
@rem limitations under the License.
|
|
15
|
-
@rem
|
|
16
|
-
|
|
17
|
-
@if "%DEBUG%" == "" @echo off
|
|
18
|
-
@rem ##########################################################################
|
|
19
|
-
@rem
|
|
20
|
-
@rem Gradle startup script for Windows
|
|
21
|
-
@rem
|
|
22
|
-
@rem ##########################################################################
|
|
23
|
-
|
|
24
|
-
@rem Set local scope for the variables with windows NT shell
|
|
25
|
-
if "%OS%"=="Windows_NT" setlocal
|
|
26
|
-
|
|
27
|
-
set DIRNAME=%~dp0
|
|
28
|
-
if "%DIRNAME%" == "" set DIRNAME=.
|
|
29
|
-
set APP_BASE_NAME=%~n0
|
|
30
|
-
set APP_HOME=%DIRNAME%
|
|
31
|
-
|
|
32
|
-
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
|
33
|
-
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
|
34
|
-
|
|
35
|
-
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
36
|
-
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
|
37
|
-
|
|
38
|
-
@rem Find java.exe
|
|
39
|
-
if defined JAVA_HOME goto findJavaFromJavaHome
|
|
40
|
-
|
|
41
|
-
set JAVA_EXE=java.exe
|
|
42
|
-
%JAVA_EXE% -version >NUL 2>&1
|
|
43
|
-
if "%ERRORLEVEL%" == "0" goto execute
|
|
44
|
-
|
|
45
|
-
echo.
|
|
46
|
-
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
47
|
-
echo.
|
|
48
|
-
echo Please set the JAVA_HOME variable in your environment to match the
|
|
49
|
-
echo location of your Java installation.
|
|
50
|
-
|
|
51
|
-
goto fail
|
|
52
|
-
|
|
53
|
-
:findJavaFromJavaHome
|
|
54
|
-
set JAVA_HOME=%JAVA_HOME:"=%
|
|
55
|
-
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
|
56
|
-
|
|
57
|
-
if exist "%JAVA_EXE%" goto execute
|
|
58
|
-
|
|
59
|
-
echo.
|
|
60
|
-
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
|
61
|
-
echo.
|
|
62
|
-
echo Please set the JAVA_HOME variable in your environment to match the
|
|
63
|
-
echo location of your Java installation.
|
|
64
|
-
|
|
65
|
-
goto fail
|
|
66
|
-
|
|
67
|
-
:execute
|
|
68
|
-
@rem Setup the command line
|
|
69
|
-
|
|
70
|
-
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
@rem Execute Gradle
|
|
74
|
-
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
|
75
|
-
|
|
76
|
-
:end
|
|
77
|
-
@rem End local scope for the variables with windows NT shell
|
|
78
|
-
if "%ERRORLEVEL%"=="0" goto mainEnd
|
|
79
|
-
|
|
80
|
-
:fail
|
|
81
|
-
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
|
82
|
-
rem the _cmd.exe /c_ return code!
|
|
83
|
-
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
|
84
|
-
exit /b 1
|
|
85
|
-
|
|
86
|
-
:mainEnd
|
|
87
|
-
if "%OS%"=="Windows_NT" endlocal
|
|
88
|
-
|
|
89
|
-
:omega
|
|
Binary file
|
package/ios/RnBugfender.xcodeproj/xcuserdata/fj.xcuserdatad/xcschemes/xcschememanagement.plist
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
-
<plist version="1.0">
|
|
4
|
-
<dict>
|
|
5
|
-
<key>SchemeUserState</key>
|
|
6
|
-
<dict>
|
|
7
|
-
<key>RnBugfender.xcscheme_^#shared#^_</key>
|
|
8
|
-
<dict>
|
|
9
|
-
<key>orderHint</key>
|
|
10
|
-
<integer>0</integer>
|
|
11
|
-
</dict>
|
|
12
|
-
</dict>
|
|
13
|
-
</dict>
|
|
14
|
-
</plist>
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.PrintToConsole = void 0;
|
|
7
|
-
|
|
8
|
-
var _util = require("util");
|
|
9
|
-
|
|
10
|
-
var _log = require("./types/log");
|
|
11
|
-
|
|
12
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
|
-
|
|
14
|
-
class PrintToConsole {
|
|
15
|
-
constructor(console) {
|
|
16
|
-
this.console = console;
|
|
17
|
-
|
|
18
|
-
_defineProperty(this, "printToConsole", false);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
init(printToConsole) {
|
|
22
|
-
this.printToConsole = printToConsole;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
error() {
|
|
26
|
-
if (this.printToConsole) {
|
|
27
|
-
this.console.error(...arguments);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
info() {
|
|
32
|
-
if (this.printToConsole) {
|
|
33
|
-
this.console.info(...arguments);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
log() {
|
|
38
|
-
if (this.printToConsole) {
|
|
39
|
-
this.console.log(...arguments);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
debug() {
|
|
44
|
-
if (this.printToConsole) {
|
|
45
|
-
this.console.debug(...arguments);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
trace() {
|
|
50
|
-
if (this.printToConsole) {
|
|
51
|
-
this.console.trace(...arguments);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
warn() {
|
|
56
|
-
if (this.printToConsole) {
|
|
57
|
-
this.console.warn(...arguments);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
printLog(log) {
|
|
62
|
-
if (this.printToConsole) {
|
|
63
|
-
// Log to browser console
|
|
64
|
-
// debug, warning, error, trace, info, fatal
|
|
65
|
-
const levelToMethod = ['log', 'warn', 'error', 'trace', 'info', 'error'];
|
|
66
|
-
const method = levelToMethod[log.level || _log.LogLevel.Debug];
|
|
67
|
-
const tag = log.tag ? `[${log.tag}] ` : '';
|
|
68
|
-
const location = [log.file || '', log.method || '', log.line || ''].filter(p => p !== '').join(':');
|
|
69
|
-
const message = `${tag}${(0, _util.format)(log.text)} ${location}`; // @ts-ignore
|
|
70
|
-
|
|
71
|
-
this.console[method](message);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
exports.PrintToConsole = PrintToConsole;
|
|
78
|
-
//# sourceMappingURL=print-to-console.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["print-to-console.ts"],"names":["PrintToConsole","constructor","console","init","printToConsole","error","info","log","debug","trace","warn","printLog","levelToMethod","method","level","LogLevel","Debug","tag","location","file","line","filter","p","join","message","text"],"mappings":";;;;;;;AAAA;;AAEA;;;;AAEO,MAAMA,cAAN,CAAqB;AAG1BC,EAAAA,WAAW,CACUC,OADV,EAET;AAAA,SADmBA,OACnB,GADmBA,OACnB;;AAAA,4CAJkC,KAIlC;AACD;;AAEMC,EAAAA,IAAI,CAACC,cAAD,EAAgC;AACzC,SAAKA,cAAL,GAAsBA,cAAtB;AACD;;AAEMC,EAAAA,KAAK,GAAiC;AAC3C,QAAI,KAAKD,cAAT,EAAyB;AACvB,WAAKF,OAAL,CAAaG,KAAb,CAAmB,YAAnB;AACD;AACF;;AAEMC,EAAAA,IAAI,GAAiC;AAC1C,QAAI,KAAKF,cAAT,EAAyB;AACvB,WAAKF,OAAL,CAAaI,IAAb,CAAkB,YAAlB;AACD;AACF;;AAEMC,EAAAA,GAAG,GAAiC;AACzC,QAAI,KAAKH,cAAT,EAAyB;AACvB,WAAKF,OAAL,CAAaK,GAAb,CAAiB,YAAjB;AACD;AACF;;AAEMC,EAAAA,KAAK,GAAiC;AAC3C,QAAI,KAAKJ,cAAT,EAAyB;AACvB,WAAKF,OAAL,CAAaM,KAAb,CAAmB,YAAnB;AACD;AACF;;AAEMC,EAAAA,KAAK,GAAiC;AAC3C,QAAI,KAAKL,cAAT,EAAyB;AACvB,WAAKF,OAAL,CAAaO,KAAb,CAAmB,YAAnB;AACD;AACF;;AAEMC,EAAAA,IAAI,GAAiC;AAC1C,QAAI,KAAKN,cAAT,EAAyB;AACvB,WAAKF,OAAL,CAAaQ,IAAb,CAAkB,YAAlB;AACD;AACF;;AAEMC,EAAAA,QAAQ,CAACJ,GAAD,EAAuB;AACpC,QAAI,KAAKH,cAAT,EAAyB;AACvB;AACA;AACA,YAAMQ,aAAa,GAAG,CAAC,KAAD,EAAQ,MAAR,EAAgB,OAAhB,EAAyB,OAAzB,EAAkC,MAAlC,EAA0C,OAA1C,CAAtB;AACA,YAAMC,MAAM,GAAGD,aAAa,CAACL,GAAG,CAACO,KAAJ,IAAaC,cAASC,KAAvB,CAA5B;AACA,YAAMC,GAAG,GAAGV,GAAG,CAACU,GAAJ,GAAW,IAAGV,GAAG,CAACU,GAAI,IAAtB,GAA4B,EAAxC;AACA,YAAMC,QAAQ,GAAG,CAACX,GAAG,CAACY,IAAJ,IAAY,EAAb,EAAiBZ,GAAG,CAACM,MAAJ,IAAc,EAA/B,EAAmCN,GAAG,CAACa,IAAJ,IAAY,EAA/C,EAAmDC,MAAnD,CAA0DC,CAAC,IAAIA,CAAC,KAAK,EAArE,EAAyEC,IAAzE,CAA8E,GAA9E,CAAjB;AACA,YAAMC,OAAO,GAAI,GAAEP,GAAI,GAAE,kBAAOV,GAAG,CAACkB,IAAX,CAAiB,IAAGP,QAAS,EAAtD,CAPuB,CASvB;;AACA,WAAKhB,OAAL,CAAaW,MAAb,EAAqBW,OAArB;AACD;AACF;;AA7DyB","sourcesContent":["import {format} from 'util';\nimport type {ILogEntry} from \"./types/log\";\nimport {LogLevel} from \"./types/log\";\n\nexport class PrintToConsole {\n protected printToConsole: boolean = false;\n\n constructor(\n protected readonly console: Console,\n ) {\n }\n\n public init(printToConsole: boolean): void {\n this.printToConsole = printToConsole;\n }\n\n public error(...parameters: unknown[]): void {\n if (this.printToConsole) {\n this.console.error(...parameters);\n }\n }\n\n public info(...parameters: unknown[]): void {\n if (this.printToConsole) {\n this.console.info(...parameters);\n }\n }\n\n public log(...parameters: unknown[]): void {\n if (this.printToConsole) {\n this.console.log(...parameters);\n }\n }\n\n public debug(...parameters: unknown[]): void {\n if (this.printToConsole) {\n this.console.debug(...parameters);\n }\n }\n\n public trace(...parameters: unknown[]): void {\n if (this.printToConsole) {\n this.console.trace(...parameters);\n }\n }\n\n public warn(...parameters: unknown[]): void {\n if (this.printToConsole) {\n this.console.warn(...parameters);\n }\n }\n\n public printLog(log: ILogEntry): void {\n if (this.printToConsole) {\n // Log to browser console\n // debug, warning, error, trace, info, fatal\n const levelToMethod = ['log', 'warn', 'error', 'trace', 'info', 'error'];\n const method = levelToMethod[log.level || LogLevel.Debug];\n const tag = log.tag ? `[${log.tag}] ` : '';\n const location = [log.file || '', log.method || '', log.line || ''].filter(p => p !== '').join(':');\n const message = `${tag}${format(log.text)} ${location}`;\n\n // @ts-ignore\n this.console[method](message);\n }\n }\n}\n"]}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.StringFormatter = void 0;
|
|
7
|
-
|
|
8
|
-
var _util = require("util");
|
|
9
|
-
|
|
10
|
-
class StringFormatter {
|
|
11
|
-
format(parameters) {
|
|
12
|
-
const [, ...textParams] = parameters;
|
|
13
|
-
let [textFormat] = parameters;
|
|
14
|
-
let text;
|
|
15
|
-
|
|
16
|
-
try {
|
|
17
|
-
// Our sanitizer gives better results, try with it first
|
|
18
|
-
textFormat = this.toString(textFormat);
|
|
19
|
-
} catch {
|
|
20
|
-
// Fallback to `format`
|
|
21
|
-
textFormat = (0, _util.format)(textFormat);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
if (textParams.length > 0) {
|
|
25
|
-
text = (0, _util.format)(textFormat, ...textParams);
|
|
26
|
-
} else {
|
|
27
|
-
text = textFormat;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return text;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
toString(value) {
|
|
34
|
-
// Depending on the type we prefer to do `String` or `stringify`
|
|
35
|
-
const isToString = ['string', 'symbol', 'bigint', 'function'].includes(typeof value) || value instanceof Error;
|
|
36
|
-
|
|
37
|
-
if (isToString) {
|
|
38
|
-
try {
|
|
39
|
-
return String(value);
|
|
40
|
-
} catch {
|
|
41
|
-
return JSON.stringify(value);
|
|
42
|
-
}
|
|
43
|
-
} else {
|
|
44
|
-
try {
|
|
45
|
-
return JSON.stringify(value);
|
|
46
|
-
} catch {
|
|
47
|
-
return String(value);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
exports.StringFormatter = StringFormatter;
|
|
55
|
-
//# sourceMappingURL=string-formatter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["string-formatter.ts"],"names":["StringFormatter","format","parameters","textParams","textFormat","text","toString","length","value","isToString","includes","Error","String","JSON","stringify"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,eAAN,CAAsB;AACpBC,EAAAA,MAAM,CAACC,UAAD,EAAgC;AAC3C,UAAM,GAAG,GAAGC,UAAN,IAAoBD,UAA1B;AACA,QAAI,CAACE,UAAD,IAAeF,UAAnB;AACA,QAAIG,IAAJ;;AAEA,QAAI;AACF;AACAD,MAAAA,UAAU,GAAG,KAAKE,QAAL,CAAcF,UAAd,CAAb;AACD,KAHD,CAGE,MAAM;AACN;AACAA,MAAAA,UAAU,GAAG,kBAAOA,UAAP,CAAb;AACD;;AAED,QAAID,UAAU,CAACI,MAAX,GAAoB,CAAxB,EAA2B;AACzBF,MAAAA,IAAI,GAAG,kBAAOD,UAAP,EAAmB,GAAGD,UAAtB,CAAP;AACD,KAFD,MAEO;AACLE,MAAAA,IAAI,GAAGD,UAAP;AACD;;AAED,WAAOC,IAAP;AACD;;AAEOC,EAAAA,QAAQ,CAACE,KAAD,EAAyB;AACvC;AACA,UAAMC,UAAU,GAAG,CAAC,QAAD,EAAW,QAAX,EAAqB,QAArB,EAA+B,UAA/B,EAA2CC,QAA3C,CAAoD,OAAOF,KAA3D,KAAqEA,KAAK,YAAYG,KAAzG;;AAEA,QAAIF,UAAJ,EAAgB;AACd,UAAI;AACF,eAAOG,MAAM,CAACJ,KAAD,CAAb;AACD,OAFD,CAEE,MAAM;AACN,eAAOK,IAAI,CAACC,SAAL,CAAeN,KAAf,CAAP;AACD;AACF,KAND,MAMO;AACL,UAAI;AACF,eAAOK,IAAI,CAACC,SAAL,CAAeN,KAAf,CAAP;AACD,OAFD,CAEE,MAAM;AACN,eAAOI,MAAM,CAACJ,KAAD,CAAb;AACD;AACF;AACF;;AAxC0B","sourcesContent":["import {format} from \"util\";\n\nexport class StringFormatter {\n public format(parameters: unknown[]): string {\n const [, ...textParams] = parameters;\n let [textFormat] = parameters as string[];\n let text: string;\n\n try {\n // Our sanitizer gives better results, try with it first\n textFormat = this.toString(textFormat);\n } catch {\n // Fallback to `format`\n textFormat = format(textFormat);\n }\n\n if (textParams.length > 0) {\n text = format(textFormat, ...textParams);\n } else {\n text = textFormat;\n }\n\n return text;\n }\n\n private toString(value: unknown): string {\n // Depending on the type we prefer to do `String` or `stringify`\n const isToString = ['string', 'symbol', 'bigint', 'function'].includes(typeof value) || value instanceof Error;\n\n if (isToString) {\n try {\n return String(value);\n } catch {\n return JSON.stringify(value);\n }\n } else {\n try {\n return JSON.stringify(value);\n } catch {\n return String(value);\n }\n }\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.LogLevel = exports.LOG_LEVELS = void 0;
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Log Levels
|
|
10
|
-
*
|
|
11
|
-
* Check the main README to see how to access the `LogLevel` enum.
|
|
12
|
-
*/
|
|
13
|
-
let LogLevel;
|
|
14
|
-
/**
|
|
15
|
-
* @hidden
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
exports.LogLevel = LogLevel;
|
|
19
|
-
|
|
20
|
-
(function (LogLevel) {
|
|
21
|
-
LogLevel[LogLevel["Debug"] = 0] = "Debug";
|
|
22
|
-
LogLevel[LogLevel["Warning"] = 1] = "Warning";
|
|
23
|
-
LogLevel[LogLevel["Error"] = 2] = "Error";
|
|
24
|
-
LogLevel[LogLevel["Trace"] = 3] = "Trace";
|
|
25
|
-
LogLevel[LogLevel["Info"] = 4] = "Info";
|
|
26
|
-
LogLevel[LogLevel["Fatal"] = 5] = "Fatal";
|
|
27
|
-
})(LogLevel || (exports.LogLevel = LogLevel = {}));
|
|
28
|
-
|
|
29
|
-
const LOG_LEVELS = [LogLevel.Debug, LogLevel.Warning, LogLevel.Error, LogLevel.Trace, LogLevel.Info, LogLevel.Fatal];
|
|
30
|
-
/**
|
|
31
|
-
* @hidden
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
exports.LOG_LEVELS = LOG_LEVELS;
|
|
35
|
-
//# sourceMappingURL=log.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["log.ts"],"names":["LogLevel","LOG_LEVELS","Debug","Warning","Error","Trace","Info","Fatal"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;IACYA,Q;AASZ;AACA;AACA;;;;WAXYA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;AAAAA,EAAAA,Q,CAAAA,Q;GAAAA,Q,wBAAAA,Q;;AAYL,MAAMC,UAAsB,GAAG,CACpCD,QAAQ,CAACE,KAD2B,EAEpCF,QAAQ,CAACG,OAF2B,EAGpCH,QAAQ,CAACI,KAH2B,EAIpCJ,QAAQ,CAACK,KAJ2B,EAKpCL,QAAQ,CAACM,IAL2B,EAMpCN,QAAQ,CAACO,KAN2B,CAA/B;AASP;AACA;AACA","sourcesContent":["/**\n * Log Levels\n *\n * Check the main README to see how to access the `LogLevel` enum.\n */\nexport enum LogLevel {\n Debug = 0,\n Warning = 1,\n Error = 2,\n Trace = 3,\n Info = 4,\n Fatal = 5,\n}\n\n/**\n * @hidden\n */\nexport const LOG_LEVELS: LogLevel[] = [\n LogLevel.Debug,\n LogLevel.Warning,\n LogLevel.Error,\n LogLevel.Trace,\n LogLevel.Info,\n LogLevel.Fatal,\n];\n\n/**\n * @hidden\n */\nexport interface ILogEntryShort {\n /** Date ISO */\n x: string;\n /** Text */\n t: string;\n /** Method */\n m: string;\n /** Absolute Time */\n at: number;\n /** Tag */\n tg: string;\n /** File */\n f: string;\n /** Line */\n l: number;\n /** Level */\n ll: number;\n /** URL */\n u: string;\n}\n\n/**\n * Log Entry object interface\n */\nexport interface ILogEntry {\n /** The line number where the log was triggered from */\n line?: number;\n\n /** The log's level based on LogLevel constant */\n level?: LogLevel;\n\n /** The log's tag */\n tag?: string;\n\n /** The method name where the log was triggered from */\n method?: string;\n\n /** The file name where the log was triggered from */\n file?: string;\n\n /** The log's text content */\n text?: string;\n\n /** The log's origin URL. This attribute is ignored on Android & iOS */\n url?: string;\n}\n"]}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.removeUndefinedAttributes = removeUndefinedAttributes;
|
|
7
|
-
|
|
8
|
-
function removeUndefinedAttributes(object) {
|
|
9
|
-
Object.entries(object).forEach(_ref => {
|
|
10
|
-
let [key, value] = _ref;
|
|
11
|
-
|
|
12
|
-
if (value === undefined) {
|
|
13
|
-
// @ts-ignore
|
|
14
|
-
delete object[key];
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=utilities.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["utilities.ts"],"names":["removeUndefinedAttributes","object","Object","entries","forEach","key","value","undefined"],"mappings":";;;;;;;AAAO,SAASA,yBAAT,CAAmCC,MAAnC,EAAgD;AACrDC,EAAAA,MAAM,CAACC,OAAP,CAAeF,MAAf,EAAuBG,OAAvB,CAA+B,QAAkB;AAAA,QAAjB,CAACC,GAAD,EAAMC,KAAN,CAAiB;;AAC/C,QAAIA,KAAK,KAAKC,SAAd,EAAyB;AACvB;AACA,aAAON,MAAM,CAACI,GAAD,CAAb;AACD;AACF,GALD;AAMD","sourcesContent":["export function removeUndefinedAttributes(object: any) {\n Object.entries(object).forEach(([key, value]) => {\n if (value === undefined) {\n // @ts-ignore\n delete object[key];\n }\n });\n}\n"]}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
|
|
3
|
-
import { format } from 'util';
|
|
4
|
-
import { LogLevel } from "./types/log";
|
|
5
|
-
export class PrintToConsole {
|
|
6
|
-
constructor(console) {
|
|
7
|
-
this.console = console;
|
|
8
|
-
|
|
9
|
-
_defineProperty(this, "printToConsole", false);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
init(printToConsole) {
|
|
13
|
-
this.printToConsole = printToConsole;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
error() {
|
|
17
|
-
if (this.printToConsole) {
|
|
18
|
-
this.console.error(...arguments);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
info() {
|
|
23
|
-
if (this.printToConsole) {
|
|
24
|
-
this.console.info(...arguments);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
log() {
|
|
29
|
-
if (this.printToConsole) {
|
|
30
|
-
this.console.log(...arguments);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
debug() {
|
|
35
|
-
if (this.printToConsole) {
|
|
36
|
-
this.console.debug(...arguments);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
trace() {
|
|
41
|
-
if (this.printToConsole) {
|
|
42
|
-
this.console.trace(...arguments);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
warn() {
|
|
47
|
-
if (this.printToConsole) {
|
|
48
|
-
this.console.warn(...arguments);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
printLog(log) {
|
|
53
|
-
if (this.printToConsole) {
|
|
54
|
-
// Log to browser console
|
|
55
|
-
// debug, warning, error, trace, info, fatal
|
|
56
|
-
const levelToMethod = ['log', 'warn', 'error', 'trace', 'info', 'error'];
|
|
57
|
-
const method = levelToMethod[log.level || LogLevel.Debug];
|
|
58
|
-
const tag = log.tag ? `[${log.tag}] ` : '';
|
|
59
|
-
const location = [log.file || '', log.method || '', log.line || ''].filter(p => p !== '').join(':');
|
|
60
|
-
const message = `${tag}${format(log.text)} ${location}`; // @ts-ignore
|
|
61
|
-
|
|
62
|
-
this.console[method](message);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
//# sourceMappingURL=print-to-console.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["print-to-console.ts"],"names":["format","LogLevel","PrintToConsole","constructor","console","init","printToConsole","error","info","log","debug","trace","warn","printLog","levelToMethod","method","level","Debug","tag","location","file","line","filter","p","join","message","text"],"mappings":";;AAAA,SAAQA,MAAR,QAAqB,MAArB;AAEA,SAAQC,QAAR,QAAuB,aAAvB;AAEA,OAAO,MAAMC,cAAN,CAAqB;AAG1BC,EAAAA,WAAW,CACUC,OADV,EAET;AAAA,SADmBA,OACnB,GADmBA,OACnB;;AAAA,4CAJkC,KAIlC;AACD;;AAEMC,EAAAA,IAAI,CAACC,cAAD,EAAgC;AACzC,SAAKA,cAAL,GAAsBA,cAAtB;AACD;;AAEMC,EAAAA,KAAK,GAAiC;AAC3C,QAAI,KAAKD,cAAT,EAAyB;AACvB,WAAKF,OAAL,CAAaG,KAAb,CAAmB,YAAnB;AACD;AACF;;AAEMC,EAAAA,IAAI,GAAiC;AAC1C,QAAI,KAAKF,cAAT,EAAyB;AACvB,WAAKF,OAAL,CAAaI,IAAb,CAAkB,YAAlB;AACD;AACF;;AAEMC,EAAAA,GAAG,GAAiC;AACzC,QAAI,KAAKH,cAAT,EAAyB;AACvB,WAAKF,OAAL,CAAaK,GAAb,CAAiB,YAAjB;AACD;AACF;;AAEMC,EAAAA,KAAK,GAAiC;AAC3C,QAAI,KAAKJ,cAAT,EAAyB;AACvB,WAAKF,OAAL,CAAaM,KAAb,CAAmB,YAAnB;AACD;AACF;;AAEMC,EAAAA,KAAK,GAAiC;AAC3C,QAAI,KAAKL,cAAT,EAAyB;AACvB,WAAKF,OAAL,CAAaO,KAAb,CAAmB,YAAnB;AACD;AACF;;AAEMC,EAAAA,IAAI,GAAiC;AAC1C,QAAI,KAAKN,cAAT,EAAyB;AACvB,WAAKF,OAAL,CAAaQ,IAAb,CAAkB,YAAlB;AACD;AACF;;AAEMC,EAAAA,QAAQ,CAACJ,GAAD,EAAuB;AACpC,QAAI,KAAKH,cAAT,EAAyB;AACvB;AACA;AACA,YAAMQ,aAAa,GAAG,CAAC,KAAD,EAAQ,MAAR,EAAgB,OAAhB,EAAyB,OAAzB,EAAkC,MAAlC,EAA0C,OAA1C,CAAtB;AACA,YAAMC,MAAM,GAAGD,aAAa,CAACL,GAAG,CAACO,KAAJ,IAAaf,QAAQ,CAACgB,KAAvB,CAA5B;AACA,YAAMC,GAAG,GAAGT,GAAG,CAACS,GAAJ,GAAW,IAAGT,GAAG,CAACS,GAAI,IAAtB,GAA4B,EAAxC;AACA,YAAMC,QAAQ,GAAG,CAACV,GAAG,CAACW,IAAJ,IAAY,EAAb,EAAiBX,GAAG,CAACM,MAAJ,IAAc,EAA/B,EAAmCN,GAAG,CAACY,IAAJ,IAAY,EAA/C,EAAmDC,MAAnD,CAA0DC,CAAC,IAAIA,CAAC,KAAK,EAArE,EAAyEC,IAAzE,CAA8E,GAA9E,CAAjB;AACA,YAAMC,OAAO,GAAI,GAAEP,GAAI,GAAElB,MAAM,CAACS,GAAG,CAACiB,IAAL,CAAW,IAAGP,QAAS,EAAtD,CAPuB,CASvB;;AACA,WAAKf,OAAL,CAAaW,MAAb,EAAqBU,OAArB;AACD;AACF;;AA7DyB","sourcesContent":["import {format} from 'util';\nimport type {ILogEntry} from \"./types/log\";\nimport {LogLevel} from \"./types/log\";\n\nexport class PrintToConsole {\n protected printToConsole: boolean = false;\n\n constructor(\n protected readonly console: Console,\n ) {\n }\n\n public init(printToConsole: boolean): void {\n this.printToConsole = printToConsole;\n }\n\n public error(...parameters: unknown[]): void {\n if (this.printToConsole) {\n this.console.error(...parameters);\n }\n }\n\n public info(...parameters: unknown[]): void {\n if (this.printToConsole) {\n this.console.info(...parameters);\n }\n }\n\n public log(...parameters: unknown[]): void {\n if (this.printToConsole) {\n this.console.log(...parameters);\n }\n }\n\n public debug(...parameters: unknown[]): void {\n if (this.printToConsole) {\n this.console.debug(...parameters);\n }\n }\n\n public trace(...parameters: unknown[]): void {\n if (this.printToConsole) {\n this.console.trace(...parameters);\n }\n }\n\n public warn(...parameters: unknown[]): void {\n if (this.printToConsole) {\n this.console.warn(...parameters);\n }\n }\n\n public printLog(log: ILogEntry): void {\n if (this.printToConsole) {\n // Log to browser console\n // debug, warning, error, trace, info, fatal\n const levelToMethod = ['log', 'warn', 'error', 'trace', 'info', 'error'];\n const method = levelToMethod[log.level || LogLevel.Debug];\n const tag = log.tag ? `[${log.tag}] ` : '';\n const location = [log.file || '', log.method || '', log.line || ''].filter(p => p !== '').join(':');\n const message = `${tag}${format(log.text)} ${location}`;\n\n // @ts-ignore\n this.console[method](message);\n }\n }\n}\n"]}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { format } from "util";
|
|
2
|
-
export class StringFormatter {
|
|
3
|
-
format(parameters) {
|
|
4
|
-
const [, ...textParams] = parameters;
|
|
5
|
-
let [textFormat] = parameters;
|
|
6
|
-
let text;
|
|
7
|
-
|
|
8
|
-
try {
|
|
9
|
-
// Our sanitizer gives better results, try with it first
|
|
10
|
-
textFormat = this.toString(textFormat);
|
|
11
|
-
} catch {
|
|
12
|
-
// Fallback to `format`
|
|
13
|
-
textFormat = format(textFormat);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (textParams.length > 0) {
|
|
17
|
-
text = format(textFormat, ...textParams);
|
|
18
|
-
} else {
|
|
19
|
-
text = textFormat;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return text;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
toString(value) {
|
|
26
|
-
// Depending on the type we prefer to do `String` or `stringify`
|
|
27
|
-
const isToString = ['string', 'symbol', 'bigint', 'function'].includes(typeof value) || value instanceof Error;
|
|
28
|
-
|
|
29
|
-
if (isToString) {
|
|
30
|
-
try {
|
|
31
|
-
return String(value);
|
|
32
|
-
} catch {
|
|
33
|
-
return JSON.stringify(value);
|
|
34
|
-
}
|
|
35
|
-
} else {
|
|
36
|
-
try {
|
|
37
|
-
return JSON.stringify(value);
|
|
38
|
-
} catch {
|
|
39
|
-
return String(value);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=string-formatter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["string-formatter.ts"],"names":["format","StringFormatter","parameters","textParams","textFormat","text","toString","length","value","isToString","includes","Error","String","JSON","stringify"],"mappings":"AAAA,SAAQA,MAAR,QAAqB,MAArB;AAEA,OAAO,MAAMC,eAAN,CAAsB;AACpBD,EAAAA,MAAM,CAACE,UAAD,EAAgC;AAC3C,UAAM,GAAG,GAAGC,UAAN,IAAoBD,UAA1B;AACA,QAAI,CAACE,UAAD,IAAeF,UAAnB;AACA,QAAIG,IAAJ;;AAEA,QAAI;AACF;AACAD,MAAAA,UAAU,GAAG,KAAKE,QAAL,CAAcF,UAAd,CAAb;AACD,KAHD,CAGE,MAAM;AACN;AACAA,MAAAA,UAAU,GAAGJ,MAAM,CAACI,UAAD,CAAnB;AACD;;AAED,QAAID,UAAU,CAACI,MAAX,GAAoB,CAAxB,EAA2B;AACzBF,MAAAA,IAAI,GAAGL,MAAM,CAACI,UAAD,EAAa,GAAGD,UAAhB,CAAb;AACD,KAFD,MAEO;AACLE,MAAAA,IAAI,GAAGD,UAAP;AACD;;AAED,WAAOC,IAAP;AACD;;AAEOC,EAAAA,QAAQ,CAACE,KAAD,EAAyB;AACvC;AACA,UAAMC,UAAU,GAAG,CAAC,QAAD,EAAW,QAAX,EAAqB,QAArB,EAA+B,UAA/B,EAA2CC,QAA3C,CAAoD,OAAOF,KAA3D,KAAqEA,KAAK,YAAYG,KAAzG;;AAEA,QAAIF,UAAJ,EAAgB;AACd,UAAI;AACF,eAAOG,MAAM,CAACJ,KAAD,CAAb;AACD,OAFD,CAEE,MAAM;AACN,eAAOK,IAAI,CAACC,SAAL,CAAeN,KAAf,CAAP;AACD;AACF,KAND,MAMO;AACL,UAAI;AACF,eAAOK,IAAI,CAACC,SAAL,CAAeN,KAAf,CAAP;AACD,OAFD,CAEE,MAAM;AACN,eAAOI,MAAM,CAACJ,KAAD,CAAb;AACD;AACF;AACF;;AAxC0B","sourcesContent":["import {format} from \"util\";\n\nexport class StringFormatter {\n public format(parameters: unknown[]): string {\n const [, ...textParams] = parameters;\n let [textFormat] = parameters as string[];\n let text: string;\n\n try {\n // Our sanitizer gives better results, try with it first\n textFormat = this.toString(textFormat);\n } catch {\n // Fallback to `format`\n textFormat = format(textFormat);\n }\n\n if (textParams.length > 0) {\n text = format(textFormat, ...textParams);\n } else {\n text = textFormat;\n }\n\n return text;\n }\n\n private toString(value: unknown): string {\n // Depending on the type we prefer to do `String` or `stringify`\n const isToString = ['string', 'symbol', 'bigint', 'function'].includes(typeof value) || value instanceof Error;\n\n if (isToString) {\n try {\n return String(value);\n } catch {\n return JSON.stringify(value);\n }\n } else {\n try {\n return JSON.stringify(value);\n } catch {\n return String(value);\n }\n }\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|