@jay-framework/wix-deploy 0.18.0 → 0.18.3
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/artifact-store.d.ts +71 -0
- package/dist/artifact-store.js +233 -201
- package/dist/commands/build-entry.d.ts +15 -0
- package/dist/commands/build-entry.js +448 -0
- package/dist/commands/deploy-baas.d.ts +14 -0
- package/dist/commands/deploy-baas.js +250 -0
- package/dist/commands/deploy.d.ts +19 -0
- package/dist/commands/deploy.js +87 -0
- package/dist/commands/upload-backend.d.ts +14 -0
- package/dist/commands/upload-backend.js +122 -0
- package/dist/constants.d.ts +2 -0
- package/dist/constants.js +2 -0
- package/dist/index.d.ts +7 -112
- package/dist/index.js +6 -965
- package/dist/setup.d.ts +19 -0
- package/dist/setup.js +101 -0
- package/package.json +10 -10
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WixDataArtifactStore — implements ArtifactStore for Wix BaaS deployments.
|
|
3
|
+
*
|
|
4
|
+
* Manages both reads (for serving) and writes (for upload/renderer) of
|
|
5
|
+
* backend build artifacts in a Wix data collection. All items are versioned
|
|
6
|
+
* so that a new version can be uploaded while the current version serves.
|
|
7
|
+
*
|
|
8
|
+
* Data collection schema:
|
|
9
|
+
* _id: string — "{version}__{path}" (unique key)
|
|
10
|
+
* version: string — build version (semver)
|
|
11
|
+
* path: string — relative file path within backend dir
|
|
12
|
+
* content: string — file content (text)
|
|
13
|
+
* fileType: string — extension (js, json)
|
|
14
|
+
* sizeBytes: number — content byte length
|
|
15
|
+
* category: string — 'eager' | 'lazy'
|
|
16
|
+
*/
|
|
17
|
+
import type { WixClient } from '@wix/sdk';
|
|
18
|
+
import type { ArtifactStore, RouteManifest, CacheEntry, ServerElementModule } from '@jay-framework/production-server/serve';
|
|
19
|
+
export type { ArtifactStore, RouteManifest, CacheEntry, ServerElementModule };
|
|
20
|
+
export interface BackendFileItem {
|
|
21
|
+
_id: string;
|
|
22
|
+
version: string;
|
|
23
|
+
path: string;
|
|
24
|
+
content: string;
|
|
25
|
+
fileType: string;
|
|
26
|
+
sizeBytes: number;
|
|
27
|
+
category: 'eager' | 'lazy';
|
|
28
|
+
}
|
|
29
|
+
export declare function makeItemId(version: string, relativePath: string): string;
|
|
30
|
+
export interface WixDataArtifactStoreOptions {
|
|
31
|
+
wixClient: WixClient;
|
|
32
|
+
collectionId: string;
|
|
33
|
+
cacheDir: string;
|
|
34
|
+
version: string;
|
|
35
|
+
moduleRegistry?: Record<string, any>;
|
|
36
|
+
}
|
|
37
|
+
export declare class WixDataArtifactStore implements ArtifactStore {
|
|
38
|
+
readonly collectionId: string;
|
|
39
|
+
readonly version: string;
|
|
40
|
+
private readonly cacheDir;
|
|
41
|
+
private readonly dataClient;
|
|
42
|
+
private readonly moduleRegistry;
|
|
43
|
+
private manifestCache?;
|
|
44
|
+
private moduleCache;
|
|
45
|
+
private fetchPromises;
|
|
46
|
+
constructor(options: WixDataArtifactStoreOptions);
|
|
47
|
+
readManifest(): Promise<RouteManifest>;
|
|
48
|
+
readCacheData(relativePath: string): Promise<CacheEntry>;
|
|
49
|
+
readPagePartsConfig(relativePath: string): Promise<any>;
|
|
50
|
+
loadServerElement(relativePath: string): Promise<ServerElementModule>;
|
|
51
|
+
loadModule(modulePath: string, _local?: boolean): Promise<any>;
|
|
52
|
+
getAssetPath(relativePath: string): string;
|
|
53
|
+
getBuildDir(): string;
|
|
54
|
+
loadEagerFiles(): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Write a single file to the data collection.
|
|
57
|
+
*/
|
|
58
|
+
writeFile(relativePath: string, content: string, category: 'eager' | 'lazy'): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* Write a batch of files to the data collection.
|
|
61
|
+
* Returns the number of successfully written files.
|
|
62
|
+
*/
|
|
63
|
+
writeFiles(files: Array<{
|
|
64
|
+
path: string;
|
|
65
|
+
content: string;
|
|
66
|
+
category: 'eager' | 'lazy';
|
|
67
|
+
}>): Promise<number>;
|
|
68
|
+
private ensureFile;
|
|
69
|
+
private fetchFromCollection;
|
|
70
|
+
private writeToCache;
|
|
71
|
+
}
|
package/dist/artifact-store.js
CHANGED
|
@@ -1,214 +1,246 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
/**
|
|
2
|
+
* WixDataArtifactStore — implements ArtifactStore for Wix BaaS deployments.
|
|
3
|
+
*
|
|
4
|
+
* Manages both reads (for serving) and writes (for upload/renderer) of
|
|
5
|
+
* backend build artifacts in a Wix data collection. All items are versioned
|
|
6
|
+
* so that a new version can be uploaded while the current version serves.
|
|
7
|
+
*
|
|
8
|
+
* Data collection schema:
|
|
9
|
+
* _id: string — "{version}__{path}" (unique key)
|
|
10
|
+
* version: string — build version (semver)
|
|
11
|
+
* path: string — relative file path within backend dir
|
|
12
|
+
* content: string — file content (text)
|
|
13
|
+
* fileType: string — extension (js, json)
|
|
14
|
+
* sizeBytes: number — content byte length
|
|
15
|
+
* category: string — 'eager' | 'lazy'
|
|
16
|
+
*/
|
|
17
|
+
import { items } from '@wix/data';
|
|
18
|
+
import crypto from 'node:crypto';
|
|
19
|
+
import fs from 'node:fs';
|
|
20
|
+
import path from 'node:path';
|
|
21
|
+
export function makeItemId(version, relativePath) {
|
|
22
|
+
return crypto
|
|
23
|
+
.createHash('sha256')
|
|
24
|
+
.update(`v${version}/${relativePath}`)
|
|
25
|
+
.digest('hex')
|
|
26
|
+
.slice(0, 32);
|
|
7
27
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
// ========================================================================
|
|
28
|
-
async readManifest() {
|
|
29
|
-
if (this.manifestCache) return this.manifestCache;
|
|
30
|
-
const content = await this.ensureFile("route-manifest.json");
|
|
31
|
-
this.manifestCache = JSON.parse(content);
|
|
32
|
-
return this.manifestCache;
|
|
33
|
-
}
|
|
34
|
-
async readCacheData(relativePath) {
|
|
35
|
-
const cacheContent = await this.ensureFile(relativePath);
|
|
36
|
-
try {
|
|
37
|
-
const cacheData = JSON.parse(cacheContent);
|
|
38
|
-
return {
|
|
39
|
-
slowViewState: cacheData.slowViewState || {},
|
|
40
|
-
carryForward: cacheData.carryForward || {}
|
|
41
|
-
};
|
|
42
|
-
} catch {
|
|
43
|
-
return { slowViewState: {}, carryForward: {} };
|
|
28
|
+
// ============================================================================
|
|
29
|
+
// Read + Write artifact store
|
|
30
|
+
// ============================================================================
|
|
31
|
+
export class WixDataArtifactStore {
|
|
32
|
+
collectionId;
|
|
33
|
+
version;
|
|
34
|
+
cacheDir;
|
|
35
|
+
dataClient;
|
|
36
|
+
moduleRegistry;
|
|
37
|
+
manifestCache;
|
|
38
|
+
moduleCache = new Map();
|
|
39
|
+
fetchPromises = new Map();
|
|
40
|
+
constructor(options) {
|
|
41
|
+
this.collectionId = options.collectionId;
|
|
42
|
+
this.version = options.version;
|
|
43
|
+
this.cacheDir = options.cacheDir;
|
|
44
|
+
this.dataClient = options.wixClient.use({ items });
|
|
45
|
+
this.moduleRegistry = options.moduleRegistry || {};
|
|
46
|
+
fs.mkdirSync(this.cacheDir, { recursive: true });
|
|
44
47
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if (this.moduleRegistry[modulePath]) {
|
|
55
|
-
return this.moduleRegistry[modulePath];
|
|
48
|
+
// ========================================================================
|
|
49
|
+
// ArtifactStore interface (reads)
|
|
50
|
+
// ========================================================================
|
|
51
|
+
async readManifest() {
|
|
52
|
+
if (this.manifestCache)
|
|
53
|
+
return this.manifestCache;
|
|
54
|
+
const content = await this.ensureFile('route-manifest.json');
|
|
55
|
+
this.manifestCache = JSON.parse(content);
|
|
56
|
+
return this.manifestCache;
|
|
56
57
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
await this.ensureFile(modulePath);
|
|
60
|
-
const fullPath = path.join(this.cacheDir, modulePath);
|
|
61
|
-
const mod = await import(
|
|
62
|
-
/* @vite-ignore */
|
|
63
|
-
fullPath
|
|
64
|
-
);
|
|
65
|
-
this.moduleCache.set(modulePath, mod);
|
|
66
|
-
return mod;
|
|
67
|
-
}
|
|
68
|
-
getAssetPath(relativePath) {
|
|
69
|
-
return path.join(this.cacheDir, relativePath);
|
|
70
|
-
}
|
|
71
|
-
getBuildDir() {
|
|
72
|
-
return this.cacheDir;
|
|
73
|
-
}
|
|
74
|
-
// ========================================================================
|
|
75
|
-
// Eager loading (cold start)
|
|
76
|
-
// ========================================================================
|
|
77
|
-
async loadEagerFiles() {
|
|
78
|
-
console.log(
|
|
79
|
-
`[WixDataArtifactStore] Loading eager files v${this.version} from "${this.collectionId}"...`
|
|
80
|
-
);
|
|
81
|
-
let totalLoaded = 0;
|
|
82
|
-
let hasMore = true;
|
|
83
|
-
let offset = 0;
|
|
84
|
-
const limit = 50;
|
|
85
|
-
while (hasMore) {
|
|
86
|
-
const result = await this.dataClient.items.query(this.collectionId).eq("category", "eager").eq("version", this.version).skip(offset).limit(limit).find();
|
|
87
|
-
for (const item of result.items) {
|
|
88
|
-
this.writeToCache(item.path, item.content);
|
|
89
|
-
totalLoaded++;
|
|
90
|
-
}
|
|
91
|
-
hasMore = result.items.length === limit;
|
|
92
|
-
offset += limit;
|
|
93
|
-
}
|
|
94
|
-
console.log(`[WixDataArtifactStore] Loaded ${totalLoaded} eager files`);
|
|
95
|
-
}
|
|
96
|
-
// ========================================================================
|
|
97
|
-
// Writes (for upload-backend and renderer)
|
|
98
|
-
// ========================================================================
|
|
99
|
-
/**
|
|
100
|
-
* Write a single file to the data collection.
|
|
101
|
-
*/
|
|
102
|
-
async writeFile(relativePath, content, category) {
|
|
103
|
-
const ext = path.extname(relativePath).slice(1);
|
|
104
|
-
const item = {
|
|
105
|
-
_id: makeItemId(this.version, relativePath),
|
|
106
|
-
version: this.version,
|
|
107
|
-
path: relativePath,
|
|
108
|
-
content,
|
|
109
|
-
fileType: ext || "unknown",
|
|
110
|
-
sizeBytes: Buffer.byteLength(content),
|
|
111
|
-
category
|
|
112
|
-
};
|
|
113
|
-
await this.dataClient.items.save(this.collectionId, item);
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Write a batch of files to the data collection.
|
|
117
|
-
* Returns the number of successfully written files.
|
|
118
|
-
*/
|
|
119
|
-
async writeFiles(files) {
|
|
120
|
-
const dataItems = files.map((f) => ({
|
|
121
|
-
_id: makeItemId(this.version, f.path),
|
|
122
|
-
version: this.version,
|
|
123
|
-
path: f.path,
|
|
124
|
-
content: f.content,
|
|
125
|
-
fileType: path.extname(f.path).slice(1) || "unknown",
|
|
126
|
-
sizeBytes: Buffer.byteLength(f.content),
|
|
127
|
-
category: f.category
|
|
128
|
-
}));
|
|
129
|
-
try {
|
|
130
|
-
await this.dataClient.items.bulkSave(this.collectionId, dataItems);
|
|
131
|
-
return dataItems.length;
|
|
132
|
-
} catch {
|
|
133
|
-
let count = 0;
|
|
134
|
-
for (const item of dataItems) {
|
|
58
|
+
async readCacheData(relativePath) {
|
|
59
|
+
const cacheContent = await this.ensureFile(relativePath);
|
|
135
60
|
try {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
61
|
+
const cacheData = JSON.parse(cacheContent);
|
|
62
|
+
return {
|
|
63
|
+
slowViewState: cacheData.slowViewState || {},
|
|
64
|
+
carryForward: cacheData.carryForward || {},
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return { slowViewState: {}, carryForward: {} };
|
|
139
69
|
}
|
|
140
|
-
}
|
|
141
|
-
return count;
|
|
142
70
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
// ========================================================================
|
|
147
|
-
async ensureFile(relativePath) {
|
|
148
|
-
const fullPath = path.join(this.cacheDir, relativePath);
|
|
149
|
-
if (fs.existsSync(fullPath)) {
|
|
150
|
-
return fs.readFileSync(fullPath, "utf8");
|
|
71
|
+
async readPagePartsConfig(relativePath) {
|
|
72
|
+
const content = await this.ensureFile(relativePath);
|
|
73
|
+
return JSON.parse(content);
|
|
151
74
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
const promise = this.fetchFromCollection(relativePath);
|
|
155
|
-
this.fetchPromises.set(relativePath, promise);
|
|
156
|
-
try {
|
|
157
|
-
return await promise;
|
|
158
|
-
} finally {
|
|
159
|
-
this.fetchPromises.delete(relativePath);
|
|
75
|
+
async loadServerElement(relativePath) {
|
|
76
|
+
return this.loadModule(relativePath, true);
|
|
160
77
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
);
|
|
78
|
+
async loadModule(modulePath, _local) {
|
|
79
|
+
if (this.moduleRegistry[modulePath]) {
|
|
80
|
+
return this.moduleRegistry[modulePath];
|
|
81
|
+
}
|
|
82
|
+
const cached = this.moduleCache.get(modulePath);
|
|
83
|
+
if (cached)
|
|
84
|
+
return cached;
|
|
85
|
+
await this.ensureFile(modulePath);
|
|
86
|
+
const fullPath = path.join(this.cacheDir, modulePath);
|
|
87
|
+
const mod = await import(/* @vite-ignore */ fullPath);
|
|
88
|
+
this.moduleCache.set(modulePath, mod);
|
|
89
|
+
return mod;
|
|
174
90
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
)
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
91
|
+
getAssetPath(relativePath) {
|
|
92
|
+
return path.join(this.cacheDir, relativePath);
|
|
93
|
+
}
|
|
94
|
+
getBuildDir() {
|
|
95
|
+
return this.cacheDir;
|
|
96
|
+
}
|
|
97
|
+
// ========================================================================
|
|
98
|
+
// Eager loading (cold start)
|
|
99
|
+
// ========================================================================
|
|
100
|
+
async loadEagerFiles() {
|
|
101
|
+
console.log(`[WixDataArtifactStore] Loading eager files v${this.version} from "${this.collectionId}"...`);
|
|
102
|
+
let totalLoaded = 0;
|
|
103
|
+
let hasMore = true;
|
|
104
|
+
let offset = 0;
|
|
105
|
+
const limit = 50;
|
|
106
|
+
while (hasMore) {
|
|
107
|
+
const result = await this.dataClient.items
|
|
108
|
+
.query(this.collectionId)
|
|
109
|
+
.eq('category', 'eager')
|
|
110
|
+
.eq('version', this.version)
|
|
111
|
+
.skip(offset)
|
|
112
|
+
.limit(limit)
|
|
113
|
+
.find();
|
|
114
|
+
for (const item of result.items) {
|
|
115
|
+
this.writeToCache(item.path, item.content);
|
|
116
|
+
totalLoaded++;
|
|
199
117
|
}
|
|
200
|
-
|
|
118
|
+
hasMore = result.items.length === limit;
|
|
119
|
+
offset += limit;
|
|
120
|
+
}
|
|
121
|
+
console.log(`[WixDataArtifactStore] Loaded ${totalLoaded} eager files`);
|
|
122
|
+
}
|
|
123
|
+
// ========================================================================
|
|
124
|
+
// Writes (for upload-backend and renderer)
|
|
125
|
+
// ========================================================================
|
|
126
|
+
/**
|
|
127
|
+
* Write a single file to the data collection.
|
|
128
|
+
*/
|
|
129
|
+
async writeFile(relativePath, content, category) {
|
|
130
|
+
const ext = path.extname(relativePath).slice(1);
|
|
131
|
+
const item = {
|
|
132
|
+
_id: makeItemId(this.version, relativePath),
|
|
133
|
+
version: this.version,
|
|
134
|
+
path: relativePath,
|
|
135
|
+
content,
|
|
136
|
+
fileType: ext || 'unknown',
|
|
137
|
+
sizeBytes: Buffer.byteLength(content),
|
|
138
|
+
category,
|
|
201
139
|
};
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
140
|
+
await this.dataClient.items.save(this.collectionId, item);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Write a batch of files to the data collection.
|
|
144
|
+
* Returns the number of successfully written files.
|
|
145
|
+
*/
|
|
146
|
+
async writeFiles(files) {
|
|
147
|
+
const dataItems = files.map((f) => ({
|
|
148
|
+
_id: makeItemId(this.version, f.path),
|
|
149
|
+
version: this.version,
|
|
150
|
+
path: f.path,
|
|
151
|
+
content: f.content,
|
|
152
|
+
fileType: path.extname(f.path).slice(1) || 'unknown',
|
|
153
|
+
sizeBytes: Buffer.byteLength(f.content),
|
|
154
|
+
category: f.category,
|
|
155
|
+
}));
|
|
156
|
+
try {
|
|
157
|
+
await this.dataClient.items.bulkSave(this.collectionId, dataItems);
|
|
158
|
+
return dataItems.length;
|
|
159
|
+
}
|
|
160
|
+
catch {
|
|
161
|
+
// Fallback to individual saves
|
|
162
|
+
let count = 0;
|
|
163
|
+
for (const item of dataItems) {
|
|
164
|
+
try {
|
|
165
|
+
await this.dataClient.items.save(this.collectionId, item);
|
|
166
|
+
count++;
|
|
167
|
+
}
|
|
168
|
+
catch {
|
|
169
|
+
/* skip failed items */
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return count;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
// ========================================================================
|
|
176
|
+
// Internal: lazy file fetching
|
|
177
|
+
// ========================================================================
|
|
178
|
+
async ensureFile(relativePath) {
|
|
179
|
+
const fullPath = path.join(this.cacheDir, relativePath);
|
|
180
|
+
if (fs.existsSync(fullPath)) {
|
|
181
|
+
return fs.readFileSync(fullPath, 'utf8');
|
|
182
|
+
}
|
|
183
|
+
const existing = this.fetchPromises.get(relativePath);
|
|
184
|
+
if (existing)
|
|
185
|
+
return existing;
|
|
186
|
+
const promise = this.fetchFromCollection(relativePath);
|
|
187
|
+
this.fetchPromises.set(relativePath, promise);
|
|
188
|
+
try {
|
|
189
|
+
return await promise;
|
|
190
|
+
}
|
|
191
|
+
finally {
|
|
192
|
+
this.fetchPromises.delete(relativePath);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
async fetchFromCollection(relativePath) {
|
|
196
|
+
const id = makeItemId(this.version, relativePath);
|
|
197
|
+
const t0 = Date.now();
|
|
198
|
+
const item = (await this.dataClient.items.get(this.collectionId, id));
|
|
199
|
+
const t1 = Date.now();
|
|
200
|
+
if (!item?.content) {
|
|
201
|
+
throw new Error(`File not found in data collection: v${this.version}/${relativePath} (id: ${id})`);
|
|
202
|
+
}
|
|
203
|
+
this.writeToCache(relativePath, item.content);
|
|
204
|
+
console.log(`[WixDataArtifactStore] Fetched v${this.version}/${relativePath} (${t1 - t0}ms)`);
|
|
205
|
+
return item.content;
|
|
206
|
+
}
|
|
207
|
+
writeToCache(relativePath, content) {
|
|
208
|
+
const fullPath = path.join(this.cacheDir, relativePath);
|
|
209
|
+
fs.mkdirSync(path.dirname(fullPath), { recursive: true });
|
|
210
|
+
// Rewrite page-parts.json modulePath entries from absolute build paths
|
|
211
|
+
// to package names that Node can resolve from the bundled entry.mjs
|
|
212
|
+
if (relativePath.endsWith('page-parts.json')) {
|
|
213
|
+
try {
|
|
214
|
+
const config = JSON.parse(content);
|
|
215
|
+
const rewriteParts = (parts) => {
|
|
216
|
+
for (const part of parts) {
|
|
217
|
+
if (part.modulePath && part.source === 'npm') {
|
|
218
|
+
// Extract package dir name from absolute path and map to npm name
|
|
219
|
+
// e.g. /Users/.../packages/wix-stores/dist/index.js → @jay-framework/wix-stores
|
|
220
|
+
// e.g. /Users/.../node_modules/@jay-framework/wix-stores/dist/index.js → @jay-framework/wix-stores
|
|
221
|
+
const npmMatch = part.modulePath.match(/\/@jay-framework\/([^/]+)\//);
|
|
222
|
+
if (npmMatch) {
|
|
223
|
+
part.modulePath = `@jay-framework/${npmMatch[1]}`;
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
const pkgMatch = part.modulePath.match(/\/packages\/(wix-[^/]+)\//);
|
|
227
|
+
if (pkgMatch) {
|
|
228
|
+
part.modulePath = `@jay-framework/${pkgMatch[1]}`;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
if (config.parts)
|
|
235
|
+
rewriteParts(config.parts);
|
|
236
|
+
if (config.instanceComponents)
|
|
237
|
+
rewriteParts(config.instanceComponents);
|
|
238
|
+
content = JSON.stringify(config);
|
|
239
|
+
}
|
|
240
|
+
catch {
|
|
241
|
+
/* keep original content if parsing fails */
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
fs.writeFileSync(fullPath, content, 'utf8');
|
|
207
245
|
}
|
|
208
|
-
fs.writeFileSync(fullPath, content, "utf8");
|
|
209
|
-
}
|
|
210
246
|
}
|
|
211
|
-
export {
|
|
212
|
-
WixDataArtifactStore,
|
|
213
|
-
makeItemId
|
|
214
|
-
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* jay-stack run wix-deploy/build-entry
|
|
3
|
+
*
|
|
4
|
+
* Reads route-manifest.json from the build backend dir, generates an entry
|
|
5
|
+
* source with pre-imported plugins/actions + WixDataArtifactStore, and
|
|
6
|
+
* bundles it with esbuild into a single entry.mjs (~3-5 MB).
|
|
7
|
+
*/
|
|
8
|
+
import type { ConsoleContext } from '@jay-framework/fullstack-component';
|
|
9
|
+
interface BuildEntryInput {
|
|
10
|
+
collectionId?: string;
|
|
11
|
+
staticBaseUrl?: string;
|
|
12
|
+
excludePlugins?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const buildEntry: import("@jay-framework/fullstack-component").JayCliCommand<BuildEntryInput> & import("@jay-framework/fullstack-component").JayCliCommandDefinition<BuildEntryInput, [ConsoleContext]>;
|
|
15
|
+
export {};
|