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.
- package/apps/ServiceWorker.mjs +2 -2
- package/apps/portal/view/home/FooterContainer.mjs +1 -1
- package/apps/portal/view/learn/MainContainerStateProvider.mjs +2 -2
- package/buildScripts/buildESModules.mjs +21 -3
- package/examples/ServiceWorker.mjs +2 -2
- package/package.json +1 -1
- package/src/DefaultConfig.mjs +2 -2
- package/src/main/addon/Stylesheet.mjs +1 -13
- package/src/worker/Manager.mjs +1 -7
package/apps/ServiceWorker.mjs
CHANGED
@@ -14,9 +14,9 @@ class MainContainerStateProvider extends StateProvider {
|
|
14
14
|
*/
|
15
15
|
className: 'Portal.view.learn.MainContainerStateProvider',
|
16
16
|
/**
|
17
|
-
* @member {String} contentBasePath='
|
17
|
+
* @member {String} contentBasePath=Neo.config.basePath+'resources/data/deck/'
|
18
18
|
*/
|
19
|
-
contentBasePath: '
|
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
|
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
|
-
|
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
|
package/package.json
CHANGED
package/src/DefaultConfig.mjs
CHANGED
@@ -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.
|
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.
|
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
|
}
|
package/src/worker/Manager.mjs
CHANGED
@@ -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 ||
|
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,
|