@popcraft/cli 0.9.4 → 0.9.6

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/dist/popcraft.mjs +35 -6
  2. package/package.json +2 -2
package/dist/popcraft.mjs CHANGED
@@ -1173,7 +1173,7 @@ function operations(spec = openapi) {
1173
1173
  }
1174
1174
  async function call(target2, method, path, opts = {}) {
1175
1175
  const qs = new URLSearchParams(opts.query ?? {}).toString();
1176
- const headers = { "user-agent": `popcraft-cli/${"0.9.4"}`, ...opts.headers };
1176
+ const headers = { "user-agent": `popcraft-cli/${"0.9.6"}`, ...opts.headers };
1177
1177
  if (target2.token) headers.authorization = `Bearer ${target2.token}`;
1178
1178
  if (opts.contentType) headers["content-type"] = opts.contentType;
1179
1179
  try {
@@ -90355,6 +90355,21 @@ var init_idb_keyval = __esm({
90355
90355
  }
90356
90356
  });
90357
90357
 
90358
+ // lib/storage/open-connections.ts
90359
+ function holdsIndexedDB(close) {
90360
+ closers.add(close);
90361
+ return () => {
90362
+ closers.delete(close);
90363
+ };
90364
+ }
90365
+ var closers;
90366
+ var init_open_connections = __esm({
90367
+ "lib/storage/open-connections.ts"() {
90368
+ "use strict";
90369
+ closers = /* @__PURE__ */ new Set();
90370
+ }
90371
+ });
90372
+
90358
90373
  // lib/storage/idb.ts
90359
90374
  function open3(dbName, storeName, version6) {
90360
90375
  return new Promise((resolve6, reject) => {
@@ -90376,12 +90391,19 @@ function createStore(dbName, storeName) {
90376
90391
  let db3 = null;
90377
90392
  const connect2 = () => db3 ??= open3(dbName, storeName).then(
90378
90393
  (conn) => {
90394
+ const release = holdsIndexedDB(() => {
90395
+ conn.close();
90396
+ db3 = null;
90397
+ release();
90398
+ });
90379
90399
  conn.onversionchange = () => {
90380
90400
  conn.close();
90381
90401
  db3 = null;
90402
+ release();
90382
90403
  };
90383
90404
  conn.onclose = () => {
90384
90405
  db3 = null;
90406
+ release();
90385
90407
  };
90386
90408
  return conn;
90387
90409
  },
@@ -90396,6 +90418,7 @@ var fallback, defaultStore, get2, set3, setMany2, getMany2, update2, del2, delMa
90396
90418
  var init_idb = __esm({
90397
90419
  "lib/storage/idb.ts"() {
90398
90420
  init_idb_keyval();
90421
+ init_open_connections();
90399
90422
  init_idb_keyval();
90400
90423
  fallback = null;
90401
90424
  defaultStore = () => fallback ??= createStore("keyval-store", "keyval");
@@ -239716,7 +239739,6 @@ function resyncText(doc2, ids2) {
239716
239739
  var isVirtualId;
239717
239740
  var init_invariants2 = __esm({
239718
239741
  "lib/document/invariants.ts"() {
239719
- "use strict";
239720
239742
  init_auto_layout();
239721
239743
  init_scene_graph();
239722
239744
  init_text_bounds();
@@ -263225,6 +263247,7 @@ var init_client = __esm({
263225
263247
  init_encoding();
263226
263248
  init_decoding();
263227
263249
  init_y_indexeddb();
263250
+ init_open_connections();
263228
263251
  init_legacy_migration();
263229
263252
  init_protocol();
263230
263253
  CollabClient = class {
@@ -263253,8 +263276,13 @@ var init_client = __esm({
263253
263276
  this.onUnload = () => {
263254
263277
  removeAwarenessStates(this.awareness, [this.ydoc.clientID], "unload");
263255
263278
  };
263279
+ this.releaseIndexedDB = () => {
263280
+ };
263256
263281
  this.role = opts.role ?? null;
263257
263282
  this.persistence = new IndexeddbPersistence(`popcraft-ydoc:${opts.key}`, this.ydoc);
263283
+ this.releaseIndexedDB = holdsIndexedDB(() => {
263284
+ void this.persistence.destroy();
263285
+ });
263258
263286
  this.ydoc.on("update", (update3, origin) => {
263259
263287
  if (origin === this || !this.ws || this.ws.readyState !== WebSocket.OPEN || !this.canWrite()) return;
263260
263288
  const enc2 = createEncoder();
@@ -263448,6 +263476,7 @@ var init_client = __esm({
263448
263476
  if (type === MSG_AWARENESS) applyAwarenessUpdate(this.awareness, readVarUint8Array(dec), this);
263449
263477
  }
263450
263478
  destroy() {
263479
+ this.releaseIndexedDB();
263451
263480
  this.destroyed = true;
263452
263481
  if (this.reconnectTimer) clearTimeout(this.reconnectTimer);
263453
263482
  if (this.refreshTimer) clearInterval(this.refreshTimer);
@@ -308700,6 +308729,7 @@ function agentToolList() {
308700
308729
  var AGENT_CAPABILITIES, legacyCommandId, legacyTools, blobToDataUrl3, provided, legacyTool, legacyToolList;
308701
308730
  var init_agent = __esm({
308702
308731
  "lib/commands/agent.ts"() {
308732
+ "use strict";
308703
308733
  init_types5();
308704
308734
  init_registry();
308705
308735
  init_errors();
@@ -317233,7 +317263,7 @@ var init_package = __esm({
317233
317263
  "packages/runtime/package.json"() {
317234
317264
  package_default = {
317235
317265
  name: "@popcraft/runtime",
317236
- version: "0.9.4",
317266
+ version: "0.9.6",
317237
317267
  description: "What code exported from PopCraft shares: the meaning of expressions (operators and functions) and, as it grows, the parts of a design's behaviour that are common code rather than generated React.",
317238
317268
  license: "MIT",
317239
317269
  homepage: "https://popcraft.app/docs/exporting/nextjs",
@@ -342834,6 +342864,7 @@ function hashOf(text) {
342834
342864
  }
342835
342865
  var init_hash = __esm({
342836
342866
  "lib/code/hash.ts"() {
342867
+ "use strict";
342837
342868
  }
342838
342869
  });
342839
342870
 
@@ -348917,7 +348948,6 @@ function publishSite(key5, files, opts = {}) {
348917
348948
  var siteStatus, setSiteVersion, renameSite;
348918
348949
  var init_sites = __esm({
348919
348950
  "lib/client/cloud/sites.ts"() {
348920
- "use strict";
348921
348951
  init_files();
348922
348952
  init_upload2();
348923
348953
  init_api4();
@@ -349440,7 +349470,6 @@ var init_recorders = __esm({
349440
349470
  var HELPER_NAMES;
349441
349471
  var init_helper_names = __esm({
349442
349472
  "lib/agent/design-script/helper-names.ts"() {
349443
- "use strict";
349444
349473
  HELPER_NAMES = ["draw", "marks", "fit", "motion", "captions", "overlays", "texture", "pointer", "windows", "devices", "type", "beat", "web", "social", "video", "site", "effects"];
349445
349474
  }
349446
349475
  });
@@ -397799,7 +397828,7 @@ init_resources();
397799
397828
  init_desktop();
397800
397829
  init_hypery();
397801
397830
  import { createInterface } from "node:readline";
397802
- var VERSION2 = "0.9.4";
397831
+ var VERSION2 = "0.9.6";
397803
397832
  var HELP = `popcraft ${VERSION2} \u2014 the PopCraft command line
397804
397833
 
397805
397834
  Files (headless, on .popcraft files):
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@popcraft/cli",
3
- "version": "0.9.4",
3
+ "version": "0.9.6",
4
4
  "description": "The PopCraft command line: edit .popcraft files headlessly, call the REST API, publish to the marketplace and manage the desktop app's local plugins, themes, fonts, skills and agents.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://popcraft.app/docs/api/cli",
@@ -34,7 +34,7 @@
34
34
  "esbuild": "0.28.2"
35
35
  },
36
36
  "dependencies": {
37
- "@popcraft/kit": "0.9.4"
37
+ "@popcraft/kit": "0.9.6"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "node build.mjs",