@jxrstudios/jxr 1.0.3 → 1.0.5
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/README.md +6 -2
- package/bin/jxr.js +60 -0
- package/dist/deployer.d.ts +8 -12
- package/dist/deployer.d.ts.map +1 -1
- package/dist/deployer.js +69 -106
- package/dist/deployer.js.map +1 -1
- package/dist/enhanced-transpiler.d.ts +36 -0
- package/dist/enhanced-transpiler.d.ts.map +1 -0
- package/dist/enhanced-transpiler.js +272 -0
- package/dist/enhanced-transpiler.js.map +1 -0
- package/dist/entry-point-detection.d.ts +22 -0
- package/dist/entry-point-detection.d.ts.map +1 -0
- package/dist/entry-point-detection.js +415 -0
- package/dist/entry-point-detection.js.map +1 -0
- package/dist/index.d.ts +19 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2119 -16
- package/dist/index.js.map +1 -1
- package/dist/jxr-server-manager.d.ts +32 -0
- package/dist/jxr-server-manager.d.ts.map +1 -0
- package/dist/jxr-server-manager.js +353 -0
- package/dist/jxr-server-manager.js.map +1 -0
- package/dist/runtime.d.ts +9 -9
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +3 -3
- package/package.json +15 -4
- package/src/deployer.ts +231 -0
- package/src/enhanced-transpiler.ts +331 -0
- package/src/entry-point-detection.ts +470 -0
- package/src/index.ts +63 -0
- package/src/jxr-server-manager.ts +410 -0
- package/src/module-resolver.ts +520 -0
- package/src/moq-transport.ts +267 -0
- package/src/runtime.ts +188 -0
- package/src/web-crypto.ts +279 -0
- package/src/worker-pool.ts +321 -0
- package/zzz_react_template/App.tsx +160 -0
- package/zzz_react_template/index.css +16 -0
- package/zzz_react_template/index.html +12 -0
- package/zzz_react_template/main.tsx +10 -0
- package/zzz_react_template/package.json +25 -0
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
A JavaScript runtime framework for elite developers. Execute JavaScript at the edge with zero-build JSX transformation, virtual file system, worker pools, and secure module resolution.
|
|
4
4
|
|
|
5
|
+
**Website:** https://jxrstudios.online
|
|
6
|
+
|
|
5
7
|
## Installation
|
|
6
8
|
|
|
7
9
|
```bash
|
|
@@ -19,7 +21,7 @@ await jxrRuntime.init();
|
|
|
19
21
|
// Or create your own instance
|
|
20
22
|
const runtime = new JXRRuntime({
|
|
21
23
|
maxWorkers: 8,
|
|
22
|
-
moqEndpoint: 'wss://
|
|
24
|
+
moqEndpoint: 'wss://jxrstudios.workers.dev',
|
|
23
25
|
enableCrypto: true,
|
|
24
26
|
});
|
|
25
27
|
await runtime.init();
|
|
@@ -102,6 +104,8 @@ const manifest = await jxrCrypto.signManifest({
|
|
|
102
104
|
|
|
103
105
|
Deploy to JXR Studios' Cloudflare infrastructure without configuring wrangler or having a Cloudflare account.
|
|
104
106
|
|
|
107
|
+
Get your API key at: https://jxrstudios.online/dashboard
|
|
108
|
+
|
|
105
109
|
```typescript
|
|
106
110
|
import { JXRDeployer, jxrDeployer } from '@jxrstudios/jxr';
|
|
107
111
|
|
|
@@ -122,7 +126,7 @@ if (result.success) {
|
|
|
122
126
|
### Environment Variables
|
|
123
127
|
|
|
124
128
|
```bash
|
|
125
|
-
# Set your JXR API key
|
|
129
|
+
# Set your JXR API key (get it at https://jxrstudios.online/dashboard)
|
|
126
130
|
export JXR_API_KEY=jxr_live_xxxxx
|
|
127
131
|
|
|
128
132
|
# Optional: Set default project ID
|
package/bin/jxr.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { JXRServerManager, JXRDeployer } from "../src/index.ts";
|
|
3
|
+
|
|
4
|
+
const args = process.argv.slice(2);
|
|
5
|
+
const command = args[0] || "dev";
|
|
6
|
+
|
|
7
|
+
if (command === "deploy") {
|
|
8
|
+
// Deploy command
|
|
9
|
+
const projectPath = args[1] || "./dist";
|
|
10
|
+
const env = args.find((a) => a.startsWith("--env="))?.split("=")[1] || "production";
|
|
11
|
+
|
|
12
|
+
if (!process.env.JXR_API_KEY) {
|
|
13
|
+
console.error("❌ JXR_API_KEY environment variable required");
|
|
14
|
+
console.error(" Get your key at: https://jxrstudios.online/dashboard");
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const deployer = new JXRDeployer(process.env.JXR_API_KEY, process.env.JXR_PROJECT_ID);
|
|
19
|
+
|
|
20
|
+
const result = await deployer.deploy(projectPath, { environment: env });
|
|
21
|
+
|
|
22
|
+
if (result.success) {
|
|
23
|
+
console.log("✅ Deployed successfully!");
|
|
24
|
+
console.log(` URL: ${result.url}`);
|
|
25
|
+
result.logs.forEach(log => console.log(` ${log}`));
|
|
26
|
+
} else {
|
|
27
|
+
console.error("❌ Deploy failed");
|
|
28
|
+
result.logs.forEach(log => console.error(` ${log}`));
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
} else if (command === "dev" || !command) {
|
|
33
|
+
// Dev server (default)
|
|
34
|
+
const port = parseInt(process.env.PORT || args.find((a, i) => args[i - 1] === "--port" || a.startsWith("--port="))?.split("=")[1] || "3000");
|
|
35
|
+
const hmr = !args.includes("--no-hmr");
|
|
36
|
+
|
|
37
|
+
const server = new JXRServerManager({ port, enableHMR: hmr });
|
|
38
|
+
|
|
39
|
+
await server.initialize();
|
|
40
|
+
await server.start();
|
|
41
|
+
|
|
42
|
+
// Graceful shutdown - only register once
|
|
43
|
+
let shuttingDown = false;
|
|
44
|
+
const shutdown = async () => {
|
|
45
|
+
if (shuttingDown) return;
|
|
46
|
+
shuttingDown = true;
|
|
47
|
+
console.log("\n⚠️ Shutting down...");
|
|
48
|
+
await server.stop();
|
|
49
|
+
process.exit(0);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
process.on("SIGINT", shutdown);
|
|
53
|
+
process.on("SIGTERM", shutdown);
|
|
54
|
+
|
|
55
|
+
} else {
|
|
56
|
+
console.log("Usage:");
|
|
57
|
+
console.log(" jxr dev [--port=3000] [--no-hmr]");
|
|
58
|
+
console.log(" jxr deploy <path> [--env=production|staging]");
|
|
59
|
+
process.exit(1);
|
|
60
|
+
}
|
package/dist/deployer.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* JXR.js — Wranglerless Deployer
|
|
3
|
-
* ─────────────────────────────────────────────────────────────────────────────
|
|
4
3
|
* Deploy projects to JXR Studios' Cloudflare infrastructure without wrangler.
|
|
5
4
|
* Users only need a JXR API key - no Cloudflare account required.
|
|
6
|
-
* ─────────────────────────────────────────────────────────────────────────────
|
|
7
5
|
*/
|
|
8
6
|
export interface DeployConfig {
|
|
9
7
|
projectId?: string;
|
|
@@ -29,15 +27,20 @@ export interface DeploymentStatus {
|
|
|
29
27
|
*/
|
|
30
28
|
export declare class JXRDeployer {
|
|
31
29
|
private apiKey;
|
|
32
|
-
private apiUrl;
|
|
33
30
|
private projectId;
|
|
34
31
|
constructor(apiKey: string, projectId?: string);
|
|
35
32
|
/**
|
|
36
33
|
* Deploy the current project to JXR infrastructure
|
|
37
|
-
* @param projectPath Path to the built project (dist/ folder)
|
|
38
|
-
* @param config Deployment configuration
|
|
39
34
|
*/
|
|
40
35
|
deploy(projectPath: string, config?: DeployConfig): Promise<DeployResult>;
|
|
36
|
+
/**
|
|
37
|
+
* Create a tarball of the build directory
|
|
38
|
+
*/
|
|
39
|
+
private createTarball;
|
|
40
|
+
/**
|
|
41
|
+
* Upload tarball to JXR API
|
|
42
|
+
*/
|
|
43
|
+
private uploadTarball;
|
|
41
44
|
/**
|
|
42
45
|
* Get deployment status
|
|
43
46
|
*/
|
|
@@ -56,13 +59,6 @@ export declare class JXRDeployer {
|
|
|
56
59
|
* Rollback to a previous deployment
|
|
57
60
|
*/
|
|
58
61
|
rollback(deploymentId: string): Promise<DeployResult>;
|
|
59
|
-
/**
|
|
60
|
-
* Delete a deployment
|
|
61
|
-
*/
|
|
62
|
-
deleteDeployment(deploymentId: string): Promise<void>;
|
|
63
|
-
private uploadBuild;
|
|
64
|
-
private triggerDeployment;
|
|
65
|
-
private pollDeployment;
|
|
66
62
|
private generateProjectId;
|
|
67
63
|
}
|
|
68
64
|
/** Global deployer singleton */
|
package/dist/deployer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deployer.d.ts","sourceRoot":"","sources":["../src/deployer.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"deployer.d.ts","sourceRoot":"","sources":["../src/deployer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,MAAM,WAAW,YAAY;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,YAAY,GAAG,SAAS,GAAG,SAAS,CAAC;IACnD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,QAAQ,CAAC;IACvD,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,SAAS,CAAS;gBAEd,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;IAK9C;;OAEG;IACG,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,GAAE,YAAiB,GAAG,OAAO,CAAC,YAAY,CAAC;IA+CnF;;OAEG;YACW,aAAa;IAkB3B;;OAEG;YACW,aAAa;IAgC3B;;OAEG;IACG,SAAS,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAchE;;OAEG;IACG,eAAe,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;QACvD,EAAE,EAAE,MAAM,CAAC;QACX,GAAG,EAAE,MAAM,CAAC;QACZ,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC,CAAC;IAgBH;;OAEG;IACG,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAuB3D,OAAO,CAAC,iBAAiB;CAK1B;AAED,gCAAgC;AAChC,eAAO,MAAM,WAAW,aAGvB,CAAC"}
|
package/dist/deployer.js
CHANGED
|
@@ -1,76 +1,113 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* JXR.js — Wranglerless Deployer
|
|
3
|
-
* ─────────────────────────────────────────────────────────────────────────────
|
|
4
3
|
* Deploy projects to JXR Studios' Cloudflare infrastructure without wrangler.
|
|
5
4
|
* Users only need a JXR API key - no Cloudflare account required.
|
|
6
|
-
* ─────────────────────────────────────────────────────────────────────────────
|
|
7
5
|
*/
|
|
6
|
+
import { readFile, stat } from "fs/promises";
|
|
7
|
+
import path from "path";
|
|
8
|
+
import { spawn } from "child_process";
|
|
8
9
|
/**
|
|
9
10
|
* JXRDeployer — Deploy to JXR Cloudflare infrastructure
|
|
10
11
|
* No wrangler config needed. Just your JXR API key.
|
|
11
12
|
*/
|
|
12
13
|
export class JXRDeployer {
|
|
13
14
|
apiKey;
|
|
14
|
-
apiUrl;
|
|
15
15
|
projectId;
|
|
16
16
|
constructor(apiKey, projectId) {
|
|
17
17
|
this.apiKey = apiKey;
|
|
18
|
-
this.apiUrl = 'https://api.jxr.dev/v1';
|
|
19
18
|
this.projectId = projectId || this.generateProjectId();
|
|
20
19
|
}
|
|
21
20
|
/**
|
|
22
21
|
* Deploy the current project to JXR infrastructure
|
|
23
|
-
* @param projectPath Path to the built project (dist/ folder)
|
|
24
|
-
* @param config Deployment configuration
|
|
25
22
|
*/
|
|
26
23
|
async deploy(projectPath, config = {}) {
|
|
27
24
|
const env = config.environment || 'production';
|
|
28
25
|
const branch = config.branch || 'main';
|
|
26
|
+
const pid = config.projectId || this.projectId;
|
|
29
27
|
console.log(`🚀 Deploying to JXR ${env}...`);
|
|
28
|
+
const logs = [];
|
|
30
29
|
try {
|
|
31
|
-
//
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
//
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
environment: env,
|
|
44
|
-
uploadId: uploadResult.uploadId,
|
|
45
|
-
});
|
|
46
|
-
// Step 3: Poll for completion
|
|
47
|
-
const result = await this.pollDeployment(deployment.deploymentId);
|
|
30
|
+
// Verify project path exists
|
|
31
|
+
await stat(projectPath);
|
|
32
|
+
logs.push(`📁 Deploying from: ${projectPath}`);
|
|
33
|
+
// Create tarball of build files
|
|
34
|
+
const tarballPath = await this.createTarball(projectPath);
|
|
35
|
+
logs.push(`📦 Created tarball: ${tarballPath}`);
|
|
36
|
+
// Upload tarball
|
|
37
|
+
const uploadResult = await this.uploadTarball(tarballPath, pid, env, branch);
|
|
38
|
+
logs.push(`☁️ Uploaded to JXR`);
|
|
39
|
+
// Get deployment URL
|
|
40
|
+
const url = `https://${pid}.jxr.dev`;
|
|
41
|
+
logs.push(`🌐 Live at: ${url}`);
|
|
48
42
|
return {
|
|
49
|
-
success:
|
|
50
|
-
url
|
|
51
|
-
deploymentId:
|
|
43
|
+
success: true,
|
|
44
|
+
url,
|
|
45
|
+
deploymentId: uploadResult.deploymentId,
|
|
52
46
|
timestamp: new Date().toISOString(),
|
|
53
|
-
logs
|
|
47
|
+
logs,
|
|
54
48
|
};
|
|
55
49
|
}
|
|
56
50
|
catch (error) {
|
|
51
|
+
const errorMsg = error instanceof Error ? error.message : 'Unknown error';
|
|
52
|
+
logs.push(`❌ Error: ${errorMsg}`);
|
|
57
53
|
return {
|
|
58
54
|
success: false,
|
|
59
55
|
url: '',
|
|
60
56
|
deploymentId: '',
|
|
61
57
|
timestamp: new Date().toISOString(),
|
|
62
|
-
logs
|
|
58
|
+
logs,
|
|
63
59
|
};
|
|
64
60
|
}
|
|
65
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Create a tarball of the build directory
|
|
64
|
+
*/
|
|
65
|
+
async createTarball(projectPath) {
|
|
66
|
+
const tarballPath = path.join(process.cwd(), '.jxr-deploy.tar.gz');
|
|
67
|
+
return new Promise((resolve, reject) => {
|
|
68
|
+
const tar = spawn('tar', ['-czf', tarballPath, '-C', projectPath, '.']);
|
|
69
|
+
tar.on('close', (code) => {
|
|
70
|
+
if (code === 0) {
|
|
71
|
+
resolve(tarballPath);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
reject(new Error(`tar exited with code ${code}`));
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
tar.on('error', reject);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Upload tarball to JXR API
|
|
82
|
+
*/
|
|
83
|
+
async uploadTarball(tarballPath, projectId, environment, branch) {
|
|
84
|
+
const formData = new FormData();
|
|
85
|
+
const fileContent = await readFile(tarballPath);
|
|
86
|
+
const blob = new Blob([fileContent]);
|
|
87
|
+
formData.append('build', blob, 'build.tar.gz');
|
|
88
|
+
formData.append('projectId', projectId);
|
|
89
|
+
formData.append('environment', environment);
|
|
90
|
+
formData.append('branch', branch);
|
|
91
|
+
const response = await fetch('https://api.jxrstudios.online/v1/deployments', {
|
|
92
|
+
method: 'POST',
|
|
93
|
+
headers: {
|
|
94
|
+
'Authorization': `Bearer ${this.apiKey}`,
|
|
95
|
+
},
|
|
96
|
+
body: formData,
|
|
97
|
+
});
|
|
98
|
+
if (!response.ok) {
|
|
99
|
+
throw new Error(`Upload failed: ${response.statusText}`);
|
|
100
|
+
}
|
|
101
|
+
const result = await response.json();
|
|
102
|
+
return { deploymentId: result.deploymentId };
|
|
103
|
+
}
|
|
66
104
|
/**
|
|
67
105
|
* Get deployment status
|
|
68
106
|
*/
|
|
69
107
|
async getStatus(deploymentId) {
|
|
70
|
-
const response = await fetch(
|
|
108
|
+
const response = await fetch(`https://api.jxrstudios.online/v1/deployments/${deploymentId}`, {
|
|
71
109
|
headers: {
|
|
72
110
|
'Authorization': `Bearer ${this.apiKey}`,
|
|
73
|
-
'Content-Type': 'application/json',
|
|
74
111
|
},
|
|
75
112
|
});
|
|
76
113
|
if (!response.ok) {
|
|
@@ -83,7 +120,7 @@ export class JXRDeployer {
|
|
|
83
120
|
*/
|
|
84
121
|
async listDeployments(projectId) {
|
|
85
122
|
const pid = projectId || this.projectId;
|
|
86
|
-
const response = await fetch(
|
|
123
|
+
const response = await fetch(`https://api.jxrstudios.online/v1/projects/${pid}/deployments`, {
|
|
87
124
|
headers: {
|
|
88
125
|
'Authorization': `Bearer ${this.apiKey}`,
|
|
89
126
|
},
|
|
@@ -97,11 +134,10 @@ export class JXRDeployer {
|
|
|
97
134
|
* Rollback to a previous deployment
|
|
98
135
|
*/
|
|
99
136
|
async rollback(deploymentId) {
|
|
100
|
-
const response = await fetch(
|
|
137
|
+
const response = await fetch(`https://api.jxrstudios.online/v1/deployments/${deploymentId}/rollback`, {
|
|
101
138
|
method: 'POST',
|
|
102
139
|
headers: {
|
|
103
140
|
'Authorization': `Bearer ${this.apiKey}`,
|
|
104
|
-
'Content-Type': 'application/json',
|
|
105
141
|
},
|
|
106
142
|
});
|
|
107
143
|
if (!response.ok) {
|
|
@@ -116,80 +152,7 @@ export class JXRDeployer {
|
|
|
116
152
|
logs: ['Rollback successful'],
|
|
117
153
|
};
|
|
118
154
|
}
|
|
119
|
-
/**
|
|
120
|
-
* Delete a deployment
|
|
121
|
-
*/
|
|
122
|
-
async deleteDeployment(deploymentId) {
|
|
123
|
-
const response = await fetch(`${this.apiUrl}/deployments/${deploymentId}`, {
|
|
124
|
-
method: 'DELETE',
|
|
125
|
-
headers: {
|
|
126
|
-
'Authorization': `Bearer ${this.apiKey}`,
|
|
127
|
-
},
|
|
128
|
-
});
|
|
129
|
-
if (!response.ok) {
|
|
130
|
-
throw new Error(`Delete failed: ${response.statusText}`);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
// ─── Private Methods ────────────────────────────────────────────────────────
|
|
134
|
-
async uploadBuild(projectPath, options) {
|
|
135
|
-
// In a real implementation, this would:
|
|
136
|
-
// 1. Create a tarball of the build files
|
|
137
|
-
// 2. Upload to JXR's blob storage
|
|
138
|
-
// 3. Return an upload ID
|
|
139
|
-
// For now, simulate the API call
|
|
140
|
-
const formData = new FormData();
|
|
141
|
-
formData.append('projectId', options.projectId);
|
|
142
|
-
formData.append('environment', options.environment);
|
|
143
|
-
formData.append('branch', options.branch);
|
|
144
|
-
// TODO: Actually create and append tarball
|
|
145
|
-
// formData.append('build', tarballBlob);
|
|
146
|
-
const response = await fetch(`${this.apiUrl}/uploads`, {
|
|
147
|
-
method: 'POST',
|
|
148
|
-
headers: {
|
|
149
|
-
'Authorization': `Bearer ${this.apiKey}`,
|
|
150
|
-
},
|
|
151
|
-
body: formData,
|
|
152
|
-
});
|
|
153
|
-
if (!response.ok) {
|
|
154
|
-
return { success: false, uploadId: '', error: response.statusText };
|
|
155
|
-
}
|
|
156
|
-
const data = await response.json();
|
|
157
|
-
return { success: true, uploadId: data.uploadId };
|
|
158
|
-
}
|
|
159
|
-
async triggerDeployment(options) {
|
|
160
|
-
const response = await fetch(`${this.apiUrl}/deployments`, {
|
|
161
|
-
method: 'POST',
|
|
162
|
-
headers: {
|
|
163
|
-
'Authorization': `Bearer ${this.apiKey}`,
|
|
164
|
-
'Content-Type': 'application/json',
|
|
165
|
-
},
|
|
166
|
-
body: JSON.stringify({
|
|
167
|
-
projectId: options.projectId,
|
|
168
|
-
environment: options.environment,
|
|
169
|
-
uploadId: options.uploadId,
|
|
170
|
-
}),
|
|
171
|
-
});
|
|
172
|
-
if (!response.ok) {
|
|
173
|
-
throw new Error(`Failed to trigger deployment: ${response.statusText}`);
|
|
174
|
-
}
|
|
175
|
-
return response.json();
|
|
176
|
-
}
|
|
177
|
-
async pollDeployment(deploymentId, maxAttempts = 60) {
|
|
178
|
-
for (let i = 0; i < maxAttempts; i++) {
|
|
179
|
-
const status = await this.getStatus(deploymentId);
|
|
180
|
-
if (status.status === 'deployed') {
|
|
181
|
-
return { status: 'deployed', url: status.url, logs: [] };
|
|
182
|
-
}
|
|
183
|
-
if (status.status === 'failed') {
|
|
184
|
-
return { status: 'failed', logs: [status.error || 'Deployment failed'] };
|
|
185
|
-
}
|
|
186
|
-
// Wait 2 seconds before next poll
|
|
187
|
-
await new Promise(resolve => setTimeout(resolve, 2000));
|
|
188
|
-
}
|
|
189
|
-
throw new Error('Deployment timed out');
|
|
190
|
-
}
|
|
191
155
|
generateProjectId() {
|
|
192
|
-
// Generate a unique project ID from the current directory or package.json
|
|
193
156
|
const timestamp = Date.now().toString(36);
|
|
194
157
|
const random = Math.random().toString(36).substring(2, 8);
|
|
195
158
|
return `jxr-${timestamp}-${random}`;
|
package/dist/deployer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deployer.js","sourceRoot":"","sources":["../src/deployer.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"deployer.js","sourceRoot":"","sources":["../src/deployer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAW,IAAI,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAuBtC;;;GAGG;AACH,MAAM,OAAO,WAAW;IACd,MAAM,CAAS;IACf,SAAS,CAAS;IAE1B,YAAY,MAAc,EA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,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QAC1C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC1D,OAAO,OAAO,SAAS,IAAI,MAAM,EAAE,CAAC;IACtC,CAAC;CACF;AAED,gCAAgC;AAChC,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,WAAW,CACxC,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,EAAE,EAC7B,OAAO,CAAC,GAAG,CAAC,cAAc,CAC3B,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export interface TranspilerOptions {
|
|
2
|
+
filename: string;
|
|
3
|
+
presets?: string[];
|
|
4
|
+
plugins?: any[];
|
|
5
|
+
cache?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface TranspilationResult {
|
|
8
|
+
code: string;
|
|
9
|
+
map?: any;
|
|
10
|
+
error?: Error;
|
|
11
|
+
cached?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare class EnhancedTranspiler {
|
|
14
|
+
private transformCache;
|
|
15
|
+
private dependencyGraph;
|
|
16
|
+
private options;
|
|
17
|
+
constructor(options?: Partial<TranspilerOptions>);
|
|
18
|
+
transpileTypeScript(code: string, filename: string, options?: Partial<TranspilerOptions>): TranspilationResult;
|
|
19
|
+
transpileJSX(code: string, filename: string, options?: Partial<TranspilerOptions>): TranspilationResult;
|
|
20
|
+
private createImportTransformer;
|
|
21
|
+
private resolveImportPath;
|
|
22
|
+
trackDependencies(filename: string, dependencies: string[]): void;
|
|
23
|
+
invalidateCache(changedFiles: string[]): void;
|
|
24
|
+
clearCache(): void;
|
|
25
|
+
invalidateFile(filename: string): void;
|
|
26
|
+
getCacheStats(): {
|
|
27
|
+
size: number;
|
|
28
|
+
hitRate: number;
|
|
29
|
+
};
|
|
30
|
+
extractDependencies(code: string): string[];
|
|
31
|
+
validateTranspiledCode(code: string): {
|
|
32
|
+
valid: boolean;
|
|
33
|
+
errors: string[];
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=enhanced-transpiler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enhanced-transpiler.d.ts","sourceRoot":"","sources":["../src/enhanced-transpiler.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,OAAO,CAAC,EAAE,GAAG,EAAE,CAAA;IACf,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,GAAG,CAAA;IACT,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,cAAc,CAAyC;IAC/D,OAAO,CAAC,eAAe,CAAiC;IACxD,OAAO,CAAC,OAAO,CAA4B;gBAE/B,OAAO,GAAE,OAAO,CAAC,iBAAiB,CAAM;IAIpD,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,OAAO,CAAC,iBAAiB,CAAM,GAAG,mBAAmB;IA8ClH,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,OAAO,CAAC,iBAAiB,CAAM,GAAG,mBAAmB;IA4C3G,OAAO,CAAC,uBAAuB;IAyD/B,OAAO,CAAC,iBAAiB;IAiCzB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,IAAI;IAKjE,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,IAAI;I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