mm_statics 1.5.5 → 1.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +7 -6
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -196,8 +196,9 @@ Static.prototype._toAmd = async function (file_type, text) {
|
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
-
//
|
|
200
|
-
|
|
199
|
+
// 格式化代码后返回,确保返回字符串而不是Promise
|
|
200
|
+
const result = await this._formatCode(txt, file_type);
|
|
201
|
+
return result;
|
|
201
202
|
};
|
|
202
203
|
|
|
203
204
|
/**
|
|
@@ -552,17 +553,17 @@ Static.prototype._handleCache = async function (url, ctx) {
|
|
|
552
553
|
* @param {string} path 文件路径
|
|
553
554
|
* @returns {string|null} 编译后的内容
|
|
554
555
|
*/
|
|
555
|
-
Static.prototype._handleFileCompile = function (path) {
|
|
556
|
+
Static.prototype._handleFileCompile = async function (path) {
|
|
556
557
|
if (!path.startsWith(this.config.path)) return null;
|
|
557
558
|
|
|
558
559
|
let file_type = this._getType(path);
|
|
559
560
|
let { compile_vue, convert_amd } = this.config;
|
|
560
561
|
|
|
561
562
|
if (convert_amd && this.config.files.includes('.' + file_type)) {
|
|
562
|
-
return this._runAmd(path, file_type);
|
|
563
|
+
return await this._runAmd(path, file_type);
|
|
563
564
|
}
|
|
564
565
|
else if (compile_vue && file_type === 'vue') {
|
|
565
|
-
return this._runVue(path);
|
|
566
|
+
return await this._runVue(path);
|
|
566
567
|
}
|
|
567
568
|
|
|
568
569
|
return null;
|
|
@@ -601,7 +602,7 @@ Static.prototype.main = async function (ctx, next) {
|
|
|
601
602
|
}
|
|
602
603
|
|
|
603
604
|
// 处理文件编译
|
|
604
|
-
let body = this._handleFileCompile(path);
|
|
605
|
+
let body = await this._handleFileCompile(path);
|
|
605
606
|
if (body) {
|
|
606
607
|
await this._handleCompiledResp(url, path, body, ctx);
|
|
607
608
|
return;
|