binhend 1.1.1 → 1.1.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/package.json CHANGED
@@ -1,28 +1,20 @@
1
1
  {
2
2
  "name": "binhend",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "Nguyen Duc Binh",
7
7
  "license": "UNLICENSED",
8
8
  "scripts": {
9
9
  "test": "echo \"Error: no test specified\" && exit 1",
10
- "example-api": "nodemon example_api PORT=5555",
11
- "example-webcomp": "nodemon example_webcomp"
10
+ "example-api": "node example_api PORT=5555",
11
+ "example-webcomp": "node example_webcomp"
12
12
  },
13
13
  "dependencies": {
14
14
  "express": "^4.17.1"
15
15
  },
16
- "devDependencies": {
17
- "nodemon": "^2.0.20"
18
- },
19
- "nodemonConfig": {
20
- "ignore": [
21
- "example_webcomp/public/**"
22
- ],
23
- "delay": 2500
24
- },
25
16
  "engines": {
26
- "node": ">= 16.17.1"
17
+ "node": ">=16.17.1",
18
+ "npm": ">=8.15.0"
27
19
  }
28
20
  }
package/src/code.js CHANGED
@@ -12,7 +12,26 @@ function dependencies(component, root, metadata) {
12
12
  if (child.constructor !== component.constructor) return;
13
13
 
14
14
  var filename = child.filename;
15
- var url = filename.replace(root, '').replace(/\\/g, '/');
15
+
16
+ var url = '';
17
+
18
+ if (filename.indexOf(root) === 0) {
19
+ url = filename.replace(root, '').replace(/\\/g, '/');
20
+ }
21
+ else {
22
+ var nodeModulePaths = require.main.paths;
23
+ var length = nodeModulePaths.length;
24
+
25
+ for (var i = 0; i < length; i++) {
26
+ var nodeModulePath = nodeModulePaths[i];
27
+
28
+ if (filename.indexOf(nodeModulePath) === 0) {
29
+ url = filename.replace(nodeModulePath, 'npm:/').replace(/\\/g, '/');
30
+ break;
31
+ }
32
+ }
33
+ }
34
+
16
35
  var name = component.vars[filename] || parse(filename).name.replace(/-/g, '').replace(/\W.*/, '');
17
36
 
18
37
  local[filename] = {
@@ -62,10 +81,6 @@ function dependencies(component, root, metadata) {
62
81
  function bundle(component, root) {
63
82
  var code = '';
64
83
 
65
- if (component.filename.indexOf('AppToDos.js') > -1) {
66
- console.log('debug');
67
- }
68
-
69
84
  code += dependencies(component, root);
70
85
 
71
86
  code += '\r\n';
package/src/component.js CHANGED
@@ -17,7 +17,7 @@ function generate(source, destination) {
17
17
  function processDirectory(root, current, destination) {
18
18
  readdir(current, function (error, dirents) {
19
19
  if (error) {
20
- showError('Failed scanning directory', filepath, error);
20
+ showError('Failed scanning directory', current, error);
21
21
  return;
22
22
  }
23
23