@vixoniccom/module-packager 2.15.0-dev.1 → 2.15.0-dev.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/dist/electron.js +6 -4
- package/dist/launcher-preload.cjs +77 -0
- package/dist/launcher.html +0 -79
- package/package.json +3 -3
package/dist/electron.js
CHANGED
|
@@ -28,11 +28,13 @@ function createWindow() {
|
|
|
28
28
|
width: 1024,
|
|
29
29
|
height: 768,
|
|
30
30
|
webPreferences: {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
nodeIntegration: true,
|
|
31
|
+
preload: path.join(__dirname, 'launcher-preload.cjs'),
|
|
32
|
+
nodeIntegration: false,
|
|
34
33
|
contextIsolation: false,
|
|
35
|
-
webSecurity:
|
|
34
|
+
webSecurity: true,
|
|
35
|
+
allowRunningInsecureContent: false,
|
|
36
|
+
nodeIntegrationInSubFrames: false,
|
|
37
|
+
sandbox: false,
|
|
36
38
|
webviewTag: true
|
|
37
39
|
}
|
|
38
40
|
});
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
const path = require('path')
|
|
2
|
+
|
|
3
|
+
let ModuleController
|
|
4
|
+
try {
|
|
5
|
+
const mod = require('@vixoniccom/module-controller')
|
|
6
|
+
ModuleController = mod.default
|
|
7
|
+
} catch (err) {
|
|
8
|
+
console.error('[launcher-preload] Could not load ModuleController', err)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const { ipcRenderer } = require('electron')
|
|
12
|
+
const remote = require('@electron/remote')
|
|
13
|
+
|
|
14
|
+
ipcRenderer.on('init', (event, options) => {
|
|
15
|
+
const webview = document.createElement('webview')
|
|
16
|
+
webview.id = 'webview'
|
|
17
|
+
webview.style.width = '100%'
|
|
18
|
+
webview.style.height = '100%'
|
|
19
|
+
webview.setAttribute('partition', 'persist:webview')
|
|
20
|
+
|
|
21
|
+
webview.setAttribute('nodeintegration', '')
|
|
22
|
+
webview.setAttribute('webpreferences', 'webSecurity=false, allowRunningInsecureContent=true, nodeIntegration=yes, contextIsolation=no')
|
|
23
|
+
|
|
24
|
+
const win = remote.getCurrentWindow()
|
|
25
|
+
|
|
26
|
+
webview.addEventListener('did-finish-load', () => {
|
|
27
|
+
win.show()
|
|
28
|
+
win.focus()
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
const resolvedSrc = options.mode === 'watch'
|
|
32
|
+
? `http://localhost:${options.port}/index.html`
|
|
33
|
+
: `file://${path.join(options.build, 'index.html')}`
|
|
34
|
+
|
|
35
|
+
webview.src = resolvedSrc
|
|
36
|
+
|
|
37
|
+
document.getElementById('webview-container').appendChild(webview)
|
|
38
|
+
|
|
39
|
+
function getData() {
|
|
40
|
+
const data = {}
|
|
41
|
+
|
|
42
|
+
try {
|
|
43
|
+
data.parameters = require(path.join(options.src, 'test', 'parameters.json')).parameters
|
|
44
|
+
} catch (err) {
|
|
45
|
+
console.log('No parameters:', err.message)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
let escaped = path.join(options.mode === 'watch' ? options.src : options.build, 'test', 'downloads')
|
|
49
|
+
|
|
50
|
+
if (options.mode === 'watch') escaped = `file://${escaped}`
|
|
51
|
+
escaped = escaped.replace(/\\/g, '/')
|
|
52
|
+
|
|
53
|
+
data.downloadsPath = escaped
|
|
54
|
+
|
|
55
|
+
try {
|
|
56
|
+
data.services = require(path.join(options.src, 'test', 'services.json')).services
|
|
57
|
+
} catch (err) {
|
|
58
|
+
console.log('No services:', err.message)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return data
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function getSchema() {
|
|
65
|
+
try {
|
|
66
|
+
return require(path.join(options.src, '../configuration.json')).schema
|
|
67
|
+
} catch (err) {
|
|
68
|
+
console.log('No schema:', err.message)
|
|
69
|
+
return {}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const data = getData()
|
|
74
|
+
const schema = getSchema()
|
|
75
|
+
|
|
76
|
+
ModuleController.init(win, webview, data, schema, options.mode === 'watch')
|
|
77
|
+
})
|
package/dist/launcher.html
CHANGED
|
@@ -8,85 +8,6 @@
|
|
|
8
8
|
|
|
9
9
|
<body style="width: 100%; height: 100%; margin: 0; padding: 0;">
|
|
10
10
|
<div id="webview-container" style="width: 100%; height: 100%;"></div>
|
|
11
|
-
|
|
12
|
-
<script>
|
|
13
|
-
const path = require('path')
|
|
14
|
-
let ModuleController;
|
|
15
|
-
try {
|
|
16
|
-
const moduleControllerModule = require('@vixoniccom/module-controller');
|
|
17
|
-
ModuleController = moduleControllerModule.default;
|
|
18
|
-
} catch (err) {
|
|
19
|
-
console.error('[WEBVIEW] NO se pudo cargar ModuleController', err);
|
|
20
|
-
}
|
|
21
|
-
const { ipcRenderer } = require('electron')
|
|
22
|
-
const remote = require('@electron/remote')
|
|
23
|
-
|
|
24
|
-
ipcRenderer.on('init', (event, options) => {
|
|
25
|
-
const webview = document.createElement('webview')
|
|
26
|
-
webview.id = 'webview'
|
|
27
|
-
webview.style.width = '100%'
|
|
28
|
-
webview.style.height = '100%'
|
|
29
|
-
webview.setAttribute('partition', 'persist:webview')
|
|
30
|
-
|
|
31
|
-
webview.setAttribute('nodeintegration', '')
|
|
32
|
-
webview.setAttribute('webpreferences', 'webSecurity=false, allowRunningInsecureContent=true, nodeIntegration=yes, contextIsolation=no')
|
|
33
|
-
|
|
34
|
-
const win = remote.getCurrentWindow()
|
|
35
|
-
|
|
36
|
-
webview.addEventListener('did-finish-load', () => {
|
|
37
|
-
win.show()
|
|
38
|
-
win.focus()
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
const resolvedSrc = options.mode === 'watch'
|
|
42
|
-
? `http://localhost:${options.port}/index.html`
|
|
43
|
-
: `file://${path.join(options.build, 'index.html')}`
|
|
44
|
-
|
|
45
|
-
webview.src = resolvedSrc
|
|
46
|
-
|
|
47
|
-
document.getElementById('webview-container').appendChild(webview)
|
|
48
|
-
|
|
49
|
-
function getData() {
|
|
50
|
-
const data = {}
|
|
51
|
-
|
|
52
|
-
try {
|
|
53
|
-
data.parameters = require(path.join(options.src, 'test', 'parameters.json')).parameters
|
|
54
|
-
} catch (err) {
|
|
55
|
-
console.log('No parameters:', err.message)
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
let escaped = path.join(options.mode === 'watch' ? options.src : options.build, 'test', 'downloads')
|
|
59
|
-
|
|
60
|
-
if (options.mode === 'watch') escaped = `file://${escaped}`
|
|
61
|
-
escaped = escaped.replace(/\\/g, '/')
|
|
62
|
-
|
|
63
|
-
data.downloadsPath = escaped
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
try {
|
|
67
|
-
data.services = require(path.join(options.src, 'test','services.json')).services
|
|
68
|
-
} catch (err) {
|
|
69
|
-
console.log('No services:', err.message)
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return data
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function getSchema() {
|
|
76
|
-
try {
|
|
77
|
-
return require(path.join(options.src, '../configuration.json')).schema
|
|
78
|
-
} catch (err) {
|
|
79
|
-
console.log('No schema:', err.message)
|
|
80
|
-
return {}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const data = getData()
|
|
85
|
-
const schema = getSchema()
|
|
86
|
-
|
|
87
|
-
ModuleController.init(win, webview, data, schema, options.mode === 'watch')
|
|
88
|
-
})
|
|
89
|
-
</script>
|
|
90
11
|
</body>
|
|
91
12
|
|
|
92
13
|
</html>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vixoniccom/module-packager",
|
|
3
|
-
"version": "2.15.0-dev.
|
|
3
|
+
"version": "2.15.0-dev.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"bin": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"prepublish": "npm run build",
|
|
20
20
|
"build:main": "tsc -p tsconfig.json --outDir dist",
|
|
21
21
|
"build:renderer": "webpack --config webpack.config.js --env src=./ --env build=./dist/build --mode production",
|
|
22
|
-
"copy:launcher": "cpy launcher.html dist",
|
|
22
|
+
"copy:launcher": "cpy launcher.html launcher-preload.cjs dist",
|
|
23
23
|
"build": "npm run clean && npm-run-all -p build:renderer build:main && npm run copy:launcher",
|
|
24
24
|
"prerelease-dev": "standard-version --prerelease dev",
|
|
25
25
|
"prerelease-rc": "standard-version --prerelease rc",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@electron/remote": "2.1.3",
|
|
31
31
|
"@types/which": "^3.0.4",
|
|
32
|
-
"@vixoniccom/module-controller": "2.1.0-dev.
|
|
32
|
+
"@vixoniccom/module-controller": "2.1.0-dev.3",
|
|
33
33
|
"@vixoniccom/modules": "2.26.4",
|
|
34
34
|
"archiver": "^5.3.0",
|
|
35
35
|
"clean-webpack-plugin": "^4.0.0",
|