OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 /// Contains all warning messages produced by the code_transformers package. | 5 /// Contains all warning messages produced by the code_transformers package. |
6 library code_transformers.src.messages; | 6 library code_transformers.src.messages; |
7 | 7 |
8 import 'package:code_transformers/messages/messages.dart'; | 8 import 'package:code_transformers/messages/messages.dart'; |
9 | 9 |
10 const NO_ABSOLUTE_PATHS = const MessageTemplate( | 10 const NO_ABSOLUTE_PATHS = const MessageTemplate( |
11 const MessageId('code_transformers', 1), | 11 const MessageId('code_transformers', 1), |
12 'absolute paths not allowed: "%-url-%"', 'Absolute paths not allowed', ''' | 12 'absolute paths not allowed: "%-url-%"', |
| 13 'Absolute paths not allowed', |
| 14 ''' |
13 The transformers processing your code were trying to resolve a URL and identify | 15 The transformers processing your code were trying to resolve a URL and identify |
14 a file that they correspond to. Currently only relative paths can be resolved. | 16 a file that they correspond to. Currently only relative paths can be resolved. |
15 '''); | 17 '''); |
16 | 18 |
17 const INVALID_URL_TO_OTHER_PACKAGE = const MessageTemplate( | 19 const INVALID_URL_TO_OTHER_PACKAGE = const MessageTemplate( |
18 const MessageId('code_transformers', 2), | 20 const MessageId('code_transformers', 2), |
19 'Invalid URL to reach to another package: %-url-%. Path ' | 21 'Invalid URL to reach to another package: %-url-%. Path ' |
20 'reaching to other packages must first reach up all the ' | 22 'reaching to other packages must first reach up all the ' |
21 'way to the %-prefix-% directory. For example, try changing the URL ' | 23 'way to the %-prefix-% directory. For example, try changing the URL ' |
22 'to: %-fixedUrl-%', 'Invalid URL to reach another package', ''' | 24 'to: %-fixedUrl-%', |
| 25 'Invalid URL to reach another package', |
| 26 ''' |
23 To reach an asset that belongs to another package, use `package:` URLs in | 27 To reach an asset that belongs to another package, use `package:` URLs in |
24 Dart code, but in any other language (like HTML or CSS) use relative URLs that | 28 Dart code, but in any other language (like HTML or CSS) use relative URLs that |
25 first go all the way to the `packages/` directory. | 29 first go all the way to the `packages/` directory. |
26 | 30 |
27 The rules for correctly writing these imports are subtle and have a lot of | 31 The rules for correctly writing these imports are subtle and have a lot of |
28 special cases. Please review | 32 special cases. Please review |
29 <https://www.dartlang.org/polymer/app-directories.html> to learn | 33 <https://www.dartlang.org/polymer/app-directories.html> to learn |
30 more. | 34 more. |
31 '''); | 35 '''); |
32 | 36 |
33 const INVALID_PREFIX_PATH = const MessageTemplate( | 37 const INVALID_PREFIX_PATH = const MessageTemplate( |
34 const MessageId('code_transformers', 3), | 38 const MessageId('code_transformers', 3), |
35 'incomplete %-prefix-%/ path. It should have at least 3 ' | 39 'incomplete %-prefix-%/ path. It should have at least 3 ' |
36 'segments %-prefix-%/name/path_from_name\'s_%-folder-%_dir', | 40 'segments %-prefix-%/name/path_from_name\'s_%-folder-%_dir', |
37 'Incomplete URL to asset in another package', ''' | 41 'Incomplete URL to asset in another package', |
| 42 ''' |
38 URLs that refer to assets in other packages need to explicitly mention the | 43 URLs that refer to assets in other packages need to explicitly mention the |
39 `packages/` directory. In the future this requirement might be removed, but for | 44 `packages/` directory. In the future this requirement might be removed, but for |
40 now you must use a canonical URL form for it. | 45 now you must use a canonical URL form for it. |
41 | 46 |
42 For example, if `packages/a/a.html` needs to import `packages/b/b.html`, | 47 For example, if `packages/a/a.html` needs to import `packages/b/b.html`, |
43 you might expect a.html to import `../b/b.html`. Instead, it must import | 48 you might expect a.html to import `../b/b.html`. Instead, it must import |
44 `../../packages/b/b.html`. | 49 `../../packages/b/b.html`. |
45 | 50 |
46 See [issue 15797](http://dartbug.com/15797) and | 51 See [issue 15797](http://dartbug.com/15797) and |
47 <https://www.dartlang.org/polymer/app-directories.html> to learn more. | 52 <https://www.dartlang.org/polymer/app-directories.html> to learn more. |
48 '''); | 53 '''); |
49 | 54 |
50 const UNSPECIFIED_FROM_IN_NON_LIB_ASSET = const MessageTemplate( | 55 const UNSPECIFIED_FROM_IN_NON_LIB_ASSET = const MessageTemplate( |
51 const MessageId('code_transformers', 4), | 56 const MessageId('code_transformers', 4), |
52 'Cannot create URI for %-id-% without specifying where to import it from.', | 57 'Cannot create URI for %-id-% without specifying where to import it from.', |
53 'Missing `from` argument.', ''' | 58 'Missing `from` argument.', |
| 59 ''' |
54 Assets outside of the lib folder can only be imported via relative URIs. Use | 60 Assets outside of the lib folder can only be imported via relative URIs. Use |
55 the `from` argument in `assetIdToUri` to specify the location in the same | 61 the `from` argument in `assetIdToUri` to specify the location in the same |
56 package where you intend to import this asset from. | 62 package where you intend to import this asset from. |
57 '''); | 63 '''); |
58 | 64 |
59 const IMPORT_FROM_DIFFERENT_PACKAGE = const MessageTemplate( | 65 const IMPORT_FROM_DIFFERENT_PACKAGE = const MessageTemplate( |
60 const MessageId('code_transformers', 5), | 66 const MessageId('code_transformers', 5), |
61 'Not possible to import %-toId-% from %-fromId-%', 'Cannot import asset.', | 67 'Not possible to import %-toId-% from %-fromId-%', |
| 68 'Cannot import asset.', |
62 ''' | 69 ''' |
63 Assets outside of the lib folder can only be imported via relative URIs from | 70 Assets outside of the lib folder can only be imported via relative URIs from |
64 assets in the same package. To import an asset from another package, you need to | 71 assets in the same package. To import an asset from another package, you need to |
65 move it into the lib folder of your package. | 72 move it into the lib folder of your package. |
66 '''); | 73 '''); |
OLD | NEW |