-
Notifications
You must be signed in to change notification settings - Fork 23
/
cljs-api-format.edn
185 lines (143 loc) · 7.62 KB
/
cljs-api-format.edn
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
{:version "0.0-3297"
:history {:versions ("0.0-3297" ...) ;; versions in reverse order
;; maps versions to details
:details {"0.0-3297" {;; clojurescript
:tag "r3297"
:date "2015-05-23"
;; clojure
:clj-version "1.7.0-beta2"
:clj-tag "clojure-1.7.0-beta2"
;; tools.reader
:treader-version "0.9.2"
:treader-tag "tools.reader-0.9.2"
;; google closure library/compiler
:gclosure-com "20140625"
:gclosure-lib "0.0-20150505-021ed5b3"}
...}}
;; symbols not ported from clojure
:clj-not-cljs #{"clojure.core/the-ns"
"clojure.core/create-struct"
...}
;; map full symbol names to their API data
:symbols {"cljs.core/->"
{;; auto-parsed docs
:full-name "cljs.core/->"
:full-name-encode "cljs.core/-GT" ;; used for filenames
:ns "cljs.core"
:name "->"
:name-encode "-GT"
;; Type information
;; if this symbol is a member of a type (e.g. cljs.core/PersistentArrayMap.fromArrays)
:parent-type "PersistentArrayMap"
;; if type, this shows the protocols it implements
:protocols #{"IFoo" "IBar"}
;; if core protocol, this shows the known core types that implement it
:implementations #{"Foo" "Bar"}
;; if protocol, this shows the methods that must be implemented
:methods [{:name "-clj->js",
:signature ["[x]"],
:docstring "Recursively transforms clj values to JavaScript"}
{:name "-key->js",
:signature ["[x]"],
:docstring "Transforms map keys to valid JavaScript keys. Arbitrary keys are\n encoded to their string representation via (pr-str x)"}]
;; example data here taken from cljs.core/keys
:type "function"
:docstring "Returns a sequence of the map's keys."
:signature ["[x & forms]"]
:history [["+" "0.0-927"]]
:source {:code "... full source code ..."
:title "Source code"
:repo "clojurescript"
:tag "r3297"
:filename "src/main/cljs/cljs/core.cljs"
:lines [7559 7563]}
;; Same structure as `:source` for extra sources.
;; (For example, some symbols have both function and macro
;; implementations, so the main `:source` will have a `:title`
;; set to "Function Code", and there will be an extra source
;; with the `:title` attributes set to "Macro Code".)
:extra-sources [{...}]
;; equivalent symbol in Clojure (if it exists)
:clj-equiv {:full-name "clojure.core/->"
:url "http://clojure.github.io/clojure/branch-master/clojure.core-api.html#clojure.core/->"}
:syntax-equiv {:clj-url "..."
:edn-url "..."}
;; the URL where a user can go to edit the manual documentation
:edit-url "https://github.com/cljs/api/blob/master/docfiles/cljs.core/-GT.md"
;; manually added from md files in docfiles/
:summary "... summary in markdown ..."
:details "... details in markdown ..."
:examples "... example in markdown ..."
:md-biblio #{"cljs.core/foo"} ;; doclinks used in the markdown bodies
:see-also ["cljs.core/foo" "cljs.core/bar"]
;; sometimes a namespace can exist for the both the library
;; and compiler. we may need separate docs for them.
:summary-compiler "... summary in markdown ..."
:details-compiler "... details in markdown ..."
;; the full name where this symbol moved to or moved from
:moved-to "cljs.core/new-name"
:moved-from "cljs.core/old-name"
;; details on time of removal
:removed {:in "1.9.592"
:last-seen "1.9.581"}
;; (The :signature is auto-parsed, but can be overwritten manually in docfiles)
;; Given the :signature ["[foo]" "[foo bar]"], ;; and the :name
;; "my-func", the following :usage will be generated.
:usage ["(my-func foo)"
"(my-func foo bar)"]
;; for pseudo-namespaces and their symbols
:display-as "#queue [] literal" ;; (from syntax/queue-literal)
:display-as ":externs" ;; (from compiler-options/externs)
;; what it's usually called
:known-as "thread first" ;; (from cljs.core/->)
;; some special forms are only available in the REPL
:repl-only? false
;; search terms, for example this is useful for syntax/destructure-map
:search-terms [":keys"
":strs"
":syms"
":as"]
;; pseudo-namespace that contains sub-options
;; (for example, compiler-options/warnings has sub-options under "warnings" pseudo-ns)
:sub-options-ns "warnings"}
...}
:namespaces {
:ns "syntax"
:pseudo-ns? true ;; true for pseudo namespaces (e.g. syntax, compiler-options, repl-options)
:display-as "Syntax" ;; display title
;; If this namespaces is a pseudo-namespace that contains sub-options
;; we show the symbol that it belongs to.
;; (for example, compiler-options/warnings has sub-options under "warnings" pseudo-ns)
:sub-options-sym "compiler-options/warnings"
...}
;; API categories (i.e. syntax, library, compiler)
:api {
;; Library API
:library {
;; set of full symbol names present in this API
:symbol-names #{"cljs.core/*1"
"cljs.core/reduce"
"cljs.core/map"
...}
;; set of full namespace names present in this API
:namespace-names #{"cljs.core"
"cljs.js"
...}
;; history of changes for each version
:changes
{"0.0-3297" {:added #{"clojure.browser.repl/bootstrap"
"clojure.browser.repl/load-queue"}
:removed #{"cljs.core/load-file*"}}
...}}
;; Compiler API (same format)
:compiler {:symbol-names #{}
:namespace-names #{}
:changes []}
;; Syntax API (same format)
:syntax {:symbol-names #{}
:namespace-names #{}
:changes []}
;; Options API (same format)
:options {:symbol-names #{}
:namespace-names #{"compiler-options" "repl-options" "warnings" "closure-warnings"}
:changes []}}}