mirror of
https://github.com/openharmony/developtools_ace-js2bundle.git
synced 2026-07-21 06:05:27 -04:00
!324 Swtich js-engine of previewer to quickJS
Merge pull request !324 from Pan Zhenyu/OpenHarmony-3.2-Beta2
This commit is contained in:
@@ -217,42 +217,9 @@ function printResult(buildPath) {
|
||||
if (noteCount > 0) {
|
||||
resultInfo.NOTE = noteCount;
|
||||
}
|
||||
if (result === 'SUCCESS ' && process.env.isPreview) {
|
||||
printPreviewResult(resultInfo);
|
||||
} else {
|
||||
console.log(blue, 'COMPILE RESULT:' + result + JSON.stringify(resultInfo), reset);
|
||||
}
|
||||
console.log(blue, 'COMPILE RESULT:' + result + JSON.stringify(resultInfo), reset);
|
||||
} else {
|
||||
if (process.env.isPreview) {
|
||||
printPreviewResult();
|
||||
} else {
|
||||
console.log(blue, 'COMPILE RESULT:SUCCESS ', reset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function printPreviewResult(resultInfo = "") {
|
||||
let workerNum = Object.keys(cluster.workers).length;
|
||||
let count_ = 0;
|
||||
if (workerNum > 0) {
|
||||
for (const worker of Object.values(cluster.workers)) {
|
||||
worker.on('exit', function(code, signal) {
|
||||
count_++;
|
||||
if (count_ === workerNum) {
|
||||
printSuccessInfo(resultInfo);
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
printSuccessInfo(resultInfo);
|
||||
}
|
||||
}
|
||||
|
||||
function printSuccessInfo(resultInfo) {
|
||||
if (resultInfo.length === 0) {
|
||||
console.log(blue, 'COMPILE RESULT:SUCCESS ', reset);
|
||||
} else {
|
||||
console.log(blue, 'COMPILE RESULT:SUCCESS ' + JSON.stringify(resultInfo), reset);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -203,7 +203,7 @@ function setConfigs(env) {
|
||||
|
||||
function setArkPlugin(env, workerFile) {
|
||||
config.plugins.push(new ModuleCollectionPlugin())
|
||||
if (env.isPreview === "true" || env.compilerType && env.compilerType === 'ark') {
|
||||
if (env.compilerType && env.compilerType === 'ark') {
|
||||
let arkDir = path.join(__dirname, 'bin', 'ark');
|
||||
if (env.arkFrontendDir) {
|
||||
arkDir = env.arkFrontendDir;
|
||||
@@ -212,8 +212,6 @@ function setArkPlugin(env, workerFile) {
|
||||
if (env.nodeJs) {
|
||||
nodeJs = env.nodeJs;
|
||||
}
|
||||
config.plugins.push(new GenAbcPlugin(process.env.buildPath, arkDir, nodeJs, workerFile,
|
||||
env.buildMode === 'debug'))
|
||||
if (env.buildMode === 'release' && process.env.DEVICE_LEVEL !== 'card') {
|
||||
config.output.path = path.join(process.env.cachePath, "releaseAssets",
|
||||
path.basename(process.env.buildPath));
|
||||
@@ -310,7 +308,9 @@ module.exports = (env) => {
|
||||
if (process.env.DEVICE_LEVEL === 'card') {
|
||||
config.module = cardModule
|
||||
config.plugins.push(new AfterEmitPlugin())
|
||||
setArkPlugin(env, workerFile);
|
||||
if (env.isPreview !== "true") {
|
||||
setArkPlugin(env, workerFile);
|
||||
}
|
||||
} else {
|
||||
if (process.env.compileMode !== 'moduleJson' && process.env.abilityType === 'page') {
|
||||
config.optimization = {
|
||||
@@ -336,7 +336,9 @@ module.exports = (env) => {
|
||||
},
|
||||
}
|
||||
}
|
||||
setArkPlugin(env, workerFile);
|
||||
if (env.isPreview !== "true") {
|
||||
setArkPlugin(env, workerFile);
|
||||
}
|
||||
if (env.sourceMap === 'none') {
|
||||
config.devtool = false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user