Skip to content

Commit

Permalink
fix(cli): wxa file import other source file should rename to target w…
Browse files Browse the repository at this point in the history
…xa filename
  • Loading branch information
Genuifx committed Aug 27, 2019
1 parent 5de7216 commit 524600b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
10 changes: 4 additions & 6 deletions packages/wxa-cli/src/compilers/wxa.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,10 @@ export default class WxaCompiler {
});
}

if (!rstTypeObject.src) {
let opath = path.parse(filepath);


rstTypeObject.src = opath.dir + path.sep + opath.name + '.' + rstTypeObject.type;
}
// if (!rstTypeObject.src) {
// }
let opath = path.parse(filepath);
rstTypeObject.src = opath.dir + path.sep + opath.name + '.' + rstTypeObject.type;

rstTypeObject.$from = filepath;

Expand Down
5 changes: 5 additions & 0 deletions packages/wxa-cli/src/optimizer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ export default class Optimizer {
}

async do(dep, indexedMap) {
if (!dep.src) {
// deadcode normally
debugger;
return;
}
const text = path.relative(this.cwd, dep.src);
this.progress.draw(text, 'Optimizing', !this.cmdOptions.verbose);
switch (this.wxaConfigs.target) {
Expand Down
6 changes: 3 additions & 3 deletions packages/wxa-cli/src/schedule.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,12 @@ class Schedule {

async $doDPA() {
let tasks = [];
// while (this.$depPending.length) {
while (this.$depPending.length) {
let dep = this.$depPending.shift();

// debug('file to parse %O', dep);
tasks.push(this.$parse(dep));
// }
}

let succ = await Promise.all(tasks);

Expand Down Expand Up @@ -331,7 +331,7 @@ class Schedule {
child = indexedModule;
}

if (child.color !== COLOR.COMPILED) this.$depPending.push(child);
if (~[COLOR.CHANGED, COLOR.COMPILE_ERROR, COLOR.INIT].indexOf(child.color)) this.$depPending.push(child);
if (child.color === COLOR.INIT) this.$indexOfModule.set(child.src, child);

return child;
Expand Down

0 comments on commit 524600b

Please sign in to comment.