Hi,
We are facing a problem with using JavaScript files using the *.js extension
(that is, not the *.sjs extension), using Roxy. In that case, Roxy does not
upload them as text documents, but rather as binaries. Which makes them
usuitable to be "require()"d by other SJS files.
Is there any way to ask Roxy to upload *js files as text on "deploy
modules"?
Complete repro:
1) clone Roxy: "git clone git://github.com/marklogic/roxy.git"
2) init Roxy: "./ml init app-name --server-version=8 --app-type=bare"
3) edit deploy/build.properties, what I've done:
- app-name=test-js-vs-sjs
- app-port=6640
- xcc-port=6641
- local-server=my.vm.name
4) bootstrap it: "./ml local bootstrap"
5) create the following 5 files in Roxy's src dir:
== src/lib/lib.sjs AND src/lib/lib.js ==
module.exports = {
hello: function(who) {
return 'Hello, ' + who + '!';
}
};
== src/lib/one.js ==
module.exports = {
classic: function() {
return require('lib.sjs').hello('world');
}
};
== src/lib/two.js AND src/lib/two.sjs ==
module.exports = {
classic: function() {
return require('lib.js').hello('world');
}
};
6) upload them: "./ml local deploy modules"
7) in QConsole, against "test-js-vs-sjs-content" database, run the following
queries:
require('one.sjs').classic();
=> 'Hello, world!'
require('two.js').classic();
=> Error: two.js is not a text document
require('two.sjs').classic();
=> Error: lib.js is not a text document
* The first one, using SJS for the top lib and the one it imports, works.
* The second one, using JS for the top lib and the one it imports, fails.
* The second one, using SJS for the top lib and JS for the one it imports,
fails as well, showing it is not about the way QConsole reolves the query it
evaluates, but also how require()'s parameter is resolved for 2 modules
sitting in the modules database.
Looking at the files in the modules database, using "explore" on QConsole,
shows indeed that JS files are binary files.
Is there any way to ask Roxy to upload *js files as text on "deploy
modules"?
Regards,
--
Florent Georges
http://fgeorges.org/
http://h2oconsulting.be/
_______________________________________________
General mailing list
[email protected]
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general