vona-module-a-static 5.0.22 → 5.0.24

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/dist/index.js +10 -2
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -118,7 +118,11 @@ async function _getFullPathInner(ctx, dir, filename, options) {
118
118
  // trim prefix
119
119
  if (options.apiStaticPrefix !== '/') {
120
120
  const filePrefix = path.normalize(options.apiStaticPrefix.replace(/^\//, ''));
121
- if (filename.indexOf(filePrefix) !== 0) throw new Error(`invalid filename: ${filename}`);
121
+ if (filename.indexOf(filePrefix) !== 0) {
122
+ return;
123
+ // cannot throw error
124
+ // throw new Error(`invalid filename: ${filename}`);
125
+ }
122
126
  filename = filename.slice(filePrefix.length);
123
127
  }
124
128
  // check
@@ -134,7 +138,11 @@ async function _getFullPathInner(ctx, dir, filename, options) {
134
138
  // static
135
139
  const moduleRelativeName = `${wordFirst}-${parts.shift()}`;
136
140
  const module = ctx.app.meta.modules[moduleRelativeName];
137
- if (!module) throw new Error(`invalid filename: ${filename}`);
141
+ if (!module) {
142
+ return;
143
+ // cannot throw error
144
+ // throw new Error(`invalid filename: ${filename}`);
145
+ }
138
146
  const fullPath = ctx.app.util.getAssetPathPhysical(moduleRelativeName, 'static', parts.join(path.sep));
139
147
  return fullPath;
140
148
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vona-module-a-static",
3
3
  "type": "module",
4
- "version": "5.0.22",
4
+ "version": "5.0.24",
5
5
  "title": "a-static",
6
6
  "vonaModule": {
7
7
  "dependencies": {},
@@ -32,9 +32,9 @@
32
32
  "./package.json": "./package.json"
33
33
  },
34
34
  "files": [
35
+ "assets",
35
36
  "cli",
36
- "dist",
37
- "static"
37
+ "dist"
38
38
  ],
39
39
  "dependencies": {
40
40
  "@cabloy/koa-static-cache": "^6.0.1",