OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
| 5 /// This file moved under `sdk/lib/_internal/sdk_library_metadata/lib/libraries.
dart`. |
| 6 @deprecated |
5 library libraries; | 7 library libraries; |
6 | 8 |
7 /** | 9 export 'sdk_library_metadata/lib/libraries.dart'; |
8 * A bit flag used by [LibraryInfo] indicating that a library is used by dart2js | |
9 */ | |
10 const int DART2JS_PLATFORM = 1; | |
11 | |
12 /** | |
13 * A bit flag used by [LibraryInfo] indicating that a library is used by the VM | |
14 */ | |
15 const int VM_PLATFORM = 2; | |
16 | |
17 /** | |
18 * Mapping of "dart:" library name (e.g. "core") to information about that libra
ry. | |
19 * This information is structured such that Dart Editor can parse this file | |
20 * and extract the necessary information without executing it | |
21 * while other tools can access via execution. | |
22 */ | |
23 const Map<String, LibraryInfo> LIBRARIES = const { | |
24 | |
25 "async": const LibraryInfo( | |
26 "async/async.dart", | |
27 maturity: Maturity.STABLE, | |
28 dart2jsPatchPath: "_internal/compiler/js_lib/async_patch.dart"), | |
29 | |
30 "_blink": const LibraryInfo( | |
31 "_blink/dartium/_blink_dartium.dart", | |
32 category: "Client", | |
33 implementation: true, | |
34 documented: false, | |
35 platforms: VM_PLATFORM), | |
36 | |
37 "_chrome": const LibraryInfo( | |
38 "_chrome/dart2js/chrome_dart2js.dart", | |
39 documented: false, | |
40 category: "Client"), | |
41 | |
42 "collection": const LibraryInfo( | |
43 "collection/collection.dart", | |
44 maturity: Maturity.STABLE, | |
45 dart2jsPatchPath: "_internal/compiler/js_lib/collection_patch.dart"), | |
46 | |
47 "convert": const LibraryInfo( | |
48 "convert/convert.dart", | |
49 maturity: Maturity.STABLE, | |
50 dart2jsPatchPath: "_internal/compiler/js_lib/convert_patch.dart"), | |
51 | |
52 "core": const LibraryInfo( | |
53 "core/core.dart", | |
54 maturity: Maturity.STABLE, | |
55 dart2jsPatchPath: "_internal/compiler/js_lib/core_patch.dart"), | |
56 | |
57 "developer": const LibraryInfo( | |
58 "developer/developer.dart", | |
59 maturity: Maturity.UNSTABLE, | |
60 dart2jsPatchPath: "_internal/compiler/js_lib/developer_patch.dart"), | |
61 | |
62 "html": const LibraryInfo( | |
63 "html/dartium/html_dartium.dart", | |
64 category: "Client", | |
65 maturity: Maturity.WEB_STABLE, | |
66 dart2jsPath: "html/dart2js/html_dart2js.dart"), | |
67 | |
68 "html_common": const LibraryInfo( | |
69 "html/html_common/html_common.dart", | |
70 category: "Client", | |
71 maturity: Maturity.WEB_STABLE, | |
72 dart2jsPath: "html/html_common/html_common_dart2js.dart", | |
73 documented: false, | |
74 implementation: true), | |
75 | |
76 "indexed_db": const LibraryInfo( | |
77 "indexed_db/dartium/indexed_db_dartium.dart", | |
78 category: "Client", | |
79 maturity: Maturity.WEB_STABLE, | |
80 dart2jsPath: "indexed_db/dart2js/indexed_db_dart2js.dart"), | |
81 | |
82 "io": const LibraryInfo( | |
83 "io/io.dart", | |
84 category: "Server", | |
85 maturity: Maturity.STABLE, | |
86 dart2jsPatchPath: "_internal/compiler/js_lib/io_patch.dart"), | |
87 | |
88 "isolate": const LibraryInfo( | |
89 "isolate/isolate.dart", | |
90 maturity: Maturity.STABLE, | |
91 dart2jsPatchPath: "_internal/compiler/js_lib/isolate_patch.dart"), | |
92 | |
93 "js": const LibraryInfo( | |
94 "js/dartium/js_dartium.dart", | |
95 category: "Client", | |
96 maturity: Maturity.STABLE, | |
97 dart2jsPath: "js/dart2js/js_dart2js.dart"), | |
98 | |
99 "math": const LibraryInfo( | |
100 "math/math.dart", | |
101 maturity: Maturity.STABLE, | |
102 dart2jsPatchPath: "_internal/compiler/js_lib/math_patch.dart"), | |
103 | |
104 "mirrors": const LibraryInfo( | |
105 "mirrors/mirrors.dart", | |
106 maturity: Maturity.UNSTABLE, | |
107 dart2jsPatchPath: "_internal/compiler/js_lib/mirrors_patch.dart"), | |
108 | |
109 "profiler": const LibraryInfo( | |
110 "profiler/profiler.dart", | |
111 maturity: Maturity.UNSTABLE), | |
112 | |
113 "nativewrappers": const LibraryInfo( | |
114 "html/dartium/nativewrappers.dart", | |
115 category: "Client", | |
116 implementation: true, | |
117 documented: false, | |
118 platforms: VM_PLATFORM), | |
119 | |
120 "typed_data": const LibraryInfo( | |
121 "typed_data/typed_data.dart", | |
122 maturity: Maturity.STABLE, | |
123 dart2jsPatchPath: "_internal/compiler/js_lib/typed_data_patch.dart"), | |
124 | |
125 "_native_typed_data": const LibraryInfo( | |
126 "_internal/compiler/js_lib/native_typed_data.dart", | |
127 category: "Internal", | |
128 implementation: true, | |
129 documented: false, | |
130 platforms: DART2JS_PLATFORM), | |
131 | |
132 "svg": const LibraryInfo( | |
133 "svg/dartium/svg_dartium.dart", | |
134 category: "Client", | |
135 maturity: Maturity.WEB_STABLE, | |
136 dart2jsPath: "svg/dart2js/svg_dart2js.dart"), | |
137 | |
138 "web_audio": const LibraryInfo( | |
139 "web_audio/dartium/web_audio_dartium.dart", | |
140 category: "Client", | |
141 maturity: Maturity.WEB_STABLE, | |
142 dart2jsPath: "web_audio/dart2js/web_audio_dart2js.dart"), | |
143 | |
144 "web_gl": const LibraryInfo( | |
145 "web_gl/dartium/web_gl_dartium.dart", | |
146 category: "Client", | |
147 maturity: Maturity.WEB_STABLE, | |
148 dart2jsPath: "web_gl/dart2js/web_gl_dart2js.dart"), | |
149 | |
150 "web_sql": const LibraryInfo( | |
151 "web_sql/dartium/web_sql_dartium.dart", | |
152 category: "Client", | |
153 maturity: Maturity.WEB_STABLE, | |
154 dart2jsPath: "web_sql/dart2js/web_sql_dart2js.dart"), | |
155 | |
156 "_internal": const LibraryInfo( | |
157 "internal/internal.dart", | |
158 category: "Internal", | |
159 documented: false, | |
160 dart2jsPatchPath: | |
161 "_internal/compiler/js_lib/internal_patch.dart"), | |
162 | |
163 "_js_helper": const LibraryInfo( | |
164 "_internal/compiler/js_lib/js_helper.dart", | |
165 category: "Internal", | |
166 documented: false, | |
167 platforms: DART2JS_PLATFORM), | |
168 | |
169 "_interceptors": const LibraryInfo( | |
170 "_internal/compiler/js_lib/interceptors.dart", | |
171 category: "Internal", | |
172 documented: false, | |
173 platforms: DART2JS_PLATFORM), | |
174 | |
175 "_foreign_helper": const LibraryInfo( | |
176 "_internal/compiler/js_lib/foreign_helper.dart", | |
177 category: "Internal", | |
178 documented: false, | |
179 platforms: DART2JS_PLATFORM), | |
180 | |
181 "_isolate_helper": const LibraryInfo( | |
182 "_internal/compiler/js_lib/isolate_helper.dart", | |
183 category: "Internal", | |
184 documented: false, | |
185 platforms: DART2JS_PLATFORM), | |
186 | |
187 "_js_mirrors": const LibraryInfo( | |
188 "_internal/compiler/js_lib/js_mirrors.dart", | |
189 category: "Internal", | |
190 documented: false, | |
191 platforms: DART2JS_PLATFORM), | |
192 | |
193 "_js_names": const LibraryInfo( | |
194 "_internal/compiler/js_lib/js_names.dart", | |
195 category: "Internal", | |
196 documented: false, | |
197 platforms: DART2JS_PLATFORM), | |
198 | |
199 "_js_primitives": const LibraryInfo( | |
200 "_internal/compiler/js_lib/js_primitives.dart", | |
201 category: "Internal", | |
202 documented: false, | |
203 platforms: DART2JS_PLATFORM), | |
204 | |
205 // TODO(ahe): This library is only for dart2dart, perhaps it should use a | |
206 // different platform. | |
207 "_mirror_helper": const LibraryInfo( | |
208 "_internal/compiler/js_lib/mirror_helper.dart", | |
209 category: "Internal", | |
210 documented: false, | |
211 platforms: DART2JS_PLATFORM), | |
212 | |
213 "_js_embedded_names": const LibraryInfo( | |
214 "_internal/compiler/js_lib/shared/embedded_names.dart", | |
215 category: "Internal", | |
216 documented: false, | |
217 platforms: DART2JS_PLATFORM), | |
218 | |
219 "_async_await_error_codes": const LibraryInfo( | |
220 "_internal/compiler/js_lib/shared/async_await_error_codes.dart", | |
221 category: "Internal", | |
222 documented: false, | |
223 platforms: DART2JS_PLATFORM), | |
224 | |
225 "_metadata": const LibraryInfo( | |
226 "html/html_common/metadata.dart", | |
227 category: "Internal", | |
228 documented: false, | |
229 platforms: DART2JS_PLATFORM), | |
230 }; | |
231 | |
232 /** | |
233 * Information about a "dart:" library. | |
234 */ | |
235 class LibraryInfo { | |
236 | |
237 /** | |
238 * Path to the library's *.dart file relative to this file. | |
239 */ | |
240 final String path; | |
241 | |
242 /** | |
243 * The category in which the library should appear in the editor | |
244 * (e.g. "Shared", "Client", "Server", ...). | |
245 * If a category is not specified it defaults to "Shared". | |
246 */ | |
247 final String category; | |
248 | |
249 /** | |
250 * Path to the dart2js library's *.dart file relative to this file | |
251 * or null if dart2js uses the common library path defined above. | |
252 * Access using the [#getDart2JsPath()] method. | |
253 */ | |
254 final String dart2jsPath; | |
255 | |
256 /** | |
257 * Path to the dart2js library's patch file relative to this file | |
258 * or null if no dart2js patch file associated with this library. | |
259 * Access using the [#getDart2JsPatchPath()] method. | |
260 */ | |
261 final String dart2jsPatchPath; | |
262 | |
263 /** | |
264 * True if this library is documented and should be shown to the user. | |
265 */ | |
266 final bool documented; | |
267 | |
268 /** | |
269 * Bit flags indicating which platforms consume this library. | |
270 * See [DART2JS_LIBRARY] and [VM_LIBRARY]. | |
271 */ | |
272 final int platforms; | |
273 | |
274 /** | |
275 * True if the library contains implementation details for another library. | |
276 * The implication is that these libraries are less commonly used | |
277 * and that tools like Dart Editor should not show these libraries | |
278 * in a list of all libraries unless the user specifically asks the tool to | |
279 * do so. | |
280 */ | |
281 final bool implementation; | |
282 | |
283 /** | |
284 * States the current maturity of this library. | |
285 */ | |
286 final Maturity maturity; | |
287 | |
288 const LibraryInfo(this.path, { | |
289 this.category: "Shared", | |
290 this.dart2jsPath, | |
291 this.dart2jsPatchPath, | |
292 this.implementation: false, | |
293 this.documented: true, | |
294 this.maturity: Maturity.UNSPECIFIED, | |
295 this.platforms: DART2JS_PLATFORM | VM_PLATFORM}); | |
296 | |
297 bool get isDart2jsLibrary => (platforms & DART2JS_PLATFORM) != 0; | |
298 bool get isVmLibrary => (platforms & VM_PLATFORM) != 0; | |
299 } | |
300 | |
301 | |
302 | |
303 /** | |
304 * Abstraction to capture the maturity of a library. | |
305 */ | |
306 class Maturity { | |
307 final int level; | |
308 final String name; | |
309 final String description; | |
310 | |
311 const Maturity(this.level, this.name, this.description); | |
312 | |
313 String toString() => "$name: $level\n$description\n"; | |
314 | |
315 static const Maturity DEPRECATED = const Maturity(0, "Deprecated", | |
316 "This library will be remove before next major release."); | |
317 | |
318 static const Maturity EXPERIMENTAL = const Maturity(1, "Experimental", | |
319 "This library is experimental and will likely change or be removed\n" | |
320 "in future versions."); | |
321 | |
322 static const Maturity UNSTABLE = const Maturity(2, "Unstable", | |
323 "This library is in still changing and have not yet endured\n" | |
324 "sufficient real-world testing.\n" | |
325 "Backwards-compatibility is NOT guaranteed."); | |
326 | |
327 static const Maturity WEB_STABLE = const Maturity(3, "Web Stable", | |
328 "This library is tracking the DOM evolution as defined by WC3.\n" | |
329 "Backwards-compatibility is NOT guaranteed."); | |
330 | |
331 static const Maturity STABLE = const Maturity(4, "Stable", | |
332 "The library is stable. API backwards-compatibility is guaranteed.\n" | |
333 "However implementation details might change."); | |
334 | |
335 static const Maturity LOCKED = const Maturity(5, "Locked", | |
336 "This library will not change except when serious bugs are encountered."); | |
337 | |
338 static const Maturity UNSPECIFIED = const Maturity(-1, "Unspecified", | |
339 "The maturity for this library has not been specified."); | |
340 } | |
OLD | NEW |