whet 0.6.2 → 0.6.3
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/bin/whet/Whet.js
CHANGED
|
@@ -26,7 +26,7 @@ class Whet_Fields_ {
|
|
|
26
26
|
if (entryUrl != thisUrl) {
|
|
27
27
|
return;
|
|
28
28
|
};
|
|
29
|
-
Whet_Fields_.program.enablePositionalOptions().passThroughOptions().description("Project tooling.").usage("[options] [command] [+ [command]...]").version("0.6.
|
|
29
|
+
Whet_Fields_.program.enablePositionalOptions().passThroughOptions().description("Project tooling.").usage("[options] [command] [+ [command]...]").version("0.6.3", "-v, --version").allowUnknownOption(true).allowExcessArguments(true).showSuggestionAfterError(true).helpOption(false).option("-p, --project <file>", "project to run", "Project.mjs").addOption(new Option("-l, --log-level <level>", "log level, a string/number")["default"]("info").env("WHET_LOG_LEVEL")).option("--no-pretty", "disable pretty logging").option("-q, --quiet", "quiet output: warn level + no color (the default when stdout is not a TTY)").option("--profile <format>", "enable profiling, export to whet-profile.json on exit (format: json or trace, default: json)").exitOverride();
|
|
30
30
|
try {
|
|
31
31
|
Whet_Fields_.program.parse();
|
|
32
32
|
}catch (_g) {
|
|
@@ -22,7 +22,7 @@ export declare class OutputFilterMatcher {
|
|
|
22
22
|
* "title.png.meta.json" → "png.meta.json"
|
|
23
23
|
* Returns null if no extension or contains wildcard.
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
static getExtension(path: string): null | string
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* Check if query extension matches any filter extension.
|
package/bin/whet/route/Router.js
CHANGED
|
@@ -89,9 +89,10 @@ class Router extends Register.inherits() {
|
|
|
89
89
|
result[i] = {"filter": f.filter, "pathSoFar": f.pathSoFar, "inProgress": f.inProgress, "remDirs": f.remDirs};
|
|
90
90
|
};
|
|
91
91
|
let routeFilters = result;
|
|
92
|
-
let possible;
|
|
93
92
|
let id = route.routeUnder;
|
|
94
|
-
|
|
93
|
+
let isDirMount = id.length == 0 || id.charCodeAt(id.length - 1) == 47;
|
|
94
|
+
let possible;
|
|
95
|
+
if (isDirMount) {
|
|
95
96
|
let this1 = routeFilters;
|
|
96
97
|
let dir = route.routeUnder;
|
|
97
98
|
if (dir.length == 0 || dir == "./") {
|
|
@@ -174,16 +175,18 @@ class Router extends Register.inherits() {
|
|
|
174
175
|
};
|
|
175
176
|
routeFilters.push({"pathSoFar": [], "filter": f, "inProgress": true, "remDirs": []});
|
|
176
177
|
};
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
178
|
+
if (isDirMount) {
|
|
179
|
+
let outputFilter = null;
|
|
180
|
+
if (((route.source) instanceof Stone)) {
|
|
181
|
+
outputFilter = route.source.getOutputFilter();
|
|
182
|
+
} else if (((route.source) instanceof Router)) {
|
|
183
|
+
outputFilter = route.source.getOutputFilter();
|
|
184
|
+
};
|
|
185
|
+
if (outputFilter != null) {
|
|
186
|
+
let queryPattern = (routeFilters.length > 0 && routeFilters[0].filter != null) ? routeFilters[0].filter.pattern : null;
|
|
187
|
+
if (queryPattern != null && !OutputFilterMatcher.couldMatch(queryPattern, outputFilter, queryIsPattern)) {
|
|
188
|
+
continue;
|
|
189
|
+
};
|
|
187
190
|
};
|
|
188
191
|
};
|
|
189
192
|
let prom;
|
|
@@ -395,11 +398,24 @@ class Router extends Register.inherits() {
|
|
|
395
398
|
let allExtensions = new Array();
|
|
396
399
|
let allPatterns = new Array();
|
|
397
400
|
let hasUnfiltered = false;
|
|
401
|
+
let hasExtensionlessChild = false;
|
|
402
|
+
let hasPatternlessChild = false;
|
|
398
403
|
let _g = 0;
|
|
399
404
|
let _g1 = this.routes;
|
|
400
405
|
while (_g < _g1.length) {
|
|
401
406
|
let route = _g1[_g];
|
|
402
407
|
++_g;
|
|
408
|
+
let id = route.routeUnder;
|
|
409
|
+
if (!(id.length == 0 || id.charCodeAt(id.length - 1) == 47)) {
|
|
410
|
+
allPatterns.push(route.routeUnder);
|
|
411
|
+
let ext = OutputFilterMatcher.getExtension(route.routeUnder);
|
|
412
|
+
if (ext != null) {
|
|
413
|
+
if (allExtensions.indexOf(ext) == -1) {
|
|
414
|
+
allExtensions.push(ext);
|
|
415
|
+
};
|
|
416
|
+
};
|
|
417
|
+
continue;
|
|
418
|
+
};
|
|
403
419
|
let childFilter = null;
|
|
404
420
|
if (((route.source) instanceof Stone)) {
|
|
405
421
|
childFilter = route.source.getOutputFilter();
|
|
@@ -418,6 +434,8 @@ class Router extends Register.inherits() {
|
|
|
418
434
|
++_g;
|
|
419
435
|
if (allExtensions.indexOf(ext) == -1) {
|
|
420
436
|
allExtensions.push(ext);
|
|
437
|
+
} else {
|
|
438
|
+
hasExtensionlessChild = true;
|
|
421
439
|
};
|
|
422
440
|
};
|
|
423
441
|
};
|
|
@@ -428,12 +446,14 @@ class Router extends Register.inherits() {
|
|
|
428
446
|
let prefixed = Path.posix.join(route.routeUnder, _g1[_g++]);
|
|
429
447
|
allPatterns.push(prefixed);
|
|
430
448
|
};
|
|
449
|
+
} else {
|
|
450
|
+
hasPatternlessChild = true;
|
|
431
451
|
};
|
|
432
452
|
};
|
|
433
453
|
if (hasUnfiltered) {
|
|
434
454
|
return null;
|
|
435
455
|
};
|
|
436
|
-
return {"extensions": (allExtensions.length > 0) ? allExtensions : null, "patterns": (allPatterns.length > 0) ? allPatterns : null};
|
|
456
|
+
return {"extensions": (!hasExtensionlessChild && allExtensions.length > 0) ? allExtensions : null, "patterns": (!hasPatternlessChild && allPatterns.length > 0) ? allPatterns : null};
|
|
437
457
|
}
|
|
438
458
|
static get __name__() {
|
|
439
459
|
return "whet.route.Router"
|
package/package.json
CHANGED