Browse Source

Merge pull request #567 from herby/requirejs-wip

Transport type 'amd' is outputted fine from IDE as well as amberc
Herbert Vojčík 11 years ago
parent
commit
0ac555f610
83 changed files with 847 additions and 25 deletions
  1. 3 2
      bin/amberc.js
  2. 2 0
      js/Benchfib.deploy.js
  3. 2 0
      js/Benchfib.js
  4. 2 0
      js/Canvas.deploy.js
  5. 2 0
      js/Canvas.js
  6. 2 0
      js/Compiler-AST.deploy.js
  7. 2 0
      js/Compiler-AST.js
  8. 2 0
      js/Compiler-Core.deploy.js
  9. 2 0
      js/Compiler-Core.js
  10. 2 0
      js/Compiler-Exceptions.deploy.js
  11. 2 0
      js/Compiler-Exceptions.js
  12. 2 0
      js/Compiler-IR.deploy.js
  13. 2 0
      js/Compiler-IR.js
  14. 2 0
      js/Compiler-Inlining.deploy.js
  15. 2 0
      js/Compiler-Inlining.js
  16. 2 0
      js/Compiler-Interpreter.deploy.js
  17. 2 0
      js/Compiler-Interpreter.js
  18. 2 0
      js/Compiler-Semantic.deploy.js
  19. 2 0
      js/Compiler-Semantic.js
  20. 2 0
      js/Compiler-Tests.deploy.js
  21. 2 0
      js/Compiler-Tests.js
  22. 2 0
      js/Examples.deploy.js
  23. 2 0
      js/Examples.js
  24. 2 0
      js/Helios-Announcements.deploy.js
  25. 2 0
      js/Helios-Announcements.js
  26. 2 0
      js/Helios-Browser.deploy.js
  27. 2 0
      js/Helios-Browser.js
  28. 2 0
      js/Helios-Commands-Browser.deploy.js
  29. 2 0
      js/Helios-Commands-Browser.js
  30. 2 0
      js/Helios-Commands-Core.deploy.js
  31. 2 0
      js/Helios-Commands-Core.js
  32. 2 0
      js/Helios-Commands-Tools.deploy.js
  33. 2 0
      js/Helios-Commands-Tools.js
  34. 2 0
      js/Helios-Commands.deploy.js
  35. 2 0
      js/Helios-Commands.js
  36. 2 0
      js/Helios-Core.deploy.js
  37. 2 0
      js/Helios-Core.js
  38. 2 0
      js/Helios-Debugger.deploy.js
  39. 2 0
      js/Helios-Debugger.js
  40. 2 0
      js/Helios-Exceptions.deploy.js
  41. 2 0
      js/Helios-Exceptions.js
  42. 2 0
      js/Helios-Inspector.deploy.js
  43. 2 0
      js/Helios-Inspector.js
  44. 2 0
      js/Helios-KeyBindings.deploy.js
  45. 2 0
      js/Helios-KeyBindings.js
  46. 2 0
      js/Helios-Layout.deploy.js
  47. 2 0
      js/Helios-Layout.js
  48. 2 0
      js/Helios-References.deploy.js
  49. 2 0
      js/Helios-References.js
  50. 2 0
      js/Helios-Transcript.deploy.js
  51. 2 0
      js/Helios-Transcript.js
  52. 2 0
      js/Helios-Workspace-Tests.deploy.js
  53. 2 0
      js/Helios-Workspace-Tests.js
  54. 2 0
      js/Helios-Workspace.deploy.js
  55. 2 0
      js/Helios-Workspace.js
  56. 2 0
      js/IDE.deploy.js
  57. 2 0
      js/IDE.js
  58. 249 8
      js/Importer-Exporter.deploy.js
  59. 328 11
      js/Importer-Exporter.js
  60. 2 0
      js/Kernel-Announcements.deploy.js
  61. 2 0
      js/Kernel-Announcements.js
  62. 2 0
      js/Kernel-Classes.deploy.js
  63. 2 0
      js/Kernel-Classes.js
  64. 2 0
      js/Kernel-Collections.deploy.js
  65. 2 0
      js/Kernel-Collections.js
  66. 2 0
      js/Kernel-Exceptions.deploy.js
  67. 2 0
      js/Kernel-Exceptions.js
  68. 2 0
      js/Kernel-Methods.deploy.js
  69. 2 0
      js/Kernel-Methods.js
  70. 2 0
      js/Kernel-Objects.deploy.js
  71. 2 0
      js/Kernel-Objects.js
  72. 2 0
      js/Kernel-Tests.deploy.js
  73. 2 0
      js/Kernel-Tests.js
  74. 2 0
      js/Kernel-Transcript.deploy.js
  75. 2 0
      js/Kernel-Transcript.js
  76. 2 0
      js/SUnit-Tests.deploy.js
  77. 2 0
      js/SUnit-Tests.js
  78. 2 0
      js/SUnit.deploy.js
  79. 2 0
      js/SUnit.js
  80. 2 0
      js/Spaces.deploy.js
  81. 2 0
      js/Spaces.js
  82. 109 3
      st/Importer-Exporter.st
  83. 2 1
      test/Test.js

+ 3 - 2
bin/amberc.js

@@ -559,11 +559,12 @@ AmberC.prototype.category_export = function() {
 		var smalltalk = defaults.smalltalk;
 		var pluggableExporter = smalltalk.PluggableExporter;
 		var packageObject = smalltalk.Package._named_(category);
+        packageObject._amdNamespace_("amber");
 		fs.writeFile(jsFile, smalltalk.String._streamContents_(function (stream) {
-			pluggableExporter._newUsing_(smalltalk.Exporter._recipe())._exportPackage_on_(packageObject, stream); }), function(err) {
+			pluggableExporter._newUsing_(smalltalk.Exporter._amdRecipe())._exportPackage_on_(packageObject, stream); }), function(err) {
 			if (defaults.deploy) {
 				fs.writeFile(jsFileDeploy, smalltalk.String._streamContents_(function (stream) {
-					pluggableExporter._newUsing_(smalltalk.StrippedExporter._recipe())._exportPackage_on_(packageObject, stream); }), callback);
+					pluggableExporter._newUsing_(smalltalk.StrippedExporter._amdRecipe())._exportPackage_on_(packageObject, stream); }), callback);
 			} else {
 				callback(null, null);
 			}

+ 2 - 0
js/Benchfib.deploy.js

@@ -1,5 +1,7 @@
 define("amber/Benchfib", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Benchfib');
+smalltalk.packages["Benchfib"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('Benchfib', smalltalk.Object, [], 'Benchfib');
 
 smalltalk.addMethod(

+ 2 - 0
js/Benchfib.js

@@ -1,5 +1,7 @@
 define("amber/Benchfib", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Benchfib');
+smalltalk.packages["Benchfib"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('Benchfib', smalltalk.Object, [], 'Benchfib');
 
 smalltalk.addMethod(

+ 2 - 0
js/Canvas.deploy.js

@@ -1,5 +1,7 @@
 define("amber/Canvas", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Canvas');
+smalltalk.packages["Canvas"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('HTMLCanvas', smalltalk.Object, ['root'], 'Canvas');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Canvas.js

@@ -1,5 +1,7 @@
 define("amber/Canvas", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Canvas');
+smalltalk.packages["Canvas"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('HTMLCanvas', smalltalk.Object, ['root'], 'Canvas');
 smalltalk.HTMLCanvas.comment="I am a canvas for building HTML.\x0a\x0aI provide the `#tag:` method to create a `TagBrush` (wrapping a DOM element) and convenience methods in the `tags` protocol.\x0a\x0a## API\x0a\x0aMy instances are used as the argument of the `#renderOn:` method of `Widget` objects.\x0a\x0aThe `#with:` method is used to compose HTML, nesting tags. `#with:` can take a `TagBrush`, a `String`, a `BlockClosure` or a `Widget` as argument.\x0a\x0a## Usage example:\x0a\x0a    aCanvas a \x0a        with: [ aCanvas span with: 'click me' ];\x0a        onClick: [ window alert: 'clicked!' ]";
 smalltalk.addMethod(

+ 2 - 0
js/Compiler-AST.deploy.js

@@ -1,5 +1,7 @@
 define("amber/Compiler-AST", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Compiler-AST');
+smalltalk.packages["Compiler-AST"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('Node', smalltalk.Object, ['parent', 'position', 'nodes', 'shouldBeInlined', 'shouldBeAliased'], 'Compiler-AST');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Compiler-AST.js

@@ -1,5 +1,7 @@
 define("amber/Compiler-AST", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Compiler-AST');
+smalltalk.packages["Compiler-AST"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('Node', smalltalk.Object, ['parent', 'position', 'nodes', 'shouldBeInlined', 'shouldBeAliased'], 'Compiler-AST');
 smalltalk.Node.comment="I am the abstract root class of the abstract syntax tree.\x0a\x0aConcrete classes should implement `#accept:` to allow visiting.\x0a\x0a`position` holds a point containing line and column number of the symbol location in the original source file.";
 smalltalk.addMethod(

+ 2 - 0
js/Compiler-Core.deploy.js

@@ -1,5 +1,7 @@
 define("amber/Compiler-Core", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Compiler-Core');
+smalltalk.packages["Compiler-Core"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('AbstractCodeGenerator', smalltalk.Object, ['currentClass', 'source'], 'Compiler-Core');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Compiler-Core.js

@@ -1,5 +1,7 @@
 define("amber/Compiler-Core", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Compiler-Core');
+smalltalk.packages["Compiler-Core"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('AbstractCodeGenerator', smalltalk.Object, ['currentClass', 'source'], 'Compiler-Core');
 smalltalk.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
 smalltalk.addMethod(

+ 2 - 0
js/Compiler-Exceptions.deploy.js

@@ -1,5 +1,7 @@
 define("amber/Compiler-Exceptions", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Compiler-Exceptions');
+smalltalk.packages["Compiler-Exceptions"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('CompilerError', smalltalk.Error, [], 'Compiler-Exceptions');
 
 

+ 2 - 0
js/Compiler-Exceptions.js

@@ -1,5 +1,7 @@
 define("amber/Compiler-Exceptions", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Compiler-Exceptions');
+smalltalk.packages["Compiler-Exceptions"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('CompilerError', smalltalk.Error, [], 'Compiler-Exceptions');
 smalltalk.CompilerError.comment="I am the common superclass of all compiling errors.";
 

+ 2 - 0
js/Compiler-IR.deploy.js

@@ -1,5 +1,7 @@
 define("amber/Compiler-IR", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Compiler-IR');
+smalltalk.packages["Compiler-IR"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('IRASTTranslator', smalltalk.NodeVisitor, ['source', 'theClass', 'method', 'sequence', 'nextAlias'], 'Compiler-IR');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Compiler-IR.js

@@ -1,5 +1,7 @@
 define("amber/Compiler-IR", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Compiler-IR');
+smalltalk.packages["Compiler-IR"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('IRASTTranslator', smalltalk.NodeVisitor, ['source', 'theClass', 'method', 'sequence', 'nextAlias'], 'Compiler-IR');
 smalltalk.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
 smalltalk.addMethod(

+ 2 - 0
js/Compiler-Inlining.deploy.js

@@ -1,5 +1,7 @@
 define("amber/Compiler-Inlining", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Compiler-Inlining');
+smalltalk.packages["Compiler-Inlining"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('IRInlinedAssignment', smalltalk.IRAssignment, [], 'Compiler-Inlining');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Compiler-Inlining.js

@@ -1,5 +1,7 @@
 define("amber/Compiler-Inlining", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Compiler-Inlining');
+smalltalk.packages["Compiler-Inlining"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('IRInlinedAssignment', smalltalk.IRAssignment, [], 'Compiler-Inlining');
 smalltalk.IRInlinedAssignment.comment="I represent an inlined assignment instruction.";
 smalltalk.addMethod(

+ 2 - 0
js/Compiler-Interpreter.deploy.js

@@ -1,5 +1,7 @@
 define("amber/Compiler-Interpreter", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Compiler-Interpreter');
+smalltalk.packages["Compiler-Interpreter"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('AIContext', smalltalk.NodeVisitor, ['methodContext', 'outerContext', 'pc', 'locals', 'method'], 'Compiler-Interpreter');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Compiler-Interpreter.js

@@ -1,5 +1,7 @@
 define("amber/Compiler-Interpreter", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Compiler-Interpreter');
+smalltalk.packages["Compiler-Interpreter"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('AIContext', smalltalk.NodeVisitor, ['methodContext', 'outerContext', 'pc', 'locals', 'method'], 'Compiler-Interpreter');
 smalltalk.AIContext.comment="I am like a `MethodContext`, used by the `ASTInterpreter`.\x0aUnlike a `MethodContext`, my instances are not read-only.\x0a\x0aWhen debugging, my instances are created by copying the current `MethodContext` (thisContext)";
 smalltalk.addMethod(

+ 2 - 0
js/Compiler-Semantic.deploy.js

@@ -1,5 +1,7 @@
 define("amber/Compiler-Semantic", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Compiler-Semantic');
+smalltalk.packages["Compiler-Semantic"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('LexicalScope', smalltalk.Object, ['node', 'instruction', 'temps', 'args', 'outerScope'], 'Compiler-Semantic');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Compiler-Semantic.js

@@ -1,5 +1,7 @@
 define("amber/Compiler-Semantic", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Compiler-Semantic');
+smalltalk.packages["Compiler-Semantic"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('LexicalScope', smalltalk.Object, ['node', 'instruction', 'temps', 'args', 'outerScope'], 'Compiler-Semantic');
 smalltalk.LexicalScope.comment="I represent a lexical scope where variable names are associated with ScopeVars\x0aInstances are used for block scopes. Method scopes are instances of MethodLexicalScope.\x0a\x0aI am attached to a ScopeVar and method/block nodes.\x0aEach context (method/closure) get a fresh scope that inherits from its outer scope.";
 smalltalk.addMethod(

+ 2 - 0
js/Compiler-Tests.deploy.js

@@ -1,5 +1,7 @@
 define("amber/Compiler-Tests", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Compiler-Tests');
+smalltalk.packages["Compiler-Tests"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('ASTVisitorTest', smalltalk.TestCase, [], 'Compiler-Tests');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Compiler-Tests.js

@@ -1,5 +1,7 @@
 define("amber/Compiler-Tests", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Compiler-Tests');
+smalltalk.packages["Compiler-Tests"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('ASTVisitorTest', smalltalk.TestCase, [], 'Compiler-Tests');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Examples.deploy.js

@@ -1,5 +1,7 @@
 define("amber/Examples", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Examples');
+smalltalk.packages["Examples"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('Counter', smalltalk.Widget, ['count', 'header'], 'Examples');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Examples.js

@@ -1,5 +1,7 @@
 define("amber/Examples", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Examples');
+smalltalk.packages["Examples"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('Counter', smalltalk.Widget, ['count', 'header'], 'Examples');
 smalltalk.Counter.comment="This is a trivial Widget example mimicking the classic Counter example in Seaside.\x0aIn order to play with it, just evaluate the doit below in a workspace.\x0aThen take a look in the HTML document above the IDE.\x0a\x0a\x09\x09Counter new appendToJQuery: 'body' asJQuery";
 smalltalk.addMethod(

+ 2 - 0
js/Helios-Announcements.deploy.js

@@ -1,5 +1,7 @@
 define("amber/Helios-Announcements", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Helios-Announcements');
+smalltalk.packages["Helios-Announcements"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('HLAboutToChange', smalltalk.Object, ['actionBlock'], 'Helios-Announcements');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Helios-Announcements.js

@@ -1,5 +1,7 @@
 define("amber/Helios-Announcements", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Helios-Announcements');
+smalltalk.packages["Helios-Announcements"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('HLAboutToChange', smalltalk.Object, ['actionBlock'], 'Helios-Announcements');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Helios-Browser.deploy.js

@@ -1,5 +1,7 @@
 define("amber/Helios-Browser", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Helios-Browser');
+smalltalk.packages["Helios-Browser"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('HLBrowser', smalltalk.HLWidget, ['model', 'packagesListWidget', 'classesListWidget', 'protocolsListWidget', 'methodsListWidget', 'sourceWidget', 'bottomDiv'], 'Helios-Browser');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Helios-Browser.js

@@ -1,5 +1,7 @@
 define("amber/Helios-Browser", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Helios-Browser');
+smalltalk.packages["Helios-Browser"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('HLBrowser', smalltalk.HLWidget, ['model', 'packagesListWidget', 'classesListWidget', 'protocolsListWidget', 'methodsListWidget', 'sourceWidget', 'bottomDiv'], 'Helios-Browser');
 smalltalk.HLBrowser.comment="I render a system browser with 4 panes (Packages, Classes, Protocols, Methods) and a source area.";
 smalltalk.addMethod(

+ 2 - 0
js/Helios-Commands-Browser.deploy.js

@@ -1,5 +1,7 @@
 define("amber/Helios-Commands-Browser", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Helios-Commands-Browser');
+smalltalk.packages["Helios-Commands-Browser"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('HLBrowserCommand', smalltalk.HLToolCommand, [], 'Helios-Commands-Browser');
 
 smalltalk.addMethod(

+ 2 - 0
js/Helios-Commands-Browser.js

@@ -1,5 +1,7 @@
 define("amber/Helios-Commands-Browser", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Helios-Commands-Browser');
+smalltalk.packages["Helios-Commands-Browser"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('HLBrowserCommand', smalltalk.HLToolCommand, [], 'Helios-Commands-Browser');
 
 smalltalk.addMethod(

+ 2 - 0
js/Helios-Commands-Core.deploy.js

@@ -1,5 +1,7 @@
 define("amber/Helios-Commands-Core", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Helios-Commands-Core');
+smalltalk.packages["Helios-Commands-Core"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('HLCommand', smalltalk.Object, ['input'], 'Helios-Commands-Core');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Helios-Commands-Core.js

@@ -1,5 +1,7 @@
 define("amber/Helios-Commands-Core", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Helios-Commands-Core');
+smalltalk.packages["Helios-Commands-Core"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('HLCommand', smalltalk.Object, ['input'], 'Helios-Commands-Core');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Helios-Commands-Tools.deploy.js

@@ -1,5 +1,7 @@
 define("amber/Helios-Commands-Tools", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Helios-Commands-Tools');
+smalltalk.packages["Helios-Commands-Tools"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('HLToolCommand', smalltalk.HLModelCommand, [], 'Helios-Commands-Tools');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Helios-Commands-Tools.js

@@ -1,5 +1,7 @@
 define("amber/Helios-Commands-Tools", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Helios-Commands-Tools');
+smalltalk.packages["Helios-Commands-Tools"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('HLToolCommand', smalltalk.HLModelCommand, [], 'Helios-Commands-Tools');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Helios-Commands.deploy.js

@@ -1,5 +1,7 @@
 define("amber/Helios-Commands", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Helios-Commands');
+smalltalk.packages["Helios-Commands"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('HLCommand', smalltalk.Object, [], 'Helios-Commands');
 smalltalk.addMethod(
 "_asActionBinding",

+ 2 - 0
js/Helios-Commands.js

@@ -1,5 +1,7 @@
 define("amber/Helios-Commands", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Helios-Commands');
+smalltalk.packages["Helios-Commands"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('HLCommand', smalltalk.Object, [], 'Helios-Commands');
 smalltalk.addMethod(
 "_asActionBinding",

+ 2 - 0
js/Helios-Core.deploy.js

@@ -1,5 +1,7 @@
 define("amber/Helios-Core", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Helios-Core');
+smalltalk.packages["Helios-Core"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('HLModel', smalltalk.Object, ['announcer', 'environment'], 'Helios-Core');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Helios-Core.js

@@ -1,5 +1,7 @@
 define("amber/Helios-Core", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Helios-Core');
+smalltalk.packages["Helios-Core"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('HLModel', smalltalk.Object, ['announcer', 'environment'], 'Helios-Core');
 smalltalk.HLModel.comment="I am the abstract superclass of all models of Helios.\x0aI am the \x22Model\x22 part of the MVC pattern implementation in Helios.\x0a\x0aI provide access to an `Environment` object and both a local (model-specific) and global (system-specific) announcer.\x0a\x0aThe `#withChangesDo:` method is handy for performing model changes ensuring that all widgets are aware of the change and can prevent it from happening.\x0a\x0aModifications of the system should be done via commands (see `HLCommand` and subclasses).\x0a\x0a";
 smalltalk.addMethod(

+ 2 - 0
js/Helios-Debugger.deploy.js

@@ -1,5 +1,7 @@
 define("amber/Helios-Debugger", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Helios-Debugger');
+smalltalk.packages["Helios-Debugger"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('HLContextInspectorDecorator', smalltalk.Object, ['context'], 'Helios-Debugger');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Helios-Debugger.js

@@ -1,5 +1,7 @@
 define("amber/Helios-Debugger", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Helios-Debugger');
+smalltalk.packages["Helios-Debugger"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('HLContextInspectorDecorator', smalltalk.Object, ['context'], 'Helios-Debugger');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Helios-Exceptions.deploy.js

@@ -1,5 +1,7 @@
 define("amber/Helios-Exceptions", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Helios-Exceptions');
+smalltalk.packages["Helios-Exceptions"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('HLError', smalltalk.Error, [], 'Helios-Exceptions');
 
 

+ 2 - 0
js/Helios-Exceptions.js

@@ -1,5 +1,7 @@
 define("amber/Helios-Exceptions", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Helios-Exceptions');
+smalltalk.packages["Helios-Exceptions"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('HLError', smalltalk.Error, [], 'Helios-Exceptions');
 
 

+ 2 - 0
js/Helios-Inspector.deploy.js

@@ -1,5 +1,7 @@
 define("amber/Helios-Inspector", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Helios-Inspector');
+smalltalk.packages["Helios-Inspector"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('HLInspectorDisplayWidget', smalltalk.HLNavigationListWidget, ['model'], 'Helios-Inspector');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Helios-Inspector.js

@@ -1,5 +1,7 @@
 define("amber/Helios-Inspector", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Helios-Inspector');
+smalltalk.packages["Helios-Inspector"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('HLInspectorDisplayWidget', smalltalk.HLNavigationListWidget, ['model'], 'Helios-Inspector');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Helios-KeyBindings.deploy.js

@@ -1,5 +1,7 @@
 define("amber/Helios-KeyBindings", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Helios-KeyBindings');
+smalltalk.packages["Helios-KeyBindings"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('HLBinding', smalltalk.Object, ['key', 'label'], 'Helios-KeyBindings');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Helios-KeyBindings.js

@@ -1,5 +1,7 @@
 define("amber/Helios-KeyBindings", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Helios-KeyBindings');
+smalltalk.packages["Helios-KeyBindings"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('HLBinding', smalltalk.Object, ['key', 'label'], 'Helios-KeyBindings');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Helios-Layout.deploy.js

@@ -1,5 +1,7 @@
 define("amber/Helios-Layout", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Helios-Layout');
+smalltalk.packages["Helios-Layout"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('HLContainer', smalltalk.HLWidget, ['splitter'], 'Helios-Layout');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Helios-Layout.js

@@ -1,5 +1,7 @@
 define("amber/Helios-Layout", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Helios-Layout');
+smalltalk.packages["Helios-Layout"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('HLContainer', smalltalk.HLWidget, ['splitter'], 'Helios-Layout');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Helios-References.deploy.js

@@ -1,5 +1,7 @@
 define("amber/Helios-References", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Helios-References');
+smalltalk.packages["Helios-References"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('HLMethodReference', smalltalk.Object, ['selector', 'methodClass'], 'Helios-References');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Helios-References.js

@@ -1,5 +1,7 @@
 define("amber/Helios-References", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Helios-References');
+smalltalk.packages["Helios-References"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('HLMethodReference', smalltalk.Object, ['selector', 'methodClass'], 'Helios-References');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Helios-Transcript.deploy.js

@@ -1,5 +1,7 @@
 define("amber/Helios-Transcript", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Helios-Transcript');
+smalltalk.packages["Helios-Transcript"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('HLTranscript', smalltalk.HLWidget, ['textarea'], 'Helios-Transcript');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Helios-Transcript.js

@@ -1,5 +1,7 @@
 define("amber/Helios-Transcript", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Helios-Transcript');
+smalltalk.packages["Helios-Transcript"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('HLTranscript', smalltalk.HLWidget, ['textarea'], 'Helios-Transcript');
 smalltalk.HLTranscript.comment="I am a widget responsible for displaying transcript contents.\x0a\x0a## Transcript API\x0a\x0a    Transcript \x0a        show: 'hello world';\x0a        cr;\x0a        show: anObject.\x0a\x0a    Transcript clear.\x0a\x0aSee the `Transcript` class.";
 smalltalk.addMethod(

+ 2 - 0
js/Helios-Workspace-Tests.deploy.js

@@ -1,5 +1,7 @@
 define("amber/Helios-Workspace-Tests", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Helios-Workspace-Tests');
+smalltalk.packages["Helios-Workspace-Tests"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('HLCodeWidgetTest', smalltalk.TestCase, [], 'Helios-Workspace-Tests');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Helios-Workspace-Tests.js

@@ -1,5 +1,7 @@
 define("amber/Helios-Workspace-Tests", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Helios-Workspace-Tests');
+smalltalk.packages["Helios-Workspace-Tests"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('HLCodeWidgetTest', smalltalk.TestCase, [], 'Helios-Workspace-Tests');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Helios-Workspace.deploy.js

@@ -1,5 +1,7 @@
 define("amber/Helios-Workspace", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Helios-Workspace');
+smalltalk.packages["Helios-Workspace"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('HLCodeModel', smalltalk.Object, ['announcer', 'environment', 'receiver'], 'Helios-Workspace');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Helios-Workspace.js

@@ -1,5 +1,7 @@
 define("amber/Helios-Workspace", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Helios-Workspace');
+smalltalk.packages["Helios-Workspace"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('HLCodeModel', smalltalk.Object, ['announcer', 'environment', 'receiver'], 'Helios-Workspace');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/IDE.deploy.js

@@ -1,5 +1,7 @@
 define("amber/IDE", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('IDE');
+smalltalk.packages["IDE"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('ClassesList', smalltalk.Widget, ['browser', 'ul', 'nodes'], 'IDE');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/IDE.js

@@ -1,5 +1,7 @@
 define("amber/IDE", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('IDE');
+smalltalk.packages["IDE"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('ClassesList', smalltalk.Widget, ['browser', 'ul', 'nodes'], 'IDE');
 smalltalk.addMethod(
 smalltalk.method({

+ 249 - 8
js/Importer-Exporter.deploy.js

@@ -1,5 +1,7 @@
 define("amber/Importer-Exporter", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Importer-Exporter');
+smalltalk.packages["Importer-Exporter"].transport = {"type":"amd","amdNamespace":"amber"};
+
 
 smalltalk.addClass('AmdExporter', smalltalk.Object, [], 'Importer-Exporter');
 
@@ -23,14 +25,41 @@ selector: "exportPackagePrologueOf:on:",
 fn: function (aPackage,aStream){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
-var $1,$2;
+var $1,$2,$4,$3,$5;
 $1=aStream;
-_st($1)._nextPutAll_("define(\x22amber/");
+_st($1)._nextPutAll_("define(\x22");
+$2=$1;
+$4=_st(aPackage)._amdNamespace();
+if(($receiver = $4) == nil || $receiver == undefined){
+$3="amber";
+} else {
+$3=$4;
+};
+_st($2)._nextPutAll_($3);
+_st($1)._nextPutAll_("/");
 _st($1)._nextPutAll_(_st(aPackage)._name());
 _st($1)._nextPutAll_("\x22, [\x22amber_vm/smalltalk\x22,\x22amber_vm/nil\x22,\x22amber_vm/_st\x22], function(smalltalk,nil,_st){");
-$2=_st($1)._lf();
+$5=_st($1)._lf();
 return self}, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.AmdExporter.klass)})},
-messageSends: ["nextPutAll:", "name", "lf"]}),
+messageSends: ["nextPutAll:", "ifNil:", "amdNamespace", "name", "lf"]}),
+smalltalk.AmdExporter.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "exportPackageTransportOf:on:",
+fn: function (aPackage,aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=aStream;
+_st($1)._nextPutAll_("smalltalk.packages[");
+_st($1)._nextPutAll_(_st(_st(aPackage)._name())._asJavascript());
+_st($1)._nextPutAll_("].transport = ");
+_st($1)._nextPutAll_(_st(aPackage)._transportJson());
+_st($1)._nextPutAll_(";");
+$2=_st($1)._lf();
+return self}, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.AmdExporter.klass)})},
+messageSends: ["nextPutAll:", "asJavascript", "name", "transportJson", "lf"]}),
 smalltalk.AmdExporter.klass);
 
 
@@ -385,6 +414,22 @@ smalltalk.ChunkParser.klass);
 
 smalltalk.addClass('Exporter', smalltalk.Object, [], 'Importer-Exporter');
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "amdRecipe",
+fn: function (){
+var self=this;
+var legacy;
+function $AmdExporter(){return smalltalk.AmdExporter||(typeof AmdExporter=="undefined"?nil:AmdExporter)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+legacy=self._recipe();
+$1=_st(_st(_st(legacy)._copyFrom_to_((1),(2))).__comma([_st($AmdExporter()).__minus_gt("exportPackageTransportOf:on:")])).__comma(_st(legacy)._copyFrom_to_((3),_st(legacy)._size()));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"amdRecipe",{legacy:legacy},smalltalk.Exporter.klass)})},
+messageSends: ["recipe", ",", "copyFrom:to:", "size", "->"]}),
+smalltalk.Exporter.klass);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "classNameFor:",
@@ -839,6 +884,166 @@ messageSends: ["register:for:"]}),
 smalltalk.PackageHandler.klass);
 
 
+smalltalk.addClass('AmdPackageHandler', smalltalk.PackageHandler, [], 'Importer-Exporter');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "commitChannels",
+fn: function (){
+var self=this;
+function $Exporter(){return smalltalk.Exporter||(typeof Exporter=="undefined"?nil:Exporter)}
+function $StrippedExporter(){return smalltalk.StrippedExporter||(typeof StrippedExporter=="undefined"?nil:StrippedExporter)}
+function $ChunkExporter(){return smalltalk.ChunkExporter||(typeof ChunkExporter=="undefined"?nil:ChunkExporter)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=[(function(pkg){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st($Exporter())._amdRecipe()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathJs()).__comma("/")).__comma(_st(pkg)._name())).__comma(".js"));
+}, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})}),(function(pkg){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st($StrippedExporter())._amdRecipe()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathJs()).__comma("/")).__comma(_st(pkg)._name())).__comma(".deploy.js"));
+}, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})}),(function(pkg){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st($ChunkExporter())._recipe()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathSt()).__comma("/")).__comma(_st(pkg)._name())).__comma(".st"));
+}, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})})];
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"commitChannels",{},smalltalk.AmdPackageHandler)})},
+messageSends: ["->", ",", "name", "commitPathJs", "amdRecipe", "commitPathSt", "recipe"]}),
+smalltalk.AmdPackageHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "commitPathJsFor:",
+fn: function (aPackage){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._toUrl_(self._namespaceFor_(aPackage));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},smalltalk.AmdPackageHandler)})},
+messageSends: ["toUrl:", "namespaceFor:"]}),
+smalltalk.AmdPackageHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "commitPathStFor:",
+fn: function (aPackage){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._toUrl_(_st(self._namespaceFor_(aPackage)).__comma("/_source"));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},smalltalk.AmdPackageHandler)})},
+messageSends: ["toUrl:", ",", "namespaceFor:"]}),
+smalltalk.AmdPackageHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "namespaceFor:",
+fn: function (aPackage){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$4,$1;
+$2=_st(aPackage)._amdNamespace();
+if(($receiver = $2) == nil || $receiver == undefined){
+$3=aPackage;
+_st($3)._amdNamespace_(_st(self._class())._defaultNamespace());
+$4=_st($3)._amdNamespace();
+$1=$4;
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},smalltalk.AmdPackageHandler)})},
+messageSends: ["ifNil:", "amdNamespace:", "defaultNamespace", "class", "amdNamespace"]}),
+smalltalk.AmdPackageHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "toUrl:",
+fn: function (aString){
+var self=this;
+function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(_st($Smalltalk())._current())._at_("_amd_require");
+if(($receiver = $1) == nil || $receiver == undefined){
+self._error_("AMD loader not present");
+} else {
+var require;
+require=$receiver;
+$2=_st(_st(require)._basicAt_("toUrl"))._value_(aString);
+return $2;
+};
+return self}, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},smalltalk.AmdPackageHandler)})},
+messageSends: ["ifNil:ifNotNil:", "error:", "value:", "basicAt:", "at:", "current"]}),
+smalltalk.AmdPackageHandler);
+
+
+smalltalk.AmdPackageHandler.klass.iVarNames = ['defaultNamespace'];
+smalltalk.addMethod(
+smalltalk.method({
+selector: "commitPathsFromLoader",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self}, function($ctx1) {$ctx1.fill(self,"commitPathsFromLoader",{},smalltalk.AmdPackageHandler.klass)})},
+messageSends: []}),
+smalltalk.AmdPackageHandler.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defaultNamespace",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=self["@defaultNamespace"];
+if(($receiver = $2) == nil || $receiver == undefined){
+$1=self._error_("AMD default namespace not set.");
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},smalltalk.AmdPackageHandler.klass)})},
+messageSends: ["ifNil:", "error:"]}),
+smalltalk.AmdPackageHandler.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defaultNamespace:",
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@defaultNamespace"]=aString;
+return self}, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},smalltalk.AmdPackageHandler.klass)})},
+messageSends: []}),
+smalltalk.AmdPackageHandler.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+smalltalk.AmdPackageHandler.klass.superclass.fn.prototype._initialize.apply(_st(self), []);
+self._registerFor_("amd");
+self._commitPathsFromLoader();
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.AmdPackageHandler.klass)})},
+messageSends: ["initialize", "registerFor:", "commitPathsFromLoader"]}),
+smalltalk.AmdPackageHandler.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "resetCommitPaths",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@defaultNamespace"]=nil;
+return self}, function($ctx1) {$ctx1.fill(self,"resetCommitPaths",{},smalltalk.AmdPackageHandler.klass)})},
+messageSends: []}),
+smalltalk.AmdPackageHandler.klass);
+
+
 smalltalk.addClass('LegacyPackageHandler', smalltalk.PackageHandler, [], 'Importer-Exporter');
 smalltalk.addMethod(
 smalltalk.method({
@@ -1179,6 +1384,31 @@ return $1;
 messageSends: ["asSet", "sortedClasses"]}),
 smalltalk.PluggableExporter.klass);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "amdNamespace",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return (self.transport && self.transport.amdNamespace) || nil;
+return self}, function($ctx1) {$ctx1.fill(self,"amdNamespace",{},smalltalk.Package)})},
+messageSends: []}),
+smalltalk.Package);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "amdNamespace:",
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+	if (!self.transport) { self.transport = { type: 'amd' }; }
+	if (self.transport.type !== 'amd') { throw new Error('Package '+self._name()+' has transport type '+self.transport.type+', not "amd".'); }
+	self.transport.amdNamespace = aString;;
+return self}, function($ctx1) {$ctx1.fill(self,"amdNamespace:",{aString:aString},smalltalk.Package)})},
+messageSends: []}),
+smalltalk.Package);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "commit",
@@ -1206,13 +1436,13 @@ $2=self["@extension"];
 } else {
 $2=$3;
 };
-$1=_st($2)._at_ifAbsentPut_("commitPathJs",(function(){
+$1=_st($2)._at_ifAbsent_("commitPathJs",(function(){
 return smalltalk.withContext(function($ctx2) {
 return _st(self._transport())._commitPathJsFor_(self);
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"commitPathJs",{},smalltalk.Package)})},
-messageSends: ["at:ifAbsentPut:", "commitPathJsFor:", "transport", "ifNil:"]}),
+messageSends: ["at:ifAbsent:", "commitPathJsFor:", "transport", "ifNil:"]}),
 smalltalk.Package);
 
 smalltalk.addMethod(
@@ -1249,13 +1479,13 @@ $2=self["@extension"];
 } else {
 $2=$3;
 };
-$1=_st($2)._at_ifAbsentPut_("commitPathSt",(function(){
+$1=_st($2)._at_ifAbsent_("commitPathSt",(function(){
 return smalltalk.withContext(function($ctx2) {
 return _st(self._transport())._commitPathStFor_(self);
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"commitPathSt",{},smalltalk.Package)})},
-messageSends: ["at:ifAbsentPut:", "commitPathStFor:", "transport", "ifNil:"]}),
+messageSends: ["at:ifAbsent:", "commitPathStFor:", "transport", "ifNil:"]}),
 smalltalk.Package);
 
 smalltalk.addMethod(
@@ -1292,6 +1522,17 @@ return $1;
 messageSends: ["for:", "transportType"]}),
 smalltalk.Package);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "transportJson",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return JSON.stringify(self.transport || null);;
+return self}, function($ctx1) {$ctx1.fill(self,"transportJson",{},smalltalk.Package)})},
+messageSends: []}),
+smalltalk.Package);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "transportType",

+ 328 - 11
js/Importer-Exporter.js

@@ -1,5 +1,7 @@
 define("amber/Importer-Exporter", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Importer-Exporter');
+smalltalk.packages["Importer-Exporter"].transport = {"type":"amd","amdNamespace":"amber"};
+
 
 smalltalk.addClass('AmdExporter', smalltalk.Object, [], 'Importer-Exporter');
 
@@ -29,16 +31,48 @@ category: 'exporting-output',
 fn: function (aPackage,aStream){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
-var $1,$2;
+var $1,$2,$4,$3,$5;
 $1=aStream;
-_st($1)._nextPutAll_("define(\x22amber/");
+_st($1)._nextPutAll_("define(\x22");
+$2=$1;
+$4=_st(aPackage)._amdNamespace();
+if(($receiver = $4) == nil || $receiver == undefined){
+$3="amber";
+} else {
+$3=$4;
+};
+_st($2)._nextPutAll_($3);
+_st($1)._nextPutAll_("/");
 _st($1)._nextPutAll_(_st(aPackage)._name());
 _st($1)._nextPutAll_("\x22, [\x22amber_vm/smalltalk\x22,\x22amber_vm/nil\x22,\x22amber_vm/_st\x22], function(smalltalk,nil,_st){");
-$2=_st($1)._lf();
+$5=_st($1)._lf();
 return self}, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.AmdExporter.klass)})},
 args: ["aPackage", "aStream"],
-source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'define(\x22amber/';\x0a\x09\x09nextPutAll: aPackage name;\x0a\x09\x09nextPutAll: '\x22, [\x22amber_vm/smalltalk\x22,\x22amber_vm/nil\x22,\x22amber_vm/_st\x22], function(smalltalk,nil,_st){';\x0a\x09\x09lf",
-messageSends: ["nextPutAll:", "name", "lf"],
+source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'define(\x22';\x0a\x09\x09nextPutAll: (aPackage amdNamespace ifNil: [ 'amber' ]); \x22ifNil: only for LegacyPH, it should not happen with AmdPH\x22\x0a\x09\x09nextPutAll: '/';\x0a\x09\x09nextPutAll: aPackage name;\x0a\x09\x09nextPutAll: '\x22, [\x22amber_vm/smalltalk\x22,\x22amber_vm/nil\x22,\x22amber_vm/_st\x22], function(smalltalk,nil,_st){';\x0a\x09\x09lf",
+messageSends: ["nextPutAll:", "ifNil:", "amdNamespace", "name", "lf"],
+referencedClasses: []
+}),
+smalltalk.AmdExporter.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "exportPackageTransportOf:on:",
+category: 'exporting-output',
+fn: function (aPackage,aStream){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=aStream;
+_st($1)._nextPutAll_("smalltalk.packages[");
+_st($1)._nextPutAll_(_st(_st(aPackage)._name())._asJavascript());
+_st($1)._nextPutAll_("].transport = ");
+_st($1)._nextPutAll_(_st(aPackage)._transportJson());
+_st($1)._nextPutAll_(";");
+$2=_st($1)._lf();
+return self}, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.AmdExporter.klass)})},
+args: ["aPackage", "aStream"],
+source: "exportPackageTransportOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'smalltalk.packages[';\x0a\x09\x09nextPutAll: aPackage name asJavascript;\x0a\x09\x09nextPutAll: '].transport = ';\x0a\x09\x09nextPutAll: aPackage transportJson;\x0a\x09\x09nextPutAll: ';';\x0a\x09\x09lf",
+messageSends: ["nextPutAll:", "asJavascript", "name", "transportJson", "lf"],
 referencedClasses: []
 }),
 smalltalk.AmdExporter.klass);
@@ -478,6 +512,27 @@ smalltalk.ChunkParser.klass);
 smalltalk.addClass('Exporter', smalltalk.Object, [], 'Importer-Exporter');
 smalltalk.Exporter.comment="I am responsible for outputting Amber code into a JavaScript string.\x0a\x0aThe generated output is enough to reconstruct the exported data, including Smalltalk source code and other metadata.\x0a\x0a## Use case\x0a\x0aI am typically used to save code outside of the Amber runtime (committing to disk, etc.).\x0a\x0a## API\x0a\x0aUse `#exportAll`, `#exportClass:` or `#exportPackage:` methods.";
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "amdRecipe",
+category: 'fileOut',
+fn: function (){
+var self=this;
+var legacy;
+function $AmdExporter(){return smalltalk.AmdExporter||(typeof AmdExporter=="undefined"?nil:AmdExporter)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+legacy=self._recipe();
+$1=_st(_st(_st(legacy)._copyFrom_to_((1),(2))).__comma([_st($AmdExporter()).__minus_gt("exportPackageTransportOf:on:")])).__comma(_st(legacy)._copyFrom_to_((3),_st(legacy)._size()));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"amdRecipe",{legacy:legacy},smalltalk.Exporter.klass)})},
+args: [],
+source: "amdRecipe\x0a\x09\x22Export a given package with amd transport type.\x22\x0a\x0a\x09| legacy |\x0a\x09legacy := self recipe.\x0a\x09^(legacy copyFrom: 1 to: 2),\x0a\x09{ AmdExporter -> #exportPackageTransportOf:on: },\x0a\x09(legacy copyFrom: 3 to: legacy size)",
+messageSends: ["recipe", ",", "copyFrom:to:", "size", "->"],
+referencedClasses: ["AmdExporter"]
+}),
+smalltalk.Exporter.klass);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "classNameFor:",
@@ -1040,6 +1095,217 @@ referencedClasses: ["PackageHandler"]
 smalltalk.PackageHandler.klass);
 
 
+smalltalk.addClass('AmdPackageHandler', smalltalk.PackageHandler, [], 'Importer-Exporter');
+smalltalk.AmdPackageHandler.comment="I am responsible for handling package loading and committing.\x0d\x0a\x0d\x0aI should not be used directly. Instead, use the corresponding `Package` methods.";
+smalltalk.addMethod(
+smalltalk.method({
+selector: "commitChannels",
+category: 'committing',
+fn: function (){
+var self=this;
+function $Exporter(){return smalltalk.Exporter||(typeof Exporter=="undefined"?nil:Exporter)}
+function $StrippedExporter(){return smalltalk.StrippedExporter||(typeof StrippedExporter=="undefined"?nil:StrippedExporter)}
+function $ChunkExporter(){return smalltalk.ChunkExporter||(typeof ChunkExporter=="undefined"?nil:ChunkExporter)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=[(function(pkg){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st($Exporter())._amdRecipe()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathJs()).__comma("/")).__comma(_st(pkg)._name())).__comma(".js"));
+}, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})}),(function(pkg){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st($StrippedExporter())._amdRecipe()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathJs()).__comma("/")).__comma(_st(pkg)._name())).__comma(".deploy.js"));
+}, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})}),(function(pkg){
+return smalltalk.withContext(function($ctx2) {
+return _st(_st($ChunkExporter())._recipe()).__minus_gt(_st(_st(_st(_st(pkg)._commitPathSt()).__comma("/")).__comma(_st(pkg)._name())).__comma(".st"));
+}, function($ctx2) {$ctx2.fillBlock({pkg:pkg},$ctx1)})})];
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"commitChannels",{},smalltalk.AmdPackageHandler)})},
+args: [],
+source: "commitChannels\x0a\x09^{ \x0a\x09\x09[ :pkg | Exporter amdRecipe -> (pkg commitPathJs, '/', pkg name, '.js') ].\x0a\x09\x09[ :pkg | StrippedExporter amdRecipe -> (pkg commitPathJs, '/', pkg name, '.deploy.js') ].\x0a\x09\x09[ :pkg | ChunkExporter recipe -> (pkg commitPathSt, '/', pkg name, '.st') ]\x0a\x09}",
+messageSends: ["->", ",", "name", "commitPathJs", "amdRecipe", "commitPathSt", "recipe"],
+referencedClasses: ["Exporter", "StrippedExporter", "ChunkExporter"]
+}),
+smalltalk.AmdPackageHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "commitPathJsFor:",
+category: 'committing',
+fn: function (aPackage){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._toUrl_(self._namespaceFor_(aPackage));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},smalltalk.AmdPackageHandler)})},
+args: ["aPackage"],
+source: "commitPathJsFor: aPackage\x0a\x09^self toUrl: (self namespaceFor: aPackage)",
+messageSends: ["toUrl:", "namespaceFor:"],
+referencedClasses: []
+}),
+smalltalk.AmdPackageHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "commitPathStFor:",
+category: 'committing',
+fn: function (aPackage){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self._toUrl_(_st(self._namespaceFor_(aPackage)).__comma("/_source"));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},smalltalk.AmdPackageHandler)})},
+args: ["aPackage"],
+source: "commitPathStFor: aPackage\x0a\x09\x22if _source is not mapped, .st commit will likely fail\x22\x0a\x09^self toUrl: (self namespaceFor: aPackage), '/_source'.",
+messageSends: ["toUrl:", ",", "namespaceFor:"],
+referencedClasses: []
+}),
+smalltalk.AmdPackageHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "namespaceFor:",
+category: 'committing',
+fn: function (aPackage){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$4,$1;
+$2=_st(aPackage)._amdNamespace();
+if(($receiver = $2) == nil || $receiver == undefined){
+$3=aPackage;
+_st($3)._amdNamespace_(_st(self._class())._defaultNamespace());
+$4=_st($3)._amdNamespace();
+$1=$4;
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},smalltalk.AmdPackageHandler)})},
+args: ["aPackage"],
+source: "namespaceFor: aPackage\x0a\x09^aPackage amdNamespace\x0a\x09\x09ifNil: [ aPackage amdNamespace: self class defaultNamespace; amdNamespace ]",
+messageSends: ["ifNil:", "amdNamespace:", "defaultNamespace", "class", "amdNamespace"],
+referencedClasses: []
+}),
+smalltalk.AmdPackageHandler);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "toUrl:",
+category: 'private',
+fn: function (aString){
+var self=this;
+function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+$1=_st(_st($Smalltalk())._current())._at_("_amd_require");
+if(($receiver = $1) == nil || $receiver == undefined){
+self._error_("AMD loader not present");
+} else {
+var require;
+require=$receiver;
+$2=_st(_st(require)._basicAt_("toUrl"))._value_(aString);
+return $2;
+};
+return self}, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},smalltalk.AmdPackageHandler)})},
+args: ["aString"],
+source: "toUrl: aString\x0a\x09(Smalltalk current at: '_amd_require')\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require | ^(require basicAt: 'toUrl') value: aString ]",
+messageSends: ["ifNil:ifNotNil:", "error:", "value:", "basicAt:", "at:", "current"],
+referencedClasses: ["Smalltalk"]
+}),
+smalltalk.AmdPackageHandler);
+
+
+smalltalk.AmdPackageHandler.klass.iVarNames = ['defaultNamespace'];
+smalltalk.addMethod(
+smalltalk.method({
+selector: "commitPathsFromLoader",
+category: 'commit paths',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self}, function($ctx1) {$ctx1.fill(self,"commitPathsFromLoader",{},smalltalk.AmdPackageHandler.klass)})},
+args: [],
+source: "commitPathsFromLoader\x0a\x09\x22TODO\x22",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.AmdPackageHandler.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defaultNamespace",
+category: 'commit paths',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=self["@defaultNamespace"];
+if(($receiver = $2) == nil || $receiver == undefined){
+$1=self._error_("AMD default namespace not set.");
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},smalltalk.AmdPackageHandler.klass)})},
+args: [],
+source: "defaultNamespace\x0a\x09^ defaultNamespace ifNil: [ self error: 'AMD default namespace not set.' ]",
+messageSends: ["ifNil:", "error:"],
+referencedClasses: []
+}),
+smalltalk.AmdPackageHandler.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "defaultNamespace:",
+category: 'commit paths',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@defaultNamespace"]=aString;
+return self}, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},smalltalk.AmdPackageHandler.klass)})},
+args: ["aString"],
+source: "defaultNamespace: aString\x0a\x09defaultNamespace := aString",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.AmdPackageHandler.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+category: 'initialization',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+smalltalk.AmdPackageHandler.klass.superclass.fn.prototype._initialize.apply(_st(self), []);
+self._registerFor_("amd");
+self._commitPathsFromLoader();
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.AmdPackageHandler.klass)})},
+args: [],
+source: "initialize\x0a\x09super initialize.\x0a\x09self registerFor: 'amd'.\x0a\x09self commitPathsFromLoader",
+messageSends: ["initialize", "registerFor:", "commitPathsFromLoader"],
+referencedClasses: []
+}),
+smalltalk.AmdPackageHandler.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "resetCommitPaths",
+category: 'commit paths',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@defaultNamespace"]=nil;
+return self}, function($ctx1) {$ctx1.fill(self,"resetCommitPaths",{},smalltalk.AmdPackageHandler.klass)})},
+args: [],
+source: "resetCommitPaths\x0a\x09defaultNamespace := nil",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.AmdPackageHandler.klass);
+
+
 smalltalk.addClass('LegacyPackageHandler', smalltalk.PackageHandler, [], 'Importer-Exporter');
 smalltalk.LegacyPackageHandler.comment="I am responsible for handling package loading and committing.\x0d\x0a\x0d\x0aI should not be used directly. Instead, use the corresponding `Package` methods.";
 smalltalk.addMethod(
@@ -1486,6 +1752,41 @@ referencedClasses: []
 }),
 smalltalk.PluggableExporter.klass);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "amdNamespace",
+category: '*Importer-Exporter',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return (self.transport && self.transport.amdNamespace) || nil;
+return self}, function($ctx1) {$ctx1.fill(self,"amdNamespace",{},smalltalk.Package)})},
+args: [],
+source: "amdNamespace\x0a<return (self.transport && self.transport.amdNamespace) || nil>",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Package);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "amdNamespace:",
+category: '*Importer-Exporter',
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+
+	if (!self.transport) { self.transport = { type: 'amd' }; }
+	if (self.transport.type !== 'amd') { throw new Error('Package '+self._name()+' has transport type '+self.transport.type+', not "amd".'); }
+	self.transport.amdNamespace = aString;;
+return self}, function($ctx1) {$ctx1.fill(self,"amdNamespace:",{aString:aString},smalltalk.Package)})},
+args: ["aString"],
+source: "amdNamespace: aString\x0a<\x0a\x09if (!self.transport) { self.transport = { type: 'amd' }; }\x0a\x09if (self.transport.type !== 'amd') { throw new Error('Package '+self._name()+' has transport type '+self.transport.type+', not \x22amd\x22.'); }\x0a\x09self.transport.amdNamespace = aString;\x0a>",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Package);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "commit",
@@ -1519,15 +1820,15 @@ $2=self["@extension"];
 } else {
 $2=$3;
 };
