framer-export 4.3.0 → 4.3.2
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/index.js +222 -195
- package/dist/cli/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -15,7 +15,7 @@ var init_package = __esm({
|
|
|
15
15
|
"package.json"() {
|
|
16
16
|
package_default = {
|
|
17
17
|
name: "framer-export",
|
|
18
|
-
version: "4.3.
|
|
18
|
+
version: "4.3.2",
|
|
19
19
|
description: "Export any Framer, Webflow, or Wix site into a fully working local mirror. Downloads all assets, strips badges, rewrites URLs, and pretty-prints JS.",
|
|
20
20
|
type: "module",
|
|
21
21
|
main: "dist/cli/index.js",
|
|
@@ -100,8 +100,8 @@ function showBanner() {
|
|
|
100
100
|
const gold = chalk.hex("#D4A017").bold;
|
|
101
101
|
const gray = chalk.gray;
|
|
102
102
|
console.log("");
|
|
103
|
-
ASCII_ART.forEach((
|
|
104
|
-
console.log(" " + gold(
|
|
103
|
+
ASCII_ART.forEach((line) => {
|
|
104
|
+
console.log(" " + gold(line));
|
|
105
105
|
});
|
|
106
106
|
console.log("");
|
|
107
107
|
console.log(` ${gray(`v${package_default.version}`)} ${chalk.white.bold("Framer \xB7 Webflow \xB7 Wix Exporter")}
|
|
@@ -263,72 +263,45 @@ import chalk3 from "chalk";
|
|
|
263
263
|
function setCooking(spinner) {
|
|
264
264
|
_cooking = spinner;
|
|
265
265
|
}
|
|
266
|
-
function nextMsgColor() {
|
|
267
|
-
return MSG_COLORS[_msgIdx++ % MSG_COLORS.length];
|
|
268
|
-
}
|
|
269
266
|
function trunc(text, max) {
|
|
270
267
|
if (text.length <= max) return text;
|
|
271
|
-
return text.slice(0, max - 2) + "
|
|
268
|
+
return text.slice(0, max - 2) + "..";
|
|
269
|
+
}
|
|
270
|
+
function nextColor() {
|
|
271
|
+
return MSG_COLORS[_msgIdx++ % MSG_COLORS.length];
|
|
272
272
|
}
|
|
273
|
-
function output(
|
|
273
|
+
function output(line) {
|
|
274
274
|
if (_cooking) {
|
|
275
|
-
_cooking.log(
|
|
275
|
+
_cooking.log(line);
|
|
276
276
|
} else {
|
|
277
|
-
console.log(
|
|
277
|
+
console.log(line);
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
|
-
var _cooking, T,
|
|
280
|
+
var _cooking, T, MSG_COLORS, _msgIdx, log, info, warn, success;
|
|
281
281
|
var init_logger = __esm({
|
|
282
282
|
"src/logger/index.ts"() {
|
|
283
283
|
"use strict";
|
|
284
284
|
_cooking = null;
|
|
285
285
|
T = () => (/* @__PURE__ */ new Date()).toISOString().slice(11, 19);
|
|
286
|
-
TIME_COLORS = [
|
|
287
|
-
chalk3.gray,
|
|
288
|
-
chalk3.hex("#9e9e9e"),
|
|
289
|
-
chalk3.hex("#757575"),
|
|
290
|
-
chalk3.hex("#6d6d6d")
|
|
291
|
-
];
|
|
292
|
-
TAG_ROTATION = [
|
|
293
|
-
(s) => chalk3.hex("#D4A017")(s),
|
|
294
|
-
(s) => chalk3.hex("#E0A030")(s),
|
|
295
|
-
(s) => chalk3.hex("#DAA520")(s),
|
|
296
|
-
(s) => chalk3.hex("#C4953A")(s),
|
|
297
|
-
(s) => chalk3.hex("#F0C040")(s)
|
|
298
|
-
];
|
|
299
286
|
MSG_COLORS = [
|
|
300
|
-
(s) => chalk3.hex("#
|
|
301
|
-
(s) => chalk3.hex("#C8A951")(s),
|
|
302
|
-
(s) => chalk3.hex("#B8960A")(s),
|
|
287
|
+
(s) => chalk3.hex("#e8c33a")(s),
|
|
303
288
|
(s) => chalk3.hex("#d4a76a")(s),
|
|
304
|
-
(s) => chalk3.hex("#
|
|
305
|
-
(s) => chalk3.hex("#
|
|
289
|
+
(s) => chalk3.hex("#c8a040")(s),
|
|
290
|
+
(s) => chalk3.hex("#e0b040")(s),
|
|
291
|
+
(s) => chalk3.hex("#dab660")(s),
|
|
292
|
+
(s) => chalk3.hex("#c4953a")(s),
|
|
293
|
+
(s) => chalk3.hex("#daa520")(s),
|
|
294
|
+
(s) => chalk3.hex("#b8960a")(s)
|
|
306
295
|
];
|
|
307
296
|
_msgIdx = 0;
|
|
308
|
-
log = (m) => {
|
|
309
|
-
|
|
310
|
-
const t = timeColor(`[${T()}]`);
|
|
311
|
-
const tag = TAG_ROTATION[0]("[LOG]");
|
|
312
|
-
const msg = nextMsgColor()(trunc(m, 120));
|
|
313
|
-
output(`${t} ${tag} ${msg}`);
|
|
314
|
-
};
|
|
315
|
-
info = (m) => {
|
|
316
|
-
const timeColor = chalk3.gray;
|
|
317
|
-
const t = timeColor(`[${T()}]`);
|
|
318
|
-
const tag = chalk3.hex("#E8A317")("[INFO]");
|
|
319
|
-
output(`${t} ${tag} ${chalk3.bold(trunc(m, 120))}`);
|
|
320
|
-
};
|
|
297
|
+
log = (m) => output(`${chalk3.hex("#6d6d6d")(`[${T()}]`)} ${chalk3.hex("#D4A017")("[LOG]")} ${nextColor()(trunc(m, 120))}`);
|
|
298
|
+
info = (m) => output(`${chalk3.hex("#757575")(`[${T()}]`)} ${chalk3.hex("#E8A317").bold("[INFO]")} ${chalk3.bold(trunc(m, 120))}`);
|
|
321
299
|
warn = (m) => {
|
|
322
|
-
const
|
|
323
|
-
if (_cooking) _cooking.log(
|
|
324
|
-
else console.warn(
|
|
325
|
-
};
|
|
326
|
-
success = (m) => {
|
|
327
|
-
const t = chalk3.hex("#8a8a8a")(`[${T()}]`);
|
|
328
|
-
const tag = chalk3.greenBright("[OK]");
|
|
329
|
-
const msg = chalk3.green(trunc(m, 120));
|
|
330
|
-
output(`${t} ${tag} ${msg}`);
|
|
300
|
+
const line = `${chalk3.hex("#8a8a8a")(`[${T()}]`)} ${chalk3.hex("#CC7722").bold("[WARN]")} ${chalk3.hex("#CC7722")(trunc(m, 120))}`;
|
|
301
|
+
if (_cooking) _cooking.log(line);
|
|
302
|
+
else console.warn(line);
|
|
331
303
|
};
|
|
304
|
+
success = (m) => output(`${chalk3.hex("#7a7a7a")(`[${T()}]`)} ${chalk3.greenBright("[OK]")} ${chalk3.green(trunc(m, 120))}`);
|
|
332
305
|
}
|
|
333
306
|
});
|
|
334
307
|
|
|
@@ -1180,16 +1153,64 @@ var init_output = __esm({
|
|
|
1180
1153
|
}
|
|
1181
1154
|
});
|
|
1182
1155
|
|
|
1156
|
+
// src/cli/box.ts
|
|
1157
|
+
import chalk4 from "chalk";
|
|
1158
|
+
function maxWidth() {
|
|
1159
|
+
return Math.min(process.stdout.columns || 80, 62);
|
|
1160
|
+
}
|
|
1161
|
+
function padRight(text, w) {
|
|
1162
|
+
const visible = stripAnsi(text).length;
|
|
1163
|
+
if (visible >= w) return text;
|
|
1164
|
+
return text + " ".repeat(w - visible);
|
|
1165
|
+
}
|
|
1166
|
+
function stripAnsi(s) {
|
|
1167
|
+
return s.replace(/\x1B\[[0-9;]*[a-zA-Z]/g, "");
|
|
1168
|
+
}
|
|
1169
|
+
function boxTop(w) {
|
|
1170
|
+
const inner = w - 4;
|
|
1171
|
+
return " " + B("\u2554\u2550") + B("\u2550".repeat(inner)) + B("\u2550\u2557");
|
|
1172
|
+
}
|
|
1173
|
+
function boxBot(w) {
|
|
1174
|
+
const inner = w - 4;
|
|
1175
|
+
return " " + B("\u255A\u2550") + B("\u2550".repeat(inner)) + B("\u2550\u255D");
|
|
1176
|
+
}
|
|
1177
|
+
function boxLine(w, text) {
|
|
1178
|
+
const inner = w - 4;
|
|
1179
|
+
const padded = padRight(text, inner);
|
|
1180
|
+
return " " + B("\u2551 ") + padded + B(" \u2551");
|
|
1181
|
+
}
|
|
1182
|
+
function boxSep(w) {
|
|
1183
|
+
const inner = w - 4;
|
|
1184
|
+
return " " + B("\u2560\u2550") + B("\u2550".repeat(inner)) + B("\u2550\u2563");
|
|
1185
|
+
}
|
|
1186
|
+
function boxRow(w, label, value) {
|
|
1187
|
+
const inner = w - 4;
|
|
1188
|
+
const labelPlain = stripAnsi(chalk4.bold(label));
|
|
1189
|
+
const visible = labelPlain.length + 1 + value.length;
|
|
1190
|
+
if (visible > inner) {
|
|
1191
|
+
const avail = inner - labelPlain.length - 2;
|
|
1192
|
+
const truncated = value.length > avail ? value.slice(0, avail - 1) + ".." : value;
|
|
1193
|
+
return " " + G("\u2551 ") + chalk4.bold(label) + ": " + chalk4.yellow(truncated) + " ".repeat(Math.max(0, inner - labelPlain.length - 1 - truncated.length)) + G(" \u2551");
|
|
1194
|
+
}
|
|
1195
|
+
const right = inner - labelPlain.length - 1 - value.length;
|
|
1196
|
+
return " " + G("\u2551 ") + chalk4.bold(label) + ": " + chalk4.yellow(value) + " ".repeat(right) + G(" \u2551");
|
|
1197
|
+
}
|
|
1198
|
+
var B, G;
|
|
1199
|
+
var init_box = __esm({
|
|
1200
|
+
"src/cli/box.ts"() {
|
|
1201
|
+
"use strict";
|
|
1202
|
+
B = chalk4.hex("#8B6914");
|
|
1203
|
+
G = chalk4.hex("#C4953A");
|
|
1204
|
+
}
|
|
1205
|
+
});
|
|
1206
|
+
|
|
1183
1207
|
// src/exporter/summary.ts
|
|
1184
1208
|
import fs3 from "fs/promises";
|
|
1185
1209
|
import path4 from "path";
|
|
1186
|
-
import
|
|
1187
|
-
function getWidth2() {
|
|
1188
|
-
return process.stdout.columns || 80;
|
|
1189
|
-
}
|
|
1210
|
+
import chalk5 from "chalk";
|
|
1190
1211
|
async function printSummary(exporter) {
|
|
1191
|
-
const
|
|
1192
|
-
const isSmall =
|
|
1212
|
+
const w = maxWidth();
|
|
1213
|
+
const isSmall = w < 50;
|
|
1193
1214
|
const count = async (d) => {
|
|
1194
1215
|
try {
|
|
1195
1216
|
return (await fs3.readdir(path4.join(exporter.outDir, d))).length;
|
|
@@ -1197,7 +1218,7 @@ async function printSummary(exporter) {
|
|
|
1197
1218
|
return 0;
|
|
1198
1219
|
}
|
|
1199
1220
|
};
|
|
1200
|
-
const [imgs, fonts, videos, misc, scripts, vendor, styles, data] = await Promise.all([
|
|
1221
|
+
const [imgs, fonts, videos, misc, scripts, vendor, styles, data, subpages] = await Promise.all([
|
|
1201
1222
|
count("assets/images"),
|
|
1202
1223
|
count("assets/fonts"),
|
|
1203
1224
|
count("assets/videos"),
|
|
@@ -1205,62 +1226,81 @@ async function printSummary(exporter) {
|
|
|
1205
1226
|
count("scripts/modules"),
|
|
1206
1227
|
count("scripts/vendor"),
|
|
1207
1228
|
count("styles"),
|
|
1208
|
-
count("data")
|
|
1229
|
+
count("data"),
|
|
1230
|
+
count("subpages")
|
|
1209
1231
|
]);
|
|
1210
|
-
const
|
|
1232
|
+
const G2 = chalk5.hex("#D4A017");
|
|
1233
|
+
const G22 = chalk5.hex("#DAA520");
|
|
1234
|
+
const C2 = chalk5.hex("#E0B040");
|
|
1235
|
+
const Y = chalk5.yellow;
|
|
1236
|
+
const O = chalk5.hex("#CC7722");
|
|
1237
|
+
const Br = chalk5.hex("#B8860B");
|
|
1238
|
+
const Gr = chalk5.gray;
|
|
1239
|
+
const Gn = chalk5.green;
|
|
1240
|
+
const entries = [
|
|
1241
|
+
["styles/", styles, "CSS", G2],
|
|
1242
|
+
["scripts/vendor/", vendor, "JS vendor", G22],
|
|
1243
|
+
["scripts/modules/", scripts, "JS modules", C2],
|
|
1244
|
+
["assets/images/", imgs, "images", Y],
|
|
1245
|
+
["assets/videos/", videos, "videos", O],
|
|
1246
|
+
["assets/fonts/", fonts, "fonts", Br],
|
|
1247
|
+
["assets/misc/", misc, "misc", Gr],
|
|
1248
|
+
["data/", data, "data", Gr],
|
|
1249
|
+
["subpages/", subpages, "pages", Gn]
|
|
1250
|
+
];
|
|
1211
1251
|
console.log("");
|
|
1212
1252
|
if (!isSmall) {
|
|
1213
|
-
console.log(
|
|
1214
|
-
console.log(
|
|
1215
|
-
console.log(
|
|
1253
|
+
console.log(boxTop(w));
|
|
1254
|
+
console.log(boxLine(w, chalk5.bold.white(" Export Summary")));
|
|
1255
|
+
console.log(boxSep(w));
|
|
1216
1256
|
} else {
|
|
1217
|
-
console.log(
|
|
1218
|
-
}
|
|
1219
|
-
const
|
|
1220
|
-
if (
|
|
1221
|
-
const
|
|
1222
|
-
const
|
|
1257
|
+
console.log(chalk5.bold.white(" Export Summary:"));
|
|
1258
|
+
}
|
|
1259
|
+
for (const [label, cnt, type, color] of entries) {
|
|
1260
|
+
if (cnt === 0) continue;
|
|
1261
|
+
const inner = w - 4;
|
|
1262
|
+
const l = label.padEnd(16);
|
|
1263
|
+
const c = String(cnt).padStart(3);
|
|
1264
|
+
const rowText = `${color(l)}${chalk5.white(c)} ${chalk5.gray(type)}`;
|
|
1265
|
+
const visible = 16 + 3 + 2 + type.length;
|
|
1266
|
+
const pad = Math.max(0, inner - visible);
|
|
1223
1267
|
if (isSmall) {
|
|
1224
|
-
console.log(` ${
|
|
1268
|
+
console.log(` ${color(label)} ${chalk5.white(String(cnt))} ${chalk5.gray(type)}`);
|
|
1225
1269
|
} else {
|
|
1226
|
-
console.log(
|
|
1270
|
+
console.log(" " + chalk5.hex("#C4953A")("\u2551 ") + rowText + " ".repeat(pad) + chalk5.hex("#C4953A")(" \u2551"));
|
|
1227
1271
|
}
|
|
1228
|
-
}
|
|
1229
|
-
row("styles/", styles, "CSS files");
|
|
1230
|
-
row("scripts/vendor/", vendor, "JS modules");
|
|
1231
|
-
row("scripts/modules/", scripts, "components");
|
|
1232
|
-
row("assets/images/", imgs, "images");
|
|
1233
|
-
row("assets/videos/", videos, "videos");
|
|
1234
|
-
row("assets/fonts/", fonts, "fonts");
|
|
1235
|
-
row("assets/misc/", misc, "misc files");
|
|
1236
|
-
row("data/", data, "data files");
|
|
1272
|
+
}
|
|
1237
1273
|
if (!isSmall) {
|
|
1238
|
-
console.log(
|
|
1274
|
+
console.log(boxBot(w));
|
|
1239
1275
|
}
|
|
1240
1276
|
console.log("");
|
|
1241
|
-
const
|
|
1277
|
+
const cdCmd = "cd " + path4.basename(exporter.outDir) + " && node serve.cjs";
|
|
1242
1278
|
if (!isSmall) {
|
|
1243
|
-
console.log(
|
|
1244
|
-
console.log(
|
|
1245
|
-
console.log(
|
|
1246
|
-
|
|
1247
|
-
|
|
1279
|
+
console.log(boxTop(w));
|
|
1280
|
+
console.log(boxLine(w, chalk5.bold.white(" To serve locally")));
|
|
1281
|
+
console.log(boxSep(w));
|
|
1282
|
+
const inner = w - 6;
|
|
1283
|
+
const cmdLen = cdCmd.length;
|
|
1284
|
+
const pad = Math.max(0, inner - cmdLen);
|
|
1285
|
+
console.log(" " + chalk5.hex("#C4953A")("\u2551 ") + G2(cdCmd) + " ".repeat(pad) + chalk5.hex("#9e9e9e")(" \u{1F5D0}") + chalk5.hex("#C4953A")(" \u2551"));
|
|
1286
|
+
console.log(boxBot(w));
|
|
1248
1287
|
} else {
|
|
1249
|
-
console.log(
|
|
1250
|
-
console.log(` ${
|
|
1288
|
+
console.log(chalk5.bold.white(" To serve locally:"));
|
|
1289
|
+
console.log(` ${G2(cdCmd)}`);
|
|
1251
1290
|
}
|
|
1252
1291
|
console.log("");
|
|
1253
|
-
console.log(
|
|
1292
|
+
console.log(chalk5.gray(" NOTE: Must be served via HTTP for JS modules to work."));
|
|
1254
1293
|
console.log("");
|
|
1255
1294
|
}
|
|
1256
1295
|
var init_summary = __esm({
|
|
1257
1296
|
"src/exporter/summary.ts"() {
|
|
1258
1297
|
"use strict";
|
|
1298
|
+
init_box();
|
|
1259
1299
|
}
|
|
1260
1300
|
});
|
|
1261
1301
|
|
|
1262
1302
|
// src/cli/cooking.ts
|
|
1263
|
-
import
|
|
1303
|
+
import chalk6 from "chalk";
|
|
1264
1304
|
var SHINE_WIDTH, FRAME_INTERVAL, SPINNER_FRAMES, PALETTE, CookingSpinner;
|
|
1265
1305
|
var init_cooking = __esm({
|
|
1266
1306
|
"src/cli/cooking.ts"() {
|
|
@@ -1269,14 +1309,14 @@ var init_cooking = __esm({
|
|
|
1269
1309
|
FRAME_INTERVAL = 140;
|
|
1270
1310
|
SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
1271
1311
|
PALETTE = [
|
|
1272
|
-
(s) =>
|
|
1273
|
-
(s) =>
|
|
1274
|
-
(s) =>
|
|
1275
|
-
(s) =>
|
|
1276
|
-
(s) =>
|
|
1277
|
-
(s) =>
|
|
1278
|
-
(s) =>
|
|
1279
|
-
(s) =>
|
|
1312
|
+
(s) => chalk6.hex("#D4A017")(s),
|
|
1313
|
+
(s) => chalk6.hex("#E8A317")(s),
|
|
1314
|
+
(s) => chalk6.hex("#DAA520")(s),
|
|
1315
|
+
(s) => chalk6.hex("#F0C040")(s),
|
|
1316
|
+
(s) => chalk6.hex("#C4953A")(s),
|
|
1317
|
+
(s) => chalk6.hex("#E6B83C")(s),
|
|
1318
|
+
(s) => chalk6.hex("#C8A951")(s),
|
|
1319
|
+
(s) => chalk6.hex("#D9B44D")(s)
|
|
1280
1320
|
];
|
|
1281
1321
|
CookingSpinner = class {
|
|
1282
1322
|
interval = null;
|
|
@@ -1334,11 +1374,11 @@ var init_cooking = __esm({
|
|
|
1334
1374
|
const dotPhase = Math.floor(this.frame / 3) % 4;
|
|
1335
1375
|
const dotStr = dotPhase === 0 ? " " : dotPhase === 1 ? ". " : dotPhase === 2 ? ".. " : "...";
|
|
1336
1376
|
const shimmer = this.renderShimmer("Cooking");
|
|
1337
|
-
const spinnerChar =
|
|
1377
|
+
const spinnerChar = chalk6.hex("#F0C040")(spinner);
|
|
1338
1378
|
const barLen = 12;
|
|
1339
1379
|
const barPos = this.bar % (barLen * 2);
|
|
1340
1380
|
const barStr = this.renderBar(barLen, barPos);
|
|
1341
|
-
const phaseStr = this.phase ? ` ${
|
|
1381
|
+
const phaseStr = this.phase ? ` ${chalk6.gray(this.limitLen(this.phase, 38))}` : "";
|
|
1342
1382
|
process.stdout.write(
|
|
1343
1383
|
`\r\x1B[2K ${spinnerChar} ${shimmer} ${paletteFn(dotStr)} ${barStr}${phaseStr}`
|
|
1344
1384
|
);
|
|
@@ -1351,9 +1391,9 @@ var init_cooking = __esm({
|
|
|
1351
1391
|
if (dist < SHINE_WIDTH) {
|
|
1352
1392
|
const t = 1 - dist / SHINE_WIDTH;
|
|
1353
1393
|
const g = Math.floor(160 + t * 95);
|
|
1354
|
-
result +=
|
|
1394
|
+
result += chalk6.rgb(g, g, g)(text[i]);
|
|
1355
1395
|
} else {
|
|
1356
|
-
result +=
|
|
1396
|
+
result += chalk6.rgb(160, 160, 160)(text[i]);
|
|
1357
1397
|
}
|
|
1358
1398
|
}
|
|
1359
1399
|
return result;
|
|
@@ -1367,11 +1407,11 @@ var init_cooking = __esm({
|
|
|
1367
1407
|
const r = Math.floor(200 + t * 55);
|
|
1368
1408
|
const g = Math.floor(160 + t * 50);
|
|
1369
1409
|
const b = Math.floor(20 + t * 30);
|
|
1370
|
-
s +=
|
|
1410
|
+
s += chalk6.rgb(r, g, b)("\u258C");
|
|
1371
1411
|
} else if (dist < 6) {
|
|
1372
|
-
s +=
|
|
1412
|
+
s += chalk6.rgb(140, 100, 20)("\u258C");
|
|
1373
1413
|
} else {
|
|
1374
|
-
s +=
|
|
1414
|
+
s += chalk6.rgb(50, 35, 10)(" ");
|
|
1375
1415
|
}
|
|
1376
1416
|
}
|
|
1377
1417
|
return `[${s}]`;
|
|
@@ -1392,7 +1432,7 @@ __export(exporter_exports, {
|
|
|
1392
1432
|
});
|
|
1393
1433
|
import fs4 from "fs/promises";
|
|
1394
1434
|
import path5 from "path";
|
|
1395
|
-
import
|
|
1435
|
+
import chalk7 from "chalk";
|
|
1396
1436
|
function deriveOutputName(url, platformName) {
|
|
1397
1437
|
try {
|
|
1398
1438
|
const parsed = new URL(url);
|
|
@@ -1451,12 +1491,12 @@ var init_exporter = __esm({
|
|
|
1451
1491
|
}
|
|
1452
1492
|
}
|
|
1453
1493
|
async run(includeSubpages = false) {
|
|
1454
|
-
console.log(
|
|
1455
|
-
info("Source : " +
|
|
1456
|
-
info("Output : " +
|
|
1457
|
-
info("Platform : " +
|
|
1494
|
+
console.log(chalk7.bold.hex("#D4A017")("\n Cooksite v4 - Full Mirror & Clean Export\n"));
|
|
1495
|
+
info("Source : " + chalk7.underline(this.siteUrl));
|
|
1496
|
+
info("Output : " + chalk7.yellow(this.outDir));
|
|
1497
|
+
info("Platform : " + chalk7.hex("#D4A017")(this.platform.displayName));
|
|
1458
1498
|
if (includeSubpages) {
|
|
1459
|
-
info("Subpages : " +
|
|
1499
|
+
info("Subpages : " + chalk7.green("enabled"));
|
|
1460
1500
|
}
|
|
1461
1501
|
console.log("");
|
|
1462
1502
|
this.cooking = new CookingSpinner();
|
|
@@ -1484,12 +1524,12 @@ var init_exporter = __esm({
|
|
|
1484
1524
|
this.ssrHTML = buf.toString("utf-8");
|
|
1485
1525
|
success("SSR HTML fetched (" + (this.ssrHTML.length / 1024).toFixed(1) + " KB)");
|
|
1486
1526
|
} catch (e) {
|
|
1487
|
-
log(
|
|
1527
|
+
log(chalk7.red("Could not fetch SSR HTML: " + e.message));
|
|
1488
1528
|
}
|
|
1489
1529
|
const htmlDetected = detectPlatform(this.siteUrl, this.ssrHTML);
|
|
1490
1530
|
if (htmlDetected.name !== this.platform.name) {
|
|
1491
1531
|
this.platform = htmlDetected;
|
|
1492
|
-
log("Platform refined: " +
|
|
1532
|
+
log("Platform refined: " + chalk7.hex("#D4A017")(this.platform.displayName) + " (from HTML analysis)");
|
|
1493
1533
|
}
|
|
1494
1534
|
await launchAndCapture(this);
|
|
1495
1535
|
if (includeSubpages && this.page) {
|
|
@@ -1571,7 +1611,7 @@ var init_exporter = __esm({
|
|
|
1571
1611
|
// src/cli/select.ts
|
|
1572
1612
|
import readline from "readline";
|
|
1573
1613
|
import { stdin, stdout } from "process";
|
|
1574
|
-
import
|
|
1614
|
+
import chalk8 from "chalk";
|
|
1575
1615
|
async function select(question, options, defaultIndex = 0) {
|
|
1576
1616
|
return new Promise((resolve) => {
|
|
1577
1617
|
let selected = defaultIndex;
|
|
@@ -1580,12 +1620,12 @@ async function select(question, options, defaultIndex = 0) {
|
|
|
1580
1620
|
stdout.write(`\x1B[${options.length + 1}A`);
|
|
1581
1621
|
stdout.write("\x1B[J");
|
|
1582
1622
|
}
|
|
1583
|
-
console.log(` ${
|
|
1623
|
+
console.log(` ${chalk8.hex("#D4A017")("?")} ${chalk8.white.bold(question)}`);
|
|
1584
1624
|
for (let i = 0; i < options.length; i++) {
|
|
1585
1625
|
if (i === selected) {
|
|
1586
|
-
console.log(` ${
|
|
1626
|
+
console.log(` ${chalk8.hex("#D4A017")(">")} ${chalk8.white.bold(options[i].label)}`);
|
|
1587
1627
|
} else {
|
|
1588
|
-
console.log(` ${
|
|
1628
|
+
console.log(` ${chalk8.gray(options[i].label)}`);
|
|
1589
1629
|
}
|
|
1590
1630
|
}
|
|
1591
1631
|
};
|
|
@@ -1607,7 +1647,7 @@ async function select(question, options, defaultIndex = 0) {
|
|
|
1607
1647
|
stdin.pause();
|
|
1608
1648
|
stdout.write(`\x1B[${options.length + 1}A`);
|
|
1609
1649
|
stdout.write("\x1B[J");
|
|
1610
|
-
console.log(` ${
|
|
1650
|
+
console.log(` ${chalk8.green("\u2713")} ${chalk8.white.bold(question)} ${chalk8.hex("#D4A017")(options[selected].label)}
|
|
1611
1651
|
`);
|
|
1612
1652
|
resolve(options[selected].value);
|
|
1613
1653
|
} else if (key.ctrl && key.name === "c" || key.name === "escape") {
|
|
@@ -1635,46 +1675,27 @@ import readline2 from "readline/promises";
|
|
|
1635
1675
|
import { stdin as stdin2, stdout as stdout2 } from "process";
|
|
1636
1676
|
import path6 from "path";
|
|
1637
1677
|
import { URL as URL4 } from "url";
|
|
1638
|
-
import
|
|
1639
|
-
function getWidth3() {
|
|
1640
|
-
return process.stdout.columns || 80;
|
|
1641
|
-
}
|
|
1678
|
+
import chalk9 from "chalk";
|
|
1642
1679
|
function drawHeader(title) {
|
|
1643
|
-
const
|
|
1644
|
-
|
|
1645
|
-
const magenta = chalk8.hex("#D4A017");
|
|
1646
|
-
const boldWhite = chalk8.bold.white;
|
|
1647
|
-
if (isSmall) {
|
|
1680
|
+
const w = maxWidth();
|
|
1681
|
+
if (w < 50) {
|
|
1648
1682
|
console.log(`
|
|
1649
|
-
${
|
|
1683
|
+
${chalk9.hex("#D4A017")("\u25CF")} ${chalk9.bold.white(title)}`);
|
|
1650
1684
|
return;
|
|
1651
1685
|
}
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
console.log(magenta(" \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510"));
|
|
1656
|
-
console.log(magenta(" \u2502") + boldWhite(" " + title) + rightPad + magenta("\u2502"));
|
|
1657
|
-
console.log(magenta(" \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518"));
|
|
1686
|
+
console.log(boxTop(w));
|
|
1687
|
+
console.log(boxLine(w, chalk9.bold.white(" " + title)));
|
|
1688
|
+
console.log(boxBot(w));
|
|
1658
1689
|
console.log("");
|
|
1659
1690
|
}
|
|
1660
|
-
function line(label, value) {
|
|
1661
|
-
const width = getWidth3();
|
|
1662
|
-
const isSmall = width < 50;
|
|
1663
|
-
const magenta = chalk8.hex("#D4A017");
|
|
1664
|
-
if (isSmall) {
|
|
1665
|
-
console.log(` ${chalk8.bold(label)}: ${chalk8.yellow(value)}`);
|
|
1666
|
-
return;
|
|
1667
|
-
}
|
|
1668
|
-
console.log(` ${magenta("\u2502")} ${chalk8.bold(label.padEnd(14))} ${chalk8.yellow(value)}`);
|
|
1669
|
-
}
|
|
1670
1691
|
async function runSetup(legacyMode = false) {
|
|
1671
1692
|
showBanner();
|
|
1672
|
-
console.log(
|
|
1673
|
-
console.log(
|
|
1693
|
+
console.log(chalk9.bold.white(" Welcome to Framer Export setup.\n"));
|
|
1694
|
+
console.log(chalk9.gray(" Supports Framer, Webflow, and Wix sites.\n"));
|
|
1674
1695
|
const rl = readline2.createInterface({ input: stdin2, output: stdout2 });
|
|
1675
1696
|
const ask = async (question, defaultVal) => {
|
|
1676
|
-
const suffix = defaultVal ?
|
|
1677
|
-
const prompt = ` ${
|
|
1697
|
+
const suffix = defaultVal ? chalk9.gray(` (${defaultVal})`) : "";
|
|
1698
|
+
const prompt = ` ${chalk9.hex("#D4A017")("?")} ${chalk9.white.bold(question)}${suffix} ${chalk9.gray(">")} `;
|
|
1678
1699
|
const answer = await rl.question(prompt);
|
|
1679
1700
|
return answer.trim() || defaultVal || "";
|
|
1680
1701
|
};
|
|
@@ -1686,42 +1707,42 @@ async function runSetup(legacyMode = false) {
|
|
|
1686
1707
|
new URL4(input);
|
|
1687
1708
|
siteUrl = input;
|
|
1688
1709
|
} catch {
|
|
1689
|
-
console.log(` ${
|
|
1710
|
+
console.log(` ${chalk9.red("\u2717")} ${chalk9.red("Invalid URL. Enter a valid URL (https://...)")}
|
|
1690
1711
|
`);
|
|
1691
1712
|
}
|
|
1692
1713
|
}
|
|
1693
|
-
console.log(` ${
|
|
1714
|
+
console.log(` ${chalk9.green("\u2713")} ${chalk9.green("URL:")} ${chalk9.underline(siteUrl)}
|
|
1694
1715
|
`);
|
|
1695
1716
|
drawHeader("Step 2 : Platform");
|
|
1696
1717
|
const detected = detectPlatform(siteUrl);
|
|
1697
1718
|
let platformName;
|
|
1698
1719
|
if (legacyMode) {
|
|
1699
|
-
console.log(` ${
|
|
1720
|
+
console.log(` ${chalk9.blue("i")} Auto-detected: ${chalk9.hex("#D4A017")(detected.displayName)}`);
|
|
1700
1721
|
const platformInput = await ask("Platform (framer/webflow/wix)", detected.name);
|
|
1701
1722
|
platformName = ["framer", "webflow", "wix"].includes(platformInput) ? platformInput : detected.name;
|
|
1702
|
-
console.log(` ${
|
|
1723
|
+
console.log(` ${chalk9.green("\u2713")} ${chalk9.green("Platform:")} ${chalk9.hex("#D4A017")(platformName)}
|
|
1703
1724
|
`);
|
|
1704
1725
|
} else {
|
|
1705
1726
|
rl.close();
|
|
1706
1727
|
const platforms = [
|
|
1707
|
-
{ label: `Framer${detected.name === "framer" ?
|
|
1708
|
-
{ label: `Webflow${detected.name === "webflow" ?
|
|
1709
|
-
{ label: `Wix${detected.name === "wix" ?
|
|
1728
|
+
{ label: `Framer${detected.name === "framer" ? chalk9.gray(" (detected)") : ""}`, value: "framer" },
|
|
1729
|
+
{ label: `Webflow${detected.name === "webflow" ? chalk9.gray(" (detected)") : ""}`, value: "webflow" },
|
|
1730
|
+
{ label: `Wix${detected.name === "wix" ? chalk9.gray(" (detected)") : ""}`, value: "wix" }
|
|
1710
1731
|
];
|
|
1711
1732
|
const defaultIdx = ["framer", "webflow", "wix"].indexOf(detected.name);
|
|
1712
1733
|
platformName = await select("Select platform", platforms, Math.max(0, defaultIdx));
|
|
1713
1734
|
}
|
|
1714
1735
|
const rl2 = legacyMode ? rl : readline2.createInterface({ input: stdin2, output: stdout2 });
|
|
1715
1736
|
const ask2 = async (question, defaultVal) => {
|
|
1716
|
-
const suffix = defaultVal ?
|
|
1717
|
-
const prompt = ` ${
|
|
1737
|
+
const suffix = defaultVal ? chalk9.gray(` (${defaultVal})`) : "";
|
|
1738
|
+
const prompt = ` ${chalk9.hex("#D4A017")("?")} ${chalk9.white.bold(question)}${suffix} ${chalk9.gray(">")} `;
|
|
1718
1739
|
const answer = await rl2.question(prompt);
|
|
1719
1740
|
return answer.trim() || defaultVal || "";
|
|
1720
1741
|
};
|
|
1721
1742
|
const derivedName = deriveOutputName(siteUrl, platformName);
|
|
1722
1743
|
drawHeader("Step 3 : Output Directory");
|
|
1723
1744
|
const outDir = await ask2("Output directory", "./" + derivedName);
|
|
1724
|
-
console.log(` ${
|
|
1745
|
+
console.log(` ${chalk9.green("\u2713")} ${chalk9.green("Output:")} ${chalk9.yellow(outDir)}
|
|
1725
1746
|
`);
|
|
1726
1747
|
drawHeader("Step 4 : Options");
|
|
1727
1748
|
let prettyPrint;
|
|
@@ -1730,15 +1751,15 @@ async function runSetup(legacyMode = false) {
|
|
|
1730
1751
|
if (legacyMode) {
|
|
1731
1752
|
const prettyAnswer = await ask2("Pretty-print JS files? (y/n)", "y");
|
|
1732
1753
|
prettyPrint = prettyAnswer.toLowerCase().startsWith("y");
|
|
1733
|
-
console.log(` ${
|
|
1754
|
+
console.log(` ${chalk9.green("\u2713")} Pretty-print: ${prettyPrint ? chalk9.green("yes") : chalk9.red("no")}
|
|
1734
1755
|
`);
|
|
1735
1756
|
const subpagesAnswer = await ask2("Export sub-pages? (y/n)", "n");
|
|
1736
1757
|
includeSubpages = subpagesAnswer.toLowerCase().startsWith("y");
|
|
1737
|
-
console.log(` ${
|
|
1758
|
+
console.log(` ${chalk9.green("\u2713")} Sub-pages: ${includeSubpages ? chalk9.green("yes") : chalk9.red("no")}
|
|
1738
1759
|
`);
|
|
1739
1760
|
const concurrencyAnswer = await ask2("Download concurrency", "12");
|
|
1740
1761
|
concurrency = parseInt(concurrencyAnswer, 10) || 12;
|
|
1741
|
-
console.log(` ${
|
|
1762
|
+
console.log(` ${chalk9.green("\u2713")} Concurrency: ${chalk9.yellow(String(concurrency))}
|
|
1742
1763
|
`);
|
|
1743
1764
|
} else {
|
|
1744
1765
|
rl2.close();
|
|
@@ -1759,24 +1780,29 @@ async function runSetup(legacyMode = false) {
|
|
|
1759
1780
|
], 1);
|
|
1760
1781
|
concurrency = parseInt(concurrencyVal, 10);
|
|
1761
1782
|
}
|
|
1783
|
+
const w = maxWidth();
|
|
1784
|
+
const isSmall = w < 50;
|
|
1785
|
+
const G2 = chalk9.hex("#C4953A");
|
|
1786
|
+
const B2 = chalk9.hex("#8B6914");
|
|
1762
1787
|
console.log("");
|
|
1763
|
-
const width = getWidth3();
|
|
1764
|
-
const isSmall = width < 50;
|
|
1765
1788
|
if (!isSmall) {
|
|
1766
|
-
console.log(
|
|
1767
|
-
console.log(
|
|
1768
|
-
console.log(chalk8.hex("#D4A017")(" \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524"));
|
|
1789
|
+
console.log(boxTop(w));
|
|
1790
|
+
console.log(boxLine(w, chalk9.bold.white(" Summary")));
|
|
1769
1791
|
} else {
|
|
1770
|
-
console.log(
|
|
1771
|
-
}
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1792
|
+
console.log(chalk9.bold.white(" Summary:"));
|
|
1793
|
+
}
|
|
1794
|
+
for (const [label, value] of [
|
|
1795
|
+
["URL", siteUrl],
|
|
1796
|
+
["Platform", platformName],
|
|
1797
|
+
["Output", path6.resolve(outDir)],
|
|
1798
|
+
["Pretty-print", prettyPrint ? "yes" : "no"],
|
|
1799
|
+
["Sub-pages", includeSubpages ? "yes" : "no"],
|
|
1800
|
+
["Concurrency", String(concurrency)]
|
|
1801
|
+
]) {
|
|
1802
|
+
console.log(boxRow(w, label, value));
|
|
1803
|
+
}
|
|
1778
1804
|
if (!isSmall) {
|
|
1779
|
-
console.log(
|
|
1805
|
+
console.log(boxBot(w));
|
|
1780
1806
|
}
|
|
1781
1807
|
console.log("");
|
|
1782
1808
|
let startExport;
|
|
@@ -1793,7 +1819,7 @@ async function runSetup(legacyMode = false) {
|
|
|
1793
1819
|
}
|
|
1794
1820
|
if (!startExport) {
|
|
1795
1821
|
console.log(`
|
|
1796
|
-
${
|
|
1822
|
+
${chalk9.yellow("Export cancelled.")}
|
|
1797
1823
|
`);
|
|
1798
1824
|
return;
|
|
1799
1825
|
}
|
|
@@ -1811,6 +1837,7 @@ var init_setup = __esm({
|
|
|
1811
1837
|
init_exporter();
|
|
1812
1838
|
init_platforms();
|
|
1813
1839
|
init_select();
|
|
1840
|
+
init_box();
|
|
1814
1841
|
}
|
|
1815
1842
|
});
|
|
1816
1843
|
|
|
@@ -1917,28 +1944,28 @@ async function main() {
|
|
|
1917
1944
|
process.exit(0);
|
|
1918
1945
|
}
|
|
1919
1946
|
if (args.includes("--about")) {
|
|
1920
|
-
const
|
|
1947
|
+
const chalk10 = (await import("chalk")).default;
|
|
1921
1948
|
showBanner();
|
|
1922
|
-
console.log(` ${
|
|
1923
|
-
console.log(` ${
|
|
1949
|
+
console.log(` ${chalk10.white.bold("Framer Export")} ${chalk10.gray(`v${package_default.version}`)}`);
|
|
1950
|
+
console.log(` ${chalk10.white(package_default.description)}
|
|
1924
1951
|
`);
|
|
1925
|
-
console.log(` ${
|
|
1926
|
-
console.log(` ${
|
|
1927
|
-
console.log(` ${
|
|
1928
|
-
console.log(` ${
|
|
1929
|
-
console.log(` ${
|
|
1930
|
-
console.log(` ${
|
|
1952
|
+
console.log(` ${chalk10.white.bold("Author")} ${chalk10.hex("#D4A017")("Dany (danbenba)")}`);
|
|
1953
|
+
console.log(` ${chalk10.white.bold("Portfolio")} ${chalk10.underline.hex("#D4A017")("https://github.com/danbenba")}`);
|
|
1954
|
+
console.log(` ${chalk10.white.bold("GitHub")} ${chalk10.underline.hex("#D4A017")(package_default.repository.url.replace("git+", "").replace(".git", ""))}`);
|
|
1955
|
+
console.log(` ${chalk10.white.bold("npm")} ${chalk10.underline.hex("#D4A017")(`https://www.npmjs.com/package/${package_default.name}`)}`);
|
|
1956
|
+
console.log(` ${chalk10.white.bold("License")} ${chalk10.green(package_default.license)}`);
|
|
1957
|
+
console.log(` ${chalk10.white.bold("Node")} ${chalk10.gray(`>=${package_default.engines.node}`)}`);
|
|
1931
1958
|
console.log("");
|
|
1932
1959
|
process.exit(0);
|
|
1933
1960
|
}
|
|
1934
1961
|
checkForUpdates(VERSION).then((latest) => {
|
|
1935
1962
|
if (!latest) return;
|
|
1936
|
-
import("chalk").then((
|
|
1963
|
+
import("chalk").then((chalk10) => {
|
|
1937
1964
|
console.log("");
|
|
1938
1965
|
console.log(
|
|
1939
|
-
` ${
|
|
1966
|
+
` ${chalk10.default.yellow("\u21B3")} Update available: ${chalk10.default.gray(VERSION)} \u2192 ${chalk10.default.green(latest)}`
|
|
1940
1967
|
);
|
|
1941
|
-
console.log(` ${
|
|
1968
|
+
console.log(` ${chalk10.default.hex("#D4A017")(" Run:")} ${chalk10.default.hex("#B8860B")("npm i -g framer-export@latest")}`);
|
|
1942
1969
|
console.log("");
|
|
1943
1970
|
});
|
|
1944
1971
|
});
|
|
@@ -1965,9 +1992,9 @@ async function main() {
|
|
|
1965
1992
|
try {
|
|
1966
1993
|
new URL5(url);
|
|
1967
1994
|
} catch {
|
|
1968
|
-
const
|
|
1969
|
-
console.log(` ${
|
|
1970
|
-
console.log(` ${
|
|
1995
|
+
const chalk10 = (await import("chalk")).default;
|
|
1996
|
+
console.log(` ${chalk10.red("\u2717")} ${chalk10.red.bold("Invalid URL:")} ${chalk10.white(url)}`);
|
|
1997
|
+
console.log(` ${chalk10.gray("Expected: https://yoursite.framer.app")}
|
|
1971
1998
|
`);
|
|
1972
1999
|
process.exit(1);
|
|
1973
2000
|
}
|
|
@@ -1979,10 +2006,10 @@ async function main() {
|
|
|
1979
2006
|
try {
|
|
1980
2007
|
await new FramerExporter2(url, path7.resolve(out), platformOverride || void 0).run(includeSubpages);
|
|
1981
2008
|
} catch (e) {
|
|
1982
|
-
const
|
|
2009
|
+
const chalk10 = (await import("chalk")).default;
|
|
1983
2010
|
console.log(`
|
|
1984
|
-
${
|
|
1985
|
-
console.log(
|
|
2011
|
+
${chalk10.red("\u2717")} ${chalk10.red.bold("FAILED:")} ${chalk10.white(e.message)}`);
|
|
2012
|
+
console.log(chalk10.gray(e.stack || ""));
|
|
1986
2013
|
process.exit(1);
|
|
1987
2014
|
}
|
|
1988
2015
|
}
|