@series-inc/stowkit-cli 0.6.22 → 0.6.23

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/server.js +10 -0
  2. package/package.json +1 -1
package/dist/server.js CHANGED
@@ -1022,11 +1022,21 @@ async function handleRequest(req, res, staticApps) {
1022
1022
  return;
1023
1023
  }
1024
1024
  // POST /api/build — build .stow packs
1025
+ // Pass ?wait=true or { "wait": true } to process all pending assets before packing.
1025
1026
  if (pathname === '/api/build' && req.method === 'POST') {
1026
1027
  if (!projectConfig) {
1027
1028
  json(res, { error: 'No project open' }, 400);
1028
1029
  return;
1029
1030
  }
1031
+ // If wait=true, process all pending assets synchronously before building
1032
+ const body = await readBody(req).then(b => b ? JSON.parse(b) : {}).catch(() => ({}));
1033
+ const wait = body.wait === true || url.searchParams.get('wait') === 'true';
1034
+ if (wait) {
1035
+ const pending = assets.filter(a => a.status === 'pending' || a.status === 'processing');
1036
+ if (pending.length > 0) {
1037
+ await queueProcessing({ await: true });
1038
+ }
1039
+ }
1030
1040
  const assetsById = new Map(assets.map(a => [a.id, a]));
1031
1041
  const packs = projectConfig.config.packs ?? [{ name: 'default' }];
1032
1042
  const cdnDir = path.resolve(projectConfig.projectDir, projectConfig.config.cdnAssetsPath ?? 'public/cdn-assets');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@series-inc/stowkit-cli",
3
- "version": "0.6.22",
3
+ "version": "0.6.23",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "stowkit": "./dist/cli.js"