Skip to content

Commit 4117449

Browse files
committed
feat: integrate through getModule/getURL
1 parent 69403c1 commit 4117449

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

libs/rollup/index.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,25 @@ function loadModulesRollup(code) {
4040
espruino: {
4141
job,
4242

43+
externals: {
44+
// for proxy and offline support
45+
getURL: url => new Promise((resolve, reject) => {
46+
Espruino.Core.Utils.getURL(url, data => data!==undefined ? resolve(data) : reject(null));
47+
}),
48+
// for project sandbox chrome app
49+
getModule: moduleName => new Promise((resolve, reject) => {
50+
Espruino.callProcessor("getModule",
51+
{ moduleName, moduleCode:undefined, isMinified:false },
52+
data => data.moduleCode!==undefined ? resolve(data.moduleCode) : reject(null));
53+
})
54+
},
55+
4356
board: board.BOARD ? board : env,
4457
mergeModules: job.MODULE_MERGE,
4558
minify: minify ? buildEspruinoMinifyOptions() : false,
4659
minifyModules
4760
}
48-
})
61+
});
4962
}
5063

5164
function buildEspruinoMinifyOptions() {

0 commit comments

Comments
 (0)