Add !export tag to end of module name #79

Closed
wants to merge 6 commits into
from

Conversation

Projects
None yet
2 participants

finds all declarations so that the module will
export strings found until the next export comment or until the end of
document with the name:"" attribute being the property of the exported
object

Sam Armstrong added some commits Feb 20, 2014

Sam Armstrong Add !export tag to end of module name
finds all <!-- export name:"" --> declarations so that the module will
export strings found until the next export comment or until the end of
document with the  name:"" attribute being the property of the exported
object
fa1abe7
Sam Armstrong Skip null names on !export, and allow strip and export to be used at …
…the same time

modified the export function to check if name was null and to skip if it
is, and now that export doesn't need end tags, there is no reason why
stripping out the header would cause an error if there were unmatched
beginning and ending tags.

Signed-off-by: Sam Armstrong <mail@samarmstrong.me>
da6896f
Sam Armstrong Regex only exports with name
Modified regex to only match exports with name and got rid of null check
for matches without name, and also matched the name with both 'name:'
and 'name='
95f0ec8

@jrburke @requirejs @millermedeiros
What do you guys think of my changes. Should this be it's own plugin? do you like the idea of exports for text documents? Should I be making this it's own plugin? This is quite heavily dependent on Text and any changes made to this plugin would work on mine. Is there anything else you'd like me to post about these changes?

DrSammyD closed this Feb 20, 2014

DrSammyD reopened this Feb 20, 2014

@DrSammyD DrSammyD commented on an outdated diff Feb 20, 2014

@@ -13,6 +13,7 @@ define(['module'], function (module) {
var text, fs, Cc, Ci, xpcIsWindows,
progIds = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'],
+ exportRegExp = /<!--\s*?export\s*?name[^>]*>([\s\S]*?)(?=<!--\s*?export[^>]*>)|(?:<!--\s*?export\s*?name[^>]*>[\s\S]*)/g,
@DrSammyD

DrSammyD Feb 20, 2014

Here is an example of how the regex works

Sam Armstrong added some commits Feb 20, 2014

Sam Armstrong Code cleanup
Removed some extra lines
12b22ec
Sam Armstrong Regex requires a value inside name
Made the regex require matching string notation marks and a value inside
of the string that starts with [a-zA-Z] and can contain [a-zA-Z0-9] and
will end at any valid export comment or end of file
6f35df8
Sam Armstrong Removed redundant Regex characters
The "."s at the end of the regex were redundant.
dc93d62
Owner

DrSammyD commented on text.js in dc93d62 Feb 21, 2014

Here is an example of how the regex works

Owner

jrburke commented Mar 10, 2014

I think this is specialized enough that it should just be a separate loader plugin. I suggest maintaining your fork of it, and you can add it to the plugins list if you like.

jrburke closed this Mar 10, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment