This repository was archived by the owner on Jul 13, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 14
14
15
15
var isWorker = typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope ;
16
16
var isBrowser = typeof window != 'undefined' && ! isWorker ;
17
+ var isWindows = typeof process != 'undefined' && ! ! process . platform . match ( / ^ w i n / ) ;
17
18
var Promise = __global . Promise || require ( 'when/es6-shim/Promise' ) ;
18
19
19
20
// Helpers
105
106
else if ( typeof require != 'undefined' ) {
106
107
var fs ;
107
108
fetchTextFromURL = function ( url , fulfill , reject ) {
109
+ if ( url . substr ( 0 , 5 ) != 'file:' )
110
+ throw 'Only file URLs of the form file: allowed running in Node.' ;
108
111
fs = fs || require ( 'fs' ) ;
112
+ url = url . substr ( 5 ) ;
113
+ if ( isWindows )
114
+ url = url . replace ( / \/ / g, '\\' ) ;
109
115
return fs . readFile ( url , function ( err , data ) {
110
116
if ( err )
111
117
return reject ( err ) ;
129
135
this . baseURL = href . substring ( 0 , href . lastIndexOf ( '/' ) + 1 ) ;
130
136
}
131
137
else if ( typeof process != 'undefined' && process . cwd ) {
132
- this . baseURL = process . cwd ( ) + '/' ;
138
+ this . baseURL = 'file:' + process . cwd ( ) + '/' ;
139
+ if ( isWindows )
140
+ this . baseURL = this . baseURL . replace ( / \\ / g, '/' ) ;
133
141
}
134
142
else {
135
143
throw new TypeError ( 'No environment baseURL' ) ;
Original file line number Diff line number Diff line change 15
15
16
16
< script src ="../node_modules/when/es6-shim/Promise.js "> </ script >
17
17
18
- < script src ="../dist/es6-module-loader.src. js "> </ script >
18
+ < script src ="../dist/es6-module-loader.js "> </ script >
19
19
< script >
20
20
// test traceurOptions and anonymous errors
21
21
// System.traceurOptions = { classes: false };
You can’t perform that action at this time.
0 commit comments