@uptrademedia/site-kit 1.1.6 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-LHMD7CAR.mjs → chunk-2STSAGNT.mjs} +28 -6
- package/dist/chunk-2STSAGNT.mjs.map +1 -0
- package/dist/{chunk-6ODMCZHH.js → chunk-C5TQLU5U.js} +166 -32
- package/dist/chunk-C5TQLU5U.js.map +1 -0
- package/dist/{chunk-IRNMIFOE.js → chunk-ICHCPLRB.js} +28 -6
- package/dist/chunk-ICHCPLRB.js.map +1 -0
- package/dist/{chunk-E6L6AY2Q.mjs → chunk-RLO3QJ65.mjs} +166 -32
- package/dist/chunk-RLO3QJ65.mjs.map +1 -0
- package/dist/cli/index.js +404 -782
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +398 -774
- package/dist/cli/index.mjs.map +1 -1
- package/dist/engage/index.d.mts +3 -1
- package/dist/engage/index.d.ts +3 -1
- package/dist/engage/index.js +4 -4
- package/dist/engage/index.mjs +1 -1
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -3
- package/dist/index.mjs.map +1 -1
- package/dist/llms/index.d.mts +23 -274
- package/dist/llms/index.d.ts +23 -274
- package/dist/llms/index.js +14 -14
- package/dist/llms/index.js.map +1 -1
- package/dist/llms/index.mjs +4 -4
- package/dist/llms/index.mjs.map +1 -1
- package/dist/robots/index.d.mts +46 -0
- package/dist/robots/index.d.ts +46 -0
- package/dist/robots/index.js +34 -0
- package/dist/robots/index.js.map +1 -0
- package/dist/robots/index.mjs +32 -0
- package/dist/robots/index.mjs.map +1 -0
- package/dist/seo/index.d.mts +1 -1
- package/dist/seo/index.d.ts +1 -1
- package/dist/seo/index.js +0 -3
- package/dist/seo/index.js.map +1 -1
- package/dist/seo/index.mjs +1 -1
- package/dist/sitemap/index.d.mts +6 -2
- package/dist/sitemap/index.d.ts +6 -2
- package/dist/sitemap/index.js +5 -8
- package/dist/sitemap/index.js.map +1 -1
- package/dist/sitemap/index.mjs +5 -5
- package/dist/sitemap/index.mjs.map +1 -1
- package/dist/types-Cl2SOKHd.d.mts +259 -0
- package/dist/types-Cl2SOKHd.d.ts +259 -0
- package/package.json +44 -39
- package/dist/chunk-6ODMCZHH.js.map +0 -1
- package/dist/chunk-E6L6AY2Q.mjs.map +0 -1
- package/dist/chunk-IRNMIFOE.js.map +0 -1
- package/dist/chunk-LHMD7CAR.mjs.map +0 -1
package/dist/cli/index.mjs
CHANGED
|
@@ -8,17 +8,16 @@ import process6 from 'process';
|
|
|
8
8
|
import os from 'os';
|
|
9
9
|
import tty from 'tty';
|
|
10
10
|
import assert from 'assert';
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
11
|
+
import { execSync, spawnSync, spawn } from 'child_process';
|
|
12
|
+
import { existsSync, readFileSync, readdirSync, statSync, writeFileSync, unlinkSync } from 'fs';
|
|
13
|
+
import path4 from 'path';
|
|
14
14
|
import { randomUUID } from 'crypto';
|
|
15
15
|
import { Writable } from 'stream';
|
|
16
16
|
import readline from 'readline';
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import { fileURLToPath, URL } from 'url';
|
|
20
|
-
import { promisify } from 'util';
|
|
17
|
+
import fs2 from 'fs/promises';
|
|
18
|
+
import open from 'open';
|
|
21
19
|
import http from 'http';
|
|
20
|
+
import { URL } from 'url';
|
|
22
21
|
import * as parser from '@babel/parser';
|
|
23
22
|
import traverse from '@babel/traverse';
|
|
24
23
|
|
|
@@ -916,10 +915,10 @@ var require_suggestSimilar = __commonJS({
|
|
|
916
915
|
var require_command = __commonJS({
|
|
917
916
|
"node_modules/commander/lib/command.js"(exports$1) {
|
|
918
917
|
var EventEmitter = __require("events").EventEmitter;
|
|
919
|
-
var
|
|
918
|
+
var childProcess = __require("child_process");
|
|
920
919
|
var path15 = __require("path");
|
|
921
|
-
var
|
|
922
|
-
var
|
|
920
|
+
var fs10 = __require("fs");
|
|
921
|
+
var process11 = __require("process");
|
|
923
922
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
924
923
|
var { CommanderError: CommanderError2 } = require_error();
|
|
925
924
|
var { Help: Help2 } = require_help();
|
|
@@ -965,10 +964,10 @@ var require_command = __commonJS({
|
|
|
965
964
|
this._showHelpAfterError = false;
|
|
966
965
|
this._showSuggestionAfterError = true;
|
|
967
966
|
this._outputConfiguration = {
|
|
968
|
-
writeOut: (str) =>
|
|
969
|
-
writeErr: (str) =>
|
|
970
|
-
getOutHelpWidth: () =>
|
|
971
|
-
getErrHelpWidth: () =>
|
|
967
|
+
writeOut: (str) => process11.stdout.write(str),
|
|
968
|
+
writeErr: (str) => process11.stderr.write(str),
|
|
969
|
+
getOutHelpWidth: () => process11.stdout.isTTY ? process11.stdout.columns : void 0,
|
|
970
|
+
getErrHelpWidth: () => process11.stderr.isTTY ? process11.stderr.columns : void 0,
|
|
972
971
|
outputError: (str, write) => write(str)
|
|
973
972
|
};
|
|
974
973
|
this._hidden = false;
|
|
@@ -1324,7 +1323,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1324
1323
|
if (this._exitCallback) {
|
|
1325
1324
|
this._exitCallback(new CommanderError2(exitCode, code, message));
|
|
1326
1325
|
}
|
|
1327
|
-
|
|
1326
|
+
process11.exit(exitCode);
|
|
1328
1327
|
}
|
|
1329
1328
|
/**
|
|
1330
1329
|
* Register callback `fn` for the command.
|
|
@@ -1655,8 +1654,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1655
1654
|
}
|
|
1656
1655
|
parseOptions = parseOptions || {};
|
|
1657
1656
|
if (argv === void 0) {
|
|
1658
|
-
argv =
|
|
1659
|
-
if (
|
|
1657
|
+
argv = process11.argv;
|
|
1658
|
+
if (process11.versions && process11.versions.electron) {
|
|
1660
1659
|
parseOptions.from = "electron";
|
|
1661
1660
|
}
|
|
1662
1661
|
}
|
|
@@ -1669,7 +1668,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1669
1668
|
userArgs = argv.slice(2);
|
|
1670
1669
|
break;
|
|
1671
1670
|
case "electron":
|
|
1672
|
-
if (
|
|
1671
|
+
if (process11.defaultApp) {
|
|
1673
1672
|
this._scriptPath = argv[1];
|
|
1674
1673
|
userArgs = argv.slice(2);
|
|
1675
1674
|
} else {
|
|
@@ -1741,9 +1740,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1741
1740
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
1742
1741
|
function findFile(baseDir, baseName) {
|
|
1743
1742
|
const localBin = path15.resolve(baseDir, baseName);
|
|
1744
|
-
if (
|
|
1743
|
+
if (fs10.existsSync(localBin)) return localBin;
|
|
1745
1744
|
if (sourceExt.includes(path15.extname(baseName))) return void 0;
|
|
1746
|
-
const foundExt = sourceExt.find((ext) =>
|
|
1745
|
+
const foundExt = sourceExt.find((ext) => fs10.existsSync(`${localBin}${ext}`));
|
|
1747
1746
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
1748
1747
|
return void 0;
|
|
1749
1748
|
}
|
|
@@ -1754,7 +1753,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1754
1753
|
if (this._scriptPath) {
|
|
1755
1754
|
let resolvedScriptPath;
|
|
1756
1755
|
try {
|
|
1757
|
-
resolvedScriptPath =
|
|
1756
|
+
resolvedScriptPath = fs10.realpathSync(this._scriptPath);
|
|
1758
1757
|
} catch (err) {
|
|
1759
1758
|
resolvedScriptPath = this._scriptPath;
|
|
1760
1759
|
}
|
|
@@ -1772,23 +1771,23 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1772
1771
|
}
|
|
1773
1772
|
launchWithNode = sourceExt.includes(path15.extname(executableFile));
|
|
1774
1773
|
let proc;
|
|
1775
|
-
if (
|
|
1774
|
+
if (process11.platform !== "win32") {
|
|
1776
1775
|
if (launchWithNode) {
|
|
1777
1776
|
args.unshift(executableFile);
|
|
1778
|
-
args = incrementNodeInspectorPort(
|
|
1779
|
-
proc =
|
|
1777
|
+
args = incrementNodeInspectorPort(process11.execArgv).concat(args);
|
|
1778
|
+
proc = childProcess.spawn(process11.argv[0], args, { stdio: "inherit" });
|
|
1780
1779
|
} else {
|
|
1781
|
-
proc =
|
|
1780
|
+
proc = childProcess.spawn(executableFile, args, { stdio: "inherit" });
|
|
1782
1781
|
}
|
|
1783
1782
|
} else {
|
|
1784
1783
|
args.unshift(executableFile);
|
|
1785
|
-
args = incrementNodeInspectorPort(
|
|
1786
|
-
proc =
|
|
1784
|
+
args = incrementNodeInspectorPort(process11.execArgv).concat(args);
|
|
1785
|
+
proc = childProcess.spawn(process11.execPath, args, { stdio: "inherit" });
|
|
1787
1786
|
}
|
|
1788
1787
|
if (!proc.killed) {
|
|
1789
1788
|
const signals2 = ["SIGUSR1", "SIGUSR2", "SIGTERM", "SIGINT", "SIGHUP"];
|
|
1790
1789
|
signals2.forEach((signal) => {
|
|
1791
|
-
|
|
1790
|
+
process11.on(signal, () => {
|
|
1792
1791
|
if (proc.killed === false && proc.exitCode === null) {
|
|
1793
1792
|
proc.kill(signal);
|
|
1794
1793
|
}
|
|
@@ -1797,10 +1796,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1797
1796
|
}
|
|
1798
1797
|
const exitCallback = this._exitCallback;
|
|
1799
1798
|
if (!exitCallback) {
|
|
1800
|
-
proc.on("close",
|
|
1799
|
+
proc.on("close", process11.exit.bind(process11));
|
|
1801
1800
|
} else {
|
|
1802
1801
|
proc.on("close", () => {
|
|
1803
|
-
exitCallback(new CommanderError2(
|
|
1802
|
+
exitCallback(new CommanderError2(process11.exitCode || 0, "commander.executeSubCommandAsync", "(close)"));
|
|
1804
1803
|
});
|
|
1805
1804
|
}
|
|
1806
1805
|
proc.on("error", (err) => {
|
|
@@ -1815,7 +1814,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1815
1814
|
throw new Error(`'${executableFile}' not executable`);
|
|
1816
1815
|
}
|
|
1817
1816
|
if (!exitCallback) {
|
|
1818
|
-
|
|
1817
|
+
process11.exit(1);
|
|
1819
1818
|
} else {
|
|
1820
1819
|
const wrappedError = new CommanderError2(1, "commander.executeSubCommandAsync", "(error)");
|
|
1821
1820
|
wrappedError.nestedError = err;
|
|
@@ -2281,11 +2280,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2281
2280
|
*/
|
|
2282
2281
|
_parseOptionsEnv() {
|
|
2283
2282
|
this.options.forEach((option) => {
|
|
2284
|
-
if (option.envVar && option.envVar in
|
|
2283
|
+
if (option.envVar && option.envVar in process11.env) {
|
|
2285
2284
|
const optionKey = option.attributeName();
|
|
2286
2285
|
if (this.getOptionValue(optionKey) === void 0 || ["default", "config", "env"].includes(this.getOptionValueSource(optionKey))) {
|
|
2287
2286
|
if (option.required || option.optional) {
|
|
2288
|
-
this.emit(`optionEnv:${option.name()}`,
|
|
2287
|
+
this.emit(`optionEnv:${option.name()}`, process11.env[option.envVar]);
|
|
2289
2288
|
} else {
|
|
2290
2289
|
this.emit(`optionEnv:${option.name()}`);
|
|
2291
2290
|
}
|
|
@@ -2661,7 +2660,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2661
2660
|
*/
|
|
2662
2661
|
help(contextOptions) {
|
|
2663
2662
|
this.outputHelp(contextOptions);
|
|
2664
|
-
let exitCode =
|
|
2663
|
+
let exitCode = process11.exitCode || 0;
|
|
2665
2664
|
if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
|
|
2666
2665
|
exitCode = 1;
|
|
2667
2666
|
}
|
|
@@ -7711,7 +7710,7 @@ var require_innerFrom = __commonJS({
|
|
|
7711
7710
|
exports$1.fromIterable = fromIterable;
|
|
7712
7711
|
function fromAsyncIterable(asyncIterable) {
|
|
7713
7712
|
return new Observable_1.Observable(function(subscriber) {
|
|
7714
|
-
|
|
7713
|
+
process11(asyncIterable, subscriber).catch(function(err) {
|
|
7715
7714
|
return subscriber.error(err);
|
|
7716
7715
|
});
|
|
7717
7716
|
});
|
|
@@ -7721,7 +7720,7 @@ var require_innerFrom = __commonJS({
|
|
|
7721
7720
|
return fromAsyncIterable(isReadableStreamLike_1.readableStreamLikeToAsyncGenerator(readableStream));
|
|
7722
7721
|
}
|
|
7723
7722
|
exports$1.fromReadableStreamLike = fromReadableStreamLike;
|
|
7724
|
-
function
|
|
7723
|
+
function process11(asyncIterable, subscriber) {
|
|
7725
7724
|
var asyncIterable_1, asyncIterable_1_1;
|
|
7726
7725
|
var e_2, _a;
|
|
7727
7726
|
return __awaiter(this, void 0, void 0, function() {
|
|
@@ -15256,7 +15255,7 @@ var require_has_flag = __commonJS({
|
|
|
15256
15255
|
// node_modules/supports-color/index.js
|
|
15257
15256
|
var require_supports_color = __commonJS({
|
|
15258
15257
|
"node_modules/supports-color/index.js"(exports$1, module) {
|
|
15259
|
-
var
|
|
15258
|
+
var os3 = __require("os");
|
|
15260
15259
|
var tty2 = __require("tty");
|
|
15261
15260
|
var hasFlag2 = require_has_flag();
|
|
15262
15261
|
var { env: env2 } = process;
|
|
@@ -15304,7 +15303,7 @@ var require_supports_color = __commonJS({
|
|
|
15304
15303
|
return min;
|
|
15305
15304
|
}
|
|
15306
15305
|
if (process.platform === "win32") {
|
|
15307
|
-
const osRelease =
|
|
15306
|
+
const osRelease = os3.release().split(".");
|
|
15308
15307
|
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
15309
15308
|
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
15310
15309
|
}
|
|
@@ -15773,11 +15772,11 @@ var require_signals = __commonJS({
|
|
|
15773
15772
|
// node_modules/inquirer/node_modules/signal-exit/index.js
|
|
15774
15773
|
var require_signal_exit = __commonJS({
|
|
15775
15774
|
"node_modules/inquirer/node_modules/signal-exit/index.js"(exports$1, module) {
|
|
15776
|
-
var
|
|
15777
|
-
var processOk2 = function(
|
|
15778
|
-
return
|
|
15775
|
+
var process11 = global.process;
|
|
15776
|
+
var processOk2 = function(process12) {
|
|
15777
|
+
return process12 && typeof process12 === "object" && typeof process12.removeListener === "function" && typeof process12.emit === "function" && typeof process12.reallyExit === "function" && typeof process12.listeners === "function" && typeof process12.kill === "function" && typeof process12.pid === "number" && typeof process12.on === "function";
|
|
15779
15778
|
};
|
|
15780
|
-
if (!processOk2(
|
|
15779
|
+
if (!processOk2(process11)) {
|
|
15781
15780
|
module.exports = function() {
|
|
15782
15781
|
return function() {
|
|
15783
15782
|
};
|
|
@@ -15785,15 +15784,15 @@ var require_signal_exit = __commonJS({
|
|
|
15785
15784
|
} else {
|
|
15786
15785
|
assert2 = __require("assert");
|
|
15787
15786
|
signals2 = require_signals();
|
|
15788
|
-
isWin = /^win/i.test(
|
|
15787
|
+
isWin = /^win/i.test(process11.platform);
|
|
15789
15788
|
EE = __require("events");
|
|
15790
15789
|
if (typeof EE !== "function") {
|
|
15791
15790
|
EE = EE.EventEmitter;
|
|
15792
15791
|
}
|
|
15793
|
-
if (
|
|
15794
|
-
emitter =
|
|
15792
|
+
if (process11.__signal_exit_emitter__) {
|
|
15793
|
+
emitter = process11.__signal_exit_emitter__;
|
|
15795
15794
|
} else {
|
|
15796
|
-
emitter =
|
|
15795
|
+
emitter = process11.__signal_exit_emitter__ = new EE();
|
|
15797
15796
|
emitter.count = 0;
|
|
15798
15797
|
emitter.emitted = {};
|
|
15799
15798
|
}
|
|
@@ -15830,12 +15829,12 @@ var require_signal_exit = __commonJS({
|
|
|
15830
15829
|
loaded = false;
|
|
15831
15830
|
signals2.forEach(function(sig) {
|
|
15832
15831
|
try {
|
|
15833
|
-
|
|
15832
|
+
process11.removeListener(sig, sigListeners[sig]);
|
|
15834
15833
|
} catch (er) {
|
|
15835
15834
|
}
|
|
15836
15835
|
});
|
|
15837
|
-
|
|
15838
|
-
|
|
15836
|
+
process11.emit = originalProcessEmit;
|
|
15837
|
+
process11.reallyExit = originalProcessReallyExit;
|
|
15839
15838
|
emitter.count -= 1;
|
|
15840
15839
|
};
|
|
15841
15840
|
module.exports.unload = unload2;
|
|
@@ -15852,7 +15851,7 @@ var require_signal_exit = __commonJS({
|
|
|
15852
15851
|
if (!processOk2(global.process)) {
|
|
15853
15852
|
return;
|
|
15854
15853
|
}
|
|
15855
|
-
var listeners =
|
|
15854
|
+
var listeners = process11.listeners(sig);
|
|
15856
15855
|
if (listeners.length === emitter.count) {
|
|
15857
15856
|
unload2();
|
|
15858
15857
|
emit("exit", null, sig);
|
|
@@ -15860,7 +15859,7 @@ var require_signal_exit = __commonJS({
|
|
|
15860
15859
|
if (isWin && sig === "SIGHUP") {
|
|
15861
15860
|
sig = "SIGINT";
|
|
15862
15861
|
}
|
|
15863
|
-
|
|
15862
|
+
process11.kill(process11.pid, sig);
|
|
15864
15863
|
}
|
|
15865
15864
|
};
|
|
15866
15865
|
});
|
|
@@ -15876,36 +15875,36 @@ var require_signal_exit = __commonJS({
|
|
|
15876
15875
|
emitter.count += 1;
|
|
15877
15876
|
signals2 = signals2.filter(function(sig) {
|
|
15878
15877
|
try {
|
|
15879
|
-
|
|
15878
|
+
process11.on(sig, sigListeners[sig]);
|
|
15880
15879
|
return true;
|
|
15881
15880
|
} catch (er) {
|
|
15882
15881
|
return false;
|
|
15883
15882
|
}
|
|
15884
15883
|
});
|
|
15885
|
-
|
|
15886
|
-
|
|
15884
|
+
process11.emit = processEmit;
|
|
15885
|
+
process11.reallyExit = processReallyExit;
|
|
15887
15886
|
};
|
|
15888
15887
|
module.exports.load = load2;
|
|
15889
|
-
originalProcessReallyExit =
|
|
15888
|
+
originalProcessReallyExit = process11.reallyExit;
|
|
15890
15889
|
processReallyExit = function processReallyExit2(code) {
|
|
15891
15890
|
if (!processOk2(global.process)) {
|
|
15892
15891
|
return;
|
|
15893
15892
|
}
|
|
15894
|
-
|
|
15893
|
+
process11.exitCode = code || /* istanbul ignore next */
|
|
15895
15894
|
0;
|
|
15896
|
-
emit("exit",
|
|
15897
|
-
emit("afterexit",
|
|
15898
|
-
originalProcessReallyExit.call(
|
|
15895
|
+
emit("exit", process11.exitCode, null);
|
|
15896
|
+
emit("afterexit", process11.exitCode, null);
|
|
15897
|
+
originalProcessReallyExit.call(process11, process11.exitCode);
|
|
15899
15898
|
};
|
|
15900
|
-
originalProcessEmit =
|
|
15899
|
+
originalProcessEmit = process11.emit;
|
|
15901
15900
|
processEmit = function processEmit2(ev, arg) {
|
|
15902
15901
|
if (ev === "exit" && processOk2(global.process)) {
|
|
15903
15902
|
if (arg !== void 0) {
|
|
15904
|
-
|
|
15903
|
+
process11.exitCode = arg;
|
|
15905
15904
|
}
|
|
15906
15905
|
var ret = originalProcessEmit.apply(this, arguments);
|
|
15907
|
-
emit("exit",
|
|
15908
|
-
emit("afterexit",
|
|
15906
|
+
emit("exit", process11.exitCode, null);
|
|
15907
|
+
emit("afterexit", process11.exitCode, null);
|
|
15909
15908
|
return ret;
|
|
15910
15909
|
} else {
|
|
15911
15910
|
return originalProcessEmit.apply(this, arguments);
|
|
@@ -16431,12 +16430,12 @@ var require_buffer_list = __commonJS({
|
|
|
16431
16430
|
return (String )(input);
|
|
16432
16431
|
}
|
|
16433
16432
|
var _require = __require("buffer");
|
|
16434
|
-
var
|
|
16433
|
+
var Buffer2 = _require.Buffer;
|
|
16435
16434
|
var _require2 = __require("util");
|
|
16436
16435
|
var inspect = _require2.inspect;
|
|
16437
16436
|
var custom = inspect && inspect.custom || "inspect";
|
|
16438
16437
|
function copyBuffer(src, target, offset) {
|
|
16439
|
-
|
|
16438
|
+
Buffer2.prototype.copy.call(src, target, offset);
|
|
16440
16439
|
}
|
|
16441
16440
|
module.exports = /* @__PURE__ */ (function() {
|
|
16442
16441
|
function BufferList() {
|
|
@@ -16496,8 +16495,8 @@ var require_buffer_list = __commonJS({
|
|
|
16496
16495
|
}, {
|
|
16497
16496
|
key: "concat",
|
|
16498
16497
|
value: function concat(n) {
|
|
16499
|
-
if (this.length === 0) return
|
|
16500
|
-
var ret =
|
|
16498
|
+
if (this.length === 0) return Buffer2.alloc(0);
|
|
16499
|
+
var ret = Buffer2.allocUnsafe(n >>> 0);
|
|
16501
16500
|
var p = this.head;
|
|
16502
16501
|
var i = 0;
|
|
16503
16502
|
while (p) {
|
|
@@ -16561,7 +16560,7 @@ var require_buffer_list = __commonJS({
|
|
|
16561
16560
|
}, {
|
|
16562
16561
|
key: "_getBuffer",
|
|
16563
16562
|
value: function _getBuffer(n) {
|
|
16564
|
-
var ret =
|
|
16563
|
+
var ret = Buffer2.allocUnsafe(n);
|
|
16565
16564
|
var p = this.head;
|
|
16566
16565
|
var c = 1;
|
|
16567
16566
|
p.data.copy(ret);
|
|
@@ -16886,14 +16885,14 @@ var require_stream_writable = __commonJS({
|
|
|
16886
16885
|
deprecate: require_node()
|
|
16887
16886
|
};
|
|
16888
16887
|
var Stream = require_stream();
|
|
16889
|
-
var
|
|
16888
|
+
var Buffer2 = __require("buffer").Buffer;
|
|
16890
16889
|
var OurUint8Array = (typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {
|
|
16891
16890
|
};
|
|
16892
16891
|
function _uint8ArrayToBuffer(chunk) {
|
|
16893
|
-
return
|
|
16892
|
+
return Buffer2.from(chunk);
|
|
16894
16893
|
}
|
|
16895
16894
|
function _isUint8Array(obj) {
|
|
16896
|
-
return
|
|
16895
|
+
return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array;
|
|
16897
16896
|
}
|
|
16898
16897
|
var destroyImpl = require_destroy();
|
|
16899
16898
|
var _require = require_state();
|
|
@@ -17021,7 +17020,7 @@ var require_stream_writable = __commonJS({
|
|
|
17021
17020
|
var state = this._writableState;
|
|
17022
17021
|
var ret = false;
|
|
17023
17022
|
var isBuf = !state.objectMode && _isUint8Array(chunk);
|
|
17024
|
-
if (isBuf && !
|
|
17023
|
+
if (isBuf && !Buffer2.isBuffer(chunk)) {
|
|
17025
17024
|
chunk = _uint8ArrayToBuffer(chunk);
|
|
17026
17025
|
}
|
|
17027
17026
|
if (typeof encoding === "function") {
|
|
@@ -17065,7 +17064,7 @@ var require_stream_writable = __commonJS({
|
|
|
17065
17064
|
});
|
|
17066
17065
|
function decodeChunk(state, chunk, encoding) {
|
|
17067
17066
|
if (!state.objectMode && state.decodeStrings !== false && typeof chunk === "string") {
|
|
17068
|
-
chunk =
|
|
17067
|
+
chunk = Buffer2.from(chunk, encoding);
|
|
17069
17068
|
}
|
|
17070
17069
|
return chunk;
|
|
17071
17070
|
}
|
|
@@ -17434,34 +17433,34 @@ var require_stream_duplex = __commonJS({
|
|
|
17434
17433
|
var require_safe_buffer = __commonJS({
|
|
17435
17434
|
"node_modules/safe-buffer/index.js"(exports$1, module) {
|
|
17436
17435
|
var buffer = __require("buffer");
|
|
17437
|
-
var
|
|
17436
|
+
var Buffer2 = buffer.Buffer;
|
|
17438
17437
|
function copyProps(src, dst) {
|
|
17439
17438
|
for (var key in src) {
|
|
17440
17439
|
dst[key] = src[key];
|
|
17441
17440
|
}
|
|
17442
17441
|
}
|
|
17443
|
-
if (
|
|
17442
|
+
if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) {
|
|
17444
17443
|
module.exports = buffer;
|
|
17445
17444
|
} else {
|
|
17446
17445
|
copyProps(buffer, exports$1);
|
|
17447
17446
|
exports$1.Buffer = SafeBuffer;
|
|
17448
17447
|
}
|
|
17449
17448
|
function SafeBuffer(arg, encodingOrOffset, length) {
|
|
17450
|
-
return
|
|
17449
|
+
return Buffer2(arg, encodingOrOffset, length);
|
|
17451
17450
|
}
|
|
17452
|
-
SafeBuffer.prototype = Object.create(
|
|
17453
|
-
copyProps(
|
|
17451
|
+
SafeBuffer.prototype = Object.create(Buffer2.prototype);
|
|
17452
|
+
copyProps(Buffer2, SafeBuffer);
|
|
17454
17453
|
SafeBuffer.from = function(arg, encodingOrOffset, length) {
|
|
17455
17454
|
if (typeof arg === "number") {
|
|
17456
17455
|
throw new TypeError("Argument must not be a number");
|
|
17457
17456
|
}
|
|
17458
|
-
return
|
|
17457
|
+
return Buffer2(arg, encodingOrOffset, length);
|
|
17459
17458
|
};
|
|
17460
17459
|
SafeBuffer.alloc = function(size, fill, encoding) {
|
|
17461
17460
|
if (typeof size !== "number") {
|
|
17462
17461
|
throw new TypeError("Argument must be a number");
|
|
17463
17462
|
}
|
|
17464
|
-
var buf =
|
|
17463
|
+
var buf = Buffer2(size);
|
|
17465
17464
|
if (fill !== void 0) {
|
|
17466
17465
|
if (typeof encoding === "string") {
|
|
17467
17466
|
buf.fill(fill, encoding);
|
|
@@ -17477,7 +17476,7 @@ var require_safe_buffer = __commonJS({
|
|
|
17477
17476
|
if (typeof size !== "number") {
|
|
17478
17477
|
throw new TypeError("Argument must be a number");
|
|
17479
17478
|
}
|
|
17480
|
-
return
|
|
17479
|
+
return Buffer2(size);
|
|
17481
17480
|
};
|
|
17482
17481
|
SafeBuffer.allocUnsafeSlow = function(size) {
|
|
17483
17482
|
if (typeof size !== "number") {
|
|
@@ -17491,8 +17490,8 @@ var require_safe_buffer = __commonJS({
|
|
|
17491
17490
|
// node_modules/string_decoder/lib/string_decoder.js
|
|
17492
17491
|
var require_string_decoder = __commonJS({
|
|
17493
17492
|
"node_modules/string_decoder/lib/string_decoder.js"(exports$1) {
|
|
17494
|
-
var
|
|
17495
|
-
var isEncoding =
|
|
17493
|
+
var Buffer2 = require_safe_buffer().Buffer;
|
|
17494
|
+
var isEncoding = Buffer2.isEncoding || function(encoding) {
|
|
17496
17495
|
encoding = "" + encoding;
|
|
17497
17496
|
switch (encoding && encoding.toLowerCase()) {
|
|
17498
17497
|
case "hex":
|
|
@@ -17540,7 +17539,7 @@ var require_string_decoder = __commonJS({
|
|
|
17540
17539
|
}
|
|
17541
17540
|
function normalizeEncoding(enc) {
|
|
17542
17541
|
var nenc = _normalizeEncoding(enc);
|
|
17543
|
-
if (typeof nenc !== "string" && (
|
|
17542
|
+
if (typeof nenc !== "string" && (Buffer2.isEncoding === isEncoding || !isEncoding(enc))) throw new Error("Unknown encoding: " + enc);
|
|
17544
17543
|
return nenc || enc;
|
|
17545
17544
|
}
|
|
17546
17545
|
exports$1.StringDecoder = StringDecoder;
|
|
@@ -17569,7 +17568,7 @@ var require_string_decoder = __commonJS({
|
|
|
17569
17568
|
}
|
|
17570
17569
|
this.lastNeed = 0;
|
|
17571
17570
|
this.lastTotal = 0;
|
|
17572
|
-
this.lastChar =
|
|
17571
|
+
this.lastChar = Buffer2.allocUnsafe(nb);
|
|
17573
17572
|
}
|
|
17574
17573
|
StringDecoder.prototype.write = function(buf) {
|
|
17575
17574
|
if (buf.length === 0) return "";
|
|
@@ -18126,14 +18125,14 @@ var require_stream_readable = __commonJS({
|
|
|
18126
18125
|
return emitter.listeners(type).length;
|
|
18127
18126
|
};
|
|
18128
18127
|
var Stream = require_stream();
|
|
18129
|
-
var
|
|
18128
|
+
var Buffer2 = __require("buffer").Buffer;
|
|
18130
18129
|
var OurUint8Array = (typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {
|
|
18131
18130
|
};
|
|
18132
18131
|
function _uint8ArrayToBuffer(chunk) {
|
|
18133
|
-
return
|
|
18132
|
+
return Buffer2.from(chunk);
|
|
18134
18133
|
}
|
|
18135
18134
|
function _isUint8Array(obj) {
|
|
18136
|
-
return
|
|
18135
|
+
return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array;
|
|
18137
18136
|
}
|
|
18138
18137
|
var debugUtil = __require("util");
|
|
18139
18138
|
var debug;
|
|
@@ -18241,7 +18240,7 @@ var require_stream_readable = __commonJS({
|
|
|
18241
18240
|
if (typeof chunk === "string") {
|
|
18242
18241
|
encoding = encoding || state.defaultEncoding;
|
|
18243
18242
|
if (encoding !== state.encoding) {
|
|
18244
|
-
chunk =
|
|
18243
|
+
chunk = Buffer2.from(chunk, encoding);
|
|
18245
18244
|
encoding = "";
|
|
18246
18245
|
}
|
|
18247
18246
|
skipChunkCheck = true;
|
|
@@ -18266,7 +18265,7 @@ var require_stream_readable = __commonJS({
|
|
|
18266
18265
|
if (er) {
|
|
18267
18266
|
errorOrDestroy(stream, er);
|
|
18268
18267
|
} else if (state.objectMode || chunk && chunk.length > 0) {
|
|
18269
|
-
if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !==
|
|
18268
|
+
if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer2.prototype) {
|
|
18270
18269
|
chunk = _uint8ArrayToBuffer(chunk);
|
|
18271
18270
|
}
|
|
18272
18271
|
if (addToFront) {
|
|
@@ -19072,7 +19071,7 @@ var require_readable = __commonJS({
|
|
|
19072
19071
|
// node_modules/bl/BufferList.js
|
|
19073
19072
|
var require_BufferList = __commonJS({
|
|
19074
19073
|
"node_modules/bl/BufferList.js"(exports$1, module) {
|
|
19075
|
-
var { Buffer:
|
|
19074
|
+
var { Buffer: Buffer2 } = __require("buffer");
|
|
19076
19075
|
var symbol = /* @__PURE__ */ Symbol.for("BufferList");
|
|
19077
19076
|
function BufferList(buf) {
|
|
19078
19077
|
if (!(this instanceof BufferList)) {
|
|
@@ -19136,10 +19135,10 @@ var require_BufferList = __commonJS({
|
|
|
19136
19135
|
srcEnd = this.length;
|
|
19137
19136
|
}
|
|
19138
19137
|
if (srcStart >= this.length) {
|
|
19139
|
-
return dst ||
|
|
19138
|
+
return dst || Buffer2.alloc(0);
|
|
19140
19139
|
}
|
|
19141
19140
|
if (srcEnd <= 0) {
|
|
19142
|
-
return dst ||
|
|
19141
|
+
return dst || Buffer2.alloc(0);
|
|
19143
19142
|
}
|
|
19144
19143
|
const copy2 = !!dst;
|
|
19145
19144
|
const off = this._offset(srcStart);
|
|
@@ -19149,7 +19148,7 @@ var require_BufferList = __commonJS({
|
|
|
19149
19148
|
let start = off[1];
|
|
19150
19149
|
if (srcStart === 0 && srcEnd === this.length) {
|
|
19151
19150
|
if (!copy2) {
|
|
19152
|
-
return this._bufs.length === 1 ? this._bufs[0] :
|
|
19151
|
+
return this._bufs.length === 1 ? this._bufs[0] : Buffer2.concat(this._bufs, this.length);
|
|
19153
19152
|
}
|
|
19154
19153
|
for (let i = 0; i < this._bufs.length; i++) {
|
|
19155
19154
|
this._bufs[i].copy(dst, bufoff);
|
|
@@ -19161,7 +19160,7 @@ var require_BufferList = __commonJS({
|
|
|
19161
19160
|
return copy2 ? this._bufs[off[0]].copy(dst, dstStart, start, start + bytes) : this._bufs[off[0]].slice(start, start + bytes);
|
|
19162
19161
|
}
|
|
19163
19162
|
if (!copy2) {
|
|
19164
|
-
dst =
|
|
19163
|
+
dst = Buffer2.allocUnsafe(len);
|
|
19165
19164
|
}
|
|
19166
19165
|
for (let i = off[0]; i < this._bufs.length; i++) {
|
|
19167
19166
|
const l = this._bufs[i].length - start;
|
|
@@ -19237,7 +19236,7 @@ var require_BufferList = __commonJS({
|
|
|
19237
19236
|
return this;
|
|
19238
19237
|
}
|
|
19239
19238
|
if (buf.buffer) {
|
|
19240
|
-
this._appendBuffer(
|
|
19239
|
+
this._appendBuffer(Buffer2.from(buf.buffer, buf.byteOffset, buf.byteLength));
|
|
19241
19240
|
} else if (Array.isArray(buf)) {
|
|
19242
19241
|
for (let i = 0; i < buf.length; i++) {
|
|
19243
19242
|
this.append(buf[i]);
|
|
@@ -19250,7 +19249,7 @@ var require_BufferList = __commonJS({
|
|
|
19250
19249
|
if (typeof buf === "number") {
|
|
19251
19250
|
buf = buf.toString();
|
|
19252
19251
|
}
|
|
19253
|
-
this._appendBuffer(
|
|
19252
|
+
this._appendBuffer(Buffer2.from(buf));
|
|
19254
19253
|
}
|
|
19255
19254
|
return this;
|
|
19256
19255
|
};
|
|
@@ -19266,15 +19265,15 @@ var require_BufferList = __commonJS({
|
|
|
19266
19265
|
if (typeof search === "function" || Array.isArray(search)) {
|
|
19267
19266
|
throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');
|
|
19268
19267
|
} else if (typeof search === "number") {
|
|
19269
|
-
search =
|
|
19268
|
+
search = Buffer2.from([search]);
|
|
19270
19269
|
} else if (typeof search === "string") {
|
|
19271
|
-
search =
|
|
19270
|
+
search = Buffer2.from(search, encoding);
|
|
19272
19271
|
} else if (this._isBufferList(search)) {
|
|
19273
19272
|
search = search.slice();
|
|
19274
19273
|
} else if (Array.isArray(search.buffer)) {
|
|
19275
|
-
search =
|
|
19276
|
-
} else if (!
|
|
19277
|
-
search =
|
|
19274
|
+
search = Buffer2.from(search.buffer, search.byteOffset, search.byteLength);
|
|
19275
|
+
} else if (!Buffer2.isBuffer(search)) {
|
|
19276
|
+
search = Buffer2.from(search);
|
|
19278
19277
|
}
|
|
19279
19278
|
offset = Number(offset || 0);
|
|
19280
19279
|
if (isNaN(offset)) {
|
|
@@ -25332,10 +25331,10 @@ var require_lib2 = __commonJS({
|
|
|
25332
25331
|
exports$1.analyse = analyse;
|
|
25333
25332
|
var detectFile = (filepath, opts = {}) => new Promise((resolve, reject) => {
|
|
25334
25333
|
let fd;
|
|
25335
|
-
const
|
|
25334
|
+
const fs10 = (0, node_1.default)();
|
|
25336
25335
|
const handler = (err, buffer) => {
|
|
25337
25336
|
if (fd) {
|
|
25338
|
-
|
|
25337
|
+
fs10.closeSync(fd);
|
|
25339
25338
|
}
|
|
25340
25339
|
if (err) {
|
|
25341
25340
|
reject(err);
|
|
@@ -25347,9 +25346,9 @@ var require_lib2 = __commonJS({
|
|
|
25347
25346
|
};
|
|
25348
25347
|
const sampleSize = (opts === null || opts === void 0 ? void 0 : opts.sampleSize) || 0;
|
|
25349
25348
|
if (sampleSize > 0) {
|
|
25350
|
-
fd =
|
|
25349
|
+
fd = fs10.openSync(filepath, "r");
|
|
25351
25350
|
let sample = Buffer.allocUnsafe(sampleSize);
|
|
25352
|
-
|
|
25351
|
+
fs10.read(fd, sample, 0, sampleSize, opts.offset, (err, bytesRead) => {
|
|
25353
25352
|
if (err) {
|
|
25354
25353
|
handler(err, null);
|
|
25355
25354
|
} else {
|
|
@@ -25361,22 +25360,22 @@ var require_lib2 = __commonJS({
|
|
|
25361
25360
|
});
|
|
25362
25361
|
return;
|
|
25363
25362
|
}
|
|
25364
|
-
|
|
25363
|
+
fs10.readFile(filepath, handler);
|
|
25365
25364
|
});
|
|
25366
25365
|
exports$1.detectFile = detectFile;
|
|
25367
25366
|
var detectFileSync = (filepath, opts = {}) => {
|
|
25368
|
-
const
|
|
25367
|
+
const fs10 = (0, node_1.default)();
|
|
25369
25368
|
if (opts && opts.sampleSize) {
|
|
25370
|
-
const fd =
|
|
25369
|
+
const fd = fs10.openSync(filepath, "r");
|
|
25371
25370
|
let sample = Buffer.allocUnsafe(opts.sampleSize);
|
|
25372
|
-
const bytesRead =
|
|
25371
|
+
const bytesRead = fs10.readSync(fd, sample, 0, opts.sampleSize, opts.offset);
|
|
25373
25372
|
if (bytesRead < opts.sampleSize) {
|
|
25374
25373
|
sample = sample.subarray(0, bytesRead);
|
|
25375
25374
|
}
|
|
25376
|
-
|
|
25375
|
+
fs10.closeSync(fd);
|
|
25377
25376
|
return (0, exports$1.detect)(sample);
|
|
25378
25377
|
}
|
|
25379
|
-
return (0, exports$1.detect)(
|
|
25378
|
+
return (0, exports$1.detect)(fs10.readFileSync(filepath));
|
|
25380
25379
|
};
|
|
25381
25380
|
exports$1.detectFileSync = detectFileSync;
|
|
25382
25381
|
exports$1.default = {
|
|
@@ -25392,7 +25391,7 @@ var require_lib2 = __commonJS({
|
|
|
25392
25391
|
var require_safer = __commonJS({
|
|
25393
25392
|
"node_modules/safer-buffer/safer.js"(exports$1, module) {
|
|
25394
25393
|
var buffer = __require("buffer");
|
|
25395
|
-
var
|
|
25394
|
+
var Buffer2 = buffer.Buffer;
|
|
25396
25395
|
var safer = {};
|
|
25397
25396
|
var key;
|
|
25398
25397
|
for (key in buffer) {
|
|
@@ -25401,12 +25400,12 @@ var require_safer = __commonJS({
|
|
|
25401
25400
|
safer[key] = buffer[key];
|
|
25402
25401
|
}
|
|
25403
25402
|
var Safer = safer.Buffer = {};
|
|
25404
|
-
for (key in
|
|
25405
|
-
if (!
|
|
25403
|
+
for (key in Buffer2) {
|
|
25404
|
+
if (!Buffer2.hasOwnProperty(key)) continue;
|
|
25406
25405
|
if (key === "allocUnsafe" || key === "allocUnsafeSlow") continue;
|
|
25407
|
-
Safer[key] =
|
|
25406
|
+
Safer[key] = Buffer2[key];
|
|
25408
25407
|
}
|
|
25409
|
-
safer.Buffer.prototype =
|
|
25408
|
+
safer.Buffer.prototype = Buffer2.prototype;
|
|
25410
25409
|
if (!Safer.from || Safer.from === Uint8Array.from) {
|
|
25411
25410
|
Safer.from = function(value, encodingOrOffset, length) {
|
|
25412
25411
|
if (typeof value === "number") {
|
|
@@ -25415,7 +25414,7 @@ var require_safer = __commonJS({
|
|
|
25415
25414
|
if (value && typeof value.length === "undefined") {
|
|
25416
25415
|
throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value);
|
|
25417
25416
|
}
|
|
25418
|
-
return
|
|
25417
|
+
return Buffer2(value, encodingOrOffset, length);
|
|
25419
25418
|
};
|
|
25420
25419
|
}
|
|
25421
25420
|
if (!Safer.alloc) {
|
|
@@ -25426,7 +25425,7 @@ var require_safer = __commonJS({
|
|
|
25426
25425
|
if (size < 0 || size >= 2 * (1 << 30)) {
|
|
25427
25426
|
throw new RangeError('The value "' + size + '" is invalid for option "size"');
|
|
25428
25427
|
}
|
|
25429
|
-
var buf =
|
|
25428
|
+
var buf = Buffer2(size);
|
|
25430
25429
|
if (!fill || fill.length === 0) {
|
|
25431
25430
|
buf.fill(0);
|
|
25432
25431
|
} else if (typeof encoding === "string") {
|
|
@@ -25518,7 +25517,7 @@ var require_merge_exports = __commonJS({
|
|
|
25518
25517
|
// node_modules/iconv-lite/encodings/internal.js
|
|
25519
25518
|
var require_internal = __commonJS({
|
|
25520
25519
|
"node_modules/iconv-lite/encodings/internal.js"(exports$1, module) {
|
|
25521
|
-
var
|
|
25520
|
+
var Buffer2 = require_safer().Buffer;
|
|
25522
25521
|
module.exports = {
|
|
25523
25522
|
// Encodings
|
|
25524
25523
|
utf8: { type: "_internal", bomAware: true },
|
|
@@ -25542,7 +25541,7 @@ var require_internal = __commonJS({
|
|
|
25542
25541
|
} else if (this.enc === "cesu8") {
|
|
25543
25542
|
this.enc = "utf8";
|
|
25544
25543
|
this.encoder = InternalEncoderCesu8;
|
|
25545
|
-
if (
|
|
25544
|
+
if (Buffer2.from("eda0bdedb2a9", "hex").toString() !== "\u{1F4A9}") {
|
|
25546
25545
|
this.decoder = InternalDecoderCesu8;
|
|
25547
25546
|
this.defaultCharUnicode = iconv2.defaultCharUnicode;
|
|
25548
25547
|
}
|
|
@@ -25555,8 +25554,8 @@ var require_internal = __commonJS({
|
|
|
25555
25554
|
this.decoder = new StringDecoder(codec.enc);
|
|
25556
25555
|
}
|
|
25557
25556
|
InternalDecoder.prototype.write = function(buf) {
|
|
25558
|
-
if (!
|
|
25559
|
-
buf =
|
|
25557
|
+
if (!Buffer2.isBuffer(buf)) {
|
|
25558
|
+
buf = Buffer2.from(buf);
|
|
25560
25559
|
}
|
|
25561
25560
|
return this.decoder.write(buf);
|
|
25562
25561
|
};
|
|
@@ -25567,7 +25566,7 @@ var require_internal = __commonJS({
|
|
|
25567
25566
|
this.enc = codec.enc;
|
|
25568
25567
|
}
|
|
25569
25568
|
InternalEncoder.prototype.write = function(str) {
|
|
25570
|
-
return
|
|
25569
|
+
return Buffer2.from(str, this.enc);
|
|
25571
25570
|
};
|
|
25572
25571
|
InternalEncoder.prototype.end = function() {
|
|
25573
25572
|
};
|
|
@@ -25579,15 +25578,15 @@ var require_internal = __commonJS({
|
|
|
25579
25578
|
var completeQuads = str.length - str.length % 4;
|
|
25580
25579
|
this.prevStr = str.slice(completeQuads);
|
|
25581
25580
|
str = str.slice(0, completeQuads);
|
|
25582
|
-
return
|
|
25581
|
+
return Buffer2.from(str, "base64");
|
|
25583
25582
|
};
|
|
25584
25583
|
InternalEncoderBase64.prototype.end = function() {
|
|
25585
|
-
return
|
|
25584
|
+
return Buffer2.from(this.prevStr, "base64");
|
|
25586
25585
|
};
|
|
25587
25586
|
function InternalEncoderCesu8(options, codec) {
|
|
25588
25587
|
}
|
|
25589
25588
|
InternalEncoderCesu8.prototype.write = function(str) {
|
|
25590
|
-
var buf =
|
|
25589
|
+
var buf = Buffer2.alloc(str.length * 3);
|
|
25591
25590
|
var bufIdx = 0;
|
|
25592
25591
|
for (var i = 0; i < str.length; i++) {
|
|
25593
25592
|
var charCode = str.charCodeAt(i);
|
|
@@ -25683,13 +25682,13 @@ var require_internal = __commonJS({
|
|
|
25683
25682
|
str = str.slice(0, str.length - 1);
|
|
25684
25683
|
}
|
|
25685
25684
|
}
|
|
25686
|
-
return
|
|
25685
|
+
return Buffer2.from(str, this.enc);
|
|
25687
25686
|
};
|
|
25688
25687
|
InternalEncoderUtf8.prototype.end = function() {
|
|
25689
25688
|
if (this.highSurrogate) {
|
|
25690
25689
|
var str = this.highSurrogate;
|
|
25691
25690
|
this.highSurrogate = "";
|
|
25692
|
-
return
|
|
25691
|
+
return Buffer2.from(str, this.enc);
|
|
25693
25692
|
}
|
|
25694
25693
|
};
|
|
25695
25694
|
}
|
|
@@ -25698,7 +25697,7 @@ var require_internal = __commonJS({
|
|
|
25698
25697
|
// node_modules/iconv-lite/encodings/utf32.js
|
|
25699
25698
|
var require_utf32 = __commonJS({
|
|
25700
25699
|
"node_modules/iconv-lite/encodings/utf32.js"(exports$1) {
|
|
25701
|
-
var
|
|
25700
|
+
var Buffer2 = require_safer().Buffer;
|
|
25702
25701
|
exports$1._utf32 = Utf32Codec;
|
|
25703
25702
|
function Utf32Codec(codecOptions, iconv2) {
|
|
25704
25703
|
this.iconv = iconv2;
|
|
@@ -25716,8 +25715,8 @@ var require_utf32 = __commonJS({
|
|
|
25716
25715
|
this.highSurrogate = 0;
|
|
25717
25716
|
}
|
|
25718
25717
|
Utf32Encoder.prototype.write = function(str) {
|
|
25719
|
-
var src =
|
|
25720
|
-
var dst =
|
|
25718
|
+
var src = Buffer2.from(str, "ucs2");
|
|
25719
|
+
var dst = Buffer2.alloc(src.length * 2);
|
|
25721
25720
|
var write32 = this.isLE ? dst.writeUInt32LE : dst.writeUInt32BE;
|
|
25722
25721
|
var offset = 0;
|
|
25723
25722
|
for (var i = 0; i < src.length; i += 2) {
|
|
@@ -25753,7 +25752,7 @@ var require_utf32 = __commonJS({
|
|
|
25753
25752
|
if (!this.highSurrogate) {
|
|
25754
25753
|
return;
|
|
25755
25754
|
}
|
|
25756
|
-
var buf =
|
|
25755
|
+
var buf = Buffer2.alloc(4);
|
|
25757
25756
|
if (this.isLE) {
|
|
25758
25757
|
buf.writeUInt32LE(this.highSurrogate, 0);
|
|
25759
25758
|
} else {
|
|
@@ -25773,7 +25772,7 @@ var require_utf32 = __commonJS({
|
|
|
25773
25772
|
}
|
|
25774
25773
|
var i = 0;
|
|
25775
25774
|
var codepoint = 0;
|
|
25776
|
-
var dst =
|
|
25775
|
+
var dst = Buffer2.alloc(src.length + 4);
|
|
25777
25776
|
var offset = 0;
|
|
25778
25777
|
var isLE = this.isLE;
|
|
25779
25778
|
var overflow = this.overflow;
|
|
@@ -25928,7 +25927,7 @@ var require_utf32 = __commonJS({
|
|
|
25928
25927
|
// node_modules/iconv-lite/encodings/utf16.js
|
|
25929
25928
|
var require_utf16 = __commonJS({
|
|
25930
25929
|
"node_modules/iconv-lite/encodings/utf16.js"(exports$1) {
|
|
25931
|
-
var
|
|
25930
|
+
var Buffer2 = require_safer().Buffer;
|
|
25932
25931
|
exports$1.utf16be = Utf16BECodec;
|
|
25933
25932
|
function Utf16BECodec() {
|
|
25934
25933
|
}
|
|
@@ -25938,7 +25937,7 @@ var require_utf16 = __commonJS({
|
|
|
25938
25937
|
function Utf16BEEncoder() {
|
|
25939
25938
|
}
|
|
25940
25939
|
Utf16BEEncoder.prototype.write = function(str) {
|
|
25941
|
-
var buf =
|
|
25940
|
+
var buf = Buffer2.from(str, "ucs2");
|
|
25942
25941
|
for (var i = 0; i < buf.length; i += 2) {
|
|
25943
25942
|
var tmp = buf[i];
|
|
25944
25943
|
buf[i] = buf[i + 1];
|
|
@@ -25955,7 +25954,7 @@ var require_utf16 = __commonJS({
|
|
|
25955
25954
|
if (buf.length == 0) {
|
|
25956
25955
|
return "";
|
|
25957
25956
|
}
|
|
25958
|
-
var buf2 =
|
|
25957
|
+
var buf2 = Buffer2.alloc(buf.length + 1);
|
|
25959
25958
|
var i = 0;
|
|
25960
25959
|
var j = 0;
|
|
25961
25960
|
if (this.overflowByte !== -1) {
|
|
@@ -26070,7 +26069,7 @@ var require_utf16 = __commonJS({
|
|
|
26070
26069
|
// node_modules/iconv-lite/encodings/utf7.js
|
|
26071
26070
|
var require_utf7 = __commonJS({
|
|
26072
26071
|
"node_modules/iconv-lite/encodings/utf7.js"(exports$1) {
|
|
26073
|
-
var
|
|
26072
|
+
var Buffer2 = require_safer().Buffer;
|
|
26074
26073
|
exports$1.utf7 = Utf7Codec;
|
|
26075
26074
|
exports$1.unicode11utf7 = "utf7";
|
|
26076
26075
|
function Utf7Codec(codecOptions, iconv2) {
|
|
@@ -26084,7 +26083,7 @@ var require_utf7 = __commonJS({
|
|
|
26084
26083
|
this.iconv = codec.iconv;
|
|
26085
26084
|
}
|
|
26086
26085
|
Utf7Encoder.prototype.write = function(str) {
|
|
26087
|
-
return
|
|
26086
|
+
return Buffer2.from(str.replace(nonDirectChars, function(chunk) {
|
|
26088
26087
|
return "+" + (chunk === "+" ? "" : this.iconv.encode(chunk, "utf16-be").toString("base64").replace(/=+$/, "")) + "-";
|
|
26089
26088
|
}.bind(this)));
|
|
26090
26089
|
};
|
|
@@ -26122,7 +26121,7 @@ var require_utf7 = __commonJS({
|
|
|
26122
26121
|
res += "+";
|
|
26123
26122
|
} else {
|
|
26124
26123
|
var b64str = base64Accum + this.iconv.decode(buf.slice(lastI, i2), "ascii");
|
|
26125
|
-
res += this.iconv.decode(
|
|
26124
|
+
res += this.iconv.decode(Buffer2.from(b64str, "base64"), "utf16-be");
|
|
26126
26125
|
}
|
|
26127
26126
|
if (buf[i2] != minusChar) {
|
|
26128
26127
|
i2--;
|
|
@@ -26140,7 +26139,7 @@ var require_utf7 = __commonJS({
|
|
|
26140
26139
|
var canBeDecoded = b64str.length - b64str.length % 8;
|
|
26141
26140
|
base64Accum = b64str.slice(canBeDecoded);
|
|
26142
26141
|
b64str = b64str.slice(0, canBeDecoded);
|
|
26143
|
-
res += this.iconv.decode(
|
|
26142
|
+
res += this.iconv.decode(Buffer2.from(b64str, "base64"), "utf16-be");
|
|
26144
26143
|
}
|
|
26145
26144
|
this.inBase64 = inBase64;
|
|
26146
26145
|
this.base64Accum = base64Accum;
|
|
@@ -26149,7 +26148,7 @@ var require_utf7 = __commonJS({
|
|
|
26149
26148
|
Utf7Decoder.prototype.end = function() {
|
|
26150
26149
|
var res = "";
|
|
26151
26150
|
if (this.inBase64 && this.base64Accum.length > 0) {
|
|
26152
|
-
res = this.iconv.decode(
|
|
26151
|
+
res = this.iconv.decode(Buffer2.from(this.base64Accum, "base64"), "utf16-be");
|
|
26153
26152
|
}
|
|
26154
26153
|
this.inBase64 = false;
|
|
26155
26154
|
this.base64Accum = "";
|
|
@@ -26165,14 +26164,14 @@ var require_utf7 = __commonJS({
|
|
|
26165
26164
|
function Utf7IMAPEncoder(options, codec) {
|
|
26166
26165
|
this.iconv = codec.iconv;
|
|
26167
26166
|
this.inBase64 = false;
|
|
26168
|
-
this.base64Accum =
|
|
26167
|
+
this.base64Accum = Buffer2.alloc(6);
|
|
26169
26168
|
this.base64AccumIdx = 0;
|
|
26170
26169
|
}
|
|
26171
26170
|
Utf7IMAPEncoder.prototype.write = function(str) {
|
|
26172
26171
|
var inBase64 = this.inBase64;
|
|
26173
26172
|
var base64Accum = this.base64Accum;
|
|
26174
26173
|
var base64AccumIdx = this.base64AccumIdx;
|
|
26175
|
-
var buf =
|
|
26174
|
+
var buf = Buffer2.alloc(str.length * 5 + 10);
|
|
26176
26175
|
var bufIdx = 0;
|
|
26177
26176
|
for (var i2 = 0; i2 < str.length; i2++) {
|
|
26178
26177
|
var uChar = str.charCodeAt(i2);
|
|
@@ -26211,7 +26210,7 @@ var require_utf7 = __commonJS({
|
|
|
26211
26210
|
return buf.slice(0, bufIdx);
|
|
26212
26211
|
};
|
|
26213
26212
|
Utf7IMAPEncoder.prototype.end = function() {
|
|
26214
|
-
var buf =
|
|
26213
|
+
var buf = Buffer2.alloc(10);
|
|
26215
26214
|
var bufIdx = 0;
|
|
26216
26215
|
if (this.inBase64) {
|
|
26217
26216
|
if (this.base64AccumIdx > 0) {
|
|
@@ -26248,7 +26247,7 @@ var require_utf7 = __commonJS({
|
|
|
26248
26247
|
res += "&";
|
|
26249
26248
|
} else {
|
|
26250
26249
|
var b64str = base64Accum + this.iconv.decode(buf.slice(lastI, i2), "ascii").replace(/,/g, "/");
|
|
26251
|
-
res += this.iconv.decode(
|
|
26250
|
+
res += this.iconv.decode(Buffer2.from(b64str, "base64"), "utf16-be");
|
|
26252
26251
|
}
|
|
26253
26252
|
if (buf[i2] != minusChar) {
|
|
26254
26253
|
i2--;
|
|
@@ -26266,7 +26265,7 @@ var require_utf7 = __commonJS({
|
|
|
26266
26265
|
var canBeDecoded = b64str.length - b64str.length % 8;
|
|
26267
26266
|
base64Accum = b64str.slice(canBeDecoded);
|
|
26268
26267
|
b64str = b64str.slice(0, canBeDecoded);
|
|
26269
|
-
res += this.iconv.decode(
|
|
26268
|
+
res += this.iconv.decode(Buffer2.from(b64str, "base64"), "utf16-be");
|
|
26270
26269
|
}
|
|
26271
26270
|
this.inBase64 = inBase64;
|
|
26272
26271
|
this.base64Accum = base64Accum;
|
|
@@ -26275,7 +26274,7 @@ var require_utf7 = __commonJS({
|
|
|
26275
26274
|
Utf7IMAPDecoder.prototype.end = function() {
|
|
26276
26275
|
var res = "";
|
|
26277
26276
|
if (this.inBase64 && this.base64Accum.length > 0) {
|
|
26278
|
-
res = this.iconv.decode(
|
|
26277
|
+
res = this.iconv.decode(Buffer2.from(this.base64Accum, "base64"), "utf16-be");
|
|
26279
26278
|
}
|
|
26280
26279
|
this.inBase64 = false;
|
|
26281
26280
|
this.base64Accum = "";
|
|
@@ -26287,7 +26286,7 @@ var require_utf7 = __commonJS({
|
|
|
26287
26286
|
// node_modules/iconv-lite/encodings/sbcs-codec.js
|
|
26288
26287
|
var require_sbcs_codec = __commonJS({
|
|
26289
26288
|
"node_modules/iconv-lite/encodings/sbcs-codec.js"(exports$1) {
|
|
26290
|
-
var
|
|
26289
|
+
var Buffer2 = require_safer().Buffer;
|
|
26291
26290
|
exports$1._sbcs = SBCSCodec;
|
|
26292
26291
|
function SBCSCodec(codecOptions, iconv2) {
|
|
26293
26292
|
if (!codecOptions) {
|
|
@@ -26303,8 +26302,8 @@ var require_sbcs_codec = __commonJS({
|
|
|
26303
26302
|
}
|
|
26304
26303
|
codecOptions.chars = asciiString + codecOptions.chars;
|
|
26305
26304
|
}
|
|
26306
|
-
this.decodeBuf =
|
|
26307
|
-
var encodeBuf =
|
|
26305
|
+
this.decodeBuf = Buffer2.from(codecOptions.chars, "ucs2");
|
|
26306
|
+
var encodeBuf = Buffer2.alloc(65536, iconv2.defaultCharSingleByte.charCodeAt(0));
|
|
26308
26307
|
for (var i = 0; i < codecOptions.chars.length; i++) {
|
|
26309
26308
|
encodeBuf[codecOptions.chars.charCodeAt(i)] = i;
|
|
26310
26309
|
}
|
|
@@ -26316,7 +26315,7 @@ var require_sbcs_codec = __commonJS({
|
|
|
26316
26315
|
this.encodeBuf = codec.encodeBuf;
|
|
26317
26316
|
}
|
|
26318
26317
|
SBCSEncoder.prototype.write = function(str) {
|
|
26319
|
-
var buf =
|
|
26318
|
+
var buf = Buffer2.alloc(str.length);
|
|
26320
26319
|
for (var i = 0; i < str.length; i++) {
|
|
26321
26320
|
buf[i] = this.encodeBuf[str.charCodeAt(i)];
|
|
26322
26321
|
}
|
|
@@ -26329,7 +26328,7 @@ var require_sbcs_codec = __commonJS({
|
|
|
26329
26328
|
}
|
|
26330
26329
|
SBCSDecoder.prototype.write = function(buf) {
|
|
26331
26330
|
var decodeBuf = this.decodeBuf;
|
|
26332
|
-
var newBuf =
|
|
26331
|
+
var newBuf = Buffer2.alloc(buf.length * 2);
|
|
26333
26332
|
var idx1 = 0;
|
|
26334
26333
|
var idx2 = 0;
|
|
26335
26334
|
for (var i = 0; i < buf.length; i++) {
|
|
@@ -26954,7 +26953,7 @@ var require_sbcs_data_generated = __commonJS({
|
|
|
26954
26953
|
// node_modules/iconv-lite/encodings/dbcs-codec.js
|
|
26955
26954
|
var require_dbcs_codec = __commonJS({
|
|
26956
26955
|
"node_modules/iconv-lite/encodings/dbcs-codec.js"(exports$1) {
|
|
26957
|
-
var
|
|
26956
|
+
var Buffer2 = require_safer().Buffer;
|
|
26958
26957
|
exports$1._dbcs = DBCSCodec;
|
|
26959
26958
|
var UNASSIGNED = -1;
|
|
26960
26959
|
var GB18030_CODE = -2;
|
|
@@ -27190,7 +27189,7 @@ var require_dbcs_codec = __commonJS({
|
|
|
27190
27189
|
this.gb18030 = codec.gb18030;
|
|
27191
27190
|
}
|
|
27192
27191
|
DBCSEncoder.prototype.write = function(str) {
|
|
27193
|
-
var newBuf =
|
|
27192
|
+
var newBuf = Buffer2.alloc(str.length * (this.gb18030 ? 4 : 3));
|
|
27194
27193
|
var leadSurrogate = this.leadSurrogate;
|
|
27195
27194
|
var seqObj = this.seqObj;
|
|
27196
27195
|
var nextChar = -1;
|
|
@@ -27293,7 +27292,7 @@ var require_dbcs_codec = __commonJS({
|
|
|
27293
27292
|
if (this.leadSurrogate === -1 && this.seqObj === void 0) {
|
|
27294
27293
|
return;
|
|
27295
27294
|
}
|
|
27296
|
-
var newBuf =
|
|
27295
|
+
var newBuf = Buffer2.alloc(10);
|
|
27297
27296
|
var j = 0;
|
|
27298
27297
|
if (this.seqObj) {
|
|
27299
27298
|
var dbcsCode = this.seqObj[DEF_CHAR];
|
|
@@ -27323,7 +27322,7 @@ var require_dbcs_codec = __commonJS({
|
|
|
27323
27322
|
this.gb18030 = codec.gb18030;
|
|
27324
27323
|
}
|
|
27325
27324
|
DBCSDecoder.prototype.write = function(buf) {
|
|
27326
|
-
var newBuf =
|
|
27325
|
+
var newBuf = Buffer2.alloc(buf.length * 2);
|
|
27327
27326
|
var nodeIdx = this.nodeIdx;
|
|
27328
27327
|
var prevBytes = this.prevBytes;
|
|
27329
27328
|
var prevOffset = this.prevBytes.length;
|
|
@@ -28928,7 +28927,7 @@ var require_encodings = __commonJS({
|
|
|
28928
28927
|
// node_modules/iconv-lite/lib/streams.js
|
|
28929
28928
|
var require_streams = __commonJS({
|
|
28930
28929
|
"node_modules/iconv-lite/lib/streams.js"(exports$1, module) {
|
|
28931
|
-
var
|
|
28930
|
+
var Buffer2 = require_safer().Buffer;
|
|
28932
28931
|
module.exports = function(streamModule) {
|
|
28933
28932
|
var Transform = streamModule.Transform;
|
|
28934
28933
|
function IconvLiteEncoderStream(conv, options) {
|
|
@@ -28968,7 +28967,7 @@ var require_streams = __commonJS({
|
|
|
28968
28967
|
chunks.push(chunk);
|
|
28969
28968
|
});
|
|
28970
28969
|
this.on("end", function() {
|
|
28971
|
-
cb(null,
|
|
28970
|
+
cb(null, Buffer2.concat(chunks));
|
|
28972
28971
|
});
|
|
28973
28972
|
return this;
|
|
28974
28973
|
};
|
|
@@ -28982,7 +28981,7 @@ var require_streams = __commonJS({
|
|
|
28982
28981
|
constructor: { value: IconvLiteDecoderStream }
|
|
28983
28982
|
});
|
|
28984
28983
|
IconvLiteDecoderStream.prototype._transform = function(chunk, encoding, done) {
|
|
28985
|
-
if (!
|
|
28984
|
+
if (!Buffer2.isBuffer(chunk) && !(chunk instanceof Uint8Array)) {
|
|
28986
28985
|
return done(new Error("Iconv decoding stream needs buffers as its input."));
|
|
28987
28986
|
}
|
|
28988
28987
|
try {
|
|
@@ -29024,7 +29023,7 @@ var require_streams = __commonJS({
|
|
|
29024
29023
|
// node_modules/iconv-lite/lib/index.js
|
|
29025
29024
|
var require_lib3 = __commonJS({
|
|
29026
29025
|
"node_modules/iconv-lite/lib/index.js"(exports$1, module) {
|
|
29027
|
-
var
|
|
29026
|
+
var Buffer2 = require_safer().Buffer;
|
|
29028
29027
|
var bomHandling = require_bom_handling();
|
|
29029
29028
|
var mergeModules = require_merge_exports();
|
|
29030
29029
|
module.exports.encodings = null;
|
|
@@ -29035,7 +29034,7 @@ var require_lib3 = __commonJS({
|
|
|
29035
29034
|
var encoder = module.exports.getEncoder(encoding, options);
|
|
29036
29035
|
var res = encoder.write(str);
|
|
29037
29036
|
var trail = encoder.end();
|
|
29038
|
-
return trail && trail.length > 0 ?
|
|
29037
|
+
return trail && trail.length > 0 ? Buffer2.concat([res, trail]) : res;
|
|
29039
29038
|
};
|
|
29040
29039
|
module.exports.decode = function decode(buf, encoding, options) {
|
|
29041
29040
|
if (typeof buf === "string") {
|
|
@@ -29043,7 +29042,7 @@ var require_lib3 = __commonJS({
|
|
|
29043
29042
|
console.error("Iconv-lite warning: decode()-ing strings is deprecated. Refer to https://github.com/ashtuchkin/iconv-lite/wiki/Use-Buffers-when-decoding");
|
|
29044
29043
|
module.exports.skipDecodeWarning = true;
|
|
29045
29044
|
}
|
|
29046
|
-
buf =
|
|
29045
|
+
buf = Buffer2.from("" + (buf || ""), "binary");
|
|
29047
29046
|
}
|
|
29048
29047
|
var decoder = module.exports.getDecoder(encoding, options);
|
|
29049
29048
|
var res = decoder.write(buf);
|
|
@@ -29884,7 +29883,7 @@ if (process.platform === "linux") {
|
|
|
29884
29883
|
}
|
|
29885
29884
|
|
|
29886
29885
|
// node_modules/signal-exit/dist/mjs/index.js
|
|
29887
|
-
var processOk = (
|
|
29886
|
+
var processOk = (process11) => !!process11 && typeof process11 === "object" && typeof process11.removeListener === "function" && typeof process11.emit === "function" && typeof process11.reallyExit === "function" && typeof process11.listeners === "function" && typeof process11.kill === "function" && typeof process11.pid === "number" && typeof process11.on === "function";
|
|
29888
29887
|
var kExitEmitter = /* @__PURE__ */ Symbol.for("signal-exit emitter");
|
|
29889
29888
|
var global2 = globalThis;
|
|
29890
29889
|
var ObjectDefineProperty = Object.defineProperty.bind(Object);
|
|
@@ -29967,7 +29966,7 @@ var SignalExitFallback = class extends SignalExitBase {
|
|
|
29967
29966
|
};
|
|
29968
29967
|
var _hupSig, _emitter, _process, _originalProcessEmit, _originalProcessReallyExit, _sigListeners, _loaded, _SignalExit_instances, processReallyExit_fn, processEmit_fn;
|
|
29969
29968
|
var SignalExit = class extends SignalExitBase {
|
|
29970
|
-
constructor(
|
|
29969
|
+
constructor(process11) {
|
|
29971
29970
|
super();
|
|
29972
29971
|
__privateAdd(this, _SignalExit_instances);
|
|
29973
29972
|
// "SIGHUP" throws an `ENOSYS` error on Windows,
|
|
@@ -29981,13 +29980,13 @@ var SignalExit = class extends SignalExitBase {
|
|
|
29981
29980
|
__privateAdd(this, _originalProcessReallyExit);
|
|
29982
29981
|
__privateAdd(this, _sigListeners, {});
|
|
29983
29982
|
__privateAdd(this, _loaded, false);
|
|
29984
|
-
__privateSet(this, _process,
|
|
29983
|
+
__privateSet(this, _process, process11);
|
|
29985
29984
|
__privateSet(this, _sigListeners, {});
|
|
29986
29985
|
for (const sig of signals) {
|
|
29987
29986
|
__privateGet(this, _sigListeners)[sig] = () => {
|
|
29988
29987
|
const listeners = __privateGet(this, _process).listeners(sig);
|
|
29989
29988
|
let { count } = __privateGet(this, _emitter);
|
|
29990
|
-
const p =
|
|
29989
|
+
const p = process11;
|
|
29991
29990
|
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
|
|
29992
29991
|
count += p.__signal_exit_emitter__.count;
|
|
29993
29992
|
}
|
|
@@ -29996,12 +29995,12 @@ var SignalExit = class extends SignalExitBase {
|
|
|
29996
29995
|
const ret = __privateGet(this, _emitter).emit("exit", null, sig);
|
|
29997
29996
|
const s = sig === "SIGHUP" ? __privateGet(this, _hupSig) : sig;
|
|
29998
29997
|
if (!ret)
|
|
29999
|
-
|
|
29998
|
+
process11.kill(process11.pid, s);
|
|
30000
29999
|
}
|
|
30001
30000
|
};
|
|
30002
30001
|
}
|
|
30003
|
-
__privateSet(this, _originalProcessReallyExit,
|
|
30004
|
-
__privateSet(this, _originalProcessEmit,
|
|
30002
|
+
__privateSet(this, _originalProcessReallyExit, process11.reallyExit);
|
|
30003
|
+
__privateSet(this, _originalProcessEmit, process11.emit);
|
|
30005
30004
|
}
|
|
30006
30005
|
onExit(cb, opts) {
|
|
30007
30006
|
if (!processOk(__privateGet(this, _process))) {
|
|
@@ -32488,8 +32487,8 @@ var ExternalEditor = class {
|
|
|
32488
32487
|
const prefix = sanitizeAffix(this.fileOptions.prefix);
|
|
32489
32488
|
const postfix = sanitizeAffix(this.fileOptions.postfix);
|
|
32490
32489
|
const filename = `${prefix}${id}${postfix}`;
|
|
32491
|
-
const candidate =
|
|
32492
|
-
const baseResolved =
|
|
32490
|
+
const candidate = path4.resolve(baseDir, filename);
|
|
32491
|
+
const baseResolved = path4.resolve(baseDir) + path4.sep;
|
|
32493
32492
|
if (!candidate.startsWith(baseResolved)) {
|
|
32494
32493
|
throw new Error("Resolved temporary file escaped the base directory");
|
|
32495
32494
|
}
|
|
@@ -32945,472 +32944,6 @@ var inquirer = {
|
|
|
32945
32944
|
Separator
|
|
32946
32945
|
};
|
|
32947
32946
|
var lib_default = inquirer;
|
|
32948
|
-
var isDockerCached;
|
|
32949
|
-
function hasDockerEnv() {
|
|
32950
|
-
try {
|
|
32951
|
-
fs.statSync("/.dockerenv");
|
|
32952
|
-
return true;
|
|
32953
|
-
} catch {
|
|
32954
|
-
return false;
|
|
32955
|
-
}
|
|
32956
|
-
}
|
|
32957
|
-
function hasDockerCGroup() {
|
|
32958
|
-
try {
|
|
32959
|
-
return fs.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
|
|
32960
|
-
} catch {
|
|
32961
|
-
return false;
|
|
32962
|
-
}
|
|
32963
|
-
}
|
|
32964
|
-
function isDocker() {
|
|
32965
|
-
if (isDockerCached === void 0) {
|
|
32966
|
-
isDockerCached = hasDockerEnv() || hasDockerCGroup();
|
|
32967
|
-
}
|
|
32968
|
-
return isDockerCached;
|
|
32969
|
-
}
|
|
32970
|
-
|
|
32971
|
-
// node_modules/is-inside-container/index.js
|
|
32972
|
-
var cachedResult;
|
|
32973
|
-
var hasContainerEnv = () => {
|
|
32974
|
-
try {
|
|
32975
|
-
fs.statSync("/run/.containerenv");
|
|
32976
|
-
return true;
|
|
32977
|
-
} catch {
|
|
32978
|
-
return false;
|
|
32979
|
-
}
|
|
32980
|
-
};
|
|
32981
|
-
function isInsideContainer() {
|
|
32982
|
-
if (cachedResult === void 0) {
|
|
32983
|
-
cachedResult = hasContainerEnv() || isDocker();
|
|
32984
|
-
}
|
|
32985
|
-
return cachedResult;
|
|
32986
|
-
}
|
|
32987
|
-
|
|
32988
|
-
// node_modules/is-wsl/index.js
|
|
32989
|
-
var isWsl = () => {
|
|
32990
|
-
if (process6.platform !== "linux") {
|
|
32991
|
-
return false;
|
|
32992
|
-
}
|
|
32993
|
-
if (os.release().toLowerCase().includes("microsoft")) {
|
|
32994
|
-
if (isInsideContainer()) {
|
|
32995
|
-
return false;
|
|
32996
|
-
}
|
|
32997
|
-
return true;
|
|
32998
|
-
}
|
|
32999
|
-
try {
|
|
33000
|
-
return fs.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft") ? !isInsideContainer() : false;
|
|
33001
|
-
} catch {
|
|
33002
|
-
return false;
|
|
33003
|
-
}
|
|
33004
|
-
};
|
|
33005
|
-
var is_wsl_default = process6.env.__IS_WSL_TEST__ ? isWsl : isWsl();
|
|
33006
|
-
|
|
33007
|
-
// node_modules/wsl-utils/index.js
|
|
33008
|
-
var wslDrivesMountPoint = /* @__PURE__ */ (() => {
|
|
33009
|
-
const defaultMountPoint = "/mnt/";
|
|
33010
|
-
let mountPoint;
|
|
33011
|
-
return async function() {
|
|
33012
|
-
if (mountPoint) {
|
|
33013
|
-
return mountPoint;
|
|
33014
|
-
}
|
|
33015
|
-
const configFilePath = "/etc/wsl.conf";
|
|
33016
|
-
let isConfigFileExists = false;
|
|
33017
|
-
try {
|
|
33018
|
-
await fs7.access(configFilePath, constants.F_OK);
|
|
33019
|
-
isConfigFileExists = true;
|
|
33020
|
-
} catch {
|
|
33021
|
-
}
|
|
33022
|
-
if (!isConfigFileExists) {
|
|
33023
|
-
return defaultMountPoint;
|
|
33024
|
-
}
|
|
33025
|
-
const configContent = await fs7.readFile(configFilePath, { encoding: "utf8" });
|
|
33026
|
-
const configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
|
|
33027
|
-
if (!configMountPoint) {
|
|
33028
|
-
return defaultMountPoint;
|
|
33029
|
-
}
|
|
33030
|
-
mountPoint = configMountPoint.groups.mountPoint.trim();
|
|
33031
|
-
mountPoint = mountPoint.endsWith("/") ? mountPoint : `${mountPoint}/`;
|
|
33032
|
-
return mountPoint;
|
|
33033
|
-
};
|
|
33034
|
-
})();
|
|
33035
|
-
var powerShellPathFromWsl = async () => {
|
|
33036
|
-
const mountPoint = await wslDrivesMountPoint();
|
|
33037
|
-
return `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
|
|
33038
|
-
};
|
|
33039
|
-
var powerShellPath = async () => {
|
|
33040
|
-
if (is_wsl_default) {
|
|
33041
|
-
return powerShellPathFromWsl();
|
|
33042
|
-
}
|
|
33043
|
-
return `${process6.env.SYSTEMROOT || process6.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
|
|
33044
|
-
};
|
|
33045
|
-
|
|
33046
|
-
// node_modules/define-lazy-prop/index.js
|
|
33047
|
-
function defineLazyProperty(object, propertyName, valueGetter) {
|
|
33048
|
-
const define = (value) => Object.defineProperty(object, propertyName, { value, enumerable: true, writable: true });
|
|
33049
|
-
Object.defineProperty(object, propertyName, {
|
|
33050
|
-
configurable: true,
|
|
33051
|
-
enumerable: true,
|
|
33052
|
-
get() {
|
|
33053
|
-
const result = valueGetter();
|
|
33054
|
-
define(result);
|
|
33055
|
-
return result;
|
|
33056
|
-
},
|
|
33057
|
-
set(value) {
|
|
33058
|
-
define(value);
|
|
33059
|
-
}
|
|
33060
|
-
});
|
|
33061
|
-
return object;
|
|
33062
|
-
}
|
|
33063
|
-
var execFileAsync = promisify(execFile);
|
|
33064
|
-
async function defaultBrowserId() {
|
|
33065
|
-
if (process6.platform !== "darwin") {
|
|
33066
|
-
throw new Error("macOS only");
|
|
33067
|
-
}
|
|
33068
|
-
const { stdout } = await execFileAsync("defaults", ["read", "com.apple.LaunchServices/com.apple.launchservices.secure", "LSHandlers"]);
|
|
33069
|
-
const match = /LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout);
|
|
33070
|
-
const browserId = match?.groups.id ?? "com.apple.Safari";
|
|
33071
|
-
if (browserId === "com.apple.safari") {
|
|
33072
|
-
return "com.apple.Safari";
|
|
33073
|
-
}
|
|
33074
|
-
return browserId;
|
|
33075
|
-
}
|
|
33076
|
-
var execFileAsync2 = promisify(execFile);
|
|
33077
|
-
async function runAppleScript(script, { humanReadableOutput = true, signal } = {}) {
|
|
33078
|
-
if (process6.platform !== "darwin") {
|
|
33079
|
-
throw new Error("macOS only");
|
|
33080
|
-
}
|
|
33081
|
-
const outputArguments = humanReadableOutput ? [] : ["-ss"];
|
|
33082
|
-
const execOptions = {};
|
|
33083
|
-
if (signal) {
|
|
33084
|
-
execOptions.signal = signal;
|
|
33085
|
-
}
|
|
33086
|
-
const { stdout } = await execFileAsync2("osascript", ["-e", script, outputArguments], execOptions);
|
|
33087
|
-
return stdout.trim();
|
|
33088
|
-
}
|
|
33089
|
-
|
|
33090
|
-
// node_modules/bundle-name/index.js
|
|
33091
|
-
async function bundleName(bundleId) {
|
|
33092
|
-
return runAppleScript(`tell application "Finder" to set app_path to application file id "${bundleId}" as string
|
|
33093
|
-
tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`);
|
|
33094
|
-
}
|
|
33095
|
-
var execFileAsync3 = promisify(execFile);
|
|
33096
|
-
var windowsBrowserProgIds = {
|
|
33097
|
-
MSEdgeHTM: { name: "Edge", id: "com.microsoft.edge" },
|
|
33098
|
-
// The missing `L` is correct.
|
|
33099
|
-
MSEdgeBHTML: { name: "Edge Beta", id: "com.microsoft.edge.beta" },
|
|
33100
|
-
MSEdgeDHTML: { name: "Edge Dev", id: "com.microsoft.edge.dev" },
|
|
33101
|
-
AppXq0fevzme2pys62n3e0fbqa7peapykr8v: { name: "Edge", id: "com.microsoft.edge.old" },
|
|
33102
|
-
ChromeHTML: { name: "Chrome", id: "com.google.chrome" },
|
|
33103
|
-
ChromeBHTML: { name: "Chrome Beta", id: "com.google.chrome.beta" },
|
|
33104
|
-
ChromeDHTML: { name: "Chrome Dev", id: "com.google.chrome.dev" },
|
|
33105
|
-
ChromiumHTM: { name: "Chromium", id: "org.chromium.Chromium" },
|
|
33106
|
-
BraveHTML: { name: "Brave", id: "com.brave.Browser" },
|
|
33107
|
-
BraveBHTML: { name: "Brave Beta", id: "com.brave.Browser.beta" },
|
|
33108
|
-
BraveDHTML: { name: "Brave Dev", id: "com.brave.Browser.dev" },
|
|
33109
|
-
BraveSSHTM: { name: "Brave Nightly", id: "com.brave.Browser.nightly" },
|
|
33110
|
-
FirefoxURL: { name: "Firefox", id: "org.mozilla.firefox" },
|
|
33111
|
-
OperaStable: { name: "Opera", id: "com.operasoftware.Opera" },
|
|
33112
|
-
VivaldiHTM: { name: "Vivaldi", id: "com.vivaldi.Vivaldi" },
|
|
33113
|
-
"IE.HTTP": { name: "Internet Explorer", id: "com.microsoft.ie" }
|
|
33114
|
-
};
|
|
33115
|
-
new Map(Object.entries(windowsBrowserProgIds));
|
|
33116
|
-
var UnknownBrowserError = class extends Error {
|
|
33117
|
-
};
|
|
33118
|
-
async function defaultBrowser(_execFileAsync = execFileAsync3) {
|
|
33119
|
-
const { stdout } = await _execFileAsync("reg", [
|
|
33120
|
-
"QUERY",
|
|
33121
|
-
" HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice",
|
|
33122
|
-
"/v",
|
|
33123
|
-
"ProgId"
|
|
33124
|
-
]);
|
|
33125
|
-
const match = /ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(stdout);
|
|
33126
|
-
if (!match) {
|
|
33127
|
-
throw new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout)}`);
|
|
33128
|
-
}
|
|
33129
|
-
const { id } = match.groups;
|
|
33130
|
-
const dotIndex = id.lastIndexOf(".");
|
|
33131
|
-
const hyphenIndex = id.lastIndexOf("-");
|
|
33132
|
-
const baseIdByDot = dotIndex === -1 ? void 0 : id.slice(0, dotIndex);
|
|
33133
|
-
const baseIdByHyphen = hyphenIndex === -1 ? void 0 : id.slice(0, hyphenIndex);
|
|
33134
|
-
return windowsBrowserProgIds[id] ?? windowsBrowserProgIds[baseIdByDot] ?? windowsBrowserProgIds[baseIdByHyphen] ?? { name: id, id };
|
|
33135
|
-
}
|
|
33136
|
-
|
|
33137
|
-
// node_modules/default-browser/index.js
|
|
33138
|
-
var execFileAsync4 = promisify(execFile);
|
|
33139
|
-
var titleize = (string) => string.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x) => x.toUpperCase());
|
|
33140
|
-
async function defaultBrowser2() {
|
|
33141
|
-
if (process6.platform === "darwin") {
|
|
33142
|
-
const id = await defaultBrowserId();
|
|
33143
|
-
const name = await bundleName(id);
|
|
33144
|
-
return { name, id };
|
|
33145
|
-
}
|
|
33146
|
-
if (process6.platform === "linux") {
|
|
33147
|
-
const { stdout } = await execFileAsync4("xdg-mime", ["query", "default", "x-scheme-handler/http"]);
|
|
33148
|
-
const id = stdout.trim();
|
|
33149
|
-
const name = titleize(id.replace(/.desktop$/, "").replace("-", " "));
|
|
33150
|
-
return { name, id };
|
|
33151
|
-
}
|
|
33152
|
-
if (process6.platform === "win32") {
|
|
33153
|
-
return defaultBrowser();
|
|
33154
|
-
}
|
|
33155
|
-
throw new Error("Only macOS, Linux, and Windows are supported");
|
|
33156
|
-
}
|
|
33157
|
-
|
|
33158
|
-
// node_modules/open/index.js
|
|
33159
|
-
var execFile5 = promisify(childProcess.execFile);
|
|
33160
|
-
var __dirname$1 = path5.dirname(fileURLToPath(import.meta.url));
|
|
33161
|
-
var localXdgOpenPath = path5.join(__dirname$1, "xdg-open");
|
|
33162
|
-
var { platform, arch } = process6;
|
|
33163
|
-
async function getWindowsDefaultBrowserFromWsl() {
|
|
33164
|
-
const powershellPath = await powerShellPath();
|
|
33165
|
-
const rawCommand = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`;
|
|
33166
|
-
const encodedCommand = Buffer$1.from(rawCommand, "utf16le").toString("base64");
|
|
33167
|
-
const { stdout } = await execFile5(
|
|
33168
|
-
powershellPath,
|
|
33169
|
-
[
|
|
33170
|
-
"-NoProfile",
|
|
33171
|
-
"-NonInteractive",
|
|
33172
|
-
"-ExecutionPolicy",
|
|
33173
|
-
"Bypass",
|
|
33174
|
-
"-EncodedCommand",
|
|
33175
|
-
encodedCommand
|
|
33176
|
-
],
|
|
33177
|
-
{ encoding: "utf8" }
|
|
33178
|
-
);
|
|
33179
|
-
const progId = stdout.trim();
|
|
33180
|
-
const browserMap = {
|
|
33181
|
-
ChromeHTML: "com.google.chrome",
|
|
33182
|
-
BraveHTML: "com.brave.Browser",
|
|
33183
|
-
MSEdgeHTM: "com.microsoft.edge",
|
|
33184
|
-
FirefoxURL: "org.mozilla.firefox"
|
|
33185
|
-
};
|
|
33186
|
-
return browserMap[progId] ? { id: browserMap[progId] } : {};
|
|
33187
|
-
}
|
|
33188
|
-
var pTryEach = async (array, mapper) => {
|
|
33189
|
-
let latestError;
|
|
33190
|
-
for (const item of array) {
|
|
33191
|
-
try {
|
|
33192
|
-
return await mapper(item);
|
|
33193
|
-
} catch (error) {
|
|
33194
|
-
latestError = error;
|
|
33195
|
-
}
|
|
33196
|
-
}
|
|
33197
|
-
throw latestError;
|
|
33198
|
-
};
|
|
33199
|
-
var baseOpen = async (options) => {
|
|
33200
|
-
options = {
|
|
33201
|
-
wait: false,
|
|
33202
|
-
background: false,
|
|
33203
|
-
newInstance: false,
|
|
33204
|
-
allowNonzeroExitCode: false,
|
|
33205
|
-
...options
|
|
33206
|
-
};
|
|
33207
|
-
if (Array.isArray(options.app)) {
|
|
33208
|
-
return pTryEach(options.app, (singleApp) => baseOpen({
|
|
33209
|
-
...options,
|
|
33210
|
-
app: singleApp
|
|
33211
|
-
}));
|
|
33212
|
-
}
|
|
33213
|
-
let { name: app, arguments: appArguments = [] } = options.app ?? {};
|
|
33214
|
-
appArguments = [...appArguments];
|
|
33215
|
-
if (Array.isArray(app)) {
|
|
33216
|
-
return pTryEach(app, (appName) => baseOpen({
|
|
33217
|
-
...options,
|
|
33218
|
-
app: {
|
|
33219
|
-
name: appName,
|
|
33220
|
-
arguments: appArguments
|
|
33221
|
-
}
|
|
33222
|
-
}));
|
|
33223
|
-
}
|
|
33224
|
-
if (app === "browser" || app === "browserPrivate") {
|
|
33225
|
-
const ids = {
|
|
33226
|
-
"com.google.chrome": "chrome",
|
|
33227
|
-
"google-chrome.desktop": "chrome",
|
|
33228
|
-
"com.brave.Browser": "brave",
|
|
33229
|
-
"org.mozilla.firefox": "firefox",
|
|
33230
|
-
"firefox.desktop": "firefox",
|
|
33231
|
-
"com.microsoft.msedge": "edge",
|
|
33232
|
-
"com.microsoft.edge": "edge",
|
|
33233
|
-
"com.microsoft.edgemac": "edge",
|
|
33234
|
-
"microsoft-edge.desktop": "edge"
|
|
33235
|
-
};
|
|
33236
|
-
const flags = {
|
|
33237
|
-
chrome: "--incognito",
|
|
33238
|
-
brave: "--incognito",
|
|
33239
|
-
firefox: "--private-window",
|
|
33240
|
-
edge: "--inPrivate"
|
|
33241
|
-
};
|
|
33242
|
-
const browser = is_wsl_default ? await getWindowsDefaultBrowserFromWsl() : await defaultBrowser2();
|
|
33243
|
-
if (browser.id in ids) {
|
|
33244
|
-
const browserName = ids[browser.id];
|
|
33245
|
-
if (app === "browserPrivate") {
|
|
33246
|
-
appArguments.push(flags[browserName]);
|
|
33247
|
-
}
|
|
33248
|
-
return baseOpen({
|
|
33249
|
-
...options,
|
|
33250
|
-
app: {
|
|
33251
|
-
name: apps[browserName],
|
|
33252
|
-
arguments: appArguments
|
|
33253
|
-
}
|
|
33254
|
-
});
|
|
33255
|
-
}
|
|
33256
|
-
throw new Error(`${browser.name} is not supported as a default browser`);
|
|
33257
|
-
}
|
|
33258
|
-
let command;
|
|
33259
|
-
const cliArguments = [];
|
|
33260
|
-
const childProcessOptions = {};
|
|
33261
|
-
if (platform === "darwin") {
|
|
33262
|
-
command = "open";
|
|
33263
|
-
if (options.wait) {
|
|
33264
|
-
cliArguments.push("--wait-apps");
|
|
33265
|
-
}
|
|
33266
|
-
if (options.background) {
|
|
33267
|
-
cliArguments.push("--background");
|
|
33268
|
-
}
|
|
33269
|
-
if (options.newInstance) {
|
|
33270
|
-
cliArguments.push("--new");
|
|
33271
|
-
}
|
|
33272
|
-
if (app) {
|
|
33273
|
-
cliArguments.push("-a", app);
|
|
33274
|
-
}
|
|
33275
|
-
} else if (platform === "win32" || is_wsl_default && !isInsideContainer() && !app) {
|
|
33276
|
-
command = await powerShellPath();
|
|
33277
|
-
cliArguments.push(
|
|
33278
|
-
"-NoProfile",
|
|
33279
|
-
"-NonInteractive",
|
|
33280
|
-
"-ExecutionPolicy",
|
|
33281
|
-
"Bypass",
|
|
33282
|
-
"-EncodedCommand"
|
|
33283
|
-
);
|
|
33284
|
-
if (!is_wsl_default) {
|
|
33285
|
-
childProcessOptions.windowsVerbatimArguments = true;
|
|
33286
|
-
}
|
|
33287
|
-
const encodedArguments = ["Start"];
|
|
33288
|
-
if (options.wait) {
|
|
33289
|
-
encodedArguments.push("-Wait");
|
|
33290
|
-
}
|
|
33291
|
-
if (app) {
|
|
33292
|
-
encodedArguments.push(`"\`"${app}\`""`);
|
|
33293
|
-
if (options.target) {
|
|
33294
|
-
appArguments.push(options.target);
|
|
33295
|
-
}
|
|
33296
|
-
} else if (options.target) {
|
|
33297
|
-
encodedArguments.push(`"${options.target}"`);
|
|
33298
|
-
}
|
|
33299
|
-
if (appArguments.length > 0) {
|
|
33300
|
-
appArguments = appArguments.map((argument) => `"\`"${argument}\`""`);
|
|
33301
|
-
encodedArguments.push("-ArgumentList", appArguments.join(","));
|
|
33302
|
-
}
|
|
33303
|
-
options.target = Buffer$1.from(encodedArguments.join(" "), "utf16le").toString("base64");
|
|
33304
|
-
} else {
|
|
33305
|
-
if (app) {
|
|
33306
|
-
command = app;
|
|
33307
|
-
} else {
|
|
33308
|
-
const isBundled = !__dirname$1 || __dirname$1 === "/";
|
|
33309
|
-
let exeLocalXdgOpen = false;
|
|
33310
|
-
try {
|
|
33311
|
-
await fs7.access(localXdgOpenPath, constants.X_OK);
|
|
33312
|
-
exeLocalXdgOpen = true;
|
|
33313
|
-
} catch {
|
|
33314
|
-
}
|
|
33315
|
-
const useSystemXdgOpen = process6.versions.electron ?? (platform === "android" || isBundled || !exeLocalXdgOpen);
|
|
33316
|
-
command = useSystemXdgOpen ? "xdg-open" : localXdgOpenPath;
|
|
33317
|
-
}
|
|
33318
|
-
if (appArguments.length > 0) {
|
|
33319
|
-
cliArguments.push(...appArguments);
|
|
33320
|
-
}
|
|
33321
|
-
if (!options.wait) {
|
|
33322
|
-
childProcessOptions.stdio = "ignore";
|
|
33323
|
-
childProcessOptions.detached = true;
|
|
33324
|
-
}
|
|
33325
|
-
}
|
|
33326
|
-
if (platform === "darwin" && appArguments.length > 0) {
|
|
33327
|
-
cliArguments.push("--args", ...appArguments);
|
|
33328
|
-
}
|
|
33329
|
-
if (options.target) {
|
|
33330
|
-
cliArguments.push(options.target);
|
|
33331
|
-
}
|
|
33332
|
-
const subprocess = childProcess.spawn(command, cliArguments, childProcessOptions);
|
|
33333
|
-
if (options.wait) {
|
|
33334
|
-
return new Promise((resolve, reject) => {
|
|
33335
|
-
subprocess.once("error", reject);
|
|
33336
|
-
subprocess.once("close", (exitCode) => {
|
|
33337
|
-
if (!options.allowNonzeroExitCode && exitCode > 0) {
|
|
33338
|
-
reject(new Error(`Exited with code ${exitCode}`));
|
|
33339
|
-
return;
|
|
33340
|
-
}
|
|
33341
|
-
resolve(subprocess);
|
|
33342
|
-
});
|
|
33343
|
-
});
|
|
33344
|
-
}
|
|
33345
|
-
subprocess.unref();
|
|
33346
|
-
return subprocess;
|
|
33347
|
-
};
|
|
33348
|
-
var open = (target, options) => {
|
|
33349
|
-
if (typeof target !== "string") {
|
|
33350
|
-
throw new TypeError("Expected a `target`");
|
|
33351
|
-
}
|
|
33352
|
-
return baseOpen({
|
|
33353
|
-
...options,
|
|
33354
|
-
target
|
|
33355
|
-
});
|
|
33356
|
-
};
|
|
33357
|
-
function detectArchBinary(binary) {
|
|
33358
|
-
if (typeof binary === "string" || Array.isArray(binary)) {
|
|
33359
|
-
return binary;
|
|
33360
|
-
}
|
|
33361
|
-
const { [arch]: archBinary } = binary;
|
|
33362
|
-
if (!archBinary) {
|
|
33363
|
-
throw new Error(`${arch} is not supported`);
|
|
33364
|
-
}
|
|
33365
|
-
return archBinary;
|
|
33366
|
-
}
|
|
33367
|
-
function detectPlatformBinary({ [platform]: platformBinary }, { wsl }) {
|
|
33368
|
-
if (wsl && is_wsl_default) {
|
|
33369
|
-
return detectArchBinary(wsl);
|
|
33370
|
-
}
|
|
33371
|
-
if (!platformBinary) {
|
|
33372
|
-
throw new Error(`${platform} is not supported`);
|
|
33373
|
-
}
|
|
33374
|
-
return detectArchBinary(platformBinary);
|
|
33375
|
-
}
|
|
33376
|
-
var apps = {};
|
|
33377
|
-
defineLazyProperty(apps, "chrome", () => detectPlatformBinary({
|
|
33378
|
-
darwin: "google chrome",
|
|
33379
|
-
win32: "chrome",
|
|
33380
|
-
linux: ["google-chrome", "google-chrome-stable", "chromium"]
|
|
33381
|
-
}, {
|
|
33382
|
-
wsl: {
|
|
33383
|
-
ia32: "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",
|
|
33384
|
-
x64: ["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe", "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]
|
|
33385
|
-
}
|
|
33386
|
-
}));
|
|
33387
|
-
defineLazyProperty(apps, "brave", () => detectPlatformBinary({
|
|
33388
|
-
darwin: "brave browser",
|
|
33389
|
-
win32: "brave",
|
|
33390
|
-
linux: ["brave-browser", "brave"]
|
|
33391
|
-
}, {
|
|
33392
|
-
wsl: {
|
|
33393
|
-
ia32: "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",
|
|
33394
|
-
x64: ["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe", "/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]
|
|
33395
|
-
}
|
|
33396
|
-
}));
|
|
33397
|
-
defineLazyProperty(apps, "firefox", () => detectPlatformBinary({
|
|
33398
|
-
darwin: "firefox",
|
|
33399
|
-
win32: String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,
|
|
33400
|
-
linux: "firefox"
|
|
33401
|
-
}, {
|
|
33402
|
-
wsl: "/mnt/c/Program Files/Mozilla Firefox/firefox.exe"
|
|
33403
|
-
}));
|
|
33404
|
-
defineLazyProperty(apps, "edge", () => detectPlatformBinary({
|
|
33405
|
-
darwin: "microsoft edge",
|
|
33406
|
-
win32: "msedge",
|
|
33407
|
-
linux: ["microsoft-edge", "microsoft-edge-dev"]
|
|
33408
|
-
}, {
|
|
33409
|
-
wsl: "/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"
|
|
33410
|
-
}));
|
|
33411
|
-
defineLazyProperty(apps, "browser", () => "browser");
|
|
33412
|
-
defineLazyProperty(apps, "browserPrivate", () => "browserPrivate");
|
|
33413
|
-
var open_default = open;
|
|
33414
32947
|
var PORTAL_URL = process.env.UPTRADE_PORTAL_URL || "https://portal.uptrademedia.com";
|
|
33415
32948
|
var API_URL = process.env.UPTRADE_API_URL || "https://api.uptrademedia.com";
|
|
33416
32949
|
async function authenticateWithUptrade() {
|
|
@@ -33475,7 +33008,7 @@ async function authenticateWithUptrade() {
|
|
|
33475
33008
|
console.log("\n Opening browser for authentication...");
|
|
33476
33009
|
console.log(` If browser doesn't open, visit: ${authUrl}
|
|
33477
33010
|
`);
|
|
33478
|
-
|
|
33011
|
+
open(authUrl).catch(() => {
|
|
33479
33012
|
console.log(" Could not open browser automatically.");
|
|
33480
33013
|
});
|
|
33481
33014
|
});
|
|
@@ -33720,7 +33253,7 @@ async function initCommand(options) {
|
|
|
33720
33253
|
type: "input",
|
|
33721
33254
|
name: "name",
|
|
33722
33255
|
message: "Project name:",
|
|
33723
|
-
default:
|
|
33256
|
+
default: path4.basename(process.cwd()),
|
|
33724
33257
|
validate: (input) => input.length > 0 || "Name is required"
|
|
33725
33258
|
},
|
|
33726
33259
|
{
|
|
@@ -33833,7 +33366,7 @@ async function initCommand(options) {
|
|
|
33833
33366
|
async function checkNextJsProject() {
|
|
33834
33367
|
try {
|
|
33835
33368
|
const packageJson = JSON.parse(
|
|
33836
|
-
await
|
|
33369
|
+
await fs2.readFile(path4.join(process.cwd(), "package.json"), "utf-8")
|
|
33837
33370
|
);
|
|
33838
33371
|
return !!(packageJson.dependencies?.next || packageJson.devDependencies?.next);
|
|
33839
33372
|
} catch {
|
|
@@ -33860,7 +33393,7 @@ async function scanCommand(options) {
|
|
|
33860
33393
|
console.log("");
|
|
33861
33394
|
console.log(source_default.bold(" Scanning codebase..."));
|
|
33862
33395
|
console.log("");
|
|
33863
|
-
const targetDir =
|
|
33396
|
+
const targetDir = path4.resolve(options.dir || ".");
|
|
33864
33397
|
const spinner = ora("Looking for forms, metadata, widgets, schemas, FAQs, analytics, and images...").start();
|
|
33865
33398
|
let scanResults;
|
|
33866
33399
|
try {
|
|
@@ -34038,7 +33571,7 @@ function filePathToPagePath(filePath) {
|
|
|
34038
33571
|
}
|
|
34039
33572
|
if (p.startsWith("pages/") || p.startsWith("src/pages/")) {
|
|
34040
33573
|
p = p.replace(/^pages\//, "").replace(/^src\/pages\//, "");
|
|
34041
|
-
const base =
|
|
33574
|
+
const base = path4.basename(p, path4.extname(p));
|
|
34042
33575
|
return base === "index" ? "/" : "/" + base;
|
|
34043
33576
|
}
|
|
34044
33577
|
p = p.replace(/\.[^.]+$/, "").replace(/^\.\//, "").replace(/\\/g, "/");
|
|
@@ -34081,10 +33614,10 @@ async function imagesCommand(subcommand, options) {
|
|
|
34081
33614
|
}
|
|
34082
33615
|
}
|
|
34083
33616
|
async function scanImages(options) {
|
|
34084
|
-
const targetDir =
|
|
34085
|
-
const publicDir =
|
|
33617
|
+
const targetDir = path4.resolve(options.dir || ".");
|
|
33618
|
+
const publicDir = path4.join(targetDir, "public");
|
|
34086
33619
|
try {
|
|
34087
|
-
await
|
|
33620
|
+
await fs2.access(publicDir);
|
|
34088
33621
|
} catch {
|
|
34089
33622
|
console.log(source_default.yellow(" \u26A0 No public folder found"));
|
|
34090
33623
|
console.log(source_default.gray(" This command scans for images in your public folder."));
|
|
@@ -34152,7 +33685,7 @@ async function uploadImages(options) {
|
|
|
34152
33685
|
console.log("");
|
|
34153
33686
|
process.exit(1);
|
|
34154
33687
|
}
|
|
34155
|
-
const targetDir =
|
|
33688
|
+
const targetDir = path4.resolve(options.dir || ".");
|
|
34156
33689
|
const spinner = ora("Scanning for images...").start();
|
|
34157
33690
|
const results = await scanPublicImages(targetDir);
|
|
34158
33691
|
spinner.stop();
|
|
@@ -34205,7 +33738,7 @@ async function uploadImages(options) {
|
|
|
34205
33738
|
const uploadSpinner = ora(`Uploading ${img.filename}...`).start();
|
|
34206
33739
|
try {
|
|
34207
33740
|
const result = await uploadImageToPortal(
|
|
34208
|
-
|
|
33741
|
+
path4.join(targetDir, img.filePath),
|
|
34209
33742
|
img,
|
|
34210
33743
|
{ apiUrl, apiKey, category: options.category }
|
|
34211
33744
|
);
|
|
@@ -34224,8 +33757,8 @@ async function uploadImages(options) {
|
|
|
34224
33757
|
}
|
|
34225
33758
|
console.log("");
|
|
34226
33759
|
if (uploaded.length > 0) {
|
|
34227
|
-
const manifestPath =
|
|
34228
|
-
await
|
|
33760
|
+
const manifestPath = path4.join(targetDir, ".uptrade-images.json");
|
|
33761
|
+
await fs2.writeFile(manifestPath, JSON.stringify({
|
|
34229
33762
|
uploaded,
|
|
34230
33763
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
34231
33764
|
}, null, 2));
|
|
@@ -34237,8 +33770,8 @@ async function uploadImages(options) {
|
|
|
34237
33770
|
console.log("");
|
|
34238
33771
|
}
|
|
34239
33772
|
async function migrateImages(options) {
|
|
34240
|
-
const targetDir =
|
|
34241
|
-
const manifestPath =
|
|
33773
|
+
const targetDir = path4.resolve(options.dir || ".");
|
|
33774
|
+
const manifestPath = path4.join(targetDir, ".uptrade-images.json");
|
|
34242
33775
|
const apiUrl = process.env.UPTRADE_API_URL || process.env.NEXT_PUBLIC_PORTAL_API_URL || "https://api.uptrademedia.com";
|
|
34243
33776
|
const apiKey = process.env.UPTRADE_API_KEY || "";
|
|
34244
33777
|
if (!apiKey) {
|
|
@@ -34247,7 +33780,7 @@ async function migrateImages(options) {
|
|
|
34247
33780
|
}
|
|
34248
33781
|
let manifest;
|
|
34249
33782
|
try {
|
|
34250
|
-
const content = await
|
|
33783
|
+
const content = await fs2.readFile(manifestPath, "utf-8");
|
|
34251
33784
|
manifest = JSON.parse(content);
|
|
34252
33785
|
} catch {
|
|
34253
33786
|
console.log(source_default.yellow(" \u26A0 No upload manifest found"));
|
|
@@ -34341,9 +33874,9 @@ async function migrateImages(options) {
|
|
|
34341
33874
|
let successCount = 0;
|
|
34342
33875
|
let failCount = 0;
|
|
34343
33876
|
for (const [filePath, fileMigrations] of byFile) {
|
|
34344
|
-
const fileSpinner = ora(`Migrating ${
|
|
33877
|
+
const fileSpinner = ora(`Migrating ${path4.basename(filePath)}...`).start();
|
|
34345
33878
|
try {
|
|
34346
|
-
await migrateFileImages(
|
|
33879
|
+
await migrateFileImages(path4.join(targetDir, filePath), fileMigrations);
|
|
34347
33880
|
successCount += fileMigrations.length;
|
|
34348
33881
|
fileSpinner.succeed(`Migrated: ${filePath} (${fileMigrations.length} images)`);
|
|
34349
33882
|
} catch (error) {
|
|
@@ -34365,7 +33898,7 @@ async function migrateImages(options) {
|
|
|
34365
33898
|
console.log("");
|
|
34366
33899
|
}
|
|
34367
33900
|
async function uploadAndMigrate(options) {
|
|
34368
|
-
const targetDir =
|
|
33901
|
+
const targetDir = path4.resolve(options.dir || ".");
|
|
34369
33902
|
const apiUrl = process.env.UPTRADE_API_URL || process.env.NEXT_PUBLIC_PORTAL_API_URL || "https://api.uptrademedia.com";
|
|
34370
33903
|
const apiKey = process.env.UPTRADE_API_KEY || "";
|
|
34371
33904
|
if (!apiKey) {
|
|
@@ -34432,7 +33965,7 @@ async function uploadAndMigrate(options) {
|
|
|
34432
33965
|
const uploadSpinner = ora(`Uploading ${img.filename}...`).start();
|
|
34433
33966
|
try {
|
|
34434
33967
|
const result = await uploadImageToPortal(
|
|
34435
|
-
|
|
33968
|
+
path4.join(targetDir, img.filePath),
|
|
34436
33969
|
img,
|
|
34437
33970
|
{ apiUrl, apiKey, category: options.category }
|
|
34438
33971
|
);
|
|
@@ -34504,9 +34037,9 @@ async function uploadAndMigrate(options) {
|
|
|
34504
34037
|
let successCount = 0;
|
|
34505
34038
|
let failCount = 0;
|
|
34506
34039
|
for (const [filePath, fileMigrations] of byFile) {
|
|
34507
|
-
const fileSpinner = ora(`Migrating ${
|
|
34040
|
+
const fileSpinner = ora(`Migrating ${path4.basename(filePath)}...`).start();
|
|
34508
34041
|
try {
|
|
34509
|
-
await migrateFileImages(
|
|
34042
|
+
await migrateFileImages(path4.join(targetDir, filePath), fileMigrations);
|
|
34510
34043
|
successCount += fileMigrations.length;
|
|
34511
34044
|
fileSpinner.succeed(`Migrated: ${filePath} (${fileMigrations.length} images)`);
|
|
34512
34045
|
} catch (error) {
|
|
@@ -34514,8 +34047,8 @@ async function uploadAndMigrate(options) {
|
|
|
34514
34047
|
fileSpinner.fail(`Failed: ${filePath} - ${error.message}`);
|
|
34515
34048
|
}
|
|
34516
34049
|
}
|
|
34517
|
-
const manifestPath =
|
|
34518
|
-
await
|
|
34050
|
+
const manifestPath = path4.join(targetDir, ".uptrade-images.json");
|
|
34051
|
+
await fs2.writeFile(manifestPath, JSON.stringify({
|
|
34519
34052
|
uploaded,
|
|
34520
34053
|
criticalKeptLocal: criticalImages.map((i) => i.filename),
|
|
34521
34054
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -34541,11 +34074,11 @@ async function uploadAndMigrate(options) {
|
|
|
34541
34074
|
console.log("");
|
|
34542
34075
|
}
|
|
34543
34076
|
async function replaceWithCdnUrls(options) {
|
|
34544
|
-
const targetDir =
|
|
34545
|
-
const manifestPath =
|
|
34077
|
+
const targetDir = path4.resolve(options.dir || ".");
|
|
34078
|
+
const manifestPath = path4.join(targetDir, ".uptrade-images.json");
|
|
34546
34079
|
let manifest;
|
|
34547
34080
|
try {
|
|
34548
|
-
const content = await
|
|
34081
|
+
const content = await fs2.readFile(manifestPath, "utf-8");
|
|
34549
34082
|
manifest = JSON.parse(content);
|
|
34550
34083
|
} catch {
|
|
34551
34084
|
console.log(source_default.yellow(" \u26A0 No upload manifest found"));
|
|
@@ -34570,7 +34103,7 @@ async function replaceWithCdnUrls(options) {
|
|
|
34570
34103
|
const seenFileLines = /* @__PURE__ */ new Set();
|
|
34571
34104
|
for (const file of dataFiles) {
|
|
34572
34105
|
try {
|
|
34573
|
-
const content = await
|
|
34106
|
+
const content = await fs2.readFile(file, "utf-8");
|
|
34574
34107
|
const lines = content.split("\n");
|
|
34575
34108
|
for (let i = 0; i < lines.length; i++) {
|
|
34576
34109
|
for (const img of imagesWithUrls) {
|
|
@@ -34590,7 +34123,7 @@ async function replaceWithCdnUrls(options) {
|
|
|
34590
34123
|
if (!seenFileLines.has(key)) {
|
|
34591
34124
|
seenFileLines.add(key);
|
|
34592
34125
|
replacements2.push({
|
|
34593
|
-
file:
|
|
34126
|
+
file: path4.relative(targetDir, file),
|
|
34594
34127
|
localPath: pattern,
|
|
34595
34128
|
cdnUrl: img.publicUrl,
|
|
34596
34129
|
line: i + 1
|
|
@@ -34638,16 +34171,16 @@ async function replaceWithCdnUrls(options) {
|
|
|
34638
34171
|
let successCount = 0;
|
|
34639
34172
|
let failCount = 0;
|
|
34640
34173
|
for (const [filePath, fileReplacements] of byFile) {
|
|
34641
|
-
const fileSpinner = ora(`Updating ${
|
|
34174
|
+
const fileSpinner = ora(`Updating ${path4.basename(filePath)}...`).start();
|
|
34642
34175
|
try {
|
|
34643
|
-
const fullPath =
|
|
34644
|
-
let content = await
|
|
34176
|
+
const fullPath = path4.join(targetDir, filePath);
|
|
34177
|
+
let content = await fs2.readFile(fullPath, "utf-8");
|
|
34645
34178
|
for (const r of fileReplacements) {
|
|
34646
34179
|
const escaped = r.localPath.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
34647
34180
|
content = content.replace(new RegExp(escaped, "g"), r.cdnUrl);
|
|
34648
34181
|
successCount++;
|
|
34649
34182
|
}
|
|
34650
|
-
await
|
|
34183
|
+
await fs2.writeFile(fullPath, content, "utf-8");
|
|
34651
34184
|
fileSpinner.succeed(`Updated: ${filePath} (${fileReplacements.length} paths)`);
|
|
34652
34185
|
} catch (error) {
|
|
34653
34186
|
failCount += fileReplacements.length;
|
|
@@ -34668,8 +34201,8 @@ async function replaceWithCdnUrls(options) {
|
|
|
34668
34201
|
console.log("");
|
|
34669
34202
|
}
|
|
34670
34203
|
async function refreshManifest(options) {
|
|
34671
|
-
const targetDir =
|
|
34672
|
-
const manifestPath =
|
|
34204
|
+
const targetDir = path4.resolve(options.dir || ".");
|
|
34205
|
+
const manifestPath = path4.join(targetDir, ".uptrade-images.json");
|
|
34673
34206
|
const apiUrl = process.env.UPTRADE_API_URL || process.env.NEXT_PUBLIC_PORTAL_API_URL || "https://api.uptrademedia.com";
|
|
34674
34207
|
const apiKey = process.env.UPTRADE_API_KEY || "";
|
|
34675
34208
|
if (!apiKey) {
|
|
@@ -34678,7 +34211,7 @@ async function refreshManifest(options) {
|
|
|
34678
34211
|
}
|
|
34679
34212
|
let manifest;
|
|
34680
34213
|
try {
|
|
34681
|
-
const content = await
|
|
34214
|
+
const content = await fs2.readFile(manifestPath, "utf-8");
|
|
34682
34215
|
manifest = JSON.parse(content);
|
|
34683
34216
|
} catch {
|
|
34684
34217
|
console.log(source_default.yellow(" \u26A0 No upload manifest found"));
|
|
@@ -34713,7 +34246,7 @@ async function refreshManifest(options) {
|
|
|
34713
34246
|
updatedCount++;
|
|
34714
34247
|
}
|
|
34715
34248
|
}
|
|
34716
|
-
await
|
|
34249
|
+
await fs2.writeFile(manifestPath, JSON.stringify({
|
|
34717
34250
|
...manifest,
|
|
34718
34251
|
refreshed: (/* @__PURE__ */ new Date()).toISOString()
|
|
34719
34252
|
}, null, 2));
|
|
@@ -34734,9 +34267,9 @@ async function findDataFiles(rootDir) {
|
|
|
34734
34267
|
const excludeFiles = [".uptrade-images.json"];
|
|
34735
34268
|
async function scan(dir) {
|
|
34736
34269
|
try {
|
|
34737
|
-
const entries = await
|
|
34270
|
+
const entries = await fs2.readdir(dir, { withFileTypes: true });
|
|
34738
34271
|
for (const entry of entries) {
|
|
34739
|
-
const fullPath =
|
|
34272
|
+
const fullPath = path4.join(dir, entry.name);
|
|
34740
34273
|
if (entry.isDirectory()) {
|
|
34741
34274
|
if (["node_modules", ".next", ".git", "dist", "build"].includes(entry.name)) {
|
|
34742
34275
|
continue;
|
|
@@ -34746,7 +34279,7 @@ async function findDataFiles(rootDir) {
|
|
|
34746
34279
|
if (excludeFiles.includes(entry.name)) {
|
|
34747
34280
|
continue;
|
|
34748
34281
|
}
|
|
34749
|
-
const ext =
|
|
34282
|
+
const ext = path4.extname(entry.name).toLowerCase();
|
|
34750
34283
|
if ([".js", ".ts", ".json", ".jsx", ".tsx", ".mjs", ".cjs"].includes(ext)) {
|
|
34751
34284
|
files.push(fullPath);
|
|
34752
34285
|
}
|
|
@@ -34759,17 +34292,17 @@ async function findDataFiles(rootDir) {
|
|
|
34759
34292
|
return files;
|
|
34760
34293
|
}
|
|
34761
34294
|
async function scanPublicImages(rootDir) {
|
|
34762
|
-
const publicDir =
|
|
34295
|
+
const publicDir = path4.join(rootDir, "public");
|
|
34763
34296
|
const images = [];
|
|
34764
34297
|
let totalSize = 0;
|
|
34765
34298
|
let usageCount = 0;
|
|
34766
34299
|
const imageFiles = await findImagesRecursive(publicDir);
|
|
34767
34300
|
const sourceFiles = await findSourceFiles(rootDir);
|
|
34768
34301
|
for (const imagePath of imageFiles) {
|
|
34769
|
-
const relPath =
|
|
34770
|
-
const filename =
|
|
34771
|
-
const ext =
|
|
34772
|
-
const stat = await
|
|
34302
|
+
const relPath = path4.relative(rootDir, imagePath);
|
|
34303
|
+
const filename = path4.basename(imagePath);
|
|
34304
|
+
const ext = path4.extname(filename).toLowerCase();
|
|
34305
|
+
const stat = await fs2.stat(imagePath);
|
|
34773
34306
|
const category = getCategoryFromPath(relPath);
|
|
34774
34307
|
const suggestedSlotId = generateSlotId(relPath);
|
|
34775
34308
|
const usedIn = await findImageUsages(imagePath, sourceFiles, rootDir);
|
|
@@ -34792,13 +34325,13 @@ async function scanPublicImages(rootDir) {
|
|
|
34792
34325
|
}
|
|
34793
34326
|
async function findImagesRecursive(dir, files = []) {
|
|
34794
34327
|
try {
|
|
34795
|
-
const entries = await
|
|
34328
|
+
const entries = await fs2.readdir(dir, { withFileTypes: true });
|
|
34796
34329
|
for (const entry of entries) {
|
|
34797
|
-
const fullPath =
|
|
34330
|
+
const fullPath = path4.join(dir, entry.name);
|
|
34798
34331
|
if (entry.isDirectory()) {
|
|
34799
34332
|
await findImagesRecursive(fullPath, files);
|
|
34800
34333
|
} else if (entry.isFile()) {
|
|
34801
|
-
const ext =
|
|
34334
|
+
const ext = path4.extname(entry.name).toLowerCase();
|
|
34802
34335
|
if (IMAGE_EXTENSIONS.includes(ext)) {
|
|
34803
34336
|
files.push(fullPath);
|
|
34804
34337
|
}
|
|
@@ -34809,9 +34342,9 @@ async function findImagesRecursive(dir, files = []) {
|
|
|
34809
34342
|
return files;
|
|
34810
34343
|
}
|
|
34811
34344
|
async function findSourceFiles(dir, files = []) {
|
|
34812
|
-
const entries = await
|
|
34345
|
+
const entries = await fs2.readdir(dir, { withFileTypes: true });
|
|
34813
34346
|
for (const entry of entries) {
|
|
34814
|
-
const fullPath =
|
|
34347
|
+
const fullPath = path4.join(dir, entry.name);
|
|
34815
34348
|
if (entry.isDirectory()) {
|
|
34816
34349
|
if (["node_modules", ".next", ".git", "dist", "build", "public"].includes(entry.name)) {
|
|
34817
34350
|
continue;
|
|
@@ -34827,8 +34360,8 @@ async function findSourceFiles(dir, files = []) {
|
|
|
34827
34360
|
}
|
|
34828
34361
|
async function findImageUsages(imagePath, sourceFiles, rootDir) {
|
|
34829
34362
|
const usages = [];
|
|
34830
|
-
const filename =
|
|
34831
|
-
const relPath =
|
|
34363
|
+
const filename = path4.basename(imagePath);
|
|
34364
|
+
const relPath = path4.relative(path4.join(rootDir, "public"), imagePath);
|
|
34832
34365
|
const patterns = [
|
|
34833
34366
|
`/${relPath}`,
|
|
34834
34367
|
// /images/hero.jpg
|
|
@@ -34841,7 +34374,7 @@ async function findImageUsages(imagePath, sourceFiles, rootDir) {
|
|
|
34841
34374
|
];
|
|
34842
34375
|
for (const sourceFile of sourceFiles) {
|
|
34843
34376
|
try {
|
|
34844
|
-
const content = await
|
|
34377
|
+
const content = await fs2.readFile(sourceFile, "utf-8");
|
|
34845
34378
|
const lines = content.split("\n");
|
|
34846
34379
|
for (let i = 0; i < lines.length; i++) {
|
|
34847
34380
|
const line = lines[i];
|
|
@@ -34850,7 +34383,7 @@ async function findImageUsages(imagePath, sourceFiles, rootDir) {
|
|
|
34850
34383
|
const elementType = detectElementType(line);
|
|
34851
34384
|
const canAutoMigrate = ["img", "Image"].includes(elementType);
|
|
34852
34385
|
usages.push({
|
|
34853
|
-
filePath:
|
|
34386
|
+
filePath: path4.relative(rootDir, sourceFile),
|
|
34854
34387
|
line: i + 1,
|
|
34855
34388
|
elementType,
|
|
34856
34389
|
altText: extractAltText(line),
|
|
@@ -34922,7 +34455,7 @@ function detectCriticalImage(filename, relPath, usages, fileSize) {
|
|
|
34922
34455
|
(u) => u.filePath.includes("layout.") || u.filePath.includes("/layout/")
|
|
34923
34456
|
);
|
|
34924
34457
|
const usedInCriticalComponent = usages.some((u) => {
|
|
34925
|
-
const fileName =
|
|
34458
|
+
const fileName = path4.basename(u.filePath).toLowerCase();
|
|
34926
34459
|
return fileName.includes("header") || fileName.includes("navbar") || fileName.includes("nav.") || fileName.includes("hero") || fileName.includes("footer");
|
|
34927
34460
|
});
|
|
34928
34461
|
const isSiteLogo = SITE_LOGO_PATTERNS.some((p) => p.test(filename));
|
|
@@ -35010,7 +34543,7 @@ async function uploadImageToPortal(localPath, image, config2) {
|
|
|
35010
34543
|
};
|
|
35011
34544
|
}
|
|
35012
34545
|
async function migrateFileImages(filePath, migrations) {
|
|
35013
|
-
let content = await
|
|
34546
|
+
let content = await fs2.readFile(filePath, "utf-8");
|
|
35014
34547
|
const lines = content.split("\n");
|
|
35015
34548
|
const sortedMigrations = [...migrations].sort((a, b) => b.usage.line - a.usage.line);
|
|
35016
34549
|
for (const m of sortedMigrations) {
|
|
@@ -35034,7 +34567,7 @@ async function migrateFileImages(filePath, migrations) {
|
|
|
35034
34567
|
lines.splice(insertIndex, 0, importLine);
|
|
35035
34568
|
}
|
|
35036
34569
|
content = lines.join("\n");
|
|
35037
|
-
await
|
|
34570
|
+
await fs2.writeFile(filePath, content, "utf-8");
|
|
35038
34571
|
}
|
|
35039
34572
|
function formatBytes(bytes) {
|
|
35040
34573
|
if (bytes < 1024) return `${bytes} B`;
|
|
@@ -35058,7 +34591,7 @@ async function uploadAndMigrateImages(scanResults, options) {
|
|
|
35058
34591
|
for (const img of scanResults.images) {
|
|
35059
34592
|
try {
|
|
35060
34593
|
const uploadResult = await uploadImageToPortal(
|
|
35061
|
-
|
|
34594
|
+
path4.join(rootDir, img.filePath),
|
|
35062
34595
|
img,
|
|
35063
34596
|
{
|
|
35064
34597
|
apiUrl: options.apiUrl,
|
|
@@ -35086,7 +34619,7 @@ async function uploadAndMigrateImages(scanResults, options) {
|
|
|
35086
34619
|
}
|
|
35087
34620
|
for (const [filePath, migrations] of byFile) {
|
|
35088
34621
|
try {
|
|
35089
|
-
await migrateFileImages(
|
|
34622
|
+
await migrateFileImages(path4.join(rootDir, filePath), migrations);
|
|
35090
34623
|
result.migrated += migrations.length;
|
|
35091
34624
|
} catch (error) {
|
|
35092
34625
|
result.errors.push(`Migration failed for ${filePath}: ${error.message}`);
|
|
@@ -35113,14 +34646,14 @@ async function migrateCommand(options) {
|
|
|
35113
34646
|
console.log("");
|
|
35114
34647
|
}
|
|
35115
34648
|
if (options.file) {
|
|
35116
|
-
const filePath =
|
|
34649
|
+
const filePath = path4.resolve(options.file);
|
|
35117
34650
|
try {
|
|
35118
|
-
await
|
|
34651
|
+
await fs2.access(filePath);
|
|
35119
34652
|
} catch {
|
|
35120
34653
|
console.log(source_default.red(` \u2717 File not found: ${filePath}`));
|
|
35121
34654
|
process.exit(1);
|
|
35122
34655
|
}
|
|
35123
|
-
const spinner = ora(`Migrating ${
|
|
34656
|
+
const spinner = ora(`Migrating ${path4.basename(filePath)}...`).start();
|
|
35124
34657
|
try {
|
|
35125
34658
|
const result = await migrateFile(filePath, {
|
|
35126
34659
|
projectId,
|
|
@@ -35337,7 +34870,7 @@ async function locationsCommand(subcommand, arg, options) {
|
|
|
35337
34870
|
async function templateCommand(sourcePath, options, config2) {
|
|
35338
34871
|
const spinner = ora("Analyzing source page...").start();
|
|
35339
34872
|
try {
|
|
35340
|
-
const resolvedPath =
|
|
34873
|
+
const resolvedPath = path4.resolve(sourcePath);
|
|
35341
34874
|
if (!existsSync(resolvedPath)) {
|
|
35342
34875
|
spinner.fail(`File not found: ${sourcePath}`);
|
|
35343
34876
|
return;
|
|
@@ -35391,9 +34924,9 @@ async function templateCommand(sourcePath, options, config2) {
|
|
|
35391
34924
|
},
|
|
35392
34925
|
managed_components: ["schema", "faqs", "metadata"]
|
|
35393
34926
|
};
|
|
35394
|
-
await
|
|
35395
|
-
const templatePath =
|
|
35396
|
-
await
|
|
34927
|
+
await fs2.mkdir(TEMPLATES_DIR, { recursive: true });
|
|
34928
|
+
const templatePath = path4.join(TEMPLATES_DIR, `${templateName}.json`);
|
|
34929
|
+
await fs2.writeFile(templatePath, JSON.stringify(template, null, 2));
|
|
35397
34930
|
console.log("");
|
|
35398
34931
|
console.log(source_default.green(" \u2713 Template created:"), source_default.cyan(templatePath));
|
|
35399
34932
|
console.log("");
|
|
@@ -35471,7 +35004,7 @@ function inferGenerationHint(propName) {
|
|
|
35471
35004
|
return void 0;
|
|
35472
35005
|
}
|
|
35473
35006
|
function inferTemplateName(sourcePath) {
|
|
35474
|
-
const parts = sourcePath.split(
|
|
35007
|
+
const parts = sourcePath.split(path4.sep);
|
|
35475
35008
|
const pageIndex = parts.findIndex((p) => p === "page.tsx" || p === "page.jsx");
|
|
35476
35009
|
if (pageIndex > 0) {
|
|
35477
35010
|
return parts[pageIndex - 1];
|
|
@@ -35480,14 +35013,14 @@ function inferTemplateName(sourcePath) {
|
|
|
35480
35013
|
return filtered[filtered.length - 1] || "template";
|
|
35481
35014
|
}
|
|
35482
35015
|
function inferSourcePagePath(sourcePath) {
|
|
35483
|
-
const parts = sourcePath.split(
|
|
35016
|
+
const parts = sourcePath.split(path4.sep);
|
|
35484
35017
|
const appIndex = parts.findIndex((p) => p === "app" || p === "pages");
|
|
35485
35018
|
if (appIndex >= 0) {
|
|
35486
35019
|
const pathParts = parts.slice(appIndex + 1);
|
|
35487
35020
|
const filtered = pathParts.filter((p) => !["page.tsx", "page.jsx", "index.tsx", "index.jsx"].includes(p));
|
|
35488
35021
|
return "/" + filtered.join("/");
|
|
35489
35022
|
}
|
|
35490
|
-
return "/" +
|
|
35023
|
+
return "/" + path4.basename(sourcePath, path4.extname(sourcePath));
|
|
35491
35024
|
}
|
|
35492
35025
|
function toSnakeCase(str) {
|
|
35493
35026
|
return str.replace(/([A-Z])/g, "_$1").toLowerCase().replace(/^_/, "");
|
|
@@ -35499,7 +35032,7 @@ function truncate(str, maxLength) {
|
|
|
35499
35032
|
async function uploadCommand(templateName, config2) {
|
|
35500
35033
|
const spinner = ora("Uploading template to Portal...").start();
|
|
35501
35034
|
try {
|
|
35502
|
-
const templatePath =
|
|
35035
|
+
const templatePath = path4.join(TEMPLATES_DIR, `${templateName}.json`);
|
|
35503
35036
|
if (!existsSync(templatePath)) {
|
|
35504
35037
|
spinner.fail(`Template not found: ${templatePath}`);
|
|
35505
35038
|
console.log(source_default.gray(` Run: npx uptrade-setup locations template <page> --name ${templateName}`));
|
|
@@ -35641,7 +35174,7 @@ async function listCommand(config2) {
|
|
|
35641
35174
|
}
|
|
35642
35175
|
console.log("");
|
|
35643
35176
|
if (existsSync(TEMPLATES_DIR)) {
|
|
35644
|
-
const files = await
|
|
35177
|
+
const files = await fs2.readdir(TEMPLATES_DIR);
|
|
35645
35178
|
const localTemplates = files.filter((f) => f.endsWith(".json"));
|
|
35646
35179
|
if (localTemplates.length > 0) {
|
|
35647
35180
|
console.log(source_default.gray(" Local (not uploaded):"));
|
|
@@ -35656,7 +35189,7 @@ async function listCommand(config2) {
|
|
|
35656
35189
|
}
|
|
35657
35190
|
}
|
|
35658
35191
|
async function loadConfig() {
|
|
35659
|
-
const configPath =
|
|
35192
|
+
const configPath = path4.join(".uptrade", "config.json");
|
|
35660
35193
|
if (existsSync(configPath)) {
|
|
35661
35194
|
try {
|
|
35662
35195
|
const config2 = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
@@ -35677,7 +35210,7 @@ async function loadConfig() {
|
|
|
35677
35210
|
}
|
|
35678
35211
|
var API_URL3 = process.env.UPTRADE_API_URL || process.env.NEXT_PUBLIC_UPTRADE_API_URL || "https://api.uptrademedia.com";
|
|
35679
35212
|
async function loadConfig2() {
|
|
35680
|
-
const configPath =
|
|
35213
|
+
const configPath = path4.join(".uptrade", "config.json");
|
|
35681
35214
|
if (existsSync(configPath)) {
|
|
35682
35215
|
try {
|
|
35683
35216
|
const config2 = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
@@ -35752,8 +35285,8 @@ async function extractCommand(options, config2) {
|
|
|
35752
35285
|
const faqContexts = [];
|
|
35753
35286
|
for (const faq of faqSections) {
|
|
35754
35287
|
try {
|
|
35755
|
-
const fullPath =
|
|
35756
|
-
const content = await
|
|
35288
|
+
const fullPath = path4.resolve(process.cwd(), faq.filePath);
|
|
35289
|
+
const content = await fs2.readFile(fullPath, "utf-8");
|
|
35757
35290
|
let pagePath = faq.filePath.replace(/^app\//, "/").replace(/^src\/app\//, "/").replace(/\/page\.(tsx?|jsx?)$/, "").replace(/\[([^\]]+)\]/g, ":$1");
|
|
35758
35291
|
if (pagePath === "" || pagePath === "/page") pagePath = "/";
|
|
35759
35292
|
const importMatches = content.matchAll(/import\s+(?:\{[^}]+\}|\w+)\s+from\s+['"]([^'"]+)['"]/g);
|
|
@@ -35767,14 +35300,14 @@ async function extractCommand(options, config2) {
|
|
|
35767
35300
|
if (importPath.startsWith("@/")) {
|
|
35768
35301
|
resolvedPath = importPath.replace("@/", "./");
|
|
35769
35302
|
} else if (importPath.startsWith(".")) {
|
|
35770
|
-
resolvedPath =
|
|
35303
|
+
resolvedPath = path4.resolve(path4.dirname(fullPath), importPath);
|
|
35771
35304
|
}
|
|
35772
35305
|
const extensions = ["", ".js", ".ts", ".jsx", ".tsx", ".json"];
|
|
35773
35306
|
for (const ext of extensions) {
|
|
35774
35307
|
const tryPath = resolvedPath + ext;
|
|
35775
35308
|
if (existsSync(tryPath)) {
|
|
35776
35309
|
try {
|
|
35777
|
-
importedFiles[importPath] = await
|
|
35310
|
+
importedFiles[importPath] = await fs2.readFile(tryPath, "utf-8");
|
|
35778
35311
|
} catch {
|
|
35779
35312
|
}
|
|
35780
35313
|
break;
|
|
@@ -36029,7 +35562,7 @@ function getApiUrl() {
|
|
|
36029
35562
|
return process.env.UPTRADE_API_URL || process.env.NEXT_PUBLIC_UPTRADE_API_URL || "https://api.uptrademedia.com";
|
|
36030
35563
|
}
|
|
36031
35564
|
async function loadConfig3() {
|
|
36032
|
-
const configPath =
|
|
35565
|
+
const configPath = path4.join(".uptrade", "config.json");
|
|
36033
35566
|
if (existsSync(configPath)) {
|
|
36034
35567
|
try {
|
|
36035
35568
|
const config2 = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
@@ -36259,10 +35792,10 @@ async function setupCommand(options) {
|
|
|
36259
35792
|
}
|
|
36260
35793
|
async function scanForPageFiles(rootDir) {
|
|
36261
35794
|
const pages = [];
|
|
36262
|
-
const appDir =
|
|
36263
|
-
const srcAppDir =
|
|
36264
|
-
const pagesDir =
|
|
36265
|
-
const srcPagesDir =
|
|
35795
|
+
const appDir = path4.join(rootDir, "app");
|
|
35796
|
+
const srcAppDir = path4.join(rootDir, "src", "app");
|
|
35797
|
+
const pagesDir = path4.join(rootDir, "pages");
|
|
35798
|
+
const srcPagesDir = path4.join(rootDir, "src", "pages");
|
|
36266
35799
|
const dirs = [appDir, srcAppDir, pagesDir, srcPagesDir];
|
|
36267
35800
|
for (const dir of dirs) {
|
|
36268
35801
|
if (existsSync(dir)) {
|
|
@@ -36272,9 +35805,9 @@ async function scanForPageFiles(rootDir) {
|
|
|
36272
35805
|
return pages;
|
|
36273
35806
|
}
|
|
36274
35807
|
async function scanDirectory(dir, baseDir, pages) {
|
|
36275
|
-
const entries = await
|
|
35808
|
+
const entries = await fs2.readdir(dir, { withFileTypes: true });
|
|
36276
35809
|
for (const entry of entries) {
|
|
36277
|
-
const fullPath =
|
|
35810
|
+
const fullPath = path4.join(dir, entry.name);
|
|
36278
35811
|
if (entry.isDirectory()) {
|
|
36279
35812
|
if (entry.name.startsWith(".") || entry.name === "node_modules" || entry.name === "api") {
|
|
36280
35813
|
continue;
|
|
@@ -36284,9 +35817,9 @@ async function scanDirectory(dir, baseDir, pages) {
|
|
|
36284
35817
|
const isPage = entry.name.match(/^page\.(tsx?|jsx?)$/);
|
|
36285
35818
|
const isLegacyPage = baseDir.includes("/pages") && entry.name.match(/\.(tsx?|jsx?)$/) && !entry.name.startsWith("_");
|
|
36286
35819
|
if (isPage || isLegacyPage) {
|
|
36287
|
-
const content = await
|
|
36288
|
-
const relativePath =
|
|
36289
|
-
let pagePath = "/" +
|
|
35820
|
+
const content = await fs2.readFile(fullPath, "utf-8");
|
|
35821
|
+
const relativePath = path4.relative(baseDir, fullPath);
|
|
35822
|
+
let pagePath = "/" + path4.dirname(relativePath).replace(/\\/g, "/").replace(/\/page$/, "");
|
|
36290
35823
|
pagePath = pagePath.replace(/\[([^\]]+)\]/g, ":$1").replace(/^\/\.$/, "/");
|
|
36291
35824
|
if (pagePath === "/.") pagePath = "/";
|
|
36292
35825
|
pages.push({
|
|
@@ -36306,17 +35839,17 @@ async function gatherImportedFiles(page, rootDir) {
|
|
|
36306
35839
|
if (importPath.toLowerCase().includes("faq") || importPath.includes("@/data") || importPath.includes("./data") || importPath.includes("../data") || importPath.includes("/constants") || importPath.includes("/content") || importPath.includes("practice-areas") || importPath.includes("subpages") || importPath.includes("pages-data")) {
|
|
36307
35840
|
let resolvedPath = importPath;
|
|
36308
35841
|
if (importPath.startsWith("@/")) {
|
|
36309
|
-
resolvedPath =
|
|
35842
|
+
resolvedPath = path4.join(rootDir, importPath.replace("@/", ""));
|
|
36310
35843
|
} else if (importPath.startsWith(".")) {
|
|
36311
|
-
const pageDir =
|
|
36312
|
-
resolvedPath =
|
|
35844
|
+
const pageDir = path4.dirname(path4.join(rootDir, "app", page.filePath));
|
|
35845
|
+
resolvedPath = path4.resolve(pageDir, importPath);
|
|
36313
35846
|
}
|
|
36314
35847
|
const extensions = ["", ".js", ".ts", ".jsx", ".tsx", ".json"];
|
|
36315
35848
|
for (const ext of extensions) {
|
|
36316
35849
|
const tryPath = resolvedPath + ext;
|
|
36317
35850
|
if (existsSync(tryPath)) {
|
|
36318
35851
|
try {
|
|
36319
|
-
page.importedFiles[importPath] = await
|
|
35852
|
+
page.importedFiles[importPath] = await fs2.readFile(tryPath, "utf-8");
|
|
36320
35853
|
} catch {
|
|
36321
35854
|
}
|
|
36322
35855
|
break;
|
|
@@ -36365,27 +35898,27 @@ async function expandDynamicRoutes(pages, rootDir) {
|
|
|
36365
35898
|
async function findDynamicRouteData(page, parentPath, rootDir) {
|
|
36366
35899
|
const results = [];
|
|
36367
35900
|
const dataFilePaths = [
|
|
36368
|
-
|
|
36369
|
-
|
|
36370
|
-
|
|
36371
|
-
|
|
36372
|
-
|
|
36373
|
-
|
|
36374
|
-
|
|
36375
|
-
|
|
36376
|
-
|
|
36377
|
-
|
|
36378
|
-
|
|
36379
|
-
|
|
36380
|
-
|
|
36381
|
-
|
|
35901
|
+
path4.join(rootDir, "data", "practice-areas.js"),
|
|
35902
|
+
path4.join(rootDir, "data", "practice-areas.ts"),
|
|
35903
|
+
path4.join(rootDir, "data", "personal-injury-pages.js"),
|
|
35904
|
+
path4.join(rootDir, "data", "personal-injury-pages.ts"),
|
|
35905
|
+
path4.join(rootDir, "data", "pages.js"),
|
|
35906
|
+
path4.join(rootDir, "data", "pages.ts"),
|
|
35907
|
+
path4.join(rootDir, "data", "content.js"),
|
|
35908
|
+
path4.join(rootDir, "data", "content.ts"),
|
|
35909
|
+
path4.join(rootDir, "data", "services.js"),
|
|
35910
|
+
path4.join(rootDir, "data", "services.ts"),
|
|
35911
|
+
path4.join(rootDir, "data", "subpages.js"),
|
|
35912
|
+
path4.join(rootDir, "data", "subpages.ts"),
|
|
35913
|
+
path4.join(rootDir, "src", "data", "practice-areas.js"),
|
|
35914
|
+
path4.join(rootDir, "src", "data", "practice-areas.ts")
|
|
36382
35915
|
];
|
|
36383
35916
|
const routeSegment = parentPath.replace(/^\//, "").split("/")[0];
|
|
36384
35917
|
const routeSegmentNormalized = routeSegment.replace(/-/g, "");
|
|
36385
35918
|
for (const dataFile of dataFilePaths) {
|
|
36386
35919
|
if (!existsSync(dataFile)) continue;
|
|
36387
35920
|
try {
|
|
36388
|
-
const content = await
|
|
35921
|
+
const content = await fs2.readFile(dataFile, "utf-8");
|
|
36389
35922
|
const exportPattern = new RegExp(
|
|
36390
35923
|
`export\\s+const\\s+(${routeSegment.replace(/-/g, "[\\-_]?")}\\w*|\\w*${routeSegmentNormalized}\\w*)\\s*=\\s*\\{`,
|
|
36391
35924
|
"i"
|
|
@@ -36702,8 +36235,8 @@ async function checkApiConnectivity() {
|
|
|
36702
36235
|
async function checkProjectConfig() {
|
|
36703
36236
|
const checks = [];
|
|
36704
36237
|
try {
|
|
36705
|
-
const packageJsonPath =
|
|
36706
|
-
const packageJson = JSON.parse(await
|
|
36238
|
+
const packageJsonPath = path4.join(process.cwd(), "package.json");
|
|
36239
|
+
const packageJson = JSON.parse(await fs2.readFile(packageJsonPath, "utf-8"));
|
|
36707
36240
|
const hasSiteKit = packageJson.dependencies?.["@uptrade/site-kit"] || packageJson.devDependencies?.["@uptrade/site-kit"];
|
|
36708
36241
|
if (hasSiteKit) {
|
|
36709
36242
|
checks.push({
|
|
@@ -36738,14 +36271,14 @@ async function checkProjectConfig() {
|
|
|
36738
36271
|
}
|
|
36739
36272
|
async function checkSiteKitProvider() {
|
|
36740
36273
|
const layoutPaths = [
|
|
36741
|
-
|
|
36742
|
-
|
|
36743
|
-
|
|
36744
|
-
|
|
36274
|
+
path4.join(process.cwd(), "app", "layout.tsx"),
|
|
36275
|
+
path4.join(process.cwd(), "app", "layout.jsx"),
|
|
36276
|
+
path4.join(process.cwd(), "src", "app", "layout.tsx"),
|
|
36277
|
+
path4.join(process.cwd(), "src", "app", "layout.jsx")
|
|
36745
36278
|
];
|
|
36746
36279
|
for (const layoutPath of layoutPaths) {
|
|
36747
36280
|
try {
|
|
36748
|
-
const content = await
|
|
36281
|
+
const content = await fs2.readFile(layoutPath, "utf-8");
|
|
36749
36282
|
if (content.includes("SiteKitProvider")) {
|
|
36750
36283
|
return {
|
|
36751
36284
|
name: "SiteKitProvider",
|
|
@@ -36766,15 +36299,15 @@ async function checkSiteKitProvider() {
|
|
|
36766
36299
|
}
|
|
36767
36300
|
async function checkSitemap() {
|
|
36768
36301
|
const sitemapPaths = [
|
|
36769
|
-
|
|
36770
|
-
|
|
36771
|
-
|
|
36772
|
-
|
|
36773
|
-
|
|
36302
|
+
path4.join(process.cwd(), "app", "sitemap.ts"),
|
|
36303
|
+
path4.join(process.cwd(), "app", "sitemap.tsx"),
|
|
36304
|
+
path4.join(process.cwd(), "app", "sitemap.js"),
|
|
36305
|
+
path4.join(process.cwd(), "src", "app", "sitemap.ts"),
|
|
36306
|
+
path4.join(process.cwd(), "src", "app", "sitemap.tsx")
|
|
36774
36307
|
];
|
|
36775
36308
|
for (const sitemapPath of sitemapPaths) {
|
|
36776
36309
|
try {
|
|
36777
|
-
const content = await
|
|
36310
|
+
const content = await fs2.readFile(sitemapPath, "utf-8");
|
|
36778
36311
|
if (content.includes("createSitemap") || content.includes("@uptrade/site-kit")) {
|
|
36779
36312
|
return {
|
|
36780
36313
|
name: "Sitemap",
|
|
@@ -36880,8 +36413,8 @@ async function syncPagesToPortal(apiUrl, apiKey, dryRun) {
|
|
|
36880
36413
|
}
|
|
36881
36414
|
function findAppDir() {
|
|
36882
36415
|
const candidates = [
|
|
36883
|
-
|
|
36884
|
-
|
|
36416
|
+
path4.join(process.cwd(), "app"),
|
|
36417
|
+
path4.join(process.cwd(), "src", "app")
|
|
36885
36418
|
];
|
|
36886
36419
|
for (const candidate of candidates) {
|
|
36887
36420
|
if (existsSync(candidate)) {
|
|
@@ -36891,7 +36424,7 @@ function findAppDir() {
|
|
|
36891
36424
|
return null;
|
|
36892
36425
|
}
|
|
36893
36426
|
function discoverPages(appDir, currentPath = "", pages = []) {
|
|
36894
|
-
const fullPath =
|
|
36427
|
+
const fullPath = path4.join(appDir, currentPath);
|
|
36895
36428
|
if (!existsSync(fullPath)) {
|
|
36896
36429
|
return pages;
|
|
36897
36430
|
}
|
|
@@ -36913,7 +36446,7 @@ function discoverPages(appDir, currentPath = "", pages = []) {
|
|
|
36913
36446
|
});
|
|
36914
36447
|
}
|
|
36915
36448
|
for (const entry of entries) {
|
|
36916
|
-
const entryPath =
|
|
36449
|
+
const entryPath = path4.join(fullPath, entry);
|
|
36917
36450
|
const stat = statSync(entryPath);
|
|
36918
36451
|
if (stat.isDirectory()) {
|
|
36919
36452
|
const folderName = entry.toLowerCase();
|
|
@@ -36926,7 +36459,7 @@ function discoverPages(appDir, currentPath = "", pages = []) {
|
|
|
36926
36459
|
if (entry.startsWith("_")) {
|
|
36927
36460
|
continue;
|
|
36928
36461
|
}
|
|
36929
|
-
discoverPages(appDir,
|
|
36462
|
+
discoverPages(appDir, path4.join(currentPath, entry), pages);
|
|
36930
36463
|
}
|
|
36931
36464
|
}
|
|
36932
36465
|
return pages;
|
|
@@ -36950,8 +36483,8 @@ async function apiRoutesCommand(options) {
|
|
|
36950
36483
|
console.log("");
|
|
36951
36484
|
process.exit(1);
|
|
36952
36485
|
}
|
|
36953
|
-
const routeDir =
|
|
36954
|
-
const routeFile =
|
|
36486
|
+
const routeDir = path4.join(appDir, "_uptrade", "api", "[...path]");
|
|
36487
|
+
const routeFile = path4.join(routeDir, "route.ts");
|
|
36955
36488
|
if (existsSync(routeFile) && !options.force) {
|
|
36956
36489
|
console.log(source_default.yellow(" \u26A0 API routes already exist"));
|
|
36957
36490
|
console.log(source_default.gray(` ${routeFile}`));
|
|
@@ -36968,8 +36501,8 @@ async function apiRoutesCommand(options) {
|
|
|
36968
36501
|
}
|
|
36969
36502
|
const spinner = ora("Creating API routes...").start();
|
|
36970
36503
|
try {
|
|
36971
|
-
await
|
|
36972
|
-
await
|
|
36504
|
+
await fs2.mkdir(routeDir, { recursive: true });
|
|
36505
|
+
await fs2.writeFile(routeFile, generateRouteHandler());
|
|
36973
36506
|
spinner.succeed("Created API proxy routes");
|
|
36974
36507
|
console.log(source_default.gray(` ${routeFile}`));
|
|
36975
36508
|
console.log("");
|
|
@@ -36988,8 +36521,8 @@ async function apiRoutesCommand(options) {
|
|
|
36988
36521
|
}
|
|
36989
36522
|
function findAppDir2() {
|
|
36990
36523
|
const candidates = [
|
|
36991
|
-
|
|
36992
|
-
|
|
36524
|
+
path4.join(process.cwd(), "app"),
|
|
36525
|
+
path4.join(process.cwd(), "src", "app")
|
|
36993
36526
|
];
|
|
36994
36527
|
for (const candidate of candidates) {
|
|
36995
36528
|
if (existsSync(candidate)) {
|
|
@@ -37105,7 +36638,7 @@ async function installCommand(options) {
|
|
|
37105
36638
|
console.log("");
|
|
37106
36639
|
console.log(source_default.bold(" Install @uptrade/site-kit"));
|
|
37107
36640
|
console.log("");
|
|
37108
|
-
const packageJsonPath =
|
|
36641
|
+
const packageJsonPath = path4.join(process.cwd(), "package.json");
|
|
37109
36642
|
if (!existsSync(packageJsonPath)) {
|
|
37110
36643
|
console.log(source_default.red(" \u2717 No package.json found"));
|
|
37111
36644
|
console.log(source_default.gray(" Make sure you are in a Node.js project"));
|
|
@@ -37135,7 +36668,8 @@ async function installCommand(options) {
|
|
|
37135
36668
|
console.log("");
|
|
37136
36669
|
console.log(source_default.green(" Next steps:"));
|
|
37137
36670
|
console.log(source_default.gray(" 1. Run: npx uptrade-setup init"));
|
|
37138
|
-
console.log(source_default.gray(" 2.
|
|
36671
|
+
console.log(source_default.gray(" 2. Run: npx uptrade-setup scaffold (sitemap, robots, llms routes)"));
|
|
36672
|
+
console.log(source_default.gray(" 3. Follow the setup wizard"));
|
|
37139
36673
|
console.log("");
|
|
37140
36674
|
} catch (error) {
|
|
37141
36675
|
spinner.fail("Installation failed");
|
|
@@ -37144,10 +36678,10 @@ async function installCommand(options) {
|
|
|
37144
36678
|
}
|
|
37145
36679
|
}
|
|
37146
36680
|
function detectPackageManager() {
|
|
37147
|
-
if (existsSync(
|
|
36681
|
+
if (existsSync(path4.join(process.cwd(), "pnpm-lock.yaml"))) {
|
|
37148
36682
|
return "pnpm";
|
|
37149
36683
|
}
|
|
37150
|
-
if (existsSync(
|
|
36684
|
+
if (existsSync(path4.join(process.cwd(), "yarn.lock"))) {
|
|
37151
36685
|
return "yarn";
|
|
37152
36686
|
}
|
|
37153
36687
|
return "npm";
|
|
@@ -37156,7 +36690,7 @@ async function upgradeCommand(options) {
|
|
|
37156
36690
|
console.log("");
|
|
37157
36691
|
console.log(source_default.bold(" Upgrade @uptrade/site-kit"));
|
|
37158
36692
|
console.log("");
|
|
37159
|
-
const packageJsonPath =
|
|
36693
|
+
const packageJsonPath = path4.join(process.cwd(), "package.json");
|
|
37160
36694
|
if (!existsSync(packageJsonPath)) {
|
|
37161
36695
|
console.log(source_default.red(" \u2717 No package.json found"));
|
|
37162
36696
|
console.log("");
|
|
@@ -37201,14 +36735,103 @@ async function upgradeCommand(options) {
|
|
|
37201
36735
|
}
|
|
37202
36736
|
}
|
|
37203
36737
|
function detectPackageManager2() {
|
|
37204
|
-
if (existsSync(
|
|
36738
|
+
if (existsSync(path4.join(process.cwd(), "pnpm-lock.yaml"))) {
|
|
37205
36739
|
return "pnpm";
|
|
37206
36740
|
}
|
|
37207
|
-
if (existsSync(
|
|
36741
|
+
if (existsSync(path4.join(process.cwd(), "yarn.lock"))) {
|
|
37208
36742
|
return "yarn";
|
|
37209
36743
|
}
|
|
37210
36744
|
return "npm";
|
|
37211
36745
|
}
|
|
36746
|
+
async function scaffoldCommand(options) {
|
|
36747
|
+
console.log("");
|
|
36748
|
+
console.log(source_default.bold(" Scaffold Site-Kit default stack"));
|
|
36749
|
+
console.log(source_default.gray(" sitemap, robots.txt, llms.txt, llms-full.txt"));
|
|
36750
|
+
console.log("");
|
|
36751
|
+
const appDir = await findAppDir3();
|
|
36752
|
+
if (!appDir) {
|
|
36753
|
+
console.log(source_default.red(" \u2717 No app directory found (app/ or src/app/)"));
|
|
36754
|
+
process.exit(1);
|
|
36755
|
+
}
|
|
36756
|
+
const baseUrl = process.env.NEXT_PUBLIC_SITE_URL || "https://example.com";
|
|
36757
|
+
const files = [
|
|
36758
|
+
{
|
|
36759
|
+
path: path4.join(appDir, "sitemap.ts"),
|
|
36760
|
+
content: `import { createSitemap } from '@uptrademedia/site-kit/sitemap'
|
|
36761
|
+
|
|
36762
|
+
export default createSitemap({
|
|
36763
|
+
baseUrl: process.env.NEXT_PUBLIC_SITE_URL || '${baseUrl}',
|
|
36764
|
+
// additionalPaths: async () => [...],
|
|
36765
|
+
})
|
|
36766
|
+
`
|
|
36767
|
+
},
|
|
36768
|
+
{
|
|
36769
|
+
path: path4.join(appDir, "robots.txt", "route.ts"),
|
|
36770
|
+
content: `import { createRobots } from '@uptrademedia/site-kit/robots'
|
|
36771
|
+
|
|
36772
|
+
const handler = createRobots({
|
|
36773
|
+
baseUrl: process.env.NEXT_PUBLIC_SITE_URL || '${baseUrl}',
|
|
36774
|
+
})
|
|
36775
|
+
|
|
36776
|
+
export const GET = handler
|
|
36777
|
+
`
|
|
36778
|
+
},
|
|
36779
|
+
{
|
|
36780
|
+
path: path4.join(appDir, "llms.txt", "route.ts"),
|
|
36781
|
+
content: `import { createLLMsTxtHandler } from '@uptrademedia/site-kit/llms'
|
|
36782
|
+
|
|
36783
|
+
export const GET = createLLMsTxtHandler({ preferStatic: true })
|
|
36784
|
+
`
|
|
36785
|
+
},
|
|
36786
|
+
{
|
|
36787
|
+
path: path4.join(appDir, "llms-full.txt", "route.ts"),
|
|
36788
|
+
content: `import { createLLMsFullTxtHandler } from '@uptrademedia/site-kit/llms'
|
|
36789
|
+
|
|
36790
|
+
export const GET = createLLMsFullTxtHandler({ preferStatic: true })
|
|
36791
|
+
`
|
|
36792
|
+
}
|
|
36793
|
+
];
|
|
36794
|
+
if (options.dryRun) {
|
|
36795
|
+
console.log(source_default.yellow(" [DRY RUN] Would create:"));
|
|
36796
|
+
for (const f of files) {
|
|
36797
|
+
console.log(source_default.gray(` ${f.path}`));
|
|
36798
|
+
}
|
|
36799
|
+
console.log("");
|
|
36800
|
+
return;
|
|
36801
|
+
}
|
|
36802
|
+
const spinner = ora("Scaffolding...").start();
|
|
36803
|
+
for (const f of files) {
|
|
36804
|
+
try {
|
|
36805
|
+
if (existsSync(f.path) && !options.force) {
|
|
36806
|
+
spinner.warn(`Skipped (exists): ${path4.relative(process.cwd(), f.path)}`);
|
|
36807
|
+
continue;
|
|
36808
|
+
}
|
|
36809
|
+
await fs2.mkdir(path4.dirname(f.path), { recursive: true });
|
|
36810
|
+
await fs2.writeFile(f.path, f.content, "utf-8");
|
|
36811
|
+
spinner.succeed(`Created ${path4.relative(process.cwd(), f.path)}`);
|
|
36812
|
+
} catch (err) {
|
|
36813
|
+
spinner.fail(`Failed: ${f.path}`);
|
|
36814
|
+
console.log(source_default.red(` ${err.message}`));
|
|
36815
|
+
}
|
|
36816
|
+
}
|
|
36817
|
+
console.log("");
|
|
36818
|
+
console.log(source_default.green(" Next steps:"));
|
|
36819
|
+
console.log(source_default.gray(" - Set NEXT_PUBLIC_SITE_URL in .env.local"));
|
|
36820
|
+
console.log(source_default.gray(" - Set NEXT_PUBLIC_UPTRADE_API_KEY for llms.txt"));
|
|
36821
|
+
console.log(source_default.gray(" - Add getLocalData to llms route if using local data"));
|
|
36822
|
+
console.log("");
|
|
36823
|
+
}
|
|
36824
|
+
async function findAppDir3() {
|
|
36825
|
+
const cwd = process.cwd();
|
|
36826
|
+
const candidates = [
|
|
36827
|
+
path4.join(cwd, "app"),
|
|
36828
|
+
path4.join(cwd, "src", "app")
|
|
36829
|
+
];
|
|
36830
|
+
for (const dir of candidates) {
|
|
36831
|
+
if (existsSync(dir)) return dir;
|
|
36832
|
+
}
|
|
36833
|
+
return null;
|
|
36834
|
+
}
|
|
37212
36835
|
|
|
37213
36836
|
// src/cli/index.ts
|
|
37214
36837
|
config({ path: ".env.local" });
|
|
@@ -37227,6 +36850,7 @@ program2.command("sync").description("Sync local content to Portal (pages, blog,
|
|
|
37227
36850
|
program2.command("api-routes").description("Generate _uptrade API proxy routes").option("--dry-run", "Show changes without applying").option("--force", "Overwrite existing routes").action(apiRoutesCommand);
|
|
37228
36851
|
program2.command("install").description("Install @uptrade/site-kit in current project").option("-D, --dev", "Install as dev dependency").option("--dry-run", "Show command without running").action(installCommand);
|
|
37229
36852
|
program2.command("upgrade").description("Upgrade @uptrade/site-kit to latest version").option("-v, --version <version>", "Target version (default: latest)").option("--dry-run", "Show command without running").action(upgradeCommand);
|
|
36853
|
+
program2.command("scaffold").description("Scaffold sitemap, robots, llms routes (default stack)").option("--dry-run", "Show what would be created").option("-f, --force", "Overwrite existing files").action(scaffoldCommand);
|
|
37230
36854
|
if (process.argv.length === 2) {
|
|
37231
36855
|
process.argv.push("init");
|
|
37232
36856
|
}
|