@vixoniccom/module-packager 2.10.3-dev.6 → 2.10.3-dev.7

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 CHANGED
@@ -41,14 +41,12 @@ function createWindow() {
41
41
  mainWindow.loadURL(launcherURL);
42
42
  // mainWindow.webContents.openDevTools({ mode: 'detach' })
43
43
  mainWindow.webContents.once('did-finish-load', () => {
44
- console.log('[ELECTRON] did-finish-load → show()');
45
44
  mainWindow?.show();
46
45
  mainWindow?.webContents.send('init', options);
47
46
  });
48
47
  mainWindow.on('closed', () => (mainWindow = null));
49
48
  }
50
49
  app.whenReady().then(() => {
51
- console.log('[ELECTRON] App is ready');
52
50
  createWindow();
53
51
  app.on('activate', () => {
54
52
  if (BrowserWindow.getAllWindows().length === 0) {
@@ -1,5 +1,5 @@
1
1
  <!DOCTYPE html>
2
- <html style="width: 100%; height: 100%; margin: 0; padding: 0;">
2
+ <html lang="en" xml:lang="en" style="width: 100%; height: 100%; margin: 0; padding: 0;">
3
3
 
4
4
  <head>
5
5
  <meta charset="UTF-8" />
@@ -14,44 +14,29 @@
14
14
  let ModuleController;
15
15
  try {
16
16
  const moduleControllerModule = require('@vixoniccom/module-controller');
17
- ModuleController = moduleControllerModule.default;
18
-
19
- console.log('[WEBVIEW] ModuleController cargado OK', ModuleController);
20
- } catch (err) {
17
+ ModuleController = moduleControllerModule.default;
18
+ } catch (err) {
21
19
  console.error('[WEBVIEW] NO se pudo cargar ModuleController', err);
22
20
  }
23
21
  const { ipcRenderer } = require('electron')
24
22
  const remote = require('@electron/remote')
25
23
 
26
24
  ipcRenderer.on('init', (event, options) => {
27
- console.log('[WEBVIEW] init', options)
28
-
29
25
  const webview = document.getElementById('webview')
30
26
  const win = remote.getCurrentWindow()
31
27
 
32
28
  webview.setAttribute('nodeintegration', '')
33
29
  webview.setAttribute('webpreferences', 'contextIsolation=no, nodeIntegration=yes')
34
30
 
35
- // webview.addEventListener('dom-ready', () => {
36
- // webview.openDevTools() // opcional
37
- // })
38
-
39
31
  webview.addEventListener('did-finish-load', () => {
40
- console.log('[WEBVIEW] did-finish-load fired')
41
32
  win.show()
42
33
  win.focus()
43
34
  })
44
35
 
45
- webview.addEventListener('did-fail-load', (e) => {
46
- console.error('[WEBVIEW] did-fail-load', e)
47
- })
48
-
49
36
  const resolvedSrc = options.mode === 'watch'
50
37
  ? `http://localhost:${options.port}/index.html`
51
38
  : `file://${path.join(options.build, 'index.html')}`
52
39
 
53
- console.log('[WEBVIEW] Resolved src:', resolvedSrc)
54
-
55
40
  webview.src = resolvedSrc
56
41
 
57
42
  function getData() {
@@ -89,9 +74,6 @@
89
74
  const data = getData()
90
75
  const schema = getSchema()
91
76
 
92
- console.log('[WEBVIEW] Data entregada a ModuleController:', data)
93
- console.log('[WEBVIEW] Schema entregado a ModuleController:', schema)
94
-
95
77
  ModuleController.init(win, webview, data, schema, options.mode === 'watch')
96
78
  })
97
79
  </script>
package/dist/main.js CHANGED
@@ -4,7 +4,7 @@ import commandLineArgs from 'command-line-args';
4
4
  import path from 'path';
5
5
  import webpack from 'webpack';
6
6
  import WebpackDevServer from 'webpack-dev-server';
7
- import { spawn, exec } from 'child_process';
7
+ import { exec } from 'child_process';
8
8
  import { fileURLToPath } from 'url';
9
9
  import fs from 'fs';
10
10
  import archiver from 'archiver';
@@ -44,7 +44,6 @@ if (options.mode === 'build') {
44
44
  });
45
45
  }
46
46
  else if (options.mode === 'watch') {
47
- console.log('[DEBUG] Entrando a watch()');
48
47
  watch();
49
48
  }
50
49
  else if (options.mode === 'run') {
@@ -56,65 +55,47 @@ else if (options.mode === 'generate-configuration') {
56
55
  else if (options.mode === 'validate-configuration') {
57
56
  validateConfiguration();
58
57
  }
59
- function runElectron() {
60
- const electronProcess = spawn('npx', [
61
- 'electron',
62
- electronPath,
63
- '--src', path.resolve(options.src),
64
- '--build', path.resolve(options.build),
65
- '--port', `${options.port}`,
66
- '--mode', options.mode,
67
- '--config', options.config,
68
- '--externals', options.externals.join(',')
69
- ], {
70
- cwd: __dirname,
71
- env: { ...process.env, NODE_ENV: 'development' },
72
- stdio: 'inherit'
73
- });
74
- electronProcess.on('close', (code) => {
75
- console.log(`Electron process exited with code ${code}`);
76
- if (code !== 0) {
77
- console.error('Electron process exited with an error.');
78
- }
79
- });
80
- }
81
58
  async function pack(callback) {
82
- console.log(path.resolve(__dirname, './dist', options.config));
83
59
  console.log(clc.blue('Building module...'));
84
60
  validateConfiguration();
85
61
  const configPath = path.resolve(__dirname, options.config);
86
- console.log("🚀 ~ pack ~ configPath:", configPath);
87
62
  try {
88
63
  const webpackConfig = (await import(configPath)).default(options);
89
- webpack(webpackConfig, function (err, stats) {
90
- if (err) {
91
- console.error('Build error:', err);
92
- if (err.details) {
93
- console.error('Details:', err.details);
94
- }
95
- if (err.errors) {
96
- console.error('TS Errors:', JSON.stringify(err.errors, null, 2));
97
- }
98
- throw err;
64
+ function handleWebpackError(err) {
65
+ console.error('Build error:', err);
66
+ if (err.details) {
67
+ console.error('Details:', err.details);
99
68
  }
100
- else {
101
- if (stats.hasErrors()) {
102
- const info = stats.toJson('errors-only');
103
- console.error(clc.red('Webpack errors:'));
104
- if (info.errors && info.errors.length) {
105
- info.errors.forEach((e) => {
106
- console.error(clc.red(typeof e === 'object' ? JSON.stringify(e, null, 2) : e));
107
- });
108
- }
109
- else {
110
- console.error(clc.red(JSON.stringify(info, null, 2)));
111
- }
112
- callback && callback(stats);
69
+ if (err.errors) {
70
+ console.error('TS Errors:', JSON.stringify(err.errors, null, 2));
71
+ }
72
+ throw err;
73
+ }
74
+ function handleWebpackStats(stats, callback) {
75
+ if (stats.hasErrors()) {
76
+ const info = stats.toJson('errors-only');
77
+ console.error(clc.red('Webpack errors:'));
78
+ if (info.errors?.length) {
79
+ info.errors.forEach((e) => {
80
+ console.error(clc.red(typeof e === 'object' ? JSON.stringify(e, null, 2) : e));
81
+ });
113
82
  }
114
83
  else {
115
- console.log(clc.green('Build OK.'));
116
- callback && callback(null);
84
+ console.error(clc.red(JSON.stringify(info, null, 2)));
117
85
  }
86
+ callback?.(stats);
87
+ }
88
+ else {
89
+ console.log(clc.green('Build OK.'));
90
+ callback?.(null);
91
+ }
92
+ }
93
+ webpack(webpackConfig, function (err, stats) {
94
+ if (err) {
95
+ handleWebpackError(err);
96
+ }
97
+ else {
98
+ handleWebpackStats(stats, callback);
118
99
  }
119
100
  });
120
101
  }
@@ -136,11 +117,11 @@ function installExternals(callback) {
136
117
  if (err)
137
118
  throw err;
138
119
  console.log(clc.green('Externals installed.'));
139
- callback && callback(null);
120
+ callback?.(null);
140
121
  });
141
122
  }
142
123
  else {
143
- callback && callback(null);
124
+ callback?.(null);
144
125
  }
145
126
  }
146
127
  function zip() {
@@ -161,10 +142,8 @@ function zip() {
161
142
  clc.move(-2, 0);
162
143
  }
163
144
  async function watch() {
164
- console.log('[VMP] ▸ starting dev-server & electron in watch mode…');
165
145
  const cfgPath = path.resolve(__dirname, '..', 'dist/webpack.config.js');
166
146
  const webpackConfigFactory = (await import(cfgPath)).default;
167
- console.log('[VMP] ▸ webpack config loaded from', cfgPath);
168
147
  const compiler = webpack(webpackConfigFactory(options));
169
148
  const server = new WebpackDevServer({
170
149
  static: false,
@@ -173,7 +152,6 @@ async function watch() {
173
152
  historyApiFallback: true
174
153
  }, compiler);
175
154
  await server.start();
176
- console.log(`[VMP] ▸ dev-server listening on http://localhost:${options.port}`);
177
155
  const cmd = [
178
156
  'npx', 'electron', electronPath,
179
157
  '--src', path.resolve(options.src),
@@ -183,14 +161,31 @@ async function watch() {
183
161
  '--config', options.config,
184
162
  '--externals', options.externals.join(',')
185
163
  ].join(' ');
186
- console.log(`[VMP] ▸ ${cmd}`);
187
- const child = exec(cmd, { cwd: __dirname, env: { ...process.env, NODE_ENV: 'development' } });
188
- child.stdout?.pipe(process.stdout);
189
- child.stderr?.pipe(process.stderr);
164
+ const child = exec(cmd, {
165
+ cwd: __dirname,
166
+ env: {
167
+ ...process.env,
168
+ NODE_ENV: 'development',
169
+ ELECTRON_DISABLE_SECURITY_WARNINGS: 'true',
170
+ NODE_NO_WARNINGS: '1'
171
+ }
172
+ });
173
+ // Filtrar logs no deseados
174
+ child.stdout?.on('data', (data) => {
175
+ const output = data.toString();
176
+ if (!shouldFilterLog(output)) {
177
+ process.stdout.write(output);
178
+ }
179
+ });
180
+ child.stderr?.on('data', (data) => {
181
+ const output = data.toString();
182
+ if (!shouldFilterLog(output)) {
183
+ process.stderr.write(output);
184
+ }
185
+ });
190
186
  }
191
187
  async function run() {
192
188
  await new Promise((resolve, reject) => pack((err) => (err ? reject(err) : resolve())));
193
- console.log('[VMP] ▸ building renderer…');
194
189
  const cfgPath = path.resolve(__dirname, '..', 'dist/webpack.config.js');
195
190
  const webpackConfigFactory = (await import(cfgPath)).default;
196
191
  const compiler = webpack(webpackConfigFactory(options));
@@ -201,8 +196,6 @@ async function run() {
201
196
  if (stats?.hasErrors()) {
202
197
  return reject(new Error(stats.toString({ all: false, errors: true, colors: true })));
203
198
  }
204
- console.log(stats?.toString({ colors: true, chunks: false, modules: false }) ??
205
- '[VMP] ▸ renderer built');
206
199
  compiler.close(closeErr => (closeErr ? reject(closeErr) : resolve()));
207
200
  });
208
201
  });
@@ -225,10 +218,27 @@ async function run() {
225
218
  ].join(' ');
226
219
  const child = exec(cmd, {
227
220
  cwd: __dirname,
228
- env: { ...process.env, NODE_ENV: 'production' },
221
+ env: {
222
+ ...process.env,
223
+ NODE_ENV: 'production',
224
+ // Suprimir warnings en producción también
225
+ ELECTRON_DISABLE_SECURITY_WARNINGS: 'true',
226
+ NODE_NO_WARNINGS: '1'
227
+ },
228
+ });
229
+ // Aplicar el mismo filtrado
230
+ child.stdout?.on('data', (data) => {
231
+ const output = data.toString();
232
+ if (!shouldFilterLog(output)) {
233
+ process.stdout.write(output);
234
+ }
235
+ });
236
+ child.stderr?.on('data', (data) => {
237
+ const output = data.toString();
238
+ if (!shouldFilterLog(output)) {
239
+ process.stderr.write(output);
240
+ }
229
241
  });
230
- child.stdout?.pipe(process.stdout);
231
- child.stderr?.pipe(process.stderr);
232
242
  }
233
243
  async function loadConfiguration() {
234
244
  const require = createRequire(import.meta.url);
@@ -274,3 +284,22 @@ function validateConfiguration() {
274
284
  throw e;
275
285
  }
276
286
  }
287
+ function shouldFilterLog(output) {
288
+ const filtersToRemove = [
289
+ "'session.getAllExtensions' is deprecated",
290
+ "DeprecationWarning: Compilation.assets will be frozen",
291
+ "BREAKING CHANGE: No more changes should happen to Compilation.assets",
292
+ "[DEP_WEBPACK_COMPILATION_ASSETS] DeprecationWarning",
293
+ "Compilation.assets will be frozen in future",
294
+ "Request Autofill.enable failed",
295
+ "Request Autofill.setAddresses failed",
296
+ "Uncaught (in promise) SyntaxError",
297
+ "wasn't found",
298
+ "asset main.js",
299
+ "runtime modules",
300
+ "orphan modules",
301
+ "cacheable modules",
302
+ "webpack compiled successfully"
303
+ ];
304
+ return filtersToRemove.some(filter => output.includes(filter));
305
+ }
package/package.json CHANGED
@@ -1,51 +1,7 @@
1
1
  {
2
- "_args": [
3
- [
4
- {
5
- "raw": "@vixoniccom/module-packager@^1.2.0",
6
- "scope": "@vixoniccom",
7
- "escapedName": "@vixoniccom%2fmodule-packager",
8
- "name": "@vixoniccom/module-packager",
9
- "rawSpec": "^1.2.0",
10
- "spec": ">=1.2.0 <2.0.0",
11
- "type": "range"
12
- }
13
- ]
14
- ],
15
- "_from": "@vixoniccom/module-packager@>=1.2.0 <2.0.0",
16
- "_inCache": true,
17
- "_location": "/@vixoniccom/module-packager",
18
- "_nodeVersion": "7.6.0",
19
- "_npmOperationalInternal": {
20
- "host": "packages-12-west.internal.npmjs.com",
21
- "tmp": "tmp/module-packager-1.2.0.tgz_1487918846893_0.5388180573936552"
22
- },
23
- "_npmUser": {
24
- "name": "vixonic",
25
- "email": "tdadone@vixonic.net"
26
- },
27
- "_npmVersion": "2.15.9",
28
- "_phantomChildren": {},
29
- "_requested": {
30
- "raw": "@vixoniccom/module-packager@^1.2.0",
31
- "scope": "@vixonic",
32
- "escapedName": "@vixonic%2fmodule-packager",
33
- "name": "@vixoniccom/module-packager",
34
- "rawSpec": "^1.2.0",
35
- "spec": ">=1.2.0 <2.0.0",
36
- "type": "range"
37
- },
38
- "_requiredBy": [
39
- "#DEV:/"
40
- ],
41
- "_resolved": "https://registry.npmjs.org/@vixoniccom/module-packager/-/module-packager-1.2.0.tgz",
42
- "_shasum": "9735f3bcbf2101d404d7bb058cb8337b0a87c503",
43
- "_shrinkwrap": null,
44
- "_spec": "@vixoniccom/module-packager@^1.2.0",
45
- "_where": "c:\\Development\\menuboard",
46
- "author": {
47
- "name": "tdadone"
48
- },
2
+ "name": "@vixoniccom/module-packager",
3
+ "version": "2.10.3-dev.7",
4
+ "type": "module",
49
5
  "bin": {
50
6
  "vixonic-module-packager": "./dist/main.js"
51
7
  },
@@ -53,6 +9,22 @@
53
9
  "dist",
54
10
  "index.html"
55
11
  ],
12
+ "main": "dist/main.js",
13
+ "scripts": {
14
+ "start": "electron dist/electron.js --mode run --build ./dist/build",
15
+ "clean": "rimraf dist",
16
+ "build:main": "tsc -p tsconfig.json --outDir dist",
17
+ "build:renderer": "webpack --config webpack.config.js --env src=./ --env build=./dist/build --mode production",
18
+ "copy:launcher": "cp launcher.html dist/launcher.html",
19
+ "build": "npm run clean && npm-run-all -p build:renderer build:main && npm run copy:launcher",
20
+ "watch:renderer": "webpack --config webpack.config.js --env src=./ --env build=./dist/build --mode=development --watch",
21
+ "watch:main": "tsc -p tsconfig.json --outDir dist --watch",
22
+ "dev:watch": "npm run clean && npm-run-all -p watch:renderer watch:main",
23
+ "prerelease-dev": "standard-version --prerelease dev",
24
+ "prerelease-rc": "standard-version --prerelease rc",
25
+ "prerelease-test": "standard-version --prerelease test",
26
+ "release": "standard-version"
27
+ },
56
28
  "dependencies": {
57
29
  "@electron/remote": "^2.1.2",
58
30
  "@vixoniccom/module-controller": "^2.0.0-dev.2",
@@ -64,9 +36,8 @@
64
36
  "copy-webpack-plugin": "^13.0.0",
65
37
  "electron": "^36.1.0",
66
38
  "electron-debug": "^3.2.0",
67
- "file-loader": "^0.9.0",
68
39
  "global": "^4.4.0",
69
- "html-loader": "^0.4.5",
40
+ "html-loader": "^5.1.0",
70
41
  "html-webpack-plugin": "^4.5.2",
71
42
  "lodash": "^4.17.21",
72
43
  "process": "^0.11.10",
@@ -78,38 +49,6 @@
78
49
  "webpack-cli": "^6.0.1",
79
50
  "webpack-dev-server": "^5.2.1"
80
51
  },
81
- "directories": {},
82
- "dist": {
83
- "shasum": "9735f3bcbf2101d404d7bb058cb8337b0a87c503",
84
- "tarball": "https://registry.npmjs.org/@vixoniccom/module-packager/-/module-packager-1.2.0.tgz"
85
- },
86
- "main": "dist/main.js",
87
- "maintainers": [
88
- {
89
- "name": "vixonic",
90
- "email": "tdadone@vixonic.net"
91
- }
92
- ],
93
- "name": "@vixoniccom/module-packager",
94
- "readme": "ERROR: No README data found!",
95
- "scripts": {
96
- "start": "electron dist/electron.js --mode run --build ./dist/build",
97
- "clean": "rimraf dist",
98
- "build:main": "tsc -p tsconfig.json --outDir dist",
99
- "build:renderer": "webpack --config webpack.config.js --env src=./ --env build=./dist/build --mode production",
100
- "copy:launcher": "cp launcher.html dist/launcher.html",
101
- "build": "npm run clean && npm-run-all -p build:renderer build:main && npm run copy:launcher",
102
- "watch:renderer": "webpack --config webpack.config.js --env src=./ --env build=./dist/build --mode=development --watch",
103
- "watch:main": "tsc -p tsconfig.json --outDir dist --watch",
104
- "dev:watch": "npm run clean && npm-run-all -p watch:renderer watch:main",
105
- "prerelease-dev": "standard-version --prerelease dev",
106
- "prerelease-rc": "standard-version --prerelease rc",
107
- "prerelease-test": "standard-version --prerelease test",
108
- "release": "standard-version"
109
- },
110
- "type": "module",
111
- "version": "2.10.3-dev.6",
112
- "license": "ISC",
113
52
  "devDependencies": {
114
53
  "@types/archiver": "^6.0.3",
115
54
  "@types/cli-color": "^2.0.6",