| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 error and warning messages produced by web_components. | 5 /// Contains all error and warning messages produced by web_components. |
| 6 library web_components.build.messages; | 6 library web_components.build.messages; |
| 7 | 7 |
| 8 import 'package:code_transformers/messages/messages.dart'; | 8 import 'package:code_transformers/messages/messages.dart'; |
| 9 | 9 |
| 10 const scriptFileNotFound = const MessageTemplate( | 10 const scriptFileNotFound = const MessageTemplate( |
| 11 const MessageId('web_components', 0), 'Script file at "%-url-%" not found.', | 11 const MessageId('web_components', 0), |
| 12 'URL to a script file might be incorrect', ''' | 12 'Script file at "%-url-%" not found.', |
| 13 'URL to a script file might be incorrect', |
| 14 ''' |
| 13 An error occurred trying to read a script tag on a given URL. This is often the | 15 An error occurred trying to read a script tag on a given URL. This is often the |
| 14 result of a broken URL in a `<script src="...">`. | 16 result of a broken URL in a `<script src="...">`. |
| 15 '''); | 17 '''); |
| 16 | 18 |
| 17 const scriptIncludedMoreThanOnce = const MessageTemplate( | 19 const scriptIncludedMoreThanOnce = const MessageTemplate( |
| 18 const MessageId('web_components', 1), | 20 const MessageId('web_components', 1), |
| 19 'The `%-url-%` script was included more than once.', | 21 'The `%-url-%` script was included more than once.', |
| 20 'Dart script file included more than once.', ''' | 22 'Dart script file included more than once.', |
| 23 ''' |
| 21 Duplicate dart scripts often happen if you have multiple html imports that | 24 Duplicate dart scripts often happen if you have multiple html imports that |
| 22 include the same script. The simplest workaround for this is to move your dart | 25 include the same script. The simplest workaround for this is to move your dart |
| 23 script to its own html file, and import that instead of the script (html imports | 26 script to its own html file, and import that instead of the script (html imports |
| 24 are automatically deduped). | 27 are automatically deduped). |
| 25 | 28 |
| 26 For example: | 29 For example: |
| 27 | 30 |
| 28 <script type="application/dart" src="foo.dart"></script> | 31 <script type="application/dart" src="foo.dart"></script> |
| 29 | 32 |
| 30 Should turn into: | 33 Should turn into: |
| 31 | 34 |
| 32 <link rel="import" href="foo.html"> | 35 <link rel="import" href="foo.html"> |
| 33 | 36 |
| 34 And `foo.html` should look like: | 37 And `foo.html` should look like: |
| 35 | 38 |
| 36 <script type="application/dart" src="foo.dart"></script> | 39 <script type="application/dart" src="foo.dart"></script> |
| 37 '''); | 40 '''); |
| 38 | 41 |
| 39 const exactlyOneScriptPerEntryPoint = const MessageTemplate( | 42 const exactlyOneScriptPerEntryPoint = const MessageTemplate( |
| 40 const MessageId('web_components', 2), | 43 const MessageId('web_components', 2), |
| 41 'Found either zero or multiple dart scripts in the entry point `%-url-%`. ' | 44 'Found either zero or multiple dart scripts in the entry point `%-url-%`. ' |
| 42 'Exactly one was expected.', | 45 'Exactly one was expected.', |
| 43 'Each entry point html file should contain exactly one dart script tag.', | 46 'Each entry point html file should contain exactly one dart script tag.', |
| 44 'Each entry point html file should contain exactly one dart script tag.'); | 47 'Each entry point html file should contain exactly one dart script tag.'); |
| 45 | 48 |
| 46 const internalErrorDontKnowHowToImport = const MessageTemplate( | 49 const internalErrorDontKnowHowToImport = const MessageTemplate( |
| 47 const MessageId('web_components', 3), | 50 const MessageId('web_components', 3), |
| 48 "internal error: don't know how to include %-target-% from" | 51 "internal error: don't know how to include %-target-% from" |
| 49 " %-source-%.%-extra-%", "Internal error: don't know how to include a URL", | 52 " %-source-%.%-extra-%", |
| 53 "Internal error: don't know how to include a URL", |
| 50 ''' | 54 ''' |
| 51 Sorry, you just ran into a bug in the web_components transformer code. Please | 55 Sorry, you just ran into a bug in the web_components transformer code. Please |
| 52 file a bug at <https://github.com/dart-lang/web-components/issues/new> | 56 file a bug at <https://github.com/dart-lang/web-components/issues/new> |
| 53 including, if possible, some example code that can help the team reproduce the | 57 including, if possible, some example code that can help the team reproduce the |
| 54 issue. | 58 issue. |
| 55 '''); | 59 '''); |
| 56 | 60 |
| 57 const inlineImportFail = const MessageTemplate( | 61 const inlineImportFail = const MessageTemplate( |
| 58 const MessageId('web_components', 4), | 62 const MessageId('web_components', 4), |
| 59 'Failed to inline HTML import: %-error-%', 'Error while inlining an import', | 63 'Failed to inline HTML import: %-error-%', |
| 64 'Error while inlining an import', |
| 60 ''' | 65 ''' |
| 61 An error occurred while inlining an import in the web_components build. This is | 66 An error occurred while inlining an import in the web_components build. This is |
| 62 often the result of a broken HTML import. | 67 often the result of a broken HTML import. |
| 63 | 68 |
| 64 One possible cause is using an @HtmlImport containing a relative path from | 69 One possible cause is using an @HtmlImport containing a relative path from |
| 65 within an inline script tag, see http://goo.gl/ZgrhaV. The workaround currently | 70 within an inline script tag, see http://goo.gl/ZgrhaV. The workaround currently |
| 66 is to use a `package:` url instead, move the code to a dart file, or simply | 71 is to use a `package:` url instead, move the code to a dart file, or simply |
| 67 adding a real html import (since you are already in an html file). | 72 adding a real html import (since you are already in an html file). |
| 68 '''); | 73 '''); |
| OLD | NEW |