-$1=_st($2)._at_ifAbsentPut_("commitPathJs",(function(){
+$1=_st($2)._at_ifAbsent_("commitPathJs",(function(){
 return smalltalk.withContext(function($ctx2) {
 return _st(self._transport())._commitPathJsFor_(self);
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"commitPathJs",{},smalltalk.Package)})},
 args: [],
-source: "commitPathJs\x0a\x09^ (extension ifNil: [ extension := #{} ]) at: #commitPathJs ifAbsentPut: [self transport commitPathJsFor: self]",
-messageSends: ["at:ifAbsentPut:", "commitPathJsFor:", "transport", "ifNil:"],
+source: "commitPathJs\x0a\x09^ (extension ifNil: [ extension := #{} ]) at: #commitPathJs ifAbsent: [self transport commitPathJsFor: self]",
+messageSends: ["at:ifAbsent:", "commitPathJsFor:", "transport", "ifNil:"],
 referencedClasses: []
 }),
 smalltalk.Package);
@@ -1572,15 +1873,15 @@ $2=self["@extension"];
 } else {
 $2=$3;
 };
-$1=_st($2)._at_ifAbsentPut_("commitPathSt",(function(){
+$1=_st($2)._at_ifAbsent_("commitPathSt",(function(){
 return smalltalk.withContext(function($ctx2) {
 return _st(self._transport())._commitPathStFor_(self);
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"commitPathSt",{},smalltalk.Package)})},
 args: [],
-source: "commitPathSt\x0a\x09^ (extension ifNil: [ extension := #{} ]) at: #commitPathSt ifAbsentPut: [self transport commitPathStFor: self]",
-messageSends: ["at:ifAbsentPut:", "commitPathStFor:", "transport", "ifNil:"],
+source: "commitPathSt\x0a\x09^ (extension ifNil: [ extension := #{} ]) at: #commitPathSt ifAbsent: [self transport commitPathStFor: self]",
+messageSends: ["at:ifAbsent:", "commitPathStFor:", "transport", "ifNil:"],
 referencedClasses: []
 }),
 smalltalk.Package);
@@ -1629,6 +1930,22 @@ referencedClasses: ["PackageHandler"]
 }),
 smalltalk.Package);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "transportJson",
+category: '*Importer-Exporter',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return JSON.stringify(self.transport || null);;
+return self}, function($ctx1) {$ctx1.fill(self,"transportJson",{},smalltalk.Package)})},
+args: [],
+source: "transportJson\x0a\x09<return JSON.stringify(self.transport || null);>",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Package);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "transportType",

+ 2 - 0
js/Kernel-Announcements.deploy.js

@@ -1,5 +1,7 @@
 define("amber/Kernel-Announcements", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Kernel-Announcements');
+smalltalk.packages["Kernel-Announcements"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('AnnouncementSubscription', smalltalk.Object, ['valuable', 'announcementClass'], 'Kernel-Announcements');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Kernel-Announcements.js

@@ -1,5 +1,7 @@
 define("amber/Kernel-Announcements", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Kernel-Announcements');
+smalltalk.packages["Kernel-Announcements"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('AnnouncementSubscription', smalltalk.Object, ['valuable', 'announcementClass'], 'Kernel-Announcements');
 smalltalk.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
 smalltalk.addMethod(

+ 2 - 0
js/Kernel-Classes.deploy.js

@@ -1,5 +1,7 @@
 define("amber/Kernel-Classes", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Kernel-Classes');
+smalltalk.packages["Kernel-Classes"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('Behavior', smalltalk.Object, [], 'Kernel-Classes');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Kernel-Classes.js

@@ -1,5 +1,7 @@
 define("amber/Kernel-Classes", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Kernel-Classes');
+smalltalk.packages["Kernel-Classes"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('Behavior', smalltalk.Object, [], 'Kernel-Classes');
 smalltalk.Behavior.comment="I am the superclass of all class objects.\x0a\x0aI define the protocol for creating instances of a class with `#basicNew` and `#new` (see `boot.js` for class constructors details).\x0a\x0aMy instances know about the subclass/superclass relationships between classes, contain the description that instances are created from,\x0aand hold the method dictionary that's associated with each class.\x0a\x0aI also provides methods for compiling methods, examining the method dictionary, and iterating over the class hierarchy.";
 smalltalk.addMethod(

+ 2 - 0
js/Kernel-Collections.deploy.js

@@ -1,5 +1,7 @@
 define("amber/Kernel-Collections", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Kernel-Collections');
+smalltalk.packages["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('Association', smalltalk.Object, ['key', 'value'], 'Kernel-Collections');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Kernel-Collections.js

@@ -1,5 +1,7 @@
 define("amber/Kernel-Collections", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Kernel-Collections');
+smalltalk.packages["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('Association', smalltalk.Object, ['key', 'value'], 'Kernel-Collections');
 smalltalk.Association.comment="I represent a pair of associated objects, a key and a value. My instances can serve as entries in a dictionary.\x0a\x0aInstances can be created with the class-side method `#key:value:`";
 smalltalk.addMethod(

+ 2 - 0
js/Kernel-Exceptions.deploy.js

@@ -1,5 +1,7 @@
 define("amber/Kernel-Exceptions", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Kernel-Exceptions');
+smalltalk.packages["Kernel-Exceptions"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('Error', smalltalk.Object, ['messageText'], 'Kernel-Exceptions');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Kernel-Exceptions.js

@@ -1,5 +1,7 @@
 define("amber/Kernel-Exceptions", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Kernel-Exceptions');
+smalltalk.packages["Kernel-Exceptions"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('Error', smalltalk.Object, ['messageText'], 'Kernel-Exceptions');
 smalltalk.Error.comment="From the ANSI standard:\x0a\x0aThis protocol describes the behavior of instances of class `Error`.\x0aThese are used to represent error conditions that prevent the normal continuation of processing.\x0aActual error exceptions used by an application may be subclasses of this class.\x0aAs `Error` is explicitly specified to be subclassable, conforming implementations must implement its behavior in a non-fragile manner.";
 smalltalk.addMethod(

+ 2 - 0
js/Kernel-Methods.deploy.js

@@ -1,5 +1,7 @@
 define("amber/Kernel-Methods", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Kernel-Methods');
+smalltalk.packages["Kernel-Methods"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('BlockClosure', smalltalk.Object, [], 'Kernel-Methods');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Kernel-Methods.js

@@ -1,5 +1,7 @@
 define("amber/Kernel-Methods", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Kernel-Methods');
+smalltalk.packages["Kernel-Methods"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('BlockClosure', smalltalk.Object, [], 'Kernel-Methods');
 smalltalk.BlockClosure.comment="I represent a lexical closure.\x0aI am is directly mapped to JavaScript Function.\x0a\x0a## API\x0a\x0a1. Evaluation\x0a\x0a    My instances get evaluated with the `#value*` methods in the 'evaluating' protocol.\x0a\x0a    Example: ` [ :x | x + 1 ] value: 3 \x22Answers 4\x22 `\x0a\x0a2. Control structures\x0a\x0a    Blocks are used (together with `Boolean`) for control structures (methods in the `controlling` protocol).\x0a\x0a    Example: `aBlock whileTrue: [ ... ]`\x0a\x0a3. Error handling\x0a\x0a    I provide the `#on:do:` method for handling exceptions.\x0a\x0a    Example: ` aBlock on: MessageNotUnderstood do: [ :ex | ... ] `";
 smalltalk.addMethod(

+ 2 - 0
js/Kernel-Objects.deploy.js

@@ -1,5 +1,7 @@
 define("amber/Kernel-Objects", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Kernel-Objects');
+smalltalk.packages["Kernel-Objects"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('Object', smalltalk.nil, [], 'Kernel-Objects');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Kernel-Objects.js

@@ -1,5 +1,7 @@
 define("amber/Kernel-Objects", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Kernel-Objects');
+smalltalk.packages["Kernel-Objects"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('Object', smalltalk.nil, [], 'Kernel-Objects');
 smalltalk.Object.comment="**I am the root of the Smalltalk class system**. All classes in the system are subclasses of me.\x0a\x0aI provide default behavior common to all normal objects, such as:\x0a\x0a- accessing\x0a- copying\x0a- comparison\x0a- error handling\x0a- message sending\x0a- reflection\x0a\x0aAlso utility messages that all objects should respond to are defined here.\x0a\x0aI have no instance variable.\x0a\x0a##Access\x0a\x0aInstance variables can be accessed with `#instVarAt:` and `#instVarAt:put:`. `#instanceVariableNames` answers a collection of all instance variable names.\x0aAccessing JavaScript properties of an object is done through `#basicAt:`, `#basicAt:put:` and `basicDelete:`.\x0a\x0a##Copying\x0a\x0aCopying an object is handled by `#copy` and `#deepCopy`. The first one performs a shallow copy of the receiver, while the second one performs a deep copy.\x0aThe hook method `#postCopy` can be overriden in subclasses to copy fields as necessary to complete the full copy. It will be sent by the copy of the receiver.\x0a\x0a##Comparison\x0a\x0aI understand equality `#=` and identity `#==` comparison.\x0a\x0a##Error handling\x0a\x0a- `#halt` is the typical message to use for inserting breakpoints during debugging.\x0a- `#error:` throws a generic error exception\x0a- `#doesNotUnderstand:` handles the fact that there was an attempt to send the given message to the receiver but the receiver does not understand this message.\x0a\x09Overriding this message can be useful to implement proxies for example.";
 smalltalk.addMethod(

+ 2 - 0
js/Kernel-Tests.deploy.js

@@ -1,5 +1,7 @@
 define("amber/Kernel-Tests", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Kernel-Tests');
+smalltalk.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Kernel-Tests.js

@@ -1,5 +1,7 @@
 define("amber/Kernel-Tests", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Kernel-Tests');
+smalltalk.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Kernel-Transcript.deploy.js

@@ -1,5 +1,7 @@
 define("amber/Kernel-Transcript", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Kernel-Transcript');
+smalltalk.packages["Kernel-Transcript"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('ConsoleTranscript', smalltalk.Object, ['textarea'], 'Kernel-Transcript');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Kernel-Transcript.js

@@ -1,5 +1,7 @@
 define("amber/Kernel-Transcript", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Kernel-Transcript');
+smalltalk.packages["Kernel-Transcript"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('ConsoleTranscript', smalltalk.Object, ['textarea'], 'Kernel-Transcript');
 smalltalk.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
 smalltalk.addMethod(

+ 2 - 0
js/SUnit-Tests.deploy.js

@@ -1,5 +1,7 @@
 define("amber/SUnit-Tests", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('SUnit-Tests');
+smalltalk.packages["SUnit-Tests"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('ExampleSetTest', smalltalk.TestCase, ['empty', 'full'], 'SUnit-Tests');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/SUnit-Tests.js

@@ -1,5 +1,7 @@
 define("amber/SUnit-Tests", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('SUnit-Tests');
+smalltalk.packages["SUnit-Tests"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('ExampleSetTest', smalltalk.TestCase, ['empty', 'full'], 'SUnit-Tests');
 smalltalk.ExampleSetTest.comment="ExampleSetTest is taken from Pharo 1.4.\x0a\x0aTHe purpose of this class is to demonstrate a simple use case of the test framework.";
 smalltalk.addMethod(

+ 2 - 0
js/SUnit.deploy.js

@@ -1,5 +1,7 @@
 define("amber/SUnit", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('SUnit');
+smalltalk.packages["SUnit"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('ResultAnnouncement', smalltalk.Object, ['result'], 'SUnit');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/SUnit.js

@@ -1,5 +1,7 @@
 define("amber/SUnit", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('SUnit');
+smalltalk.packages["SUnit"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('ResultAnnouncement', smalltalk.Object, ['result'], 'SUnit');
 smalltalk.ResultAnnouncement.comment="I get signaled when a `TestCase` has been run.\x0a\x0aMy instances hold the result (instance of `TestResult`) of the test run.";
 smalltalk.addMethod(

+ 2 - 0
js/Spaces.deploy.js

@@ -1,5 +1,7 @@
 define("amber/Spaces", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Spaces');
+smalltalk.packages["Spaces"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('ObjectSpace', smalltalk.Object, ['frame'], 'Spaces');
 smalltalk.addMethod(
 smalltalk.method({

+ 2 - 0
js/Spaces.js

@@ -1,5 +1,7 @@
 define("amber/Spaces", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Spaces');
+smalltalk.packages["Spaces"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('ObjectSpace', smalltalk.Object, ['frame'], 'Spaces');
 smalltalk.ObjectSpace.comment="I am a connection to another Smalltalk environment.\x0aThe implementation creates an iframe on the same location as the window, and connect to the Amber environment.\x0a\x0a\x0a\x0a## Usage example:\x0a\x0a\x09| space |\x0a\x09\x0a\x09space := ObjectSpace new.\x0a\x09space do: [ smalltalk ] \x22Answers aSmalltalk\x22\x0a\x09(space do: [ smalltalk ]) == smalltalk \x22Answers false\x22\x0a\x09\x0a\x09space release \x22Remove the object space environment\x22";
 smalltalk.addMethod(

+ 109 - 3
st/Importer-Exporter.st

@@ -13,10 +13,22 @@ exportPackageEpilogueOf: aPackage on: aStream
 
 exportPackagePrologueOf: aPackage on: aStream
 	aStream
-		nextPutAll: 'define("amber/';
+		nextPutAll: 'define("';
+		nextPutAll: (aPackage amdNamespace ifNil: [ 'amber' ]); "ifNil: only for LegacyPH, it should not happen with AmdPH"
+		nextPutAll: '/';
 		nextPutAll: aPackage name;
 		nextPutAll: '", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){';
 		lf
+!
+
+exportPackageTransportOf: aPackage on: aStream
+	aStream
+		nextPutAll: 'smalltalk.packages[';
+		nextPutAll: aPackage name asJavascript;
+		nextPutAll: '].transport = ';
+		nextPutAll: aPackage transportJson;
+		nextPutAll: ';';
+		lf
 ! !
 
 Object subclass: #ChunkExporter
@@ -345,6 +357,16 @@ exportPackagePrologueOf: aPackage on: aStream
 
 !Exporter class methodsFor: 'fileOut'!
 
+amdRecipe
+	"Export a given package with amd transport type."
+
+	| legacy |
+	legacy := self recipe.
+	^(legacy copyFrom: 1 to: 2),
+	{ AmdExporter -> #exportPackageTransportOf:on: },
+	(legacy copyFrom: 3 to: legacy size)
+!
+
 recipe
 	"Export a given package."
 
@@ -506,6 +528,74 @@ registerFor: aString
 	PackageHandler register: self for: aString
 ! !
 
+PackageHandler subclass: #AmdPackageHandler
+	instanceVariableNames: ''
+	package: 'Importer-Exporter'!
+!AmdPackageHandler commentStamp!
+I am responsible for handling package loading and committing.
+
+I should not be used directly. Instead, use the corresponding `Package` methods.!
+
+!AmdPackageHandler methodsFor: 'committing'!
+
+commitChannels
+	^{ 
+		[ :pkg | Exporter amdRecipe -> (pkg commitPathJs, '/', pkg name, '.js') ].
+		[ :pkg | StrippedExporter amdRecipe -> (pkg commitPathJs, '/', pkg name, '.deploy.js') ].
+		[ :pkg | ChunkExporter recipe -> (pkg commitPathSt, '/', pkg name, '.st') ]
+	}
+!
+
+commitPathJsFor: aPackage
+	^self toUrl: (self namespaceFor: aPackage)
+!
+
+commitPathStFor: aPackage
+	"if _source is not mapped, .st commit will likely fail"
+	^self toUrl: (self namespaceFor: aPackage), '/_source'.
+!
+
+namespaceFor: aPackage
+	^aPackage amdNamespace
+		ifNil: [ aPackage amdNamespace: self class defaultNamespace; amdNamespace ]
+! !
+
+!AmdPackageHandler methodsFor: 'private'!
+
+toUrl: aString
+	(Smalltalk current at: '_amd_require')
+		ifNil: [ self error: 'AMD loader not present' ]
+		ifNotNil: [ :require | ^(require basicAt: 'toUrl') value: aString ]
+! !
+
+AmdPackageHandler class instanceVariableNames: 'defaultNamespace'!
+
+!AmdPackageHandler class methodsFor: 'commit paths'!
+
+commitPathsFromLoader
+	"TODO"
+!
+
+defaultNamespace
+	^ defaultNamespace ifNil: [ self error: 'AMD default namespace not set.' ]
+!
+
+defaultNamespace: aString
+	defaultNamespace := aString
+!
+
+resetCommitPaths
+	defaultNamespace := nil
+! !
+
+!AmdPackageHandler class methodsFor: 'initialization'!
+
+initialize
+	super initialize.
+	self registerFor: 'amd'.
+	self commitPathsFromLoader
+! !
+
 PackageHandler subclass: #LegacyPackageHandler
 	instanceVariableNames: ''
 	package: 'Importer-Exporter'!
@@ -668,12 +758,24 @@ ownClassesOfPackage: package
 
 !Package methodsFor: '*Importer-Exporter'!
 
+amdNamespace
+<return (self.transport && self.transport.amdNamespace) || nil>
+!
+
+amdNamespace: aString
+<
+	if (!!self.transport) { self.transport = { type: 'amd' }; }
+	if (self.transport.type !!== 'amd') { throw new Error('Package '+self._name()+' has transport type '+self.transport.type+', not "amd".'); }
+	self.transport.amdNamespace = aString;
+>
+!
+
 commit
 	^ self transport commit: self
 !
 
 commitPathJs
-	^ (extension ifNil: [ extension := #{} ]) at: #commitPathJs ifAbsentPut: [self transport commitPathJsFor: self]
+	^ (extension ifNil: [ extension := #{} ]) at: #commitPathJs ifAbsent: [self transport commitPathJsFor: self]
 !
 
 commitPathJs: aString
@@ -681,7 +783,7 @@ commitPathJs: aString
 !
 
 commitPathSt
-	^ (extension ifNil: [ extension := #{} ]) at: #commitPathSt ifAbsentPut: [self transport commitPathStFor: self]
+	^ (extension ifNil: [ extension := #{} ]) at: #commitPathSt ifAbsent: [self transport commitPathStFor: self]
 !
 
 commitPathSt: aString
@@ -692,6 +794,10 @@ transport
 	^ PackageHandler for: self transportType
 !
 
+transportJson
+	<return JSON.stringify(self.transport || null);>
+!
+
 transportType
 	<return (self.transport && self.transport.type) || 'unknown';>
 ! !

+ 2 - 1
test/Test.js

@@ -1,5 +1,7 @@
 define("amber/Test", ["amber_vm/smalltalk","amber_vm/nil","amber_vm/_st"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Test');
+smalltalk.packages["Test"].transport = {"type":"amd","amdNamespace":"amber"};
+
 smalltalk.addClass('NodeTestRunner', smalltalk.Object, [], 'Test');
 
 smalltalk.addMethod(
@@ -67,5 +69,4 @@ referencedClasses: ["OrderedCollection", "TestCase", "TestSuiteRunner", "ResultA
 }),
 smalltalk.NodeTestRunner.klass);
 
-
 });