st-bundle
Version:
CLI for watching and bundling SpringType projects.
43 lines (42 loc) • 1.32 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const appRoot = require("app-root-path");
const path = require("path");
const utils_1 = require("./utils/utils");
const VERSION = '4.0.0-next.134';
const FUSE_ROOT = __dirname;;
exports.env = {
FUSE_ROOT: FUSE_ROOT,
APP_ROOT: appRoot.path,
VERSION: VERSION,
isTest: !!process.env.JEST_TEST,
CACHE: {
ROOT: path.join(appRoot.path, 'node_modules/.fusebox', VERSION),
PACKAGES: 'packages',
PROJET_FILES: 'project-files',
},
SCRIPT_PATH: path.dirname(require.main.filename),
SCRIPT_FILE: require.main.filename,
FUSE_MODULES: path.join(FUSE_ROOT, 'modules'),
};
function getDevelopmentApi() {
const contents = utils_1.readFile(path.join(exports.env.FUSE_MODULES, 'fuse-loader/index.js'));
return `(function(){
${contents}
})();`;
}
exports.getDevelopmentApi = getDevelopmentApi;
function openDevelopmentApi() {
const contents = utils_1.readFile(path.join(exports.env.FUSE_MODULES, 'fuse-loader/index.js'));
return `(function(){
var FuseBox = (function(){
${contents}
return FuseBox;
})()
`;
}
exports.openDevelopmentApi = openDevelopmentApi;
function closeDevelopmentApi() {
return `\n})();`;
}
exports.closeDevelopmentApi = closeDevelopmentApi;