cortexjs-legacy / cortex

The package manager for browsers
http://ctx.io
Other
224 stars 34 forks source link

[spec] build shrinkwrap.json into built js file #451

Closed villadora closed 10 years ago

villadora commented 10 years ago

do version fix during build, make a package as closure of all the information that it contains.

additional config value may added as shrinkwrap:

define('a@1.0.0', ['b@~1.0.0'], factory, {
   shrinkwrap: {
        'a@1.0.0': [ '1.0.0', {
               'b@~1.0.0': [ '1.0.1', {
                     'c@^1.2.0': ['1.3.0']
               }]
         }]
   }
});

which make shrinkwrap info only be contains in the package itself

As it's no longer json configs, shared objects can be represented as:

var a = ['1.0.0'];
{
    "b@1.0.0": [ "1.0.0": {
        "a@~1.0.0": a,
        "c@~0.1.0": [" 0.1.0", {
            "a@^1.0.0": a
        }]
    }]
}

and cyclic dependencies could be represented as:

var a = ['1.0.0', {}];
var b = ['1.0.0', { 'a@~1.0.0': a }];
a[1]['b@~1.0.0'] = b;

But this kind of code might be hard for auto generator, candidates can be:

For normal modules, the resolved map should flat, as a global object:

{
    "a": {
        "~1.0.0": "1.0.1",
        "^1.0.0": "1.2.0"
    }
}

Pros

kaelzhang commented 10 years ago

So, close for now