-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FrontendServerAssetReader #871
Conversation
dwds/CHANGELOG.md
Outdated
@@ -1,6 +1,7 @@ | |||
## 1.0.0-dev | |||
|
|||
- Remove dependency on `package:build_daemon`. | |||
- Add 'FrontendServerAssetReader` for use with Frontend Server builds. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unmatched quotes
|
||
bool _haveReadOriginals = false; | ||
|
||
/// Creates a `FrotnendServerAssetReader`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[FrontendServerAssetReader]
_jsonIncremental = File('$outputPath.incremental.json'); | ||
|
||
@override | ||
Future<String> dartSourceContents(String serverPath) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually interesting..... this wouldn't be anything specific to the frontend_server.
At the same time we will want an identical abstraction to this one which knows how to serve the JS files.
This class should probably extend an abstract DartSourceAssetReader blass which reads from the FS using a package resolver.
And then this file should also add an additional jsFileContents(String serverPath)
method which we can plug into our server in webdev.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure we want to go with the base class approach. I think we'd want to delegate to a DartSourceAssetReader
or something. I'll cross that hump when I get there though.
Future<void> updateCaches() async { | ||
if (!_haveReadOriginals) { | ||
await _updateCaches(_mapOriginal, _jsonOriginal); | ||
_haveReadOriginals = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to an if else
} | ||
|
||
Future<void> _updateCaches(File map, File json) async { | ||
if (!(await map.exists() && await json.exists())) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should consider throwing here (or logging an error at least)
File mapOriginal; | ||
|
||
Future<void> _createTempFixtures() async { | ||
var fixtures = p.absolute(p.relative('test/fixtures', from: p.current)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shouldn't need any of the p.absolute(p.relative(
here. But you should do p.join('test', 'fixtures')
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that is required for Windows testing? It's the pattern we do for the other fixtures, hence why I copied it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It shouldn't be necessary, this is just getting passed to a normal File constructor.
FrontendServerAssetReader
for use with the Frontend ServerTowards #865