@lvce-editor/server 0.126.25 → 0.127.0
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/ThirdPartyNotices.txt +2 -2
- package/package.json +3 -3
- package/src/argvConfig.js +24 -2
- package/src/server.js +2 -2
- package/test/argvConfig.test.js +18 -1
package/ThirdPartyNotices.txt
CHANGED
|
@@ -2,7 +2,7 @@ This project incorporates components from the projects listed below, that may ha
|
|
|
2
2
|
differing from this project:
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
1) License Notice for static/
|
|
5
|
+
1) License Notice for static/bb456c5/icons (from https://github.com/microsoft/vscode-codicons)
|
|
6
6
|
---------------------------------------
|
|
7
7
|
|
|
8
8
|
Attribution 4.0 International
|
|
@@ -402,7 +402,7 @@ public licenses.
|
|
|
402
402
|
Creative Commons may be contacted at creativecommons.org.
|
|
403
403
|
|
|
404
404
|
|
|
405
|
-
2) License Notice for static/
|
|
405
|
+
2) License Notice for static/bb456c5/fonts (from https://www.npmjs.com/package/@fontsource/fira-code)
|
|
406
406
|
---------------------------------------
|
|
407
407
|
|
|
408
408
|
Copyright (c) 2014, The Fira Code Project Authors (https://github.com/tonsky/FiraCode)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.127.0",
|
|
4
4
|
"description": "Run LVCE Editor as a server.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": "bin/server.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@lvce-editor/jsonc-parser": "^1.6.0",
|
|
24
|
-
"@lvce-editor/shared-process": "0.
|
|
25
|
-
"@lvce-editor/static-server": "0.
|
|
24
|
+
"@lvce-editor/shared-process": "0.127.0",
|
|
25
|
+
"@lvce-editor/static-server": "0.127.0"
|
|
26
26
|
}
|
|
27
27
|
}
|
package/src/argvConfig.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { parse } from '@lvce-editor/jsonc-parser'
|
|
2
2
|
import { readFile } from 'node:fs/promises'
|
|
3
3
|
import { homedir, tmpdir } from 'node:os'
|
|
4
|
-
import { join } from 'node:path'
|
|
4
|
+
import { join, resolve } from 'node:path'
|
|
5
5
|
|
|
6
6
|
const applicationName = 'lvce-oss'
|
|
7
7
|
const keyPattern = /^[a-zA-Z0-9][a-zA-Z0-9._-]*$/
|
|
8
|
-
const optionsWithSeparateValues = new Set(['--connection-token', '--idle-timeout', '--link', '--only-extension', '--port', '--test-path'])
|
|
8
|
+
const optionsWithSeparateValues = new Set(['--auth-worker-path', '--connection-token', '--idle-timeout', '--link', '--only-extension', '--port', '--test-path'])
|
|
9
9
|
const reclaimerFeatureName = 'PartitionAllocMemoryReclaimer'
|
|
10
10
|
const reclaimerFeature = `${reclaimerFeatureName}:interval/1800s`
|
|
11
11
|
|
|
@@ -136,3 +136,25 @@ export const getWorkspaceArgument = (args) => {
|
|
|
136
136
|
}
|
|
137
137
|
return ''
|
|
138
138
|
}
|
|
139
|
+
|
|
140
|
+
export const resolveAuthWorkerPath = (args, workingDirectory = process.cwd()) => {
|
|
141
|
+
const resolvedArgs = [...args]
|
|
142
|
+
for (let index = 0; index < resolvedArgs.length; index++) {
|
|
143
|
+
const argument = resolvedArgs[index]
|
|
144
|
+
if (argument === '--auth-worker-path') {
|
|
145
|
+
const value = resolvedArgs[index + 1]
|
|
146
|
+
if (!value || value.startsWith('--')) {
|
|
147
|
+
throw new TypeError('--auth-worker-path requires a filesystem path')
|
|
148
|
+
}
|
|
149
|
+
resolvedArgs[index] = `--auth-worker-path=${resolve(workingDirectory, value)}`
|
|
150
|
+
resolvedArgs.splice(index + 1, 1)
|
|
151
|
+
} else if (argument.startsWith('--auth-worker-path=')) {
|
|
152
|
+
const value = argument.slice('--auth-worker-path='.length)
|
|
153
|
+
if (!value) {
|
|
154
|
+
throw new TypeError('--auth-worker-path requires a filesystem path')
|
|
155
|
+
}
|
|
156
|
+
resolvedArgs[index] = `--auth-worker-path=${resolve(workingDirectory, value)}`
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return resolvedArgs
|
|
160
|
+
}
|
package/src/server.js
CHANGED
|
@@ -19,7 +19,7 @@ if (env.LVCE_ARGV_CONFIG_LOADED !== '1') {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
// TODO pass argv to shared process instead of using environment variables / global variables
|
|
22
|
-
const argvSliced = argv.slice(2)
|
|
22
|
+
const argvSliced = ArgvConfig.resolveAuthWorkerPath(argv.slice(2))
|
|
23
23
|
let argv2 = ArgvConfig.getWorkspaceArgument(argvSliced)
|
|
24
24
|
for (const arg of argvSliced) {
|
|
25
25
|
if (arg.startsWith('--only-extension=')) {
|
|
@@ -81,7 +81,7 @@ const isStatic = (url) => {
|
|
|
81
81
|
if (url === '/index.html' || url.startsWith('/index.html?')) {
|
|
82
82
|
return !hasLinkedExtensions && !hasCustomWorkerPathOverride
|
|
83
83
|
}
|
|
84
|
-
if (url.startsWith('/
|
|
84
|
+
if (url.startsWith('/bb456c5')) {
|
|
85
85
|
return true
|
|
86
86
|
}
|
|
87
87
|
if (url.startsWith('/favicon.ico')) {
|
package/test/argvConfig.test.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import assert from 'node:assert/strict'
|
|
2
|
-
import { join } from 'node:path'
|
|
2
|
+
import { join, resolve } from 'node:path'
|
|
3
3
|
import test from 'node:test'
|
|
4
4
|
import * as ArgvConfig from '../src/argvConfig.js'
|
|
5
5
|
|
|
@@ -69,3 +69,20 @@ test('worker path options do not become workspace arguments', () => {
|
|
|
69
69
|
)
|
|
70
70
|
assert.equal(ArgvConfig.getWorkspaceArgument(['--process-explorer-worker=/worker.js']), '')
|
|
71
71
|
})
|
|
72
|
+
|
|
73
|
+
test('resolves an auth worker path supplied with equals syntax', () => {
|
|
74
|
+
const workingDirectory = '/test/workspace'
|
|
75
|
+
assert.deepEqual(ArgvConfig.resolveAuthWorkerPath(['--auth-worker-path=relative/auth worker.js'], workingDirectory), [
|
|
76
|
+
`--auth-worker-path=${resolve(workingDirectory, 'relative/auth worker.js')}`,
|
|
77
|
+
])
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
test('resolves an auth worker path supplied as a separate argument', () => {
|
|
81
|
+
const workingDirectory = '/test'
|
|
82
|
+
assert.deepEqual(ArgvConfig.resolveAuthWorkerPath(['--auth-worker-path', 'relative/auth worker.js', '/workspace'], '/test'), [
|
|
83
|
+
`--auth-worker-path=${resolve(workingDirectory, 'relative/auth worker.js')}`,
|
|
84
|
+
'/workspace',
|
|
85
|
+
])
|
|
86
|
+
assert.equal(ArgvConfig.getWorkspaceArgument(['--auth-worker-path=/test/auth worker.js', '/workspace']), '/workspace')
|
|
87
|
+
assert.equal(ArgvConfig.getWorkspaceArgument(['--auth-worker-path', '/test/auth worker.js', '/workspace']), '/workspace')
|
|
88
|
+
})
|