@codepress/codepress-engine 0.4.0-dev.preview-bundle.20251102225420
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/LICENSE +11 -0
- package/README.md +201 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +320 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +176 -0
- package/dist/index.js.map +1 -0
- package/dist/previewBundle.d.ts +20 -0
- package/dist/previewBundle.js +246 -0
- package/dist/previewBundle.js.map +1 -0
- package/dist/server.d.ts +29 -0
- package/dist/server.js +1140 -0
- package/dist/server.js.map +1 -0
- package/dist/swc/index.d.ts +16 -0
- package/dist/swc/index.js +126 -0
- package/dist/swc/index.js.map +1 -0
- package/dist/types.d.ts +4 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +114 -0
- package/swc/codepress_engine.v0_82_87.wasm +0 -0
- package/swc/codepress_engine.v26.wasm +0 -0
- package/swc/codepress_engine.v42.wasm +0 -0
- package/swc/index.js +14 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Proprietary License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Codepress
|
|
4
|
+
|
|
5
|
+
All rights reserved.
|
|
6
|
+
|
|
7
|
+
This software and associated documentation files (the "Software") are the proprietary property of Codepress. Use of the Software is governed by the license agreement that you entered into with Codepress.
|
|
8
|
+
|
|
9
|
+
Unauthorized copying, distribution, modification, public display, public performance, or creation of derivative works of the Software or any part thereof is strictly prohibited. This includes, but is not limited to, integrating or using the Software with third-party services without explicit permission from Codepress.
|
|
10
|
+
|
|
11
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
## CodePress Engine
|
|
2
|
+
|
|
3
|
+
TypeScript-powered instrumentation for the CodePress visual editor. The package ships a Babel plugin, SWC plugin, development server, and CLI so React or Next.js projects can expose file-level context to the editor.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Requirements
|
|
8
|
+
|
|
9
|
+
- Node.js **18.17.0 or newer** (Fastify v5 + diagnostics channel support)
|
|
10
|
+
- npm 8+ (or any compatible package manager)
|
|
11
|
+
- Git available on the host machine (repository & branch detection)
|
|
12
|
+
|
|
13
|
+
> Automated tests run under Node 16 and skip Fastify-specific assertions when the runtime lacks the required APIs. For production usage we strongly recommend Node 18+.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @codepress/codepress-engine
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## SWC plugin (Next.js) usage
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
// next.config.mjs (Next.js 14/15)
|
|
27
|
+
import { createSWCPlugin } from "@codepress/codepress-engine/swc";
|
|
28
|
+
|
|
29
|
+
const nextConfig = {
|
|
30
|
+
experimental: {
|
|
31
|
+
swcPlugins: [
|
|
32
|
+
// Auto-detects repo/branch; no options required
|
|
33
|
+
createSWCPlugin(),
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default nextConfig;
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Note: When using ESM (`next.config.mjs`), prefer the named import above due to CJS interop. For CommonJS configs you can use:
|
|
42
|
+
|
|
43
|
+
```js
|
|
44
|
+
// next.config.cjs
|
|
45
|
+
const { createSWCPlugin } = require("@codepress/codepress-engine/swc");
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
The SWC plugin auto-detects your repository and branch from `git` and common CI env vars. WASM selection is automatic based on your Next.js / `@swc/core` version; see the WASM exports below for manual overrides.
|
|
49
|
+
|
|
50
|
+
Optional options for `createSWCPlugin` (all are optional; omit to use auto-detection):
|
|
51
|
+
|
|
52
|
+
| Option | Type | Default | Purpose |
|
|
53
|
+
| ------------- | ------ | ------------------------------- | ---------------------------------------- |
|
|
54
|
+
| `repo_name` | string | auto-detected from `git remote` | Force repository id in `owner/repo` form |
|
|
55
|
+
| `branch_name` | string | auto-detected from env/`git` | Force branch name |
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Babel plugin usage
|
|
60
|
+
|
|
61
|
+
```js
|
|
62
|
+
// babel.config.mjs
|
|
63
|
+
export default {
|
|
64
|
+
plugins: ["@codepress/codepress-engine"],
|
|
65
|
+
};
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Each JSX element receives a `codepress-data-fp` attribute whose value encodes the relative path and start/end line numbers. On the first root container (`html`, `body`, or `div`), the plugin also injects repository and branch metadata.
|
|
69
|
+
|
|
70
|
+
Optional options for the Babel plugin (all are optional; omit to use auto-detection):
|
|
71
|
+
|
|
72
|
+
| Option | Type | Default | Purpose |
|
|
73
|
+
| ------------- | ------ | ------------------------------- | ---------------------------------------- |
|
|
74
|
+
| `repo_name` | string | auto-detected from `git remote` | Force repository id in `owner/repo` form |
|
|
75
|
+
| `branch_name` | string | auto-detected from env/`git` | Force branch name |
|
|
76
|
+
|
|
77
|
+
Entry points exposed by the package:
|
|
78
|
+
|
|
79
|
+
| Export | Description |
|
|
80
|
+
| ------------------------------------ | ---------------------------------- |
|
|
81
|
+
| `@codepress/codepress-engine/babel` | Compiled Babel plugin (CommonJS) |
|
|
82
|
+
| `@codepress/codepress-engine/swc` | SWC plugin factory & WASM helpers |
|
|
83
|
+
| `@codepress/codepress-engine/server` | Fastify development server factory |
|
|
84
|
+
| `@codepress/codepress-engine/cli` | CLI used by the `codepress` binary |
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Project layout
|
|
89
|
+
|
|
90
|
+
| Path | Details |
|
|
91
|
+
| ----------------- | ------------------------------------------------------------------------ |
|
|
92
|
+
| `src/` | TypeScript sources for the Babel plugin, CLI, dev server, and utils |
|
|
93
|
+
| `dist/` | Compiled JavaScript + declaration files (`npm run build`) |
|
|
94
|
+
| `babel/` | Lightweight proxy that re-exports the compiled Babel plugin |
|
|
95
|
+
| `swc/` | WASM binaries (`wasm-v42`, `wasm-v26`, `wasm-v0_82_87`) and plugin entry |
|
|
96
|
+
| `tests/`, `test/` | Jest suites covering Babel, SWC, and server helpers |
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Build & test workflow
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
# Install dependencies
|
|
104
|
+
npm install
|
|
105
|
+
|
|
106
|
+
# Compile TypeScript into dist/
|
|
107
|
+
npm run build
|
|
108
|
+
|
|
109
|
+
# Run Jest (ts-jest powered)
|
|
110
|
+
npm test
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
The build step must run before publishing or linking locally because Babel and CLI entry points load from `dist/`. Jest automatically performs type-checking and skips Fastify integration tests when the runtime does not support diagnostics channels.
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Local development
|
|
118
|
+
|
|
119
|
+
Run the local CodePress server alongside your app to visually edit code on disk (no GitHub commits):
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
# npm
|
|
123
|
+
npx codepress && npm start
|
|
124
|
+
|
|
125
|
+
# pnpm
|
|
126
|
+
pnpm dlx codepress && pnpm start
|
|
127
|
+
|
|
128
|
+
# yarn
|
|
129
|
+
yarn dlx codepress && yarn start
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Useful commands:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
# Show available commands
|
|
136
|
+
npx codepress help
|
|
137
|
+
|
|
138
|
+
# Launch the server explicitly on port 4321
|
|
139
|
+
npx codepress server
|
|
140
|
+
|
|
141
|
+
# Scaffold .env entries required by the server
|
|
142
|
+
npx codepress setup
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Environment variables (from `.env` when present):
|
|
146
|
+
|
|
147
|
+
| Variable | Default | Purpose |
|
|
148
|
+
| ------------------------ | ----------- | -------------------------------------------- |
|
|
149
|
+
| `CODEPRESS_DEV_PORT` | `4321` | Fastify listen port |
|
|
150
|
+
| `CODEPRESS_BACKEND_HOST` | `localhost` | CodePress backend hostname |
|
|
151
|
+
| `CODEPRESS_BACKEND_PORT` | `8007` | Backend REST port |
|
|
152
|
+
| `CODEPRESS_API_TOKEN` | _unset_ | API token used for authenticated proxy calls |
|
|
153
|
+
|
|
154
|
+
The server performs git-aware writes and enriches responses with repository metadata. It writes changes to your local filesystem and is not used in production builds.
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## SWC package exports and WASM selection
|
|
159
|
+
|
|
160
|
+
| Export | Target |
|
|
161
|
+
| --------------------- | -------------------------------------- |
|
|
162
|
+
| `./swc` | `./dist/swc/index.js` |
|
|
163
|
+
| `./swc/wasm` | `./swc/codepress_engine.v42.wasm` |
|
|
164
|
+
| `./swc/wasm-v42` | `./swc/codepress_engine.v42.wasm` |
|
|
165
|
+
| `./swc/wasm-v26` | `./swc/codepress_engine.v26.wasm` |
|
|
166
|
+
| `./swc/wasm-v0_82_87` | `./swc/codepress_engine.v0_82_87.wasm` |
|
|
167
|
+
|
|
168
|
+
The helper automatically selects the correct WASM binary based on detected Next.js / `@swc/core` versions. Override detection with `CODEPRESS_SWC_WASM=<package specifier>` or `CODEPRESS_SWC_ABI_BAND=<v42|v26|v0_82_87>`.
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Feature comparison
|
|
173
|
+
|
|
174
|
+
| Capability | Babel plugin | SWC plugin |
|
|
175
|
+
| --------------------- | ------------------------ | ------------------------------- |
|
|
176
|
+
| Git-aware attributes | ✅ | ✅ |
|
|
177
|
+
| Encoded path security | XOR + base64 | XOR + base64 |
|
|
178
|
+
| Line number tracking | ✅ start–end range | ✅ (optional) |
|
|
179
|
+
| Performance | Baseline | **20–70× faster** |
|
|
180
|
+
| Output medium | String literal attribute | `[wasmSpecifier, config]` array |
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## Additional references
|
|
185
|
+
|
|
186
|
+
- `INSTALL.md` – linking the package locally & publishing guidance
|
|
187
|
+
- `scripts/build-swc.mjs` – rebuild the WASM binaries (requires Rust toolchain)
|
|
188
|
+
- `tests/` – examples of mocking git, fetch, and file IO when validating the plugin
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Contributing
|
|
193
|
+
|
|
194
|
+
PRs are welcome. Please ensure:
|
|
195
|
+
|
|
196
|
+
1. `npm run build`
|
|
197
|
+
2. `npm test`
|
|
198
|
+
|
|
199
|
+
are both green before submitting. Mention in the PR description if Fastify integration tests were skipped due to running on Node < 18.
|
|
200
|
+
|
|
201
|
+
CodePress Engine is released under the MIT license (see `LICENSE`).
|
package/dist/cli.d.ts
ADDED
package/dist/cli.js
ADDED
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
const child_process_1 = require("child_process");
|
|
38
|
+
const fs = __importStar(require("node:fs"));
|
|
39
|
+
const os = __importStar(require("node:os"));
|
|
40
|
+
const path = __importStar(require("node:path"));
|
|
41
|
+
const server_1 = require("./server");
|
|
42
|
+
const previewBundle_1 = require("./previewBundle");
|
|
43
|
+
const args = process.argv.slice(2);
|
|
44
|
+
let activeServer = null;
|
|
45
|
+
let signalHandlersRegistered = false;
|
|
46
|
+
let currentChildProcess;
|
|
47
|
+
async function ensureServer() {
|
|
48
|
+
if (activeServer) {
|
|
49
|
+
return activeServer;
|
|
50
|
+
}
|
|
51
|
+
const server = await (0, server_1.startServer)();
|
|
52
|
+
activeServer = server !== null && server !== void 0 ? server : null;
|
|
53
|
+
if (activeServer) {
|
|
54
|
+
console.log("\x1b[36mℹ Codepress server running. Press Ctrl+C to stop.\x1b[0m");
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
console.log("\x1b[33mℹ Server already running\x1b[0m");
|
|
58
|
+
}
|
|
59
|
+
return activeServer;
|
|
60
|
+
}
|
|
61
|
+
async function shutdown(child) {
|
|
62
|
+
console.log("\n\x1b[33mℹ Shutting down Codepress server...\x1b[0m");
|
|
63
|
+
if (child && !child.killed) {
|
|
64
|
+
child.kill("SIGINT");
|
|
65
|
+
}
|
|
66
|
+
if (activeServer) {
|
|
67
|
+
try {
|
|
68
|
+
await activeServer.close();
|
|
69
|
+
console.log("\x1b[32m✓ Codepress server stopped\x1b[0m");
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
console.error(`\x1b[31m✗ Failed to stop server: ${error.message}\x1b[0m`);
|
|
73
|
+
}
|
|
74
|
+
finally {
|
|
75
|
+
activeServer = null;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
// Best-effort: remove lock if owned by this process
|
|
79
|
+
try {
|
|
80
|
+
const port = parseInt(process.env.CODEPRESS_DEV_PORT || "4321", 10);
|
|
81
|
+
const suffix = isFinite(port) ? `-${port}` : "";
|
|
82
|
+
const lockPath = path.join(os.tmpdir(), `codepress-dev-server${suffix}.lock`);
|
|
83
|
+
if (fs.existsSync(lockPath)) {
|
|
84
|
+
const raw = fs.readFileSync(lockPath, "utf8");
|
|
85
|
+
const data = JSON.parse(raw);
|
|
86
|
+
if (data && data.pid === process.pid) {
|
|
87
|
+
fs.unlinkSync(lockPath);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
// ignore
|
|
93
|
+
}
|
|
94
|
+
process.exit(0);
|
|
95
|
+
}
|
|
96
|
+
function registerSignalHandlers(child) {
|
|
97
|
+
currentChildProcess = child;
|
|
98
|
+
if (signalHandlersRegistered) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const handler = () => {
|
|
102
|
+
void shutdown(currentChildProcess);
|
|
103
|
+
};
|
|
104
|
+
process.on("SIGINT", handler);
|
|
105
|
+
process.on("SIGTERM", handler);
|
|
106
|
+
signalHandlersRegistered = true;
|
|
107
|
+
}
|
|
108
|
+
function setupDependencies() {
|
|
109
|
+
console.log("\x1b[36mℹ Setting up dependencies for Codepress visual editor...\x1b[0m");
|
|
110
|
+
try {
|
|
111
|
+
console.log("\x1b[36mℹ Installing dependencies...\x1b[0m");
|
|
112
|
+
const npmCmd = process.platform === "win32" ? "npm.cmd" : "npm";
|
|
113
|
+
(0, child_process_1.execFileSync)(npmCmd, ["install", "--save", "prettier@^3.1.0", "node-fetch@^2.6.7"], { stdio: "inherit" });
|
|
114
|
+
console.log("\n\x1b[36mℹ Setting up environment variables...\x1b[0m");
|
|
115
|
+
const envFile = path.join(process.cwd(), ".env");
|
|
116
|
+
let envContent = "";
|
|
117
|
+
if (fs.existsSync(envFile)) {
|
|
118
|
+
envContent = fs.readFileSync(envFile, "utf8");
|
|
119
|
+
}
|
|
120
|
+
let envUpdated = false;
|
|
121
|
+
if (!envContent.includes("CODEPRESS_BACKEND_HOST")) {
|
|
122
|
+
envContent += "\n# Codepress backend settings\n";
|
|
123
|
+
envContent += "CODEPRESS_BACKEND_HOST=localhost\n";
|
|
124
|
+
envContent += "CODEPRESS_BACKEND_PORT=8007\n";
|
|
125
|
+
envUpdated = true;
|
|
126
|
+
}
|
|
127
|
+
if (!envContent.includes("CODEPRESS_API_TOKEN")) {
|
|
128
|
+
envContent += "\n# Codepress authentication\n";
|
|
129
|
+
envContent += "# Get this from your organization settings in Codepress\n";
|
|
130
|
+
envContent += "CODEPRESS_API_TOKEN=\n";
|
|
131
|
+
envUpdated = true;
|
|
132
|
+
}
|
|
133
|
+
if (envUpdated) {
|
|
134
|
+
fs.writeFileSync(envFile, envContent);
|
|
135
|
+
console.log("\x1b[32m✓ Added Codepress settings to .env file\x1b[0m");
|
|
136
|
+
console.log("\x1b[33m⚠ Please set your CODEPRESS_API_TOKEN in the .env file\x1b[0m");
|
|
137
|
+
}
|
|
138
|
+
console.log("\n\x1b[32m✅ Setup completed successfully!\x1b[0m");
|
|
139
|
+
console.log("\x1b[36mℹ You can now start the server with: npx codepress server\x1b[0m");
|
|
140
|
+
}
|
|
141
|
+
catch (error) {
|
|
142
|
+
console.error(`\n\x1b[31m✗ Setup failed: ${error.message}\x1b[0m`);
|
|
143
|
+
process.exit(1);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
function showHelp() {
|
|
147
|
+
console.log(`
|
|
148
|
+
\x1b[1mCodepress CLI\x1b[0m
|
|
149
|
+
|
|
150
|
+
\x1b[1mUsage:\x1b[0m
|
|
151
|
+
codepress [command] [args...]
|
|
152
|
+
|
|
153
|
+
\x1b[1mCommands:\x1b[0m
|
|
154
|
+
server Start the development server
|
|
155
|
+
setup Setup dependencies for the visual editor
|
|
156
|
+
preview-bundle Bundle entries for Codepress preview
|
|
157
|
+
<command> Run any command with the server running in background
|
|
158
|
+
help Show this help message
|
|
159
|
+
|
|
160
|
+
\x1b[1mExamples:\x1b[0m
|
|
161
|
+
codepress server Start the server only
|
|
162
|
+
codepress setup Install required dependencies
|
|
163
|
+
codepress npm start Run npm start with server in background
|
|
164
|
+
codepress preview-bundle --entry src/components/Button.tsx --json
|
|
165
|
+
`);
|
|
166
|
+
}
|
|
167
|
+
function parsePreviewBundleArgs(args) {
|
|
168
|
+
const entries = [];
|
|
169
|
+
let repoName;
|
|
170
|
+
let branchName;
|
|
171
|
+
let tsconfigPath;
|
|
172
|
+
let json = false;
|
|
173
|
+
for (let i = 0; i < args.length; i += 1) {
|
|
174
|
+
const arg = args[i];
|
|
175
|
+
if (arg === "--entry" || arg === "-e") {
|
|
176
|
+
const value = args[i + 1];
|
|
177
|
+
if (!value) {
|
|
178
|
+
throw new Error("--entry requires a value");
|
|
179
|
+
}
|
|
180
|
+
entries.push(value);
|
|
181
|
+
i += 1;
|
|
182
|
+
}
|
|
183
|
+
else if (arg.startsWith("--entry=")) {
|
|
184
|
+
entries.push(arg.slice("--entry=".length));
|
|
185
|
+
}
|
|
186
|
+
else if (arg === "--repo-name") {
|
|
187
|
+
repoName = args[i + 1];
|
|
188
|
+
if (!repoName)
|
|
189
|
+
throw new Error("--repo-name requires a value");
|
|
190
|
+
i += 1;
|
|
191
|
+
}
|
|
192
|
+
else if (arg.startsWith("--repo-name=")) {
|
|
193
|
+
repoName = arg.slice("--repo-name=".length);
|
|
194
|
+
}
|
|
195
|
+
else if (arg === "--branch-name") {
|
|
196
|
+
branchName = args[i + 1];
|
|
197
|
+
if (!branchName)
|
|
198
|
+
throw new Error("--branch-name requires a value");
|
|
199
|
+
i += 1;
|
|
200
|
+
}
|
|
201
|
+
else if (arg.startsWith("--branch-name=")) {
|
|
202
|
+
branchName = arg.slice("--branch-name=".length);
|
|
203
|
+
}
|
|
204
|
+
else if (arg === "--tsconfig") {
|
|
205
|
+
tsconfigPath = args[i + 1];
|
|
206
|
+
if (!tsconfigPath)
|
|
207
|
+
throw new Error("--tsconfig requires a value");
|
|
208
|
+
i += 1;
|
|
209
|
+
}
|
|
210
|
+
else if (arg.startsWith("--tsconfig=")) {
|
|
211
|
+
tsconfigPath = arg.slice("--tsconfig=".length);
|
|
212
|
+
}
|
|
213
|
+
else if (arg === "--json") {
|
|
214
|
+
json = true;
|
|
215
|
+
}
|
|
216
|
+
else if (!arg.startsWith("-")) {
|
|
217
|
+
entries.push(arg);
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
throw new Error(`Unknown option: ${arg}`);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return { entries, repoName, branchName, tsconfigPath, json };
|
|
224
|
+
}
|
|
225
|
+
function printPreviewBundleResult(result, json) {
|
|
226
|
+
var _a;
|
|
227
|
+
if (json) {
|
|
228
|
+
process.stdout.write(JSON.stringify(result));
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
for (const mod of result.modules) {
|
|
232
|
+
if (mod.error) {
|
|
233
|
+
console.error(`✗ ${mod.entry} (${mod.error}): ${(_a = mod.buildError) !== null && _a !== void 0 ? _a : ""}`);
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
console.log(`✓ ${mod.entry}`);
|
|
237
|
+
if (mod.warnings.length) {
|
|
238
|
+
for (const warning of mod.warnings) {
|
|
239
|
+
console.warn(` warning: ${warning}`);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
async function main() {
|
|
246
|
+
if (args.length === 0) {
|
|
247
|
+
showHelp();
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
const [command, ...rest] = args;
|
|
251
|
+
switch (command) {
|
|
252
|
+
case "preview-bundle": {
|
|
253
|
+
let parsed;
|
|
254
|
+
try {
|
|
255
|
+
parsed = parsePreviewBundleArgs(rest);
|
|
256
|
+
}
|
|
257
|
+
catch (error) {
|
|
258
|
+
console.error(`\x1b[31m✗ ${error.message}\x1b[0m`);
|
|
259
|
+
process.exit(1);
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
if (parsed.entries.length === 0) {
|
|
263
|
+
console.error("\x1b[31m✗ preview-bundle requires at least one --entry\x1b[0m");
|
|
264
|
+
process.exit(1);
|
|
265
|
+
}
|
|
266
|
+
try {
|
|
267
|
+
const result = await (0, previewBundle_1.previewBundle)({
|
|
268
|
+
entries: parsed.entries,
|
|
269
|
+
absWorkingDir: process.cwd(),
|
|
270
|
+
repoName: parsed.repoName,
|
|
271
|
+
branchName: parsed.branchName,
|
|
272
|
+
tsconfigPath: parsed.tsconfigPath,
|
|
273
|
+
quiet: parsed.json,
|
|
274
|
+
});
|
|
275
|
+
printPreviewBundleResult(result, parsed.json);
|
|
276
|
+
const hasError = result.modules.some((mod) => mod.error);
|
|
277
|
+
if (hasError) {
|
|
278
|
+
process.exit(1);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
catch (error) {
|
|
282
|
+
console.error(`\x1b[31m✗ ${error.message}\x1b[0m`);
|
|
283
|
+
process.exit(1);
|
|
284
|
+
}
|
|
285
|
+
break;
|
|
286
|
+
}
|
|
287
|
+
case "server": {
|
|
288
|
+
const server = await ensureServer();
|
|
289
|
+
registerSignalHandlers();
|
|
290
|
+
if (!server) {
|
|
291
|
+
console.log("\x1b[33mℹ Server already running in another process\x1b[0m");
|
|
292
|
+
}
|
|
293
|
+
break;
|
|
294
|
+
}
|
|
295
|
+
case "setup":
|
|
296
|
+
setupDependencies();
|
|
297
|
+
break;
|
|
298
|
+
case "help":
|
|
299
|
+
showHelp();
|
|
300
|
+
break;
|
|
301
|
+
default: {
|
|
302
|
+
await ensureServer();
|
|
303
|
+
const childProcess = (0, child_process_1.spawn)(command, rest, {
|
|
304
|
+
stdio: "inherit",
|
|
305
|
+
shell: true,
|
|
306
|
+
});
|
|
307
|
+
childProcess.on("error", (error) => {
|
|
308
|
+
console.error(`\x1b[31m✗ Failed to start process: ${error.message}\x1b[0m`);
|
|
309
|
+
void shutdown(childProcess);
|
|
310
|
+
});
|
|
311
|
+
childProcess.on("close", (code) => {
|
|
312
|
+
console.log(`\x1b[33mℹ Child process exited with code ${code}\x1b[0m`);
|
|
313
|
+
});
|
|
314
|
+
registerSignalHandlers(childProcess);
|
|
315
|
+
break;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
void main();
|
|
320
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,iDAAuE;AAEvE,4CAA8B;AAC9B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1
|
+
import type * as Babel from "@babel/core";
|
|
2
|
+
import type { CodePressPluginOptions } from "./types";
|
|
3
|
+
interface CodePressPluginState extends Babel.PluginPass {
|
|
4
|
+
file: Babel.BabelFile & {
|
|
5
|
+
encodedPath?: string;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
export declare function decode(attributeValue: string | null | undefined): string;
|
|
9
|
+
export default function codePressPlugin(babel: typeof Babel, options?: CodePressPluginOptions): Babel.PluginObj<CodePressPluginState>;
|
|
10
|
+
export {};
|