froggy-docs 1.0.6 → 1.0.8
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/bin/froggy-docs +0 -0
- package/frontend/web/main.client.dart.js +81 -0
- package/lib/src/web_server.dart +10 -1
- package/package.json +1 -1
package/bin/froggy-docs
CHANGED
|
Binary file
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
(function() {
|
|
2
|
+
var _currentDirectory = (function () {
|
|
3
|
+
var _url;
|
|
4
|
+
var lines = new Error().stack.split('\n');
|
|
5
|
+
function lookupUrl() {
|
|
6
|
+
if (lines.length > 2) {
|
|
7
|
+
var match = lines[1].match(/^\s+at (.+):\d+:\d+$/);
|
|
8
|
+
// Chrome.
|
|
9
|
+
if (match) return match[1];
|
|
10
|
+
// Chrome nested eval case.
|
|
11
|
+
match = lines[1].match(/^\s+at eval [(](.+):\d+:\d+[)]$/);
|
|
12
|
+
if (match) return match[1];
|
|
13
|
+
// Edge.
|
|
14
|
+
match = lines[1].match(/^\s+at.+\((.+):\d+:\d+\)$/);
|
|
15
|
+
if (match) return match[1];
|
|
16
|
+
// Firefox.
|
|
17
|
+
match = lines[0].match(/[<][@](.+):\d+:\d+$/)
|
|
18
|
+
if (match) return match[1];
|
|
19
|
+
}
|
|
20
|
+
// Safari.
|
|
21
|
+
return lines[0].match(/[@](.+):\d+:\d+$/)[1];
|
|
22
|
+
}
|
|
23
|
+
_url = lookupUrl();
|
|
24
|
+
var lastSlash = _url.lastIndexOf('/');
|
|
25
|
+
if (lastSlash == -1) return _url;
|
|
26
|
+
var currentDirectory = _url.substring(0, lastSlash + 1);
|
|
27
|
+
return currentDirectory;
|
|
28
|
+
})();
|
|
29
|
+
|
|
30
|
+
var baseUrl = (function () {
|
|
31
|
+
// Attempt to detect --precompiled mode for tests, and set the base url
|
|
32
|
+
// appropriately, otherwise set it to '/'.
|
|
33
|
+
var pathParts = location.pathname.split("/");
|
|
34
|
+
if (pathParts[0] == "") {
|
|
35
|
+
pathParts.shift();
|
|
36
|
+
}
|
|
37
|
+
if (pathParts.length > 1 && pathParts[1] == "test") {
|
|
38
|
+
return "/" + pathParts.slice(0, 2).join("/") + "/";
|
|
39
|
+
}
|
|
40
|
+
// Attempt to detect base url using <base href> html tag
|
|
41
|
+
// base href should start and end with "/"
|
|
42
|
+
if (typeof document !== 'undefined') {
|
|
43
|
+
var el = document.getElementsByTagName('base');
|
|
44
|
+
if (el && el[0] && el[0].getAttribute("href") && el[0].getAttribute
|
|
45
|
+
("href").startsWith("/") && el[0].getAttribute("href").endsWith("/")){
|
|
46
|
+
return el[0].getAttribute("href");
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
// return default value
|
|
50
|
+
return "/";
|
|
51
|
+
}());
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
var mapperUri = baseUrl + "packages/build_web_compilers/src/dev_compiler_stack_trace/stack_trace_mapper.dart.js";
|
|
55
|
+
var requireUri = baseUrl +
|
|
56
|
+
"packages/build_web_compilers/src/dev_compiler/require.js";
|
|
57
|
+
var mainUri = _currentDirectory + "main.client.dart.bootstrap";
|
|
58
|
+
|
|
59
|
+
if (typeof document != 'undefined') {
|
|
60
|
+
var el = document.createElement("script");
|
|
61
|
+
el.defer = true;
|
|
62
|
+
el.async = false;
|
|
63
|
+
el.src = mapperUri;
|
|
64
|
+
document.head.appendChild(el);
|
|
65
|
+
|
|
66
|
+
el = document.createElement("script");
|
|
67
|
+
el.defer = true;
|
|
68
|
+
el.async = false;
|
|
69
|
+
el.src = requireUri;
|
|
70
|
+
el.setAttribute("data-main", mainUri);
|
|
71
|
+
document.head.appendChild(el);
|
|
72
|
+
} else {
|
|
73
|
+
importScripts(mapperUri, requireUri);
|
|
74
|
+
require.config({
|
|
75
|
+
baseUrl: baseUrl,
|
|
76
|
+
});
|
|
77
|
+
// TODO: update bootstrap code to take argument - dart-lang/build#1115
|
|
78
|
+
window = self;
|
|
79
|
+
require([mainUri + '.js']);
|
|
80
|
+
}
|
|
81
|
+
})();
|
package/lib/src/web_server.dart
CHANGED
|
@@ -35,11 +35,20 @@ String get _packageDir {
|
|
|
35
35
|
String get webDir => p.join(_packageDir, 'frontend', 'web');
|
|
36
36
|
String get deployDir => p.join(_packageDir, 'frontend', 'deploy', 'web');
|
|
37
37
|
|
|
38
|
+
String get userWebDir => p.join(Directory.current.path, 'frontend', 'web');
|
|
39
|
+
|
|
38
40
|
Router get _router {
|
|
39
41
|
final router = Router();
|
|
40
42
|
|
|
41
43
|
router.get('/froggy_docs.json', (Request request) async {
|
|
42
|
-
|
|
44
|
+
var file = File(p.join(userWebDir, 'froggy_docs.json'));
|
|
45
|
+
if (await file.existsSync()) {
|
|
46
|
+
return Response.ok(
|
|
47
|
+
file.openRead(),
|
|
48
|
+
headers: {'Content-Type': 'application/json'},
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
file = File(p.join(webDir, 'froggy_docs.json'));
|
|
43
52
|
if (await file.existsSync()) {
|
|
44
53
|
return Response.ok(
|
|
45
54
|
file.openRead(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "froggy-docs",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "Auto-generate API documentation from code annotations. Works with any programming language.",
|
|
5
5
|
"author": "Kaung Mrat Thu <kaungmyatthuu.dev@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/Kaung-Myat/froggydocs",
|