nstantpage-agent 0.5.25 → 0.5.27

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/dist/cli.js CHANGED
@@ -25,7 +25,7 @@ const program = new Command();
25
25
  program
26
26
  .name('nstantpage')
27
27
  .description('Local development agent for nstantpage.com — run projects on your machine, preview in the cloud')
28
- .version('0.5.22');
28
+ .version('0.5.27');
29
29
  program
30
30
  .command('login')
31
31
  .description('Authenticate with nstantpage.com')
@@ -26,7 +26,7 @@ import { LocalServer } from '../localServer.js';
26
26
  import { PackageInstaller } from '../packageInstaller.js';
27
27
  import { probeLocalPostgres, ensureLocalProjectDb, closeAdminPool, writeDatabaseUrlToEnv } from '../projectDb.js';
28
28
  import { StatusServer } from '../statusServer.js';
29
- const VERSION = '0.5.24';
29
+ const VERSION = '0.5.27';
30
30
  /**
31
31
  * Resolve the backend API base URL.
32
32
  * - If --backend is passed, use it
@@ -685,12 +685,21 @@ async function startAdditionalProject(projectId, opts) {
685
685
  const serverEnv = {};
686
686
  if (databaseUrl)
687
687
  serverEnv['DATABASE_URL'] = databaseUrl;
688
+ // Note: tunnel is created after localServer but before start(),
689
+ // so the onSyncDirty callback captures it via closure (late-binding).
690
+ let tunnel;
688
691
  const localServer = new LocalServer({
689
692
  projectDir, projectId,
690
693
  apiPort: allocated.apiPort, devPort: allocated.devPort,
691
694
  env: serverEnv,
695
+ backendUrl: opts.backendUrl,
696
+ onSyncDirty: (pid) => {
697
+ if (tunnel) {
698
+ tunnel.sendSyncDirty(pid);
699
+ }
700
+ },
692
701
  });
693
- const tunnel = new TunnelClient({
702
+ tunnel = new TunnelClient({
694
703
  gatewayUrl: opts.gatewayUrl,
695
704
  token: opts.token,
696
705
  projectId,
@@ -714,8 +723,10 @@ async function startAdditionalProject(projectId, opts) {
714
723
  }
715
724
  })();
716
725
  const fileStart = Date.now();
726
+ let fetchedVersionId;
717
727
  try {
718
- await fetchProjectFiles(opts.backendUrl, projectId, projectDir, opts.token);
728
+ const { versionId } = await fetchProjectFiles(opts.backendUrl, projectId, projectDir, opts.token);
729
+ fetchedVersionId = versionId;
719
730
  timings['fetch-files'] = Date.now() - fileStart;
720
731
  progress('fetching-files', `Files downloaded (${timings['fetch-files']}ms)`);
721
732
  }
@@ -730,6 +741,10 @@ async function startAdditionalProject(projectId, opts) {
730
741
  // Wait for API server before proceeding (tunnel can keep connecting in background)
731
742
  await apiServerPromise;
732
743
  progress('starting-server', `API server ready`);
744
+ // Set sync baseline so file watcher knows what "clean" looks like
745
+ if (fetchedVersionId) {
746
+ localServer.markSynced(fetchedVersionId);
747
+ }
733
748
  // ── Phase 2: Install deps (if needed) ────────────────────────────
734
749
  const installer = new PackageInstaller({ projectDir });
735
750
  const needsInstall = !installer.areDependenciesInstalled() && fs.existsSync(path.join(projectDir, 'package.json'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nstantpage-agent",
3
- "version": "0.5.25",
3
+ "version": "0.5.27",
4
4
  "description": "Local development agent for nstantpage.com — run your projects locally, preview in the cloud. Replaces cloud containers for faster builds.",
5
5
  "type": "module",
6
6
  "bin": {