pear-electron 1.7.0 → 1.7.2

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.
Files changed (4) hide show
  1. package/api.js +1 -1
  2. package/package.json +3 -3
  3. package/pre.js +1 -1
  4. package/runtime.js +11 -1
package/api.js CHANGED
@@ -352,7 +352,7 @@ module.exports = (api) => {
352
352
 
353
353
  exit = (code) => {
354
354
  process.exitCode = code
355
- this.ipc.processExit(code)
355
+ this.#ipc.exit(code)
356
356
  }
357
357
  }
358
358
  return API
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pear-electron",
3
- "version": "1.7.0",
3
+ "version": "1.7.2",
4
4
  "description": "Pear User-Interface Library for Electron",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -20,7 +20,7 @@
20
20
  "pear": {
21
21
  "assets": {
22
22
  "ui": {
23
- "link": "pear://0.2731.goowesg5dga9j1ryx47rsk9o4zms4541me4zerxsnbu8u99duh4o",
23
+ "link": "pear://0.2733.goowesg5dga9j1ryx47rsk9o4zms4541me4zerxsnbu8u99duh4o",
24
24
  "name": "Pear Runtime",
25
25
  "only": [
26
26
  "/boot.bundle",
@@ -73,7 +73,7 @@
73
73
  "iambus": "^1.0.3",
74
74
  "localdrive": "^1.12.1",
75
75
  "paparam": "^1.6.1",
76
- "pear-api": "^1.17.7",
76
+ "pear-api": "^1.21.0",
77
77
  "pear-ipc": "^6.3.0",
78
78
  "script-linker": "^2.5.3",
79
79
  "streamx": "^2.20.2",
package/pre.js CHANGED
@@ -12,7 +12,7 @@ async function configure (options) {
12
12
  const { stage = {} } = options
13
13
  const { pathname } = new URL(global.Pear.config.applink + '/')
14
14
  const drive = new Localdrive(pathname)
15
- const html = (await drive.get(options.gui.main)).toString()
15
+ const html = (await drive.get(options.gui?.main ?? 'index.html')).toString()
16
16
  const entrypoints = srcs(html)
17
17
  stage.entrypoints = Array.isArray(stage.entrypoints) ? [...stage.entrypoints, ...entrypoints] : entrypoints
18
18
  options.stage = stage
package/runtime.js CHANGED
@@ -11,7 +11,7 @@ const { pathToFileURL } = require('url-file-url')
11
11
  const constants = require('pear-api/constants')
12
12
  const plink = require('pear-api/link')
13
13
  const Logger = require('pear-api/logger')
14
- const { ERR_INVALID_APPLING, ERR_INVALID_PROJECT_DIR } = require('pear-api/errors')
14
+ const { ERR_INVALID_APPLING, ERR_INVALID_PROJECT_DIR, ERR_INVALID_CONFIG } = require('pear-api/errors')
15
15
 
16
16
  const run = require('pear-api/cmd/run')
17
17
  const pear = require('pear-api/cmd')
@@ -27,6 +27,16 @@ const bin = (name) => {
27
27
 
28
28
  class PearElectron {
29
29
  constructor () {
30
+ if (!Pear.config.assets.ui?.path) {
31
+ const info =
32
+ Pear.config.options.pre
33
+ ? { assets: Pear.config.assets }
34
+ : { assets: Pear.config.assets, hint: 'set pre: pear-electron/pre to autoset assets.ui' }
35
+ throw new ERR_INVALID_CONFIG('pear.assets.ui must be defined for project', info)
36
+ }
37
+ if (!Pear.config.assets.ui?.name) {
38
+ throw new ERR_INVALID_CONFIG('pear.assets.ui.name must be defined for project', { assets: Pear.config.assets })
39
+ }
30
40
  this.ipc = Pear[Pear.constructor.IPC]
31
41
  this.applink = new URL(Pear.config.applink)
32
42
  this.LOG = new Logger({ labels: [pkg.name] })