some improvements #4

Merged
vilor merged 3 commits from dev into master 2 years ago
  1. 1
      .npmignore
  2. 3
      README.md
  3. 11
      loader.js
  4. 2
      package.json

1
.npmignore

@ -1,2 +1,3 @@
dist dist
example example
.drone.yml

3
README.md

@ -1,7 +1,8 @@
sxml-loader sxml-loader
=========== ===========
[![Build Status](http://drone.vilor.one/api/badges/vilor/sxml-loader/status.svg)](http://drone.vilor.one/vilor/sxml-loader)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
[![Build status](http://drone.vilor.one/api/badges/vilor/sxml-loader/status.svg)](http://drone.vilor.one/vilor/sxml-loader)
[![Package version](https://img.shields.io/npm/v/sxml-loader)](https://npmjs.com/sxml-loader)
<div align="center"> <div align="center">
<img width="100" height="100" alt="Scheme" <img width="100" height="100" alt="Scheme"

11
loader.js

@ -32,12 +32,13 @@ module.exports = function(content, map, meta) {
if (options.expr) if (options.expr)
expr = options.expr; expr = options.expr;
expr = expr.replace('SXML_LOADER_CONTENT', content); expr = expr.replace('SXML_LOADER_CONTENT', content);
chdir(this.rootContext);
const cb = this.async(); const cb = this.async();
runScheme('guile', ['-c', expr]).then(data => { runScheme('guile', ['-c', expr]).then(data => {
cb(null, `${doctype}\n${data}`, map, meta); cb(null, `${doctype}\n${data}`, map, meta);
}).catch(err => { }).catch(code => {
console.error(err); console.error(`Guile exited with code ${code}`);
}); });
} }
@ -49,7 +50,11 @@ function runScheme(interpreter, flags) {
resolve(data); resolve(data);
}); });
scheme.stderr.on('data', (data) => { scheme.stderr.on('data', (data) => {
reject(data.toString()); console.error(data.toString());
});
scheme.on('exit', (code) => {
if (code)
reject(code);
}); });
}); });
} }

2
package.json

@ -1,6 +1,6 @@
{ {
"name": "sxml-loader", "name": "sxml-loader",
"version": "0.3.0", "version": "0.3.1",
"description": "Scheme XML loader for webpack", "description": "Scheme XML loader for webpack",
"main": "loader.js", "main": "loader.js",
"bugs": "http://git.vilor.one/vilor/sxml-loader/issues", "bugs": "http://git.vilor.one/vilor/sxml-loader/issues",

Loading…
Cancel
Save