1.3.0 • Published 8 years ago

antiaris-transform-commonjs-modules-systemjs v1.3.0

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

antiaris-transform-commonjs-modules-systemjs

NPM version Downloads Build Status Dependency status Dev Dependency status

CommonJS 风格模块转换为 System.register 风格。

import {transform, transformFile} from 'antiaris-transform-commonjs-modules-systemjs';

transform('require("./bar.js");\nmodule.exports = 43;', {
    moduleId: 'foo',
    isStrict: true,
    isSlient: true,
    translateDep: function(dep) {
        return path.basename(dep, '.js');
    }
}, function(err, result) {
    console.log(result.code);
    /*System.registerDynamic('foo', ['bar'], true, function(require, exports, module) {
    var define, global = this, GLOBAL = this;

    require('bar');
    module.exports = 43;

    return module.exports;
    });*/
});

ES2015 modules 语法将会被忽略。