modify node build module
This commit is contained in:
@@ -3,4 +3,5 @@
|
|||||||
# ttf 模块node端组件导出程序
|
# ttf 模块node端组件导出程序
|
||||||
|
|
||||||
edp build --config ./edp-build-config-node.js --force
|
edp build --config ./edp-build-config-node.js --force
|
||||||
|
|
||||||
echo "asset path:../fonteditor-ttf/lib"
|
echo "asset path:../fonteditor-ttf/lib"
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ exports.getProcessors = function () {
|
|||||||
'common/DataStore.js',
|
'common/DataStore.js',
|
||||||
'common/observable.js',
|
'common/observable.js',
|
||||||
'common/promise.js',
|
'common/promise.js',
|
||||||
|
'common/getPixelRatio.js',
|
||||||
'editor/**',
|
'editor/**',
|
||||||
'fonteditor/**',
|
'fonteditor/**',
|
||||||
'render/**',
|
'render/**',
|
||||||
|
|||||||
@@ -13,6 +13,13 @@ var REG_TOP_MODULE = /^(:?common|math|graphics|ttf)/;
|
|||||||
|
|
||||||
var REG_REQUIRE = /require\(\s*(['"])([^'"]+)\1\s*\)/g;
|
var REG_REQUIRE = /require\(\s*(['"])([^'"]+)\1\s*\)/g;
|
||||||
|
|
||||||
|
// dep配置模块,替换成dep的地址
|
||||||
|
var REG_DEP_MODULE = /^(:?ClipperLib)/;
|
||||||
|
|
||||||
|
// 相对于lib目录的dep目录
|
||||||
|
var DEP_PARH = '../dep/';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取ast树
|
* 获取ast树
|
||||||
* @param {string} code 代码片段
|
* @param {string} code 代码片段
|
||||||
@@ -184,7 +191,11 @@ function replaceDefine(code) {
|
|||||||
*/
|
*/
|
||||||
function replaceRequire(code, codeDepth) {
|
function replaceRequire(code, codeDepth) {
|
||||||
return code.replace(REG_REQUIRE, function ($0, $1, moduleId) {
|
return code.replace(REG_REQUIRE, function ($0, $1, moduleId) {
|
||||||
if (REG_TOP_MODULE.test(moduleId)) {
|
|
||||||
|
if (REG_DEP_MODULE.test(moduleId)) {
|
||||||
|
moduleId = codeDepth + DEP_PARH + moduleId;
|
||||||
|
}
|
||||||
|
else if (REG_TOP_MODULE.test(moduleId)) {
|
||||||
moduleId = codeDepth + moduleId;
|
moduleId = codeDepth + moduleId;
|
||||||
}
|
}
|
||||||
return 'require(\'' + moduleId + '\')';
|
return 'require(\'' + moduleId + '\')';
|
||||||
|
|||||||
Reference in New Issue
Block a user