@awesomeness-js/server 1.1.5 → 1.1.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.
@@ -20,5 +20,6 @@ export default {
20
20
  hostMap,
21
21
  initDB,
22
22
  specialRoutes,
23
- wsHandler,
23
+ wsHandler,
24
+ debug_componentDependencies: [ 'app' ], // will info for the component when called
24
25
  };
package/index.js CHANGED
@@ -1,105 +1,105 @@
1
- /**
2
- * This file is auto-generated by the build script.
3
- * It consolidates API functions for use in the application.
4
- * Do not edit manually.
5
- */
6
- import _applicationMap from './src/applicationMap.js';
7
- import _awesomenessNormalizeRequest from './src/awesomenessNormalizeRequest.js';
8
- import _brotliJsonResponse from './src/brotliJsonResponse.js';
9
- import _checkAccess from './src/checkAccess.js';
10
- import _componentDependencies from './src/componentDependencies.js';
11
- import _config from './src/config.js';
12
- import _fetchPage from './src/fetchPage.js';
13
- import _getConfig from './src/getConfig.js';
14
- import _getMD from './src/getMD.js';
15
- import _init from './src/init.js';
16
- import _koa_attachAwesomenessRequest from './src/koa/attachAwesomenessRequest.js';
17
- import _koa_cors from './src/koa/cors.js';
18
- import _koa_errorHandler from './src/koa/errorHandler.js';
19
- import _koa_finalFormat from './src/koa/finalFormat.js';
20
- import _koa_jsonBodyParser from './src/koa/jsonBodyParser.js';
21
- import _koa_routeRequest from './src/koa/routeRequest.js';
22
- import _koa_serverUp from './src/koa/serverUp.js';
23
- import _koa_staticFiles from './src/koa/staticFiles.js';
24
- import _koa_timeout from './src/koa/timeout.js';
25
- import _pageInfo from './src/pageInfo.js';
26
- import _reRoute from './src/reRoute.js';
27
- import _resolveRealCasePath from './src/resolveRealCasePath.js';
28
- import _specialPaths from './src/specialPaths.js';
29
- import _start from './src/start.js';
30
- import _validateRequest from './src/validateRequest.js';
31
- import _ws_handlers from './src/ws/handlers.js';
32
- import _ws_index from './src/ws/index.js';
33
-
34
- export { _applicationMap as applicationMap };
35
- export { _awesomenessNormalizeRequest as awesomenessNormalizeRequest };
36
- export { _brotliJsonResponse as brotliJsonResponse };
37
- export { _checkAccess as checkAccess };
38
- export { _componentDependencies as componentDependencies };
39
- export { _config as config };
40
- export { _fetchPage as fetchPage };
41
- export { _getConfig as getConfig };
42
- export { _getMD as getMD };
43
- export { _init as init };
44
- export { _pageInfo as pageInfo };
45
- export { _reRoute as reRoute };
46
- export { _resolveRealCasePath as resolveRealCasePath };
47
- export { _specialPaths as specialPaths };
48
- export { _start as start };
49
- export { _validateRequest as validateRequest };
50
-
51
- export const koa = {
52
- attachAwesomenessRequest: _koa_attachAwesomenessRequest,
53
- cors: _koa_cors,
54
- errorHandler: _koa_errorHandler,
55
- finalFormat: _koa_finalFormat,
56
- jsonBodyParser: _koa_jsonBodyParser,
57
- routeRequest: _koa_routeRequest,
58
- serverUp: _koa_serverUp,
59
- staticFiles: _koa_staticFiles,
60
- timeout: _koa_timeout
61
- };
62
-
63
- export const ws = {
64
- handlers: _ws_handlers,
65
- index: _ws_index
66
- };
67
-
68
-
69
- export default {
70
- applicationMap: _applicationMap,
71
- awesomenessNormalizeRequest: _awesomenessNormalizeRequest,
72
- brotliJsonResponse: _brotliJsonResponse,
73
- checkAccess: _checkAccess,
74
- componentDependencies: _componentDependencies,
75
- config: _config,
76
- fetchPage: _fetchPage,
77
- getConfig: _getConfig,
78
- getMD: _getMD,
79
- init: _init,
80
- pageInfo: _pageInfo,
81
- reRoute: _reRoute,
1
+ /**
2
+ * This file is auto-generated by the build script.
3
+ * It consolidates API functions for use in the application.
4
+ * Do not edit manually.
5
+ */
6
+ import _applicationMap from './src/applicationMap.js';
7
+ import _awesomenessNormalizeRequest from './src/awesomenessNormalizeRequest.js';
8
+ import _brotliJsonResponse from './src/brotliJsonResponse.js';
9
+ import _checkAccess from './src/checkAccess.js';
10
+ import _componentDependencies from './src/componentDependencies.js';
11
+ import _config from './src/config.js';
12
+ import _fetchPage from './src/fetchPage.js';
13
+ import _getConfig from './src/getConfig.js';
14
+ import _getMD from './src/getMD.js';
15
+ import _init from './src/init.js';
16
+ import _koa_attachAwesomenessRequest from './src/koa/attachAwesomenessRequest.js';
17
+ import _koa_cors from './src/koa/cors.js';
18
+ import _koa_errorHandler from './src/koa/errorHandler.js';
19
+ import _koa_finalFormat from './src/koa/finalFormat.js';
20
+ import _koa_jsonBodyParser from './src/koa/jsonBodyParser.js';
21
+ import _koa_routeRequest from './src/koa/routeRequest.js';
22
+ import _koa_serverUp from './src/koa/serverUp.js';
23
+ import _koa_staticFiles from './src/koa/staticFiles.js';
24
+ import _koa_timeout from './src/koa/timeout.js';
25
+ import _pageInfo from './src/pageInfo.js';
26
+ import _reRoute from './src/reRoute.js';
27
+ import _resolveRealCasePath from './src/resolveRealCasePath.js';
28
+ import _specialPaths from './src/specialPaths.js';
29
+ import _start from './src/start.js';
30
+ import _validateRequest from './src/validateRequest.js';
31
+ import _ws_handlers from './src/ws/handlers.js';
32
+ import _ws_index from './src/ws/index.js';
33
+
34
+ export { _applicationMap as applicationMap };
35
+ export { _awesomenessNormalizeRequest as awesomenessNormalizeRequest };
36
+ export { _brotliJsonResponse as brotliJsonResponse };
37
+ export { _checkAccess as checkAccess };
38
+ export { _componentDependencies as componentDependencies };
39
+ export { _config as config };
40
+ export { _fetchPage as fetchPage };
41
+ export { _getConfig as getConfig };
42
+ export { _getMD as getMD };
43
+ export { _init as init };
44
+ export { _pageInfo as pageInfo };
45
+ export { _reRoute as reRoute };
46
+ export { _resolveRealCasePath as resolveRealCasePath };
47
+ export { _specialPaths as specialPaths };
48
+ export { _start as start };
49
+ export { _validateRequest as validateRequest };
50
+
51
+ export const koa = {
52
+ attachAwesomenessRequest: _koa_attachAwesomenessRequest,
53
+ cors: _koa_cors,
54
+ errorHandler: _koa_errorHandler,
55
+ finalFormat: _koa_finalFormat,
56
+ jsonBodyParser: _koa_jsonBodyParser,
57
+ routeRequest: _koa_routeRequest,
58
+ serverUp: _koa_serverUp,
59
+ staticFiles: _koa_staticFiles,
60
+ timeout: _koa_timeout
61
+ };
62
+
63
+ export const ws = {
64
+ handlers: _ws_handlers,
65
+ index: _ws_index
66
+ };
67
+
68
+
69
+ export default {
70
+ applicationMap: _applicationMap,
71
+ awesomenessNormalizeRequest: _awesomenessNormalizeRequest,
72
+ brotliJsonResponse: _brotliJsonResponse,
73
+ checkAccess: _checkAccess,
74
+ componentDependencies: _componentDependencies,
75
+ config: _config,
76
+ fetchPage: _fetchPage,
77
+ getConfig: _getConfig,
78
+ getMD: _getMD,
79
+ init: _init,
80
+ pageInfo: _pageInfo,
81
+ reRoute: _reRoute,
82
82
  /**
83
83
  * Case-insensitive real path resolver.
84
84
  * Works correctly on Windows, macOS, and Linux/Docker.
85
- */
86
- resolveRealCasePath: _resolveRealCasePath,
87
- specialPaths: _specialPaths,
88
- start: _start,
89
- validateRequest: _validateRequest,
90
- koa: {
91
- attachAwesomenessRequest: _koa_attachAwesomenessRequest,
92
- cors: _koa_cors,
93
- errorHandler: _koa_errorHandler,
94
- finalFormat: _koa_finalFormat,
95
- jsonBodyParser: _koa_jsonBodyParser,
96
- routeRequest: _koa_routeRequest,
97
- serverUp: _koa_serverUp,
98
- staticFiles: _koa_staticFiles,
99
- timeout: _koa_timeout,
100
- },
101
- ws: {
102
- handlers: _ws_handlers,
103
- index: _ws_index,
104
- },
85
+ */
86
+ resolveRealCasePath: _resolveRealCasePath,
87
+ specialPaths: _specialPaths,
88
+ start: _start,
89
+ validateRequest: _validateRequest,
90
+ koa: {
91
+ attachAwesomenessRequest: _koa_attachAwesomenessRequest,
92
+ cors: _koa_cors,
93
+ errorHandler: _koa_errorHandler,
94
+ finalFormat: _koa_finalFormat,
95
+ jsonBodyParser: _koa_jsonBodyParser,
96
+ routeRequest: _koa_routeRequest,
97
+ serverUp: _koa_serverUp,
98
+ staticFiles: _koa_staticFiles,
99
+ timeout: _koa_timeout,
100
+ },
101
+ ws: {
102
+ handlers: _ws_handlers,
103
+ index: _ws_index,
104
+ },
105
105
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awesomeness-js/server",
3
- "version": "1.1.5",
3
+ "version": "1.1.6",
4
4
  "description": "Awesomeness Multi-Site Server",
5
5
  "author": "Scott Forte",
6
6
  "type": "module",
@@ -2,6 +2,7 @@ import path from "path";
2
2
  import { fileURLToPath } from "url";
3
3
  import { each, getAllFiles } from "@awesomeness-js/utils";
4
4
  import { readFileSync } from "fs";
5
+ import getConfig from "./getConfig.js";
5
6
 
6
7
 
7
8
  function urlToFsPath(u) {
@@ -57,6 +58,8 @@ export default function componentDependencies(allComponents, {
57
58
  ignore = [ "*.css.js" ],
58
59
  } = {}) {
59
60
 
61
+ const awesomenessConfig = getConfig();
62
+
60
63
  if (!Array.isArray(componentLocations) || componentLocations.length === 0) {
61
64
 
62
65
  throw new TypeError("componentLocations must be a non-empty array of URL objects");
@@ -127,6 +130,20 @@ export default function componentDependencies(allComponents, {
127
130
 
128
131
  }
129
132
 
133
+ if (
134
+ awesomenessConfig.debug_componentDependencies
135
+ && Array.isArray(awesomenessConfig.debug_componentDependencies)
136
+ && awesomenessConfig.debug_componentDependencies.includes(component)
137
+ ) {
138
+
139
+ console.log("[awesomenessConfig.debug componentDependencies] chosenRoot:", chosenRoot);
140
+ console.log("[awesomenessConfig.debug componentDependencies] allFiles count:", allFiles.length);
141
+ console.log("[awesomenessConfig.debug componentDependencies] first 50 files:", allFiles.slice(0, 50));
142
+ console.log("[awesomenessConfig.debug componentDependencies] any non-string:", allFiles.some((f) => typeof f !== "string"));
143
+ console.log("[awesomenessConfig.debug componentDependencies] any absolute:", allFiles.some((f) => path.isAbsolute(f)));
144
+
145
+ }
146
+
130
147
  allFiles.forEach((file) => {
131
148
 
132
149
  const normalizedPath = path.normalize(file);
@@ -278,6 +295,16 @@ export default function componentDependencies(allComponents, {
278
295
  } catch (err) {
279
296
 
280
297
  console.log("Failed to get dependencies", { component });
298
+ const full = path.join(chosenRoot, file);
299
+
300
+ console.error("Failed to get dependencies", {
301
+ component,
302
+ file,
303
+ full,
304
+ code: err?.code,
305
+ message: err?.message,
306
+ stack: err?.stack,
307
+ });
281
308
 
282
309
  }
283
310