binhend 2.2.8 → 2.2.9
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/demo.js +9 -7
- package/index.js +3 -3
- package/package.json +1 -1
- package/packages/module-alias/src/alias-cjs-loader.js +7 -2
package/demo.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
|
|
2
|
-
const { HttpCodes, ConfigLoader, HttpError, validation: must } = require('./index');
|
|
3
|
-
const path = require('path');
|
|
2
|
+
// const { HttpCodes, ConfigLoader, HttpError, validation: must } = require('./index');
|
|
3
|
+
// const path = require('path');
|
|
4
4
|
|
|
5
|
-
function Testa(input) {
|
|
6
|
-
|
|
7
|
-
}
|
|
5
|
+
// function Testa(input) {
|
|
6
|
+
// this.a = must.Function(input.a);
|
|
7
|
+
// }
|
|
8
8
|
|
|
9
|
-
var p = new Testa();
|
|
9
|
+
// var p = new Testa();
|
|
10
10
|
|
|
11
|
-
p.a();
|
|
11
|
+
// p.a();
|
|
12
|
+
|
|
13
|
+
require('./packages/module-alias');
|
package/index.js
CHANGED
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
+
//___ Run scripts ___//
|
|
10
|
+
require('./packages/module-alias'); //--- alias path '@' for requiring modules: require('@/any/path')
|
|
11
|
+
|
|
9
12
|
const server = require('./packages/core/src/server');
|
|
10
13
|
const Router = require('./packages/core/src/Router');
|
|
11
14
|
const { routes } = require('./packages/core/src/routes');
|
|
@@ -33,9 +36,6 @@ const validation = require('./packages/validation/src/typeValidation');
|
|
|
33
36
|
const { WebBuild } = require('./packages/web/src/WebBuild');
|
|
34
37
|
const { binh } = require('./packages/web/src/component.method');
|
|
35
38
|
|
|
36
|
-
//___ Run scripts ___//
|
|
37
|
-
require('./packages/module-alias'); //--- alias path '@' for requiring modules: require('@/any/path')
|
|
38
|
-
|
|
39
39
|
module.exports = {
|
|
40
40
|
server, routes, Router,
|
|
41
41
|
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const path = require('path');
|
|
4
4
|
const DefaultModule = require('module');
|
|
5
|
-
const { binh } = require('
|
|
5
|
+
const { binh } = require('../../web/src/component.method'); // TODO handle this 'binh' object again, more properly, workspaces will not recognize global 'binh'
|
|
6
6
|
|
|
7
7
|
// Protect against improperly customized module constructors by other frameworks/packages
|
|
8
8
|
const Module = module.constructor.length > 1 ? module.constructor : DefaultModule;
|
|
@@ -14,6 +14,11 @@ var jsconfig;
|
|
|
14
14
|
|
|
15
15
|
try {
|
|
16
16
|
jsconfig = require(jsconfigPath);
|
|
17
|
+
jsconfig.compilerOptions = jsconfig.compilerOptions || {};
|
|
18
|
+
jsconfig.compilerOptions.paths = jsconfig.compilerOptions.paths || {};
|
|
19
|
+
|
|
20
|
+
const paths = jsconfig.compilerOptions.paths;
|
|
21
|
+
paths['@binhend/*'] = [ path.join(__dirname, '../../') ];
|
|
17
22
|
}
|
|
18
23
|
catch (error) {
|
|
19
24
|
return console.log(`[BINEND] Not found 'jsconfig.json' for alias paths.`);
|
|
@@ -26,7 +31,7 @@ const paths = jsconfig?.compilerOptions?.paths || {};
|
|
|
26
31
|
const aliasMap = {};
|
|
27
32
|
|
|
28
33
|
for (const alias in paths) {
|
|
29
|
-
const aliasPath = alias.replace('/*', ''); // Strip the '/*' for matching
|
|
34
|
+
const aliasPath = alias.replace('/*', ''); // Strip the '/*' for matching // TODO write regex for ending with /*
|
|
30
35
|
const originalPaths = paths[alias]; // Get the array of paths
|
|
31
36
|
|
|
32
37
|
aliasMap[aliasPath] = originalPaths.map((originalPath) => {
|