@jay-framework/wix-deploy 0.20.0 → 0.21.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.
@@ -66,6 +66,41 @@ class WixDataArtifactStore {
66
66
  return this.cacheDir;
67
67
  }
68
68
  // ========================================================================
69
+ // Eager loading (cold start)
70
+ // ========================================================================
71
+ async loadEagerFiles() {
72
+ console.log(
73
+ `[WixDataArtifactStore] Loading eager files v${this.version} from "${this.collectionId}"...`
74
+ );
75
+ let totalLoaded = 0;
76
+ let hasMore = true;
77
+ let offset = 0;
78
+ const limit = 50;
79
+ while (hasMore) {
80
+ const result = await this.dataClient.items.query(this.collectionId).eq("category", "eager").eq("version", this.version).skip(offset).limit(limit).find();
81
+ for (const item of result.items) {
82
+ this.writeToCache(item.path, item.content);
83
+ totalLoaded++;
84
+ }
85
+ hasMore = result.items.length === limit;
86
+ offset += limit;
87
+ }
88
+ console.log(`[WixDataArtifactStore] Loaded ${totalLoaded} eager files`);
89
+ }
90
+ // ========================================================================
91
+ // Lazy page file loading
92
+ // ========================================================================
93
+ async ensurePageFiles(preRenderedPath) {
94
+ const dir = path.dirname(preRenderedPath);
95
+ const base = preRenderedPath.replace(/\.jay-html$/, "");
96
+ const filesToEnsure = [
97
+ path.join(dir, "page-parts.json"),
98
+ `${base}.cache.json`,
99
+ `${base}.server-element.js`
100
+ ];
101
+ await Promise.all(filesToEnsure.map((f) => this.ensureFile(f)));
102
+ }
103
+ // ========================================================================
69
104
  // Writes (for upload-backend and renderer)
70
105
  // ========================================================================
71
106
  async writeFile(relativePath, content, category) {
@@ -132,22 +167,26 @@ class WixDataArtifactStore {
132
167
  }
133
168
  async fetchFromCollection(relativePath) {
134
169
  const id = makeItemId(this.version, relativePath);
135
- const t0 = Date.now();
136
- const item = await this.dataClient.items.get(
137
- this.collectionId,
138
- id
139
- );
140
- const t1 = Date.now();
141
- if (!item?.content) {
142
- throw new Error(
143
- `File not found in data collection: v${this.version}/${relativePath} (id: ${id})`
170
+ try {
171
+ const item = await this.dataClient.items.get(
172
+ this.collectionId,
173
+ id
144
174
  );
175
+ if (item?.content) {
176
+ this.writeToCache(relativePath, item.content);
177
+ return item.content;
178
+ }
179
+ } catch {
145
180
  }
146
- this.writeToCache(relativePath, item.content);
147
- console.log(
148
- `[WixDataArtifactStore] Fetched v${this.version}/${relativePath} (${t1 - t0}ms)`
181
+ const result = await this.dataClient.items.query(this.collectionId).eq("path", relativePath).eq("version", this.version).limit(1).find();
182
+ if (result.items.length > 0) {
183
+ const item = result.items[0];
184
+ this.writeToCache(relativePath, item.content);
185
+ return item.content;
186
+ }
187
+ throw new Error(
188
+ `File not found in data collection: v${this.version}/${relativePath} (id: ${id})`
149
189
  );
150
- return item.content;
151
190
  }
152
191
  writeToCache(relativePath, content) {
153
192
  const fullPath = path.join(this.cacheDir, relativePath);
package/dist/index.d.ts CHANGED
@@ -52,6 +52,8 @@ declare class WixDataArtifactStore implements ArtifactStore {
52
52
  loadModule(modulePath: string, _local?: boolean): Promise<any>;
53
53
  getAssetPath(relativePath: string): string;
54
54
  getBuildDir(): string;
55
+ loadEagerFiles(): Promise<void>;
56
+ ensurePageFiles(preRenderedPath: string): Promise<void>;
55
57
  writeFile(relativePath: string, content: string, category: 'eager' | 'lazy'): Promise<void>;
56
58
  writeFiles(files: Array<{
57
59
  path: string;
package/dist/index.js CHANGED
@@ -30,7 +30,6 @@ function getDeployVersion(metadata) {
30
30
  const DEFAULT_EXCLUDE_PLUGINS = ["aiditor", "ui-kit", "wix-deploy"];
31
31
  function scanPagePartsFiles(dir, fs2, path2) {
32
32
  const results = [];
33
- if (!fs2.existsSync(dir)) return results;
34
33
  for (const entry of fs2.readdirSync(dir, { withFileTypes: true })) {
35
34
  const fullPath = path2.join(dir, entry.name);
36
35
  if (entry.isDirectory()) {
@@ -409,7 +408,11 @@ const buildEntry = makeCliCommand("build-entry").withServices(CONSOLE_CONTEXT).w
409
408
  "prettier",
410
409
  "vite",
411
410
  "lightningcss",
412
- "fsevents"
411
+ "fsevents",
412
+ "@types/js-yaml",
413
+ "@wix/sdk-runtime",
414
+ "yaml",
415
+ "js-beautify"
413
416
  ];
414
417
  const stubFilter = new RegExp(
415
418
  "^(" + stubs.map((s) => s.replace(/[/.]/g, "\\$&")).join("|") + ")$"
@@ -7202,6 +7205,7 @@ const deployBaas = makeCliCommand("deploy-baas").withServices(CONSOLE_CONTEXT).w
7202
7205
  const completedDeployment = completeData.appDeployment || {};
7203
7206
  const deploymentId = appDeployment?.id;
7204
7207
  const deploymentBaseUrl = completedDeployment.deploymentBaseUrl || appDeployment?.deploymentBaseUrl || "";
7208
+ ctx.log(`Deployment uploaded. Base URL: ${deploymentBaseUrl}`);
7205
7209
  let appVersion = 0;
7206
7210
  try {
7207
7211
  const { data: versionData } = await httpClient2.request(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jay-framework/wix-deploy",
3
- "version": "0.20.0",
3
+ "version": "0.21.0",
4
4
  "type": "module",
5
5
  "description": "Wix BaaS deployment adapter for Jay Framework — WixDataArtifactStore and entry builder",
6
6
  "license": "Apache-2.0",
@@ -16,7 +16,8 @@
16
16
  "./package.json": "./package.json"
17
17
  },
18
18
  "scripts": {
19
- "build": "npm run clean && npm run build:server && npm run build:types",
19
+ "build": "npm run clean && npm run build:server && npm run build:types && npm run validate",
20
+ "validate": "jay-stack-cli validate-plugin",
20
21
  "build:server": "vite build --ssr",
21
22
  "build:types": "tsup lib/index.ts --dts-only --format esm",
22
23
  "build:check-types": "tsc",
@@ -25,10 +26,10 @@
25
26
  "test": ":"
26
27
  },
27
28
  "dependencies": {
28
- "@jay-framework/fullstack-component": "^0.20.0",
29
- "@jay-framework/production-server": "^0.20.0",
30
- "@jay-framework/stack-server-runtime": "^0.20.0",
31
- "@jay-framework/wix-server-client": "^0.20.0",
29
+ "@jay-framework/fullstack-component": "^0.21.0",
30
+ "@jay-framework/production-server": "^0.21.0",
31
+ "@jay-framework/stack-server-runtime": "^0.21.0",
32
+ "@jay-framework/wix-server-client": "^0.21.0",
32
33
  "@wix/data": "^1.0.433",
33
34
  "@wix/sdk": "^1.21.5",
34
35
  "esbuild": "^0.21.0",