mm_statics 1.7.4 → 1.7.6
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 -7
- package/package.json +7 -9
package/index.js
CHANGED
|
@@ -614,14 +614,14 @@ Static.prototype._handleCache = async function (url, ctx) {
|
|
|
614
614
|
* @returns {string|null} 编译后的内容
|
|
615
615
|
*/
|
|
616
616
|
Static.prototype._handleFileCompile = async function (path) {
|
|
617
|
-
|
|
617
|
+
let { src_path, compile_md, files, compile_vue, convert_amd } = this.config;
|
|
618
|
+
if (compile_md && path.extname() === '.md') {
|
|
618
619
|
return await this._runMarkdown(path);
|
|
619
|
-
} else if (!path.startsWith(
|
|
620
|
+
} else if (!path.startsWith(src_path)) return null;
|
|
620
621
|
|
|
621
622
|
let file_type = this._getType(path);
|
|
622
|
-
let { compile_vue, convert_amd } = this.config;
|
|
623
623
|
|
|
624
|
-
if (convert_amd &&
|
|
624
|
+
if (convert_amd && files.includes('.' + file_type)) {
|
|
625
625
|
return await this._runAmd(path, file_type);
|
|
626
626
|
}
|
|
627
627
|
else if (compile_vue && file_type === 'vue') {
|
|
@@ -677,12 +677,12 @@ Static.prototype._pathToRoot = function (path) {
|
|
|
677
677
|
*/
|
|
678
678
|
Static.prototype.main = async function (ctx, next) {
|
|
679
679
|
let url = ctx.url; // 使用完整URL(包含查询参数)
|
|
680
|
-
|
|
680
|
+
let p = ctx.path;
|
|
681
|
+
if (p.indexOf('.') === -1 || !p.startsWith(this.config.path)) {
|
|
681
682
|
await next();
|
|
682
683
|
return '';
|
|
683
684
|
}
|
|
684
|
-
|
|
685
|
-
let path = this._getRealPath(ctx.path);
|
|
685
|
+
let path = this._getRealPath(p);
|
|
686
686
|
|
|
687
687
|
// 检查缓存
|
|
688
688
|
if (await this._handleCache(url, ctx)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mm_statics",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.6",
|
|
4
4
|
"description": "这是超级美眉statics函数模块,用于web服务端statics缓存",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -37,20 +37,18 @@
|
|
|
37
37
|
"static/"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@vue/compiler-sfc": "^3.5.
|
|
40
|
+
"@vue/compiler-sfc": "^3.5.33",
|
|
41
41
|
"abstract-syntax-tree": "^2.22.0",
|
|
42
42
|
"chokidar": "^5.0.0",
|
|
43
|
-
"
|
|
44
|
-
"koa-send": "^5.0.1",
|
|
45
|
-
"marked": "^17.0.1",
|
|
43
|
+
"marked": "^18.0.2",
|
|
46
44
|
"mm_cache": "^1.4.8",
|
|
47
45
|
"mm_es6_to_amd": "^1.4.7",
|
|
48
|
-
"prettier": "^3.8.
|
|
46
|
+
"prettier": "^3.8.3"
|
|
49
47
|
},
|
|
50
48
|
"devDependencies": {
|
|
51
|
-
"eslint": "^
|
|
52
|
-
"eslint-plugin-jsdoc": "^62.
|
|
53
|
-
"mm_eslint": "^1.
|
|
49
|
+
"eslint": "^10.2.1",
|
|
50
|
+
"eslint-plugin-jsdoc": "^62.9.0",
|
|
51
|
+
"mm_eslint": "^1.7.1",
|
|
54
52
|
"mocha": "^11.7.5",
|
|
55
53
|
"supertest": "^7.2.2"
|
|
56
54
|
}
|