-
Notifications
You must be signed in to change notification settings - Fork 15
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
Develop #27
base: master
Are you sure you want to change the base?
Develop #27
Conversation
…, enable jest debugging
…should be cleaned up
… bypass Glimmer parser for certain features
…tations/restrictions)
…es using experimental features
…custom attributes
const getAllOpeningTagDataRegex = /<([^>]*)\/?>/g; | ||
|
||
// NOTE: this regex will identify all explicit helper calls (i.e. a mustache statement with multiple arguments) | ||
// NOTE: this will not locate helper's that take 0 args since they cannot be distiniguished from basic mustache statements without additional context |
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.
TODO: is there a way to distinguish helpers that take 0 args, perhaps a manual tagging process?
// TODO: fix this hack | ||
// Instead of forcing formatting here, fix whatever is causing certain expressions to print with pre- or post- line breaks | ||
// A quick search through forked-glimmer-vm (aka glimmer-engine) didn't show anything apparent in the generator/printer | ||
export const print = (text: string): string => removeLineBreaks(text); |
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.
TODO: identify where extra line breaks are coming from so this formatting hack can be removed
); | ||
const externalImports = externals.map((name) => Babel.importDeclaration( | ||
[Babel.importDefaultSpecifier(Babel.identifier(name))], | ||
Babel.stringLiteral(`./${name}`) // TODO: add support for specifying partial and/or helpers directory |
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.
TODO: add support for specifying partial and/or helpers directory
expectedTemplate: '<div title="{{titleIfHelper hasTooltip tooltip}}"></div>', | ||
expectedHelpers: [`const titleIfHelper = (hasTooltip, tooltip) => hasTooltip ? tooltip : undefined;`] | ||
}, | ||
// { // TODO: support multiple conditional attributes within the same block? |
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.
TODO: support multiple conditional attributes within the same block?
expectedTemplate: `<div ${ATTRIBUTE_GENERATOR_HELPER_FUNCTION}="{{getDataAttributesString data prefix="data-"}}"></div>`, | ||
expectedHelpers: [] | ||
}, | ||
// { // TODO: support multiple attribute generator helpers within the same opening tag? |
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.
TODO: support multiple attribute generator helpers within the same opening tag?
replaceAttributeGeneratingHelpers, // NOTE: this preprocessor has a dependency on having already converted attributes that contain helpers within or around their value | ||
]; | ||
|
||
const preProcessUnsupportedParserFeatures = (handlebarsTemplate: string):PreparedTemplate => { |
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.
TODO: look into proper parser support for these features, to avoid the need for flaky pre-processing
} | ||
|
||
const [_, leadingData, originalHelperName, originalHelperArg, helperChild, __, trailingData] = attributeValueData; | ||
if (helperChild.match(containsMustacheBlockRegex)) { // TODO: support helperChild being a block statement (use recursion?) |
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.
// TODO: support helperChild being a block statement (use recursion?)
[WIP] Add support for helpers, partials, & additional functionality -- DO NOT MERGE