Browse Source

Merge pull request #875 from herby/underscore-source-optional

Underscore source optional
Nicolas Petton 10 years ago
parent
commit
148dcd36ed
3 changed files with 38 additions and 8 deletions
  1. 15 0
      CHANGELOG
  2. 16 6
      js/Kernel-ImportExport.js
  3. 7 2
      st/Kernel-ImportExport.st

+ 15 - 0
CHANGELOG

@@ -1,3 +1,18 @@
+??nd ??? 2014 - Release 0.12.4
+===================================
+
+Highlights:
+
+* Fixed backward compatibility for pre-0.12.3 loader syntax.
+* `namespace/_source` is not needed to map and is recommended
+  not to use; `.st` files are by default committed to the `.js` location.
+
+Commits: https://github.com/amber-smalltalk/amber/compare/0.12.3...0.12.4
+Issues:  https://github.com/amber-smalltalk/amber/issues?milestone=12&state=closed
+
+For the most important API related changes see the file API-CHANGES.txt.
+
+
 22nd Jan 2014 - Release 0.12.3
 ===================================
 

+ 16 - 6
js/Kernel-ImportExport.js

@@ -1705,14 +1705,24 @@ selector: "commitPathStFor:",
 protocol: 'accessing',
 fn: function (aPackage){
 var self=this;
+var path,pathWithout;
 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},globals.AmdPackageHandler)})},
+var $1,$3,$2;
+$1=_st(self._namespaceFor_(aPackage)).__comma("/_source");
+$ctx1.sendIdx[","]=1;
+path=self._toUrl_($1);
+pathWithout=self._commitPathJsFor_(aPackage);
+$3=_st(path).__eq(_st(pathWithout).__comma("/_source"));
+if(smalltalk.assert($3)){
+$2=pathWithout;
+} else {
+$2=path;
+};
+return $2;
+}, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,path:path,pathWithout:pathWithout},globals.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:"],
+source: "commitPathStFor: aPackage\x0a\x09\x22If _source is not mapped, .st will be committed to .js path.\x0a\x09It is recommended not to use _source as it can be deprecated.\x22\x0a\x09\x0a\x09| path pathWithout |\x0a\x09path := self toUrl: (self namespaceFor: aPackage), '/_source'.\x0a\x09pathWithout := self commitPathJsFor: aPackage.\x0a\x09^ path = (pathWithout, '/_source') ifTrue: [ pathWithout ] ifFalse: [ path ]",
+messageSends: ["toUrl:", ",", "namespaceFor:", "commitPathJsFor:", "ifTrue:ifFalse:", "="],
 referencedClasses: []
 }),
 globals.AmdPackageHandler);

+ 7 - 2
st/Kernel-ImportExport.st

@@ -645,8 +645,13 @@ commitPathJsFor: aPackage
 !
 
 commitPathStFor: aPackage
-	"if _source is not mapped, .st commit will likely fail"
-	^ self toUrl: (self namespaceFor: aPackage), '/_source'.
+	"If _source is not mapped, .st will be committed to .js path.
+	It is recommended not to use _source as it can be deprecated."
+	
+	| path pathWithout |
+	path := self toUrl: (self namespaceFor: aPackage), '/_source'.
+	pathWithout := self commitPathJsFor: aPackage.
+	^ path = (pathWithout, '/_source') ifTrue: [ pathWithout ] ifFalse: [ path ]
 !
 
 exporterClass