Opened 6 years ago

Closed 4 years ago

#17120 closed defect (wontfix)

Missing a single whitespace causes Dojo build to not detect file as AMD capable

Reported by: phated Owned by: Rawld Gill
Priority: undecided Milestone: 1.11
Component: BuildSystem Version: 1.9.0
Keywords: Cc:
Blocked By: Blocking:

Description

Continued from github thread -

https://github.com/dojo/util/commit/fcb102212623084c6af552ce1a80bde8730c5167#commitcomment-3179313

Sometimes a library will go to great lengths to get their minified build as small as possible and still have correct AMD capabilities. Example being Lo-Dash. I understand the current benefit and use of the package.js and tagging AMD modules, but most libraries don't support it. Even if Lo-Dash supported package.js and tagging, Volo wouldn't grab the package.js because it is a single file module. I think Dojo's build process could be a bit more flexible here. Why does this RegEx? need such strict, arbitrary rules?

Change History (3)

comment:1 Changed 6 years ago by ben hockey

tagging can happen in places other than the package.js so whether or not a package includes package.js or a package manager never provided it is a moot point. you can inline the resourceTags in your build profile. here's an example of something i've done before - this inlines the resourceTags for a specific package but you can also put a resourceTags property at the top level of the profile (ie same level as packages in the example below) and it will apply to all packages that don't have one defined.

    packages: [
        'dijit',
        'dojo',
        'dojox',
        {
            name: 'rql',
            resourceTags: {
                test: function (filename) {
                    return (/\/test\//).test(filename);
                },
                amd: function (filename) {
                    return (/\.js$/).test(filename);
                }
            }
        }
    ]

this doesn't make the regular expression used in the build any more robust but this highlights exactly why you'd rather tell the builder that something is AMD when you know for sure that it is - regular expression parsing is not robust.

comment:2 Changed 6 years ago by Rawld Gill

Status: newassigned

@neonstalwart's analysis and fix is 100% on target.

@phated, I completely agree that the regex parsing is janky. If it had been my choice from the beginning, I would have never implemented such a system. However, new the 1.x builder (as of 1.7) needed to follow legacy algorithms to avoid breaking lots of stuff already out there.

I'll leave the ticket open for further commentary, but unless there is no other workaround possible, I don't intend on messing with the regex's.

comment:3 Changed 4 years ago by dylan

Milestone: tbd1.11
Resolution: wontfix
Status: assignedclosed
Note: See TracTickets for help on using tickets.