pear-electron 1.7.18 → 1.7.20

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 (2) hide show
  1. package/package.json +2 -2
  2. package/pre.js +8 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pear-electron",
3
- "version": "1.7.18",
3
+ "version": "1.7.20",
4
4
  "description": "Pear User-Interface Library for Electron",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -76,7 +76,7 @@
76
76
  "paparam": "^1.6.1",
77
77
  "pear-api": "^1.28.6",
78
78
  "pear-ipc": "^6.4.0",
79
- "pear-pipe": "^1.0.1",
79
+ "pear-pipe": "^1.0.2",
80
80
  "script-linker": "^2.5.3",
81
81
  "streamx": "^2.20.2",
82
82
  "url-file-url": "^1.0.4",
package/pre.js CHANGED
@@ -2,6 +2,7 @@
2
2
  /* global Pear */
3
3
  const Localdrive = require('localdrive')
4
4
  const cenc = require('compact-encoding')
5
+ const path = require('bare-path')
5
6
  const pipe = require('pear-pipe')()
6
7
  function srcs (html) {
7
8
  return [
@@ -11,7 +12,8 @@ function srcs (html) {
11
12
 
12
13
  async function configure (options) {
13
14
  const { stage = {} } = options
14
- const { pathname } = new URL(global.Pear.config.applink + '/')
15
+ const url = new URL(global.Pear.config.applink + '/')
16
+ const pathname = normalize(url.pathname)
15
17
  const drive = new Localdrive(pathname)
16
18
  const html = (await drive.get(options.gui?.main ?? 'index.html')).toString()
17
19
  const entrypoints = srcs(html)
@@ -34,3 +36,8 @@ pipe.once('data', (data) => {
34
36
  pipe.destroy(err)
35
37
  })
36
38
  })
39
+
40
+ function normalize (pathname) {
41
+ if (pathname[0] === '/' && pathname[2] === ':') return path.normalize(pathname.slice(1))
42
+ return path.normalize(pathname)
43
+ }