mm_statics 1.5.6 → 1.5.8

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.
Files changed (2) hide show
  1. package/index.js +10 -10
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -324,12 +324,12 @@ export default {
324
324
  /**
325
325
  * 编译Vue组件
326
326
  * @param {string} code Vue组件代码
327
- * @returns {string} 可直接调用的JavaScript组件代码
327
+ * @returns {Promise<string>} 可直接调用的JavaScript组件代码
328
328
  */
329
- Static.prototype._compileVue = function (code) {
329
+ Static.prototype._compileVue = async function (code) {
330
330
  let desc = parse(code).descriptor;
331
331
  let render_function = this._processTemplate(desc);
332
- return this._processScript(desc, render_function);
332
+ return await this._processScript(desc, render_function);
333
333
  };
334
334
 
335
335
  /**
@@ -361,14 +361,14 @@ Static.prototype._runAmd = async function (path, file_type) {
361
361
  /**
362
362
  * 运行Vue组件
363
363
  * @param {string} path 文件路径
364
- * @returns {string} 编译后的代码
364
+ * @returns {Promise<string>} 编译后的代码
365
365
  */
366
- Static.prototype._runVue = function (path) {
366
+ Static.prototype._runVue = async function (path) {
367
367
  let code = null;
368
368
  let file = `.${path}`.fullname(this.config.root);
369
369
  let text = file.loadText();
370
370
  if (text) {
371
- code = this._compileVue(text);
371
+ code = await this._compileVue(text);
372
372
  }
373
373
  return code;
374
374
  };
@@ -553,17 +553,17 @@ Static.prototype._handleCache = async function (url, ctx) {
553
553
  * @param {string} path 文件路径
554
554
  * @returns {string|null} 编译后的内容
555
555
  */
556
- Static.prototype._handleFileCompile = function (path) {
556
+ Static.prototype._handleFileCompile = async function (path) {
557
557
  if (!path.startsWith(this.config.path)) return null;
558
558
 
559
559
  let file_type = this._getType(path);
560
560
  let { compile_vue, convert_amd } = this.config;
561
561
 
562
562
  if (convert_amd && this.config.files.includes('.' + file_type)) {
563
- return this._runAmd(path, file_type);
563
+ return await this._runAmd(path, file_type);
564
564
  }
565
565
  else if (compile_vue && file_type === 'vue') {
566
- return this._runVue(path);
566
+ return await this._runVue(path);
567
567
  }
568
568
 
569
569
  return null;
@@ -602,7 +602,7 @@ Static.prototype.main = async function (ctx, next) {
602
602
  }
603
603
 
604
604
  // 处理文件编译
605
- let body = this._handleFileCompile(path);
605
+ let body = await this._handleFileCompile(path);
606
606
  if (body) {
607
607
  await this._handleCompiledResp(url, path, body, ctx);
608
608
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_statics",
3
- "version": "1.5.6",
3
+ "version": "1.5.8",
4
4
  "description": "这是超级美眉statics函数模块,用于web服务端statics缓存",
5
5
  "main": "index.js",
6
6
  "scripts": {