neo.mjs 9.6.0 → 9.6.1

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,9 +20,9 @@ class ServiceWorker extends ServiceBase {
20
20
  */
21
21
  singleton: true,
22
22
  /**
23
- * @member {String} version='9.6.0'
23
+ * @member {String} version='9.6.1'
24
24
  */
25
- version: '9.6.0'
25
+ version: '9.6.1'
26
26
  }
27
27
 
28
28
  /**
@@ -107,7 +107,7 @@ class FooterContainer extends Container {
107
107
  }, {
108
108
  module: Component,
109
109
  cls : ['neo-version'],
110
- html : 'v9.6.0'
110
+ html : 'v9.6.1'
111
111
  }]
112
112
  }],
113
113
  /**
@@ -14,9 +14,9 @@ class MainContainerStateProvider extends StateProvider {
14
14
  */
15
15
  className: 'Portal.view.learn.MainContainerStateProvider',
16
16
  /**
17
- * @member {String} contentBasePath='../../resources/data/deck/'
17
+ * @member {String} contentBasePath=Neo.config.basePath+'resources/data/deck/'
18
18
  */
19
- contentBasePath: '../../resources/data/deck/',
19
+ contentBasePath: Neo.config.basePath + 'resources/data/deck/',
20
20
  /**
21
21
  * @member {Object} data
22
22
  */
@@ -8,7 +8,10 @@ const
8
8
  __filename = fileURLToPath(import.meta.url),
9
9
  __dirname = path.dirname(__filename),
10
10
  inputDirectories = ['apps', 'docs', 'examples', 'src'],
11
- outputBasePath = '../dist/esm/';
11
+ outputBasePath = '../dist/esm/',
12
+ // Regex to find import statements with 'node_modules' in the path
13
+ // It captures the entire import statement (excluding the leading 'import') and the path itself.
14
+ regexImport = /(import(?:["'\s]*(?:[\w*{}\n\r\t, ]+)from\s*)?)(["'`])((?:(?!\2).)*node_modules(?:(?!\2).)*)\2/g;
12
15
 
13
16
  async function minifyDirectory(inputDir, outputDir) {
14
17
  if (fs.existsSync(inputDir)) {
@@ -32,7 +35,11 @@ async function minifyDirectory(inputDir, outputDir) {
32
35
  const jsonContent = JSON.parse(content);
33
36
 
34
37
  if (dirent.name === 'neo-config.json') {
35
- jsonContent.environment = 'dist/esm';
38
+ Object.assign(jsonContent, {
39
+ basePath : '../../' + jsonContent.basePath,
40
+ environment : 'dist/esm',
41
+ workerBasePath: jsonContent.basePath + 'src/worker/'
42
+ })
36
43
  }
37
44
 
38
45
  fs.writeFileSync(outputPath, JSON.stringify(jsonContent));
@@ -47,7 +54,18 @@ async function minifyDirectory(inputDir, outputDir) {
47
54
  }
48
55
  // Minify JS files
49
56
  else if (dirent.name.endsWith('.mjs')) {
50
- const result = await minifyJs(content, {
57
+ let adjustedContent = content.replace(regexImport, (match, p1, p2, p3) => {
58
+ // p1 will be "import {marked} from " (or similar, including the 'import' keyword and everything up to the first quote)
59
+ // p2 will be the quote character (', ", or `)
60
+ // p3 will be the original path string (e.g., '../../../../node_modules/marked/lib/marked.esm.js')
61
+
62
+ const newPath = '../../' + p3; // Prepend 2 levels up
63
+
64
+ // Reconstruct the import statement with the new path
65
+ return p1 + p2 + newPath + p2;
66
+ });
67
+
68
+ const result = await minifyJs(adjustedContent, {
51
69
  module: true,
52
70
  compress: {
53
71
  dead_code: true
@@ -20,9 +20,9 @@ class ServiceWorker extends ServiceBase {
20
20
  */
21
21
  singleton: true,
22
22
  /**
23
- * @member {String} version='9.6.0'
23
+ * @member {String} version='9.6.1'
24
24
  */
25
- version: '9.6.0'
25
+ version: '9.6.1'
26
26
  }
27
27
 
28
28
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name" : "neo.mjs",
3
- "version" : "9.6.0",
3
+ "version" : "9.6.1",
4
4
  "description" : "The webworkers driven UI framework",
5
5
  "type" : "module",
6
6
  "repository" : {
@@ -263,12 +263,12 @@ const DefaultConfig = {
263
263
  useVdomWorker: true,
264
264
  /**
265
265
  * buildScripts/injectPackageVersion.mjs will update this value
266
- * @default '9.6.0'
266
+ * @default '9.6.1'
267
267
  * @memberOf! module:Neo
268
268
  * @name config.version
269
269
  * @type String
270
270
  */
271
- version: '9.6.0'
271
+ version: '9.6.1'
272
272
  };
273
273
 
274
274
  Object.assign(DefaultConfig, {
@@ -48,11 +48,7 @@ class Stylesheet extends Base {
48
48
 
49
49
  if (neoConfig.useFontAwesome) {
50
50
  if (env === 'development' || env === 'dist/esm') {
51
- faPath = neoConfig.basePath + 'node_modules/@fortawesome/fontawesome-free/css/all.min.css';
52
-
53
- if (env === 'dist/esm') {
54
- faPath = '../../' + faPath
55
- }
51
+ faPath = neoConfig.basePath + 'node_modules/@fortawesome/fontawesome-free/css/all.min.css'
56
52
  } else {
57
53
  faPath = neoConfig.basePath.substring(6) + 'resources/fontawesome-free/css/all.min.css'
58
54
  }
@@ -78,10 +74,6 @@ class Stylesheet extends Base {
78
74
 
79
75
  document.body.classList.add(themes[0]);
80
76
 
81
- if (env === 'dist/esm') {
82
- path = '../../' + path;
83
- }
84
-
85
77
  folders.forEach(folder => {
86
78
  if (folder.startsWith('neo-')) {
87
79
  folder = folder.substring(4)
@@ -109,10 +101,6 @@ class Stylesheet extends Base {
109
101
  promises = [],
110
102
  rootPath = config.basePath.substring(6);
111
103
 
112
- if (env === 'dist/esm') {
113
- path = '../../' + path;
114
- }
115
-
116
104
  if (className.startsWith('Neo.')) {
117
105
  className = className.substring(4)
118
106
  }
@@ -42,12 +42,6 @@ class Manager extends Base {
42
42
  * @protected
43
43
  */
44
44
  appNames: [],
45
- /**
46
- * The base path for the worker file URLs, can e.g. get set inside the index.html.
47
- * @member {String|null} basePath=Neo.config.workerBasePath || 'worker/'
48
- * @protected
49
- */
50
- basePath: NeoConfig.workerBasePath || 'worker/',
51
45
  /**
52
46
  * @member {Number} constructedThreads=0
53
47
  * @protected
@@ -164,7 +158,7 @@ class Manager extends Base {
164
158
  createWorker(opts) {
165
159
  let me = this,
166
160
  {fileName} = opts,
167
- filePath = (opts.basePath || me.basePath) + fileName,
161
+ filePath = (opts.basePath || Neo.config.workerBasePath) + fileName,
168
162
  name = `neomjs-${fileName.substring(0, fileName.indexOf('.')).toLowerCase()}-worker`,
169
163
  isShared = me.sharedWorkersEnabled && NeoConfig.useSharedWorkers,
170
164
  cls = isShared ? SharedWorker : Worker,