Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR replaces the current
languages_placeholder
with a new comment annotation base system.This will allow us to more easily add generated content in a more natural and configurable way.
What annotations are
Annotations are single line comments which have the form:
Right now, annotations have to be followed by a variable definition, assignment or key-value-pair, like this:
How annotations are replaced
Right now,
replaceAnnotations
is used to in combination with a replacer function. The replacer will get the name of the annotation, the specified options (optional), and the previous value as arguments. The string returned will replace the value of the variable.replaceAnnotations
is intended to be piped:replacer
could look like this:Some more details
undefined
.IMPORTANT: The string returned by a replacer has to be a single line.
New functions
To make asynchronous operations easier to deal with, I added 3 new functions, all of which return a
Promise
.promiseStream
will take aReadableStream
and return aPromise
which listens to the streamsend
event.readString
will read a file and return aPromise
with the string content of the file.readJson
will parse the text fromreadString
and return aPromise
with the JSON object,Other changes
components.js
in no longer hard-coded ingulpfile.js
.