pombreda / base2

Automatically exported from code.google.com/p/base2
0 stars 0 forks source link

The current packaging system does not work with minimised scripts. #126

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The current system uses eval(this.exports) to export symbols from a closure. 
This does not work correctly when a package is minimised using anything other 
than packer.

A new packaging system is required that can survive minification.

Original issue reported on code.google.com by dean.edw...@gmail.com on 5 Jan 2010 at 2:01

GoogleCodeExporter commented 9 years ago
The new packaging system will be very similar to the old one. Here is a 
template:

base2.exec(function(namespace) {

  eval(namespace); // optional

  var PI = 3.14;

  var Shape = Base.extend({
    ...
  });

  var Circle = Shape.extend({
    ...
  });

  var Rect = Shape.extend({
    ...
  });

  var shapes = new Package({
    name: "shapes",
    version: "2.0",

    exports: {
      PI: PI,
      Shape: Shape,
      Circle: Circle,
      Rect: Rect
    }
  });

});

There will also be base2.require() which will lazy-load other packages/scripts:

base2.require("dom", function(namespace) {

  eval(namespace); // optional

  // package definition

});

Original comment by dean.edw...@gmail.com on 5 Jan 2010 at 2:10

GoogleCodeExporter commented 9 years ago
Fixing this will mean that base2 will move to version 2.0 instead of version 
1.1.

Original comment by dean.edw...@gmail.com on 9 Jan 2010 at 6:17