FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
NativeScript/packages/core/utils/debug-source.ts at main · NativeScript/NativeScript · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
NativeScript
/
NativeScript
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
1.7k
Star
25.6k
Code
Issues
771
Pull requests
63
Discussions
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
NativeScript
/
packages
/
core
/
utils
/
debug-source.ts
Copy path
More file actions
More file actions
Latest commit
History
History
History
93 lines (77 loc) · 2.44 KB
Breadcrumbs
NativeScript
/
packages
/
core
/
utils
/
debug-source.ts
Copy path
File metadata and controls
93 lines (77 loc) · 2.44 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import
{
getNativeApp
}
from
'../application/helpers-common'
;
// console.log('__dirname:', global.__dirname);
function
getCurrentAppPath
(
)
:
string
{
if
(
__APPLE__
)
{
const
currentDir
=
global
.
__dirname
;
const
tnsModulesIndex
=
currentDir
.
indexOf
(
'/tns_modules'
)
;
// Module not hosted in ~/tns_modules when bundled. Use current dir.
let
appPath
=
currentDir
;
if
(
tnsModulesIndex
!==
-
1
)
{
// Strip part after tns_modules to obtain app root
appPath
=
currentDir
.
substring
(
0
,
tnsModulesIndex
)
;
}
return
appPath
;
}
else
{
const
dir
=
getNativeApp
<
android
.
app
.
Application
>
(
)
.
getApplicationContext
(
)
.
getFilesDir
(
)
;
return
`
${
dir
.
getCanonicalPath
(
)
}
/app`
;
}
}
let
applicationRootPath
:
string
;
function
ensureAppRootPath
(
)
{
if
(
!
applicationRootPath
)
{
applicationRootPath
=
getCurrentAppPath
(
)
;
applicationRootPath
=
applicationRootPath
.
substring
(
0
,
applicationRootPath
.
length
-
'app/'
.
length
)
;
}
}
export
class
Source
{
private
_uri
:
string
;
private
_line
:
number
;
private
_column
:
number
;
private
static
_source
=
Symbol
(
'source'
)
;
constructor
(
uri
:
string
,
line
:
number
,
column
:
number
)
{
ensureAppRootPath
(
)
;
if
(
uri
.
length
>
applicationRootPath
.
length
&&
uri
.
substring
(
0
,
applicationRootPath
.
length
)
===
applicationRootPath
)
{
this
.
_uri
=
'file://'
+
uri
.
substring
(
applicationRootPath
.
length
)
;
}
else
{
this
.
_uri
=
uri
;
}
this
.
_line
=
line
;
this
.
_column
=
column
;
}
get
uri
(
)
:
string
{
return
this
.
_uri
;
}
get
line
(
)
:
number
{
return
this
.
_line
;
}
get
column
(
)
:
number
{
return
this
.
_column
;
}
public
toString
(
)
{
return
this
.
_uri
+
':'
+
this
.
_line
+
':'
+
this
.
_column
;
}
public
static
get
(
object
:
any
)
:
Source
{
return
object
[
Source
.
_source
]
;
}
public
static
set
(
object
:
any
,
src
:
Source
)
{
object
[
Source
.
_source
]
=
src
;
}
}
export
class
ScopeError
extends
Error
{
constructor
(
inner
:
Error
,
message
?:
string
)
{
let
formattedMessage
;
if
(
message
&&
inner
.
message
)
{
formattedMessage
=
message
+
'\n > '
+
inner
.
message
.
replace
(
'\n'
,
'\n '
)
;
}
else
{
formattedMessage
=
message
||
inner
.
message
||
undefined
;
}
super
(
formattedMessage
)
;
this
.
stack
=
__ANDROID__
?
'Error: '
+
this
.
message
+
'\n'
+
inner
.
stack
.
substr
(
inner
.
stack
.
indexOf
(
'\n'
)
+
1
)
:
inner
.
stack
;
this
.
message
=
formattedMessage
;
}
}
export
class
SourceError
extends
ScopeError
{
constructor
(
child
:
Error
,
source
:
Source
,
message
?:
string
)
{
super
(
child
,
message
?
message
+
' @'
+
source
+
''
:
source
+
''
)
;
}
}
Back
|
FazBrowse Home
|
New Git URL