neo.mjs 3.1.2 → 3.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.
@@ -135,16 +135,16 @@ class Util extends Base {
135
135
  imageName = map[imageName] || imageName;
136
136
 
137
137
  if (Neo.config.isGitHubPages) {
138
- let path = '../../../../resources/images/flaticon/country_flags/png/' + imageName + '.png';
138
+ let path = `../../../../resources/images/flaticon/country_flags/png/${imageName}.png`;
139
139
 
140
140
  if (Neo.config.environment !== 'development') {
141
- path = '../../' + path;
141
+ path = `../../${path}`;
142
142
  }
143
143
 
144
144
  return path;
145
145
  }
146
146
 
147
- return 'https://raw.githubusercontent.com/neomjs/pages/master/resources/images/flaticon/country_flags/png/' + imageName + '.png';
147
+ return `https://raw.githubusercontent.com/neomjs/pages/master/resources/images/flaticon/country_flags/png/${imageName}.png`;
148
148
  }
149
149
 
150
150
  /**
@@ -135,16 +135,16 @@ class Util extends Base {
135
135
  imageName = map[imageName] || imageName;
136
136
 
137
137
  if (Neo.config.isGitHubPages) {
138
- let path = '../../../../resources/images/flaticon/country_flags/png/' + imageName + '.png';
138
+ let path = `../../../../resources/images/flaticon/country_flags/png/${imageName}.png`;
139
139
 
140
140
  if (Neo.config.environment !== 'development') {
141
- path = '../../' + path;
141
+ path = `../../${path}`;
142
142
  }
143
143
 
144
144
  return path;
145
145
  }
146
146
 
147
- return 'https://raw.githubusercontent.com/neomjs/pages/master/resources/images/flaticon/country_flags/png/' + imageName + '.png';
147
+ return `https://raw.githubusercontent.com/neomjs/pages/master/resources/images/flaticon/country_flags/png/${imageName}.png`;
148
148
  }
149
149
 
150
150
  /**
@@ -167,7 +167,7 @@ class MainContainerController extends ComponentController {
167
167
 
168
168
  Neo.Main.getWindowData().then(winData => {
169
169
  me.component.getDomRect(me.getReference(containerReference).id).then(data => {
170
- let {height, left, top, width} = data[0];
170
+ let {height, left, top, width} = data;
171
171
 
172
172
  height -= 50; // popup header in Chrome
173
173
  left += winData.screenLeft;
@@ -1,13 +1,14 @@
1
- import chalk from 'chalk';
2
- import { spawnSync } from 'child_process';
3
- import { Command } from 'commander/esm.mjs';
4
- import envinfo from 'envinfo';
5
- import fs from 'fs-extra';
6
- import inquirer from 'inquirer';
7
- import os from 'os';
8
- import path from 'path';
1
+ import chalk from 'chalk';
2
+ import { spawnSync } from 'child_process';
3
+ import { Command } from 'commander/esm.mjs';
4
+ import envinfo from 'envinfo';
5
+ import fs from 'fs-extra';
6
+ import inquirer from 'inquirer';
7
+ import os from 'os';
8
+ import path from 'path';
9
+ import { fileURLToPath } from 'url';
9
10
 
10
- const __dirname = path.resolve(),
11
+ const __dirname = fileURLToPath(path.dirname(import.meta.url)),
11
12
  cwd = process.cwd(),
12
13
  cpOpts = {env: process.env, cwd: cwd, stdio: 'inherit', shell: true},
13
14
  npmCmd = os.platform().startsWith('win') ? 'npm.cmd' : 'npm', // npm binary based on OS
@@ -1,15 +1,17 @@
1
- import autoprefixer from 'autoprefixer';
2
- import chalk from 'chalk';
3
- import cssnano from 'cssnano';
4
- import { Command } from 'commander/esm.mjs';
5
- import envinfo from 'envinfo';
6
- import fs from 'fs-extra';
7
- import inquirer from 'inquirer';
8
- import path from 'path';
9
- import postcss from 'postcss';
10
- import sass from 'sass';
11
-
12
- const cwd = process.cwd(),
1
+ import autoprefixer from 'autoprefixer';
2
+ import chalk from 'chalk';
3
+ import cssnano from 'cssnano';
4
+ import { Command } from 'commander/esm.mjs';
5
+ import envinfo from 'envinfo';
6
+ import fs from 'fs-extra';
7
+ import inquirer from 'inquirer';
8
+ import path from 'path';
9
+ import postcss from 'postcss';
10
+ import sass from 'sass';
11
+ import { fileURLToPath } from 'url';
12
+
13
+ const __dirname = fileURLToPath(path.dirname(import.meta.url)),
14
+ cwd = process.cwd(),
13
15
  requireJson = path => JSON.parse(fs.readFileSync((path))),
14
16
  packageJson = requireJson(path.resolve(cwd, 'package.json')),
15
17
  neoPath = packageJson.name === 'neo.mjs' ? './' : './node_modules/neo.mjs/',
@@ -422,13 +424,13 @@ if (programOpts.info) {
422
424
  // dist/development
423
425
  if (env === 'all' || env === 'dev') {
424
426
  console.log(chalk.blue(`${programName} starting dist/development`));
425
- buildEnv(path.join(scssPath), 'development');
427
+ buildEnv(scssPath, 'development');
426
428
  }
427
429
 
428
430
  // dist/production
429
431
  if (env === 'all' || env === 'prod') {
430
432
  console.log(chalk.blue(`${programName} starting dist/production`));
431
- buildEnv(path.join(scssPath), 'production');
433
+ buildEnv(scssPath, 'production');
432
434
  }
433
435
  });
434
436
  }
@@ -1,13 +1,14 @@
1
- import chalk from 'chalk';
2
- import { spawnSync } from 'child_process';
3
- import { Command } from 'commander/esm.mjs';
4
- import envinfo from 'envinfo';
5
- import fs from 'fs-extra';
6
- import inquirer from 'inquirer';
7
- import os from 'os';
8
- import path from 'path';
9
-
10
- const __dirname = path.resolve(),
1
+ import chalk from 'chalk';
2
+ import { spawnSync } from 'child_process';
3
+ import { Command } from 'commander/esm.mjs';
4
+ import envinfo from 'envinfo';
5
+ import fs from 'fs-extra';
6
+ import inquirer from 'inquirer';
7
+ import os from 'os';
8
+ import path from 'path';
9
+ import { fileURLToPath } from 'url';
10
+
11
+ const __dirname = fileURLToPath(path.dirname(import.meta.url)),
11
12
  cwd = process.cwd(),
12
13
  requireJson = path => JSON.parse(fs.readFileSync((path))),
13
14
  packageJson = requireJson(path.join(__dirname, 'package.json')),
@@ -1,9 +1,10 @@
1
- import fs from 'fs-extra';
2
- import helper from 'neo-jsdoc-x/src/lib/helper.js';
3
- import jsdocx from 'neo-jsdoc-x';
4
- import path from 'path';
1
+ import fs from 'fs-extra';
2
+ import helper from 'neo-jsdoc-x/src/lib/helper.js';
3
+ import jsdocx from 'neo-jsdoc-x';
4
+ import path from 'path';
5
+ import { fileURLToPath } from 'url';
5
6
 
6
- const __dirname = path.resolve(),
7
+ const __dirname = fileURLToPath(path.dirname(import.meta.url)),
7
8
  cwd = process.cwd(),
8
9
  requireJson = path => JSON.parse(fs.readFileSync((path))),
9
10
  packageJson = requireJson(path.resolve(cwd, 'package.json')),
@@ -1,13 +1,14 @@
1
- import chalk from 'chalk';
2
- import { spawnSync } from 'child_process';
3
- import { Command } from 'commander/esm.mjs';
4
- import envinfo from 'envinfo';
5
- import fs from 'fs-extra';
6
- import inquirer from 'inquirer';
7
- import os from 'os';
8
- import path from 'path';
9
-
10
- const __dirname = path.resolve(),
1
+ import chalk from 'chalk';
2
+ import { spawnSync } from 'child_process';
3
+ import { Command } from 'commander/esm.mjs';
4
+ import envinfo from 'envinfo';
5
+ import fs from 'fs-extra';
6
+ import inquirer from 'inquirer';
7
+ import os from 'os';
8
+ import path from 'path';
9
+ import { fileURLToPath } from 'url';
10
+
11
+ const __dirname = fileURLToPath(path.dirname(import.meta.url)),
11
12
  cwd = process.cwd(),
12
13
  cpOpts = {env: process.env, cwd: cwd, stdio: 'inherit', shell: true},
13
14
  requireJson = path => JSON.parse(fs.readFileSync((path))),
@@ -1,12 +1,13 @@
1
- import chalk from 'chalk';
2
- import { spawnSync } from 'child_process';
3
- import { Command } from 'commander/esm.mjs';
4
- import envinfo from 'envinfo';
5
- import fs from 'fs-extra';
6
- import inquirer from 'inquirer';
7
- import path from 'path';
1
+ import chalk from 'chalk';
2
+ import { spawnSync } from 'child_process';
3
+ import { Command } from 'commander/esm.mjs';
4
+ import envinfo from 'envinfo';
5
+ import fs from 'fs-extra';
6
+ import inquirer from 'inquirer';
7
+ import path from 'path';
8
+ import { fileURLToPath } from 'url';
8
9
 
9
- const __dirname = path.resolve(),
10
+ const __dirname = fileURLToPath(path.dirname(import.meta.url)),
10
11
  cwd = process.cwd(),
11
12
  cpOpts = {env: process.env, cwd: cwd, stdio: 'inherit', shell: true},
12
13
  requireJson = path => JSON.parse(fs.readFileSync((path))),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo.mjs",
3
- "version": "3.1.2",
3
+ "version": "3.1.3",
4
4
  "description": "The webworkers driven UI framework",
5
5
  "type": "module",
6
6
  "repository": {
package/src/core/Base.mjs CHANGED
@@ -121,17 +121,18 @@ class Base {
121
121
  * @protected
122
122
  */
123
123
  afterSetId(value, oldValue) {
124
- let me = this;
124
+ let me = this,
125
+ hasManager = Base.instanceManagerAvailable === true;
125
126
 
126
127
  if (oldValue) {
127
- if (Base.instanceManagerAvailable === true) {
128
+ if (hasManager) {
128
129
  Neo.manager.Instance.unregister(oldValue);
129
130
  } else {
130
131
  delete Neo.idMap[oldValue];
131
132
  }
132
133
  }
133
134
 
134
- if (Base.instanceManagerAvailable === true) {
135
+ if (hasManager) {
135
136
  Neo.manager.Instance.register(me);
136
137
  } else {
137
138
  Neo.idMap = Neo.idMap || {};
@@ -400,11 +401,12 @@ class Base {
400
401
  * @returns {Object}
401
402
  */
402
403
  setFields(config) {
403
- let configNames = this.constructor.config;
404
+ let me = this,
405
+ configNames = me.constructor.config;
404
406
 
405
407
  Object.entries(config).forEach(([key, value]) => {
406
- if (!configNames.hasOwnProperty(key) && !Neo.hasPropertySetter(this, key)) {
407
- this[key] = value;
408
+ if (!configNames.hasOwnProperty(key) && !Neo.hasPropertySetter(me, key)) {
409
+ me[key] = value;
408
410
  delete config[key];
409
411
  }
410
412
  });