@ham2k/extension-tools 1.16.1 → 1.18.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/h2kext-dev.mjs +13 -3
- package/h2kext.mjs +9 -2
- package/package.json +1 -1
package/h2kext-dev.mjs
CHANGED
|
@@ -104,6 +104,9 @@ export function parseArgs(argv) {
|
|
|
104
104
|
case "--dir":
|
|
105
105
|
options.dir = resolve(value())
|
|
106
106
|
break
|
|
107
|
+
case "--force-name":
|
|
108
|
+
options.forceName = true
|
|
109
|
+
break
|
|
107
110
|
case "--help":
|
|
108
111
|
case "-h":
|
|
109
112
|
options.help = true
|
|
@@ -115,7 +118,7 @@ export function parseArgs(argv) {
|
|
|
115
118
|
return options
|
|
116
119
|
}
|
|
117
120
|
|
|
118
|
-
export const USAGE = `usage: h2kext-dev [--port <n>] [--host <address>] [--entry <file>] [--inline <pkg,…>] [--dir <path>]
|
|
121
|
+
export const USAGE = `usage: h2kext-dev [--port <n>] [--host <address>] [--entry <file>] [--inline <pkg,…>] [--dir <path>] [--force-name]
|
|
119
122
|
|
|
120
123
|
Serves the extension in the current directory to the app's Extension Dev
|
|
121
124
|
Server (Settings → Developer), rebuilding it as you save and printing what it
|
|
@@ -125,7 +128,8 @@ logs. Point the app at one of the addresses it prints.
|
|
|
125
128
|
--host the address to bind (default 0.0.0.0, so a phone on the LAN can connect)
|
|
126
129
|
--entry the entry point (default src/index.ts); pass what build.mjs passes
|
|
127
130
|
--inline shared libraries to bundle rather than take from the app; pass what build.mjs passes
|
|
128
|
-
--dir the extension directory (default the current directory)
|
|
131
|
+
--dir the extension directory (default the current directory)
|
|
132
|
+
--force-name Ham2K's own extensions: waives the key convention, as h2kext-pack's does`
|
|
129
133
|
|
|
130
134
|
/// The author's own esbuild, resolved from their project rather than from
|
|
131
135
|
/// wherever this file is installed: the preset is written to use the caller's
|
|
@@ -164,6 +168,7 @@ export async function createDevServer({
|
|
|
164
168
|
port = DEFAULT_PORT,
|
|
165
169
|
entry = "src/index.ts",
|
|
166
170
|
inline = [],
|
|
171
|
+
forceName = false,
|
|
167
172
|
log = console.log,
|
|
168
173
|
warn = console.error,
|
|
169
174
|
}) {
|
|
@@ -203,6 +208,11 @@ export async function createDevServer({
|
|
|
203
208
|
let watching = false
|
|
204
209
|
|
|
205
210
|
function fail(message) {
|
|
211
|
+
// The same failure again is not news, as an unchanged good build is not:
|
|
212
|
+
// a rebuild with nothing new to say — a late file event, a save that
|
|
213
|
+
// changed nothing — would otherwise repeat the error to the app, ahead
|
|
214
|
+
// of the reload the next real change brings.
|
|
215
|
+
if (buildError === message) return
|
|
206
216
|
buildError = message
|
|
207
217
|
if (watching) {
|
|
208
218
|
warn(`${stamp()} ✗ ${key}\n${message}`)
|
|
@@ -227,7 +237,7 @@ export async function createDevServer({
|
|
|
227
237
|
// text compared for "unchanged" is the folded one: an edit to ABOUT.md
|
|
228
238
|
// alone is a reload too.
|
|
229
239
|
parsed = await withAboutFiles(parsed, dir)
|
|
230
|
-
const problems = validateManifest(parsed)
|
|
240
|
+
const problems = validateManifest(parsed, { forceName })
|
|
231
241
|
if (problems.length) throw new Error(problems.join("\n"))
|
|
232
242
|
if (parsed.key !== key) throw new Error(`${MANIFEST_ENTRY}: 'key' changed from ${key} to ${parsed.key}; restart h2kext-dev to serve it`)
|
|
233
243
|
return { parsed, text: JSON.stringify(parsed) }
|
package/h2kext.mjs
CHANGED
|
@@ -57,8 +57,13 @@ import yazl from "yazl"
|
|
|
57
57
|
/// trigger; 14 adds `host.fyi`, messages on the FYI line under the call
|
|
58
58
|
/// info; 15 adds `incomplete` on a live scoring verdict, the fields a
|
|
59
59
|
/// contact still needs before Enter logs it; 16 names the kernel `__halo`,
|
|
60
|
-
/// and keeps `__polo` only for a bundle that declares a lower level
|
|
61
|
-
|
|
60
|
+
/// and keeps `__polo` only for a bundle that declares a lower level; 17
|
|
61
|
+
/// makes a spectrum's gestures the host's — tuning, zoom, pan and an axis —
|
|
62
|
+
/// unless its scene's `gestures` and `scale` say otherwise; 18 adds the
|
|
63
|
+
/// logging row's segmented fields (`group`), `autoadvanceWhen`/`Before`, a
|
|
64
|
+
/// field's `suffix` and `ourExchange`, display-only (`editable: false`) and
|
|
65
|
+
/// optional (`chars.min: 0`) fields.
|
|
66
|
+
export const H2KEXT_API_VERSION = 18
|
|
62
67
|
|
|
63
68
|
/// The first API with `host.webSocket`. A manifest declaring `webSockets`
|
|
64
69
|
/// under an older one is refused: an older app would install it and fail only
|
|
@@ -230,6 +235,8 @@ SHARED_MODULES_BY_API[13] = SHARED_MODULES_BY_API[12]
|
|
|
230
235
|
SHARED_MODULES_BY_API[14] = SHARED_MODULES_BY_API[13]
|
|
231
236
|
SHARED_MODULES_BY_API[15] = SHARED_MODULES_BY_API[14]
|
|
232
237
|
SHARED_MODULES_BY_API[16] = SHARED_MODULES_BY_API[15]
|
|
238
|
+
SHARED_MODULES_BY_API[17] = SHARED_MODULES_BY_API[16]
|
|
239
|
+
SHARED_MODULES_BY_API[18] = SHARED_MODULES_BY_API[17]
|
|
233
240
|
|
|
234
241
|
/// What a scaffolded extension declares on day one: the eight modules the SDK
|
|
235
242
|
/// barrel itself reaches, so a project that has written no code yet still
|