@kevisual/cli 0.0.54 → 0.0.56

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/envision.mjs CHANGED
@@ -41570,7 +41570,7 @@ var require_form_data = __commonJS((exports, module) => {
41570
41570
  setToStringTag(FormData, "FormData");
41571
41571
  });
41572
41572
 
41573
- // node_modules/.pnpm/ignore@7.0.4/node_modules/ignore/index.js
41573
+ // node_modules/.pnpm/ignore@7.0.5/node_modules/ignore/index.js
41574
41574
  var require_ignore = __commonJS((exports, module) => {
41575
41575
  function makeArray(subject) {
41576
41576
  return Array.isArray(subject) ? subject : [subject];
@@ -41882,15 +41882,19 @@ var require_ignore = __commonJS((exports, module) => {
41882
41882
  }
41883
41883
  var factory = (options) => new Ignore(options);
41884
41884
  var isPathValid = (path9) => checkPath(path9 && checkPath.convert(path9), path9, RETURN_FALSE);
41885
- if (typeof process !== "undefined" && (process.env && process.env.IGNORE_TEST_WIN32 || process.platform === "win32")) {
41885
+ var setupWindows = () => {
41886
41886
  const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
41887
41887
  checkPath.convert = makePosix;
41888
41888
  const REGEX_TEST_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
41889
41889
  checkPath.isNotRelative = (path9) => REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path9) || isNotRelative(path9);
41890
+ };
41891
+ if (typeof process !== "undefined" && process.platform === "win32") {
41892
+ setupWindows();
41890
41893
  }
41891
41894
  module.exports = factory;
41892
41895
  factory.default = factory;
41893
41896
  module.exports.isPathValid = isPathValid;
41897
+ define2(module.exports, Symbol.for("setupWindows"), setupWindows);
41894
41898
  });
41895
41899
 
41896
41900
  // node_modules/.pnpm/commander@14.0.0/node_modules/commander/esm.mjs
@@ -41913,8 +41917,8 @@ var {
41913
41917
  import fs from "fs";
41914
41918
  var version = "0.0.1";
41915
41919
  try {
41916
- if ("0.0.54")
41917
- version = "0.0.54";
41920
+ if ("0.0.56")
41921
+ version = "0.0.56";
41918
41922
  } catch (e) {}
41919
41923
  program.name("app").description("A CLI tool with envison").version(version, "-V, --version");
41920
41924
  var ls = new Command("ls").description("List files in the current directory").action(() => {
@@ -41959,14 +41963,14 @@ var writeConfig = (config) => {
41959
41963
  return config;
41960
41964
  };
41961
41965
 
41962
- // node_modules/.pnpm/@inquirer+core@10.1.11_@types+node@22.15.18/node_modules/@inquirer/core/dist/esm/lib/key.js
41966
+ // node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/key.js
41963
41967
  var isUpKey = (key) => key.name === "up" || key.name === "k" || key.ctrl && key.name === "p";
41964
41968
  var isDownKey = (key) => key.name === "down" || key.name === "j" || key.ctrl && key.name === "n";
41965
41969
  var isSpaceKey = (key) => key.name === "space";
41966
41970
  var isBackspaceKey = (key) => key.name === "backspace";
41967
41971
  var isNumberKey = (key) => "1234567890".includes(key.name);
41968
41972
  var isEnterKey = (key) => key.name === "enter" || key.name === "return";
41969
- // node_modules/.pnpm/@inquirer+core@10.1.11_@types+node@22.15.18/node_modules/@inquirer/core/dist/esm/lib/errors.js
41973
+ // node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/errors.js
41970
41974
  class AbortPromptError extends Error {
41971
41975
  name = "AbortPromptError";
41972
41976
  message = "Prompt was aborted";
@@ -41992,10 +41996,10 @@ class HookError extends Error {
41992
41996
  class ValidationError extends Error {
41993
41997
  name = "ValidationError";
41994
41998
  }
41995
- // node_modules/.pnpm/@inquirer+core@10.1.11_@types+node@22.15.18/node_modules/@inquirer/core/dist/esm/lib/use-prefix.js
41999
+ // node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/use-state.js
41996
42000
  import { AsyncResource as AsyncResource2 } from "node:async_hooks";
41997
42001
 
41998
- // node_modules/.pnpm/@inquirer+core@10.1.11_@types+node@22.15.18/node_modules/@inquirer/core/dist/esm/lib/hook-engine.js
42002
+ // node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/hook-engine.js
41999
42003
  import { AsyncLocalStorage, AsyncResource } from "node:async_hooks";
42000
42004
  var hookStorage = new AsyncLocalStorage;
42001
42005
  function createStore(rl) {
@@ -42100,25 +42104,25 @@ var effectScheduler = {
42100
42104
  }
42101
42105
  };
42102
42106
 
42103
- // node_modules/.pnpm/@inquirer+core@10.1.11_@types+node@22.15.18/node_modules/@inquirer/core/dist/esm/lib/use-state.js
42107
+ // node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/use-state.js
42104
42108
  function useState(defaultValue) {
42105
42109
  return withPointer((pointer) => {
42106
- const setFn = (newValue) => {
42110
+ const setState = AsyncResource2.bind(function setState(newValue) {
42107
42111
  if (pointer.get() !== newValue) {
42108
42112
  pointer.set(newValue);
42109
42113
  handleChange();
42110
42114
  }
42111
- };
42115
+ });
42112
42116
  if (pointer.initialized) {
42113
- return [pointer.get(), setFn];
42117
+ return [pointer.get(), setState];
42114
42118
  }
42115
42119
  const value = typeof defaultValue === "function" ? defaultValue() : defaultValue;
42116
42120
  pointer.set(value);
42117
- return [value, setFn];
42121
+ return [value, setState];
42118
42122
  });
42119
42123
  }
42120
42124
 
42121
- // node_modules/.pnpm/@inquirer+core@10.1.11_@types+node@22.15.18/node_modules/@inquirer/core/dist/esm/lib/use-effect.js
42125
+ // node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/use-effect.js
42122
42126
  function useEffect(cb, depArray) {
42123
42127
  withPointer((pointer) => {
42124
42128
  const oldDeps = pointer.get();
@@ -42130,10 +42134,10 @@ function useEffect(cb, depArray) {
42130
42134
  });
42131
42135
  }
42132
42136
 
42133
- // node_modules/.pnpm/@inquirer+core@10.1.11_@types+node@22.15.18/node_modules/@inquirer/core/dist/esm/lib/theme.js
42137
+ // node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/theme.js
42134
42138
  var import_yoctocolors_cjs = __toESM(require_yoctocolors_cjs(), 1);
42135
42139
 
42136
- // node_modules/.pnpm/@inquirer+figures@1.0.11/node_modules/@inquirer/figures/dist/esm/index.js
42140
+ // node_modules/.pnpm/@inquirer+figures@1.0.12/node_modules/@inquirer/figures/dist/esm/index.js
42137
42141
  import process2 from "node:process";
42138
42142
  function isUnicodeSupported() {
42139
42143
  if (process2.platform !== "win32") {
@@ -42419,7 +42423,7 @@ var figures = shouldUseMain ? mainSymbols : fallbackSymbols;
42419
42423
  var esm_default = figures;
42420
42424
  var replacements = Object.entries(specialMainSymbols);
42421
42425
 
42422
- // node_modules/.pnpm/@inquirer+core@10.1.11_@types+node@22.15.18/node_modules/@inquirer/core/dist/esm/lib/theme.js
42426
+ // node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/theme.js
42423
42427
  var defaultTheme = {
42424
42428
  prefix: {
42425
42429
  idle: import_yoctocolors_cjs.default.blue("?"),
@@ -42440,7 +42444,7 @@ var defaultTheme = {
42440
42444
  }
42441
42445
  };
42442
42446
 
42443
- // node_modules/.pnpm/@inquirer+core@10.1.11_@types+node@22.15.18/node_modules/@inquirer/core/dist/esm/lib/make-theme.js
42447
+ // node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/make-theme.js
42444
42448
  function isPlainObject(value) {
42445
42449
  if (typeof value !== "object" || value === null)
42446
42450
  return false;
@@ -42468,7 +42472,7 @@ function makeTheme(...themes) {
42468
42472
  return deepMerge(...themesToMerge);
42469
42473
  }
42470
42474
 
42471
- // node_modules/.pnpm/@inquirer+core@10.1.11_@types+node@22.15.18/node_modules/@inquirer/core/dist/esm/lib/use-prefix.js
42475
+ // node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/use-prefix.js
42472
42476
  function usePrefix({ status = "idle", theme }) {
42473
42477
  const [showLoader, setShowLoader] = useState(false);
42474
42478
  const [tick, setTick] = useState(0);
@@ -42477,13 +42481,13 @@ function usePrefix({ status = "idle", theme }) {
42477
42481
  if (status === "loading") {
42478
42482
  let tickInterval;
42479
42483
  let inc = -1;
42480
- const delayTimeout = setTimeout(AsyncResource2.bind(() => {
42484
+ const delayTimeout = setTimeout(() => {
42481
42485
  setShowLoader(true);
42482
- tickInterval = setInterval(AsyncResource2.bind(() => {
42486
+ tickInterval = setInterval(() => {
42483
42487
  inc = inc + 1;
42484
42488
  setTick(inc % spinner.frames.length);
42485
- }), spinner.interval);
42486
- }), 300);
42489
+ }, spinner.interval);
42490
+ }, 300);
42487
42491
  return () => {
42488
42492
  clearTimeout(delayTimeout);
42489
42493
  clearInterval(tickInterval);
@@ -42498,7 +42502,7 @@ function usePrefix({ status = "idle", theme }) {
42498
42502
  const iconName = status === "loading" ? "idle" : status;
42499
42503
  return typeof prefix === "string" ? prefix : prefix[iconName] ?? prefix["idle"];
42500
42504
  }
42501
- // node_modules/.pnpm/@inquirer+core@10.1.11_@types+node@22.15.18/node_modules/@inquirer/core/dist/esm/lib/use-memo.js
42505
+ // node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/use-memo.js
42502
42506
  function useMemo(fn, dependencies) {
42503
42507
  return withPointer((pointer) => {
42504
42508
  const prev = pointer.get();
@@ -42510,11 +42514,11 @@ function useMemo(fn, dependencies) {
42510
42514
  return prev.value;
42511
42515
  });
42512
42516
  }
42513
- // node_modules/.pnpm/@inquirer+core@10.1.11_@types+node@22.15.18/node_modules/@inquirer/core/dist/esm/lib/use-ref.js
42517
+ // node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/use-ref.js
42514
42518
  function useRef(val) {
42515
42519
  return useState({ current: val })[0];
42516
42520
  }
42517
- // node_modules/.pnpm/@inquirer+core@10.1.11_@types+node@22.15.18/node_modules/@inquirer/core/dist/esm/lib/use-keypress.js
42521
+ // node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/use-keypress.js
42518
42522
  function useKeypress(userHandler) {
42519
42523
  const signal = useRef(userHandler);
42520
42524
  signal.current = userHandler;
@@ -42532,7 +42536,7 @@ function useKeypress(userHandler) {
42532
42536
  };
42533
42537
  }, []);
42534
42538
  }
42535
- // node_modules/.pnpm/@inquirer+core@10.1.11_@types+node@22.15.18/node_modules/@inquirer/core/dist/esm/lib/utils.js
42539
+ // node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/utils.js
42536
42540
  var import_cli_width = __toESM(require_cli_width(), 1);
42537
42541
  var import_wrap_ansi = __toESM(require_wrap_ansi(), 1);
42538
42542
  function breakLines(content, width) {
@@ -42545,96 +42549,73 @@ function readlineWidth() {
42545
42549
  return import_cli_width.default({ defaultWidth: 80, output: readline().output });
42546
42550
  }
42547
42551
 
42548
- // node_modules/.pnpm/@inquirer+core@10.1.11_@types+node@22.15.18/node_modules/@inquirer/core/dist/esm/lib/pagination/lines.js
42549
- function split(content, width) {
42550
- return breakLines(content, width).split(`
42551
- `);
42552
- }
42553
- function rotate(count, items) {
42554
- const max = items.length;
42555
- const offset = (count % max + max) % max;
42556
- return [...items.slice(offset), ...items.slice(0, offset)];
42557
- }
42558
- function lines({ items, width, renderItem, active, position: requested, pageSize }) {
42559
- const layouts = items.map((item, index) => ({
42560
- item,
42561
- index,
42562
- isActive: index === active
42563
- }));
42564
- const layoutsInPage = rotate(active - requested, layouts).slice(0, pageSize);
42565
- const renderItemAt = (index) => layoutsInPage[index] == null ? [] : split(renderItem(layoutsInPage[index]), width);
42566
- const pageBuffer = Array.from({ length: pageSize });
42567
- const activeItem = renderItemAt(requested).slice(0, pageSize);
42568
- const position = requested + activeItem.length <= pageSize ? requested : pageSize - activeItem.length;
42569
- pageBuffer.splice(position, activeItem.length, ...activeItem);
42570
- let bufferPointer = position + activeItem.length;
42571
- let layoutPointer = requested + 1;
42572
- while (bufferPointer < pageSize && layoutPointer < layoutsInPage.length) {
42573
- for (const line of renderItemAt(layoutPointer)) {
42574
- pageBuffer[bufferPointer++] = line;
42575
- if (bufferPointer >= pageSize)
42576
- break;
42577
- }
42578
- layoutPointer++;
42579
- }
42580
- bufferPointer = position - 1;
42581
- layoutPointer = requested - 1;
42582
- while (bufferPointer >= 0 && layoutPointer >= 0) {
42583
- for (const line of renderItemAt(layoutPointer).reverse()) {
42584
- pageBuffer[bufferPointer--] = line;
42585
- if (bufferPointer < 0)
42586
- break;
42587
- }
42588
- layoutPointer--;
42589
- }
42590
- return pageBuffer.filter((line) => typeof line === "string");
42591
- }
42592
-
42593
- // node_modules/.pnpm/@inquirer+core@10.1.11_@types+node@22.15.18/node_modules/@inquirer/core/dist/esm/lib/pagination/position.js
42594
- function finite({ active, pageSize, total }) {
42552
+ // node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/pagination/use-pagination.js
42553
+ function usePointerPosition({ active, renderedItems, pageSize, loop }) {
42554
+ const state = useRef({
42555
+ lastPointer: active,
42556
+ lastActive: undefined
42557
+ });
42558
+ const { lastPointer, lastActive } = state.current;
42595
42559
  const middle = Math.floor(pageSize / 2);
42596
- if (total <= pageSize || active < middle)
42597
- return active;
42598
- if (active >= total - middle)
42599
- return active + pageSize - total;
42600
- return middle;
42601
- }
42602
- function infinite({ active, lastActive, total, pageSize, pointer }) {
42603
- if (total <= pageSize)
42604
- return active;
42605
- if (lastActive < active && active - lastActive < pageSize) {
42606
- return Math.min(Math.floor(pageSize / 2), pointer + active - lastActive);
42560
+ const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
42561
+ const defaultPointerPosition = renderedItems.slice(0, active).reduce((acc, item) => acc + item.length, 0);
42562
+ let pointer = defaultPointerPosition;
42563
+ if (renderedLength > pageSize) {
42564
+ if (loop) {
42565
+ pointer = lastPointer;
42566
+ if (lastActive != null && lastActive < active && active - lastActive < pageSize) {
42567
+ pointer = Math.min(middle, Math.abs(active - lastActive) === 1 ? Math.min(lastPointer + (renderedItems[lastActive]?.length ?? 0), Math.max(defaultPointerPosition, lastPointer)) : lastPointer + active - lastActive);
42568
+ }
42569
+ } else {
42570
+ const spaceUnderActive = renderedItems.slice(active).reduce((acc, item) => acc + item.length, 0);
42571
+ pointer = spaceUnderActive < pageSize - middle ? pageSize - spaceUnderActive : Math.min(defaultPointerPosition, middle);
42572
+ }
42607
42573
  }
42574
+ state.current.lastPointer = pointer;
42575
+ state.current.lastActive = active;
42608
42576
  return pointer;
42609
42577
  }
42610
-
42611
- // node_modules/.pnpm/@inquirer+core@10.1.11_@types+node@22.15.18/node_modules/@inquirer/core/dist/esm/lib/pagination/use-pagination.js
42612
42578
  function usePagination({ items, active, renderItem, pageSize, loop = true }) {
42613
- const state = useRef({ position: 0, lastActive: 0 });
42614
- const position = loop ? infinite({
42615
- active,
42616
- lastActive: state.current.lastActive,
42617
- total: items.length,
42618
- pageSize,
42619
- pointer: state.current.position
42620
- }) : finite({
42621
- active,
42622
- total: items.length,
42623
- pageSize
42579
+ const width = readlineWidth();
42580
+ const bound = (num) => (num % items.length + items.length) % items.length;
42581
+ const renderedItems = items.map((item, index) => {
42582
+ if (item == null)
42583
+ return [];
42584
+ return breakLines(renderItem({ item, index, isActive: index === active }), width).split(`
42585
+ `);
42624
42586
  });
42625
- state.current.position = position;
42626
- state.current.lastActive = active;
42627
- return lines({
42628
- items,
42629
- width: readlineWidth(),
42630
- renderItem,
42631
- active,
42632
- position,
42633
- pageSize
42634
- }).join(`
42587
+ const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
42588
+ const renderItemAtIndex = (index) => renderedItems[index] ?? [];
42589
+ const pointer = usePointerPosition({ active, renderedItems, pageSize, loop });
42590
+ const activeItem = renderItemAtIndex(active).slice(0, pageSize);
42591
+ const activeItemPosition = pointer + activeItem.length <= pageSize ? pointer : pageSize - activeItem.length;
42592
+ const pageBuffer = Array.from({ length: pageSize });
42593
+ pageBuffer.splice(activeItemPosition, activeItem.length, ...activeItem);
42594
+ const itemVisited = new Set([active]);
42595
+ let bufferPointer = activeItemPosition + activeItem.length;
42596
+ let itemPointer = bound(active + 1);
42597
+ while (bufferPointer < pageSize && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer > active)) {
42598
+ const lines = renderItemAtIndex(itemPointer);
42599
+ const linesToAdd = lines.slice(0, pageSize - bufferPointer);
42600
+ pageBuffer.splice(bufferPointer, linesToAdd.length, ...linesToAdd);
42601
+ itemVisited.add(itemPointer);
42602
+ bufferPointer += linesToAdd.length;
42603
+ itemPointer = bound(itemPointer + 1);
42604
+ }
42605
+ bufferPointer = activeItemPosition - 1;
42606
+ itemPointer = bound(active - 1);
42607
+ while (bufferPointer >= 0 && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer < active)) {
42608
+ const lines = renderItemAtIndex(itemPointer);
42609
+ const linesToAdd = lines.slice(Math.max(0, lines.length - bufferPointer - 1));
42610
+ pageBuffer.splice(bufferPointer - linesToAdd.length + 1, linesToAdd.length, ...linesToAdd);
42611
+ itemVisited.add(itemPointer);
42612
+ bufferPointer -= linesToAdd.length;
42613
+ itemPointer = bound(itemPointer - 1);
42614
+ }
42615
+ return pageBuffer.filter((line) => typeof line === "string").join(`
42635
42616
  `);
42636
42617
  }
42637
- // node_modules/.pnpm/@inquirer+core@10.1.11_@types+node@22.15.18/node_modules/@inquirer/core/dist/esm/lib/create-prompt.js
42618
+ // node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/create-prompt.js
42638
42619
  var import_mute_stream = __toESM(require_lib(), 1);
42639
42620
  import * as readline2 from "node:readline";
42640
42621
  import { AsyncResource as AsyncResource3 } from "node:async_hooks";
@@ -42847,7 +42828,7 @@ var {
42847
42828
  unload
42848
42829
  } = signalExitWrap(processOk(process3) ? new SignalExit(process3) : new SignalExitFallback);
42849
42830
 
42850
- // node_modules/.pnpm/@inquirer+core@10.1.11_@types+node@22.15.18/node_modules/@inquirer/core/dist/esm/lib/screen-manager.js
42831
+ // node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/screen-manager.js
42851
42832
  var import_ansi_escapes = __toESM(require_ansi_escapes(), 1);
42852
42833
  import { stripVTControlCharacters } from "node:util";
42853
42834
  var height = (content) => content.split(`
@@ -42917,7 +42898,7 @@ class ScreenManager {
42917
42898
  }
42918
42899
  }
42919
42900
 
42920
- // node_modules/.pnpm/@inquirer+core@10.1.11_@types+node@22.15.18/node_modules/@inquirer/core/dist/esm/lib/promise-polyfill.js
42901
+ // node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/promise-polyfill.js
42921
42902
  class PromisePolyfill extends Promise {
42922
42903
  static withResolver() {
42923
42904
  let resolve;
@@ -42930,7 +42911,7 @@ class PromisePolyfill extends Promise {
42930
42911
  }
42931
42912
  }
42932
42913
 
42933
- // node_modules/.pnpm/@inquirer+core@10.1.11_@types+node@22.15.18/node_modules/@inquirer/core/dist/esm/lib/create-prompt.js
42914
+ // node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/create-prompt.js
42934
42915
  function getCallSites() {
42935
42916
  const _prepareStackTrace = Error.prepareStackTrace;
42936
42917
  let result = [];
@@ -43016,7 +42997,7 @@ function createPrompt(view) {
43016
42997
  };
43017
42998
  return prompt;
43018
42999
  }
43019
- // node_modules/.pnpm/@inquirer+core@10.1.11_@types+node@22.15.18/node_modules/@inquirer/core/dist/esm/lib/Separator.js
43000
+ // node_modules/.pnpm/@inquirer+core@10.1.13_@types+node@22.15.29/node_modules/@inquirer/core/dist/esm/lib/Separator.js
43020
43001
  var import_yoctocolors_cjs2 = __toESM(require_yoctocolors_cjs(), 1);
43021
43002
  class Separator {
43022
43003
  separator = import_yoctocolors_cjs2.default.dim(Array.from({ length: 15 }).join(esm_default.line));
@@ -43030,7 +43011,7 @@ class Separator {
43030
43011
  return Boolean(choice && typeof choice === "object" && "type" in choice && choice.type === "separator");
43031
43012
  }
43032
43013
  }
43033
- // node_modules/.pnpm/@inquirer+checkbox@4.1.6_@types+node@22.15.18/node_modules/@inquirer/checkbox/dist/esm/index.js
43014
+ // node_modules/.pnpm/@inquirer+checkbox@4.1.8_@types+node@22.15.29/node_modules/@inquirer/checkbox/dist/esm/index.js
43034
43015
  var import_yoctocolors_cjs3 = __toESM(require_yoctocolors_cjs(), 1);
43035
43016
  var import_ansi_escapes2 = __toESM(require_ansi_escapes(), 1);
43036
43017
  var checkboxTheme = {
@@ -43204,9 +43185,8 @@ ${theme.style.error(errorMsg)}`;
43204
43185
  return `${prefix} ${message}${helpTipTop}
43205
43186
  ${page}${helpTipBottom}${choiceDescription}${error}${import_ansi_escapes2.default.cursorHide}`;
43206
43187
  });
43207
- // node_modules/.pnpm/@inquirer+editor@4.2.11_@types+node@22.15.18/node_modules/@inquirer/editor/dist/esm/index.js
43188
+ // node_modules/.pnpm/@inquirer+editor@4.2.13_@types+node@22.15.29/node_modules/@inquirer/editor/dist/esm/index.js
43208
43189
  var import_external_editor = __toESM(require_main(), 1);
43209
- import { AsyncResource as AsyncResource4 } from "node:async_hooks";
43210
43190
  var editorTheme = {
43211
43191
  validationFailureMode: "keep"
43212
43192
  };
@@ -43219,7 +43199,7 @@ var esm_default3 = createPrompt((config, done) => {
43219
43199
  const prefix = usePrefix({ status, theme });
43220
43200
  function startEditor(rl) {
43221
43201
  rl.pause();
43222
- const editCallback = AsyncResource4.bind(async (error2, answer) => {
43202
+ const editCallback = async (error2, answer) => {
43223
43203
  rl.resume();
43224
43204
  if (error2) {
43225
43205
  setError(error2.toString());
@@ -43240,7 +43220,7 @@ var esm_default3 = createPrompt((config, done) => {
43240
43220
  setStatus("idle");
43241
43221
  }
43242
43222
  }
43243
- });
43223
+ };
43244
43224
  import_external_editor.editAsync(value, (error2, answer) => void editCallback(error2, answer), {
43245
43225
  postfix,
43246
43226
  ...fileProps
@@ -43273,7 +43253,7 @@ var esm_default3 = createPrompt((config, done) => {
43273
43253
  }
43274
43254
  return [[prefix, message, helpTip].filter(Boolean).join(" "), error];
43275
43255
  });
43276
- // node_modules/.pnpm/@inquirer+confirm@5.1.10_@types+node@22.15.18/node_modules/@inquirer/confirm/dist/esm/index.js
43256
+ // node_modules/.pnpm/@inquirer+confirm@5.1.12_@types+node@22.15.29/node_modules/@inquirer/confirm/dist/esm/index.js
43277
43257
  function getBooleanValue(value, defaultValue) {
43278
43258
  let answer = defaultValue !== false;
43279
43259
  if (/^(y|yes)/i.test(value))
@@ -43316,7 +43296,7 @@ var esm_default4 = createPrompt((config, done) => {
43316
43296
  const message = theme.style.message(config.message, status);
43317
43297
  return `${prefix} ${message}${defaultValue} ${formattedValue}`;
43318
43298
  });
43319
- // node_modules/.pnpm/@inquirer+input@4.1.10_@types+node@22.15.18/node_modules/@inquirer/input/dist/esm/index.js
43299
+ // node_modules/.pnpm/@inquirer+input@4.1.12_@types+node@22.15.29/node_modules/@inquirer/input/dist/esm/index.js
43320
43300
  var inputTheme = {
43321
43301
  validationFailureMode: "keep"
43322
43302
  };
@@ -43381,7 +43361,7 @@ var esm_default5 = createPrompt((config, done) => {
43381
43361
  error
43382
43362
  ];
43383
43363
  });
43384
- // node_modules/.pnpm/@inquirer+number@3.0.13_@types+node@22.15.18/node_modules/@inquirer/number/dist/esm/index.js
43364
+ // node_modules/.pnpm/@inquirer+number@3.0.15_@types+node@22.15.29/node_modules/@inquirer/number/dist/esm/index.js
43385
43365
  function isStepOf(value, step, min) {
43386
43366
  const valuePow = value * Math.pow(10, 6);
43387
43367
  const stepPow = step * Math.pow(10, 6);
@@ -43461,7 +43441,7 @@ var esm_default6 = createPrompt((config, done) => {
43461
43441
  error
43462
43442
  ];
43463
43443
  });
43464
- // node_modules/.pnpm/@inquirer+expand@4.0.13_@types+node@22.15.18/node_modules/@inquirer/expand/dist/esm/index.js
43444
+ // node_modules/.pnpm/@inquirer+expand@4.0.15_@types+node@22.15.29/node_modules/@inquirer/expand/dist/esm/index.js
43465
43445
  var import_yoctocolors_cjs4 = __toESM(require_yoctocolors_cjs(), 1);
43466
43446
  function normalizeChoices2(choices) {
43467
43447
  return choices.map((choice) => {
@@ -43558,7 +43538,7 @@ var esm_default7 = createPrompt((config, done) => {
43558
43538
  `)
43559
43539
  ];
43560
43540
  });
43561
- // node_modules/.pnpm/@inquirer+rawlist@4.1.1_@types+node@22.15.18/node_modules/@inquirer/rawlist/dist/esm/index.js
43541
+ // node_modules/.pnpm/@inquirer+rawlist@4.1.3_@types+node@22.15.29/node_modules/@inquirer/rawlist/dist/esm/index.js
43562
43542
  var import_yoctocolors_cjs5 = __toESM(require_yoctocolors_cjs(), 1);
43563
43543
  var numberRegex = /\d+/;
43564
43544
  function isSelectableChoice(choice) {
@@ -43670,7 +43650,7 @@ var esm_default8 = createPrompt((config, done) => {
43670
43650
  `)
43671
43651
  ];
43672
43652
  });
43673
- // node_modules/.pnpm/@inquirer+password@4.0.13_@types+node@22.15.18/node_modules/@inquirer/password/dist/esm/index.js
43653
+ // node_modules/.pnpm/@inquirer+password@4.0.15_@types+node@22.15.29/node_modules/@inquirer/password/dist/esm/index.js
43674
43654
  var import_ansi_escapes3 = __toESM(require_ansi_escapes(), 1);
43675
43655
  var esm_default9 = createPrompt((config, done) => {
43676
43656
  const { validate = () => true } = config;
@@ -43719,7 +43699,7 @@ var esm_default9 = createPrompt((config, done) => {
43719
43699
  }
43720
43700
  return [[prefix, message, config.mask ? formattedValue : helpTip].join(" "), error];
43721
43701
  });
43722
- // node_modules/.pnpm/@inquirer+search@3.0.13_@types+node@22.15.18/node_modules/@inquirer/search/dist/esm/index.js
43702
+ // node_modules/.pnpm/@inquirer+search@3.0.15_@types+node@22.15.29/node_modules/@inquirer/search/dist/esm/index.js
43723
43703
  var import_yoctocolors_cjs6 = __toESM(require_yoctocolors_cjs(), 1);
43724
43704
  var searchTheme = {
43725
43705
  icon: { cursor: esm_default.pointer },
@@ -43884,7 +43864,7 @@ ${theme.style.description(selectedChoice.description)}` : ``;
43884
43864
  `${error ?? page}${helpTip}${choiceDescription}`
43885
43865
  ];
43886
43866
  });
43887
- // node_modules/.pnpm/@inquirer+select@4.2.1_@types+node@22.15.18/node_modules/@inquirer/select/dist/esm/index.js
43867
+ // node_modules/.pnpm/@inquirer+select@4.2.3_@types+node@22.15.29/node_modules/@inquirer/select/dist/esm/index.js
43888
43868
  var import_yoctocolors_cjs7 = __toESM(require_yoctocolors_cjs(), 1);
43889
43869
  var import_ansi_escapes4 = __toESM(require_ansi_escapes(), 1);
43890
43870
  var selectTheme = {
@@ -44030,7 +44010,7 @@ ${theme.style.description(selectedChoice.description)}` : ``;
44030
44010
  return `${[prefix, message, helpTipTop].filter(Boolean).join(" ")}
44031
44011
  ${page}${helpTipBottom}${choiceDescription}${import_ansi_escapes4.default.cursorHide}`;
44032
44012
  });
44033
- // node_modules/.pnpm/inquirer@12.6.1_@types+node@22.15.18/node_modules/inquirer/dist/esm/ui/prompt.js
44013
+ // node_modules/.pnpm/inquirer@12.6.3_@types+node@22.15.29/node_modules/inquirer/dist/esm/ui/prompt.js
44034
44014
  var import_rxjs = __toESM(require_cjs(), 1);
44035
44015
  var import_run_async = __toESM(require_run_async(), 1);
44036
44016
  var import_mute_stream2 = __toESM(require_lib(), 1);
@@ -44242,7 +44222,7 @@ class PromptsRunner {
44242
44222
  };
44243
44223
  }
44244
44224
 
44245
- // node_modules/.pnpm/inquirer@12.6.1_@types+node@22.15.18/node_modules/inquirer/dist/esm/index.js
44225
+ // node_modules/.pnpm/inquirer@12.6.3_@types+node@22.15.29/node_modules/inquirer/dist/esm/index.js
44246
44226
  var builtInPrompts = {
44247
44227
  input: esm_default5,
44248
44228
  select: esm_default11,
@@ -44294,7 +44274,7 @@ var esm_default12 = inquirer;
44294
44274
  // src/module/login/login-by-web.ts
44295
44275
  var import_md5 = __toESM(require_md5(), 1);
44296
44276
 
44297
- // node_modules/.pnpm/@kevisual+query@0.0.18_encoding@0.1.13_ws@8.18.0/node_modules/@kevisual/query/dist/query.js
44277
+ // node_modules/.pnpm/@kevisual+query@0.0.20_encoding@0.1.13_ws@8.18.0/node_modules/@kevisual/query/dist/query.js
44298
44278
  var adapter = async (opts, overloadOpts) => {
44299
44279
  const controller = new AbortController;
44300
44280
  const signal = controller.signal;
@@ -44370,6 +44350,7 @@ class Query {
44370
44350
  headers;
44371
44351
  timeout;
44372
44352
  stop;
44353
+ qws;
44373
44354
  constructor(opts) {
44374
44355
  this.adapter = opts?.adapter || adapter;
44375
44356
  this.url = opts?.url || "/api/router";
@@ -44378,6 +44359,9 @@ class Query {
44378
44359
  };
44379
44360
  this.timeout = opts?.timeout || 60000 * 3;
44380
44361
  }
44362
+ setQueryWs(qws) {
44363
+ this.qws = qws;
44364
+ }
44381
44365
  setStop(stop) {
44382
44366
  this.stop = stop;
44383
44367
  }
@@ -44461,7 +44445,7 @@ class Query {
44461
44445
  }
44462
44446
  }
44463
44447
 
44464
- // node_modules/.pnpm/@kevisual+query@0.0.18_encoding@0.1.13_ws@8.18.0/node_modules/@kevisual/query/dist/query-browser.js
44448
+ // node_modules/.pnpm/@kevisual+query@0.0.20_encoding@0.1.13_ws@8.18.0/node_modules/@kevisual/query/dist/query-browser.js
44465
44449
  var adapter2 = async (opts, overloadOpts) => {
44466
44450
  const controller = new AbortController;
44467
44451
  const signal = controller.signal;
@@ -44537,6 +44521,7 @@ class Query2 {
44537
44521
  headers;
44538
44522
  timeout;
44539
44523
  stop;
44524
+ qws;
44540
44525
  constructor(opts) {
44541
44526
  this.adapter = opts?.adapter || adapter2;
44542
44527
  this.url = opts?.url || "/api/router";
@@ -44545,6 +44530,9 @@ class Query2 {
44545
44530
  };
44546
44531
  this.timeout = opts?.timeout || 60000 * 3;
44547
44532
  }
44533
+ setQueryWs(qws) {
44534
+ this.qws = qws;
44535
+ }
44548
44536
  setStop(stop) {
44549
44537
  this.stop = stop;
44550
44538
  }
@@ -44630,8 +44618,20 @@ class Query2 {
44630
44618
 
44631
44619
  class BaseQuery {
44632
44620
  query;
44633
- constructor({ query }) {
44634
- this.query = query;
44621
+ queryDefine;
44622
+ constructor(opts) {
44623
+ if (opts?.clientQuery) {
44624
+ this.query = opts.clientQuery;
44625
+ } else {
44626
+ this.query = opts?.query;
44627
+ }
44628
+ if (opts.queryDefine) {
44629
+ this.queryDefine = opts.queryDefine;
44630
+ this.queryDefine.query = this.query;
44631
+ }
44632
+ }
44633
+ get chain() {
44634
+ return this.queryDefine.queryChain;
44635
44635
  }
44636
44636
  post(data, options) {
44637
44637
  return this.query.post(data, options);
@@ -44641,7 +44641,7 @@ class BaseQuery {
44641
44641
  }
44642
44642
  }
44643
44643
 
44644
- // node_modules/.pnpm/@kevisual+query-login@0.0.5_@kevisual+query@0.0.18_encoding@0.1.13_ws@8.18.0__rollup@4.41.0_typescript@5.8.2/node_modules/@kevisual/query-login/dist/query-login-node.js
44644
+ // node_modules/.pnpm/@kevisual+query-login@0.0.6_@kevisual+query@0.0.20_encoding@0.1.13_ws@8.18.0__rollup@4.41.1_tslib@2.8.1_typescript@5.8.2/node_modules/@kevisual/query-login/dist/query-login-node.js
44645
44645
  import { homedir } from "node:os";
44646
44646
  import { join, dirname } from "node:path";
44647
44647
  import fs3 from "node:fs";
@@ -44795,6 +44795,11 @@ var QueryLogin = class extends BaseQuery {
44795
44795
  }
44796
44796
  return res;
44797
44797
  }
44798
+ async setLoginToken(token) {
44799
+ const { accessToken, refreshToken } = token;
44800
+ this.storage.setItem("token", accessToken || "");
44801
+ await this.beforeSetLoginUser({ accessToken, refreshToken });
44802
+ }
44798
44803
  async loginByWechat(data) {
44799
44804
  const res = await this.post({ path: "wx", key: "open-login", code: data.code });
44800
44805
  if (res.code === 200) {
@@ -48589,10 +48594,10 @@ class Header {
48589
48594
  throw new Error("need 512 bytes for header");
48590
48595
  }
48591
48596
  const prefixSize = this.ctime || this.atime ? 130 : 155;
48592
- const split2 = splitPrefix(this.path || "", prefixSize);
48593
- const path2 = split2[0];
48594
- const prefix = split2[1];
48595
- this.needPax = !!split2[2];
48597
+ const split = splitPrefix(this.path || "", prefixSize);
48598
+ const path2 = split[0];
48599
+ const prefix = split[1];
48600
+ this.needPax = !!split[2];
48596
48601
  this.needPax = encString(buf, off, 100, path2) || this.needPax;
48597
48602
  this.needPax = encNumber(buf, off + 100, 8, this.mode) || this.needPax;
48598
48603
  this.needPax = encNumber(buf, off + 108, 8, this.uid) || this.needPax;
@@ -52309,6 +52314,7 @@ ${filesString}
52309
52314
  fs15.writeFileSync(indexHtmlPath, indexHtmlContent);
52310
52315
  };
52311
52316
  var pack2 = async (opts) => {
52317
+ const isTar = opts.isTar;
52312
52318
  const cwd = process.cwd();
52313
52319
  const collection = {};
52314
52320
  const packageJsonPath = path9.join(cwd, "package.json");
@@ -52355,8 +52361,8 @@ var pack2 = async (opts) => {
52355
52361
  Tarball Details`);
52356
52362
  console.log(`name: ${packageJson.name}`);
52357
52363
  console.log(`version: ${packageJson.version}`);
52358
- console.log(`filename: ${outputFileName}`);
52359
- console.log(`package size: ${packageSize}`);
52364
+ isTar && console.log(`filename: ${outputFileName}`);
52365
+ isTar && console.log(`package size: ${packageSize}`);
52360
52366
  console.log(`total files: ${allFiles.length}`);
52361
52367
  opts?.isTar && console.log(`Created package: ${outputFileName}`);
52362
52368
  try {
@@ -52473,11 +52479,26 @@ var deployLoadFn = async (id, fileKey, force = false, install = false) => {
52473
52479
  console.error(chalk2.red("id is required"));
52474
52480
  return;
52475
52481
  }
52482
+ let appKey = "";
52483
+ let version3 = "";
52484
+ if (id && id.includes("/")) {
52485
+ const [a, b] = id.split("/");
52486
+ if (a) {
52487
+ appKey = b || "1.0.0";
52488
+ version3 = a;
52489
+ id = "";
52490
+ } else {
52491
+ console.error(chalk2.red('id format error, please use "version/appKey" format'));
52492
+ return;
52493
+ }
52494
+ }
52476
52495
  const res = await query.post({
52477
52496
  path: "micro-app",
52478
52497
  key: "deploy",
52479
52498
  data: {
52480
52499
  id,
52500
+ version: version3,
52501
+ appKey,
52481
52502
  key: fileKey,
52482
52503
  force,
52483
52504
  install: !!install
@@ -52543,10 +52564,9 @@ var packCommand = new Command("pack").description("打包应用, 默认使用 pa
52543
52564
  fs15.writeFileSync(path9.join(process.cwd(), "pack-dist", "package.json"), JSON.stringify(newPackageJson, null, 2));
52544
52565
  }
52545
52566
  if (opts.publish) {
52546
- const runDeployCommand = "envision pack-deploy " + value.outputFilePath + " -k " + appKey;
52547
52567
  const [_app, _command] = process.argv;
52548
52568
  let deployDist = opts.isTar ? value.outputFilePath : packDist;
52549
- const deployCommand = [_app, _command, "deploy", deployDist, "-k", appKey, "-v", version3, "-u"];
52569
+ const deployCommand = [_app, _command, "deploy", deployDist, "-k", appKey, "-v", version3, "-u", "-d"];
52550
52570
  if (opts.org) {
52551
52571
  deployCommand.push("-o", opts.org);
52552
52572
  }
@@ -52557,9 +52577,7 @@ var packCommand = new Command("pack").description("打包应用, 默认使用 pa
52557
52577
  deployCommand.push("-y", "yes");
52558
52578
  }
52559
52579
  console.log(chalk2.blue("deploy doing: "), deployCommand.slice(2).join(" "), `
52560
-
52561
52580
  `);
52562
- console.log("pack deploy services", chalk2.blue("example: "), runDeployCommand);
52563
52581
  program.parse(deployCommand);
52564
52582
  }
52565
52583
  });
@@ -52735,7 +52753,7 @@ var getBufferHash = (buffer) => {
52735
52753
  // src/module/download/upload.ts
52736
52754
  var import_form_data = __toESM(require_form_data(), 1);
52737
52755
 
52738
- // node_modules/.pnpm/@kevisual+logger@0.0.3/node_modules/@kevisual/logger/dist/logger-node.mjs
52756
+ // node_modules/.pnpm/@kevisual+logger@0.0.4/node_modules/@kevisual/logger/dist/logger-node.mjs
52739
52757
  import process5 from "node:process";
52740
52758
  import os3 from "node:os";
52741
52759
  import tty2 from "node:tty";
@@ -52783,7 +52801,16 @@ class Logger {
52783
52801
  showTime;
52784
52802
  format;
52785
52803
  constructor(opts) {
52786
- this.level = opts?.level ?? "info";
52804
+ if (opts?.level) {
52805
+ const normalizedLevel = opts.level.toLowerCase();
52806
+ if (logLevel.includes(normalizedLevel)) {
52807
+ this.level = normalizedLevel;
52808
+ } else {
52809
+ this.level = "info";
52810
+ }
52811
+ } else {
52812
+ this.level = "info";
52813
+ }
52787
52814
  this.printer = opts?.printer ?? new Printer;
52788
52815
  this.showTime = opts?.showTime ?? false;
52789
52816
  this.format = opts?.format ?? "HH:mm:ss";
@@ -53310,6 +53337,21 @@ class Printer2 extends Printer {
53310
53337
  error(...args) {
53311
53338
  console.log(source_default2.red(this.getNewArgs(...args)));
53312
53339
  }
53340
+ green(...args) {
53341
+ console.log(source_default2.green(this.getNewArgs(...args)));
53342
+ }
53343
+ red(...args) {
53344
+ console.log(source_default2.red(this.getNewArgs(...args)));
53345
+ }
53346
+ blue(...args) {
53347
+ console.log(source_default2.blue(this.getNewArgs(...args)));
53348
+ }
53349
+ chalk(fn, ...args) {
53350
+ const show = source_default2[fn];
53351
+ if (show) {
53352
+ console.log(show(this.getNewArgs(...args)));
53353
+ }
53354
+ }
53313
53355
  }
53314
53356
 
53315
53357
  class Logger2 extends Logger {
@@ -53394,6 +53436,26 @@ var upload = (opts) => {
53394
53436
  });
53395
53437
  };
53396
53438
 
53439
+ // src/query/app-manager/query-app.ts
53440
+ var queryApp = async (params, opts) => {
53441
+ return await query.post({
53442
+ path: "app",
53443
+ key: "getApp",
53444
+ data: {
53445
+ ...params
53446
+ }
53447
+ }, opts);
53448
+ };
53449
+ var queryAppVersion = async (params, opts) => {
53450
+ return await query.post({
53451
+ path: "app",
53452
+ key: "get",
53453
+ data: {
53454
+ ...params
53455
+ }
53456
+ }, opts);
53457
+ };
53458
+
53397
53459
  // src/command/deploy.ts
53398
53460
  var getPackageJson = () => {
53399
53461
  const filePath = path10.join(process.cwd(), "package.json");
@@ -53455,7 +53517,7 @@ var command2 = new Command("deploy").description("把前端文件传到服务器
53455
53517
  if (stat2.isDirectory()) {
53456
53518
  isDirectory = true;
53457
53519
  const gPath = path10.join(directory, "**/*");
53458
- const files = await import_fast_glob2.default(gPath, { cwd: pwd, ignore: ["node_modules/**/*"], onlyFiles: true, dot });
53520
+ const files = await import_fast_glob2.default(gPath, { cwd: pwd, ignore: ["node_modules/**/*", ".git/**/*", ".DS_Store"], onlyFiles: true, dot });
53459
53521
  _relativeFiles = files.map((file) => path10.relative(directory, file));
53460
53522
  } else if (stat2.isFile()) {
53461
53523
  const filename = path10.basename(directory);
@@ -53482,7 +53544,15 @@ var command2 = new Command("deploy").description("把前端文件传到服务器
53482
53544
  res.data?.upload?.map?.((d) => {
53483
53545
  console.log(source_default.green("uploaded file", d?.name, d?.path));
53484
53546
  });
53485
- const { id, data, ...rest } = res.data?.app || {};
53547
+ const res2 = await queryAppVersion({
53548
+ key: key2,
53549
+ version: version3
53550
+ });
53551
+ if (res2.code !== 200) {
53552
+ console.error(source_default.red("查询应用版本失败"), res2.message);
53553
+ return;
53554
+ }
53555
+ const { id, data, ...rest } = res2.data || {};
53486
53556
  if (id && !update3) {
53487
53557
  console.log(source_default.green("id: "), id);
53488
53558
  if (!org) {
@@ -53493,6 +53563,7 @@ var command2 = new Command("deploy").description("把前端文件传到服务器
53493
53563
  } else if (id && update3) {
53494
53564
  deployLoadFn2(id);
53495
53565
  } else {}
53566
+ logger.debug("deploy success", res2.data);
53496
53567
  if (id && showBackend) {
53497
53568
  console.log(`
53498
53569
  `);
@@ -53516,7 +53587,6 @@ var command2 = new Command("deploy").description("把前端文件传到服务器
53516
53587
  });
53517
53588
  var uploadFiles = async (files, directory, opts) => {
53518
53589
  const { key: key2, version: version3, username } = opts || {};
53519
- const config2 = await getConfig();
53520
53590
  const form = new import_form_data2.default;
53521
53591
  const data = { files: [] };
53522
53592
  for (const file of files) {
@@ -54458,7 +54528,7 @@ class SyncBase {
54458
54528
  let obj = {};
54459
54529
  const keys = [];
54460
54530
  for (let item of syncDirectory) {
54461
- const { registry, ignore: ignore2 = [], files = [], replace: replace3 = {} } = item;
54531
+ const { registry, ignore: ignore2 = [], files = [], replace: replace3 = {}, metadata } = item;
54462
54532
  const cwd = this.#dir;
54463
54533
  const glob_files = await import_fast_glob3.default(files, {
54464
54534
  ignore: this.getIngore(ignore2),
@@ -54485,7 +54555,10 @@ class SyncBase {
54485
54555
  const pathname = path14.join(_registryURL.pathname, newKey);
54486
54556
  _registryURL.pathname = pathname;
54487
54557
  keys.push(key2);
54488
- obj[key2] = _registryURL.toString();
54558
+ obj[key2] = { url: _registryURL.toString() };
54559
+ if (metadata) {
54560
+ obj[key2] = { ...obj[key2], metadata };
54561
+ }
54489
54562
  }
54490
54563
  }
54491
54564
  return { sync: obj, keys };
@@ -54524,11 +54597,12 @@ class SyncBase {
54524
54597
  import path15 from "path";
54525
54598
  import fs22 from "fs";
54526
54599
  var import_fast_glob4 = __toESM(require_out4(), 1);
54527
- var fetchLink = async (url, opts) => {
54600
+ var fetchLink = async (url = "", opts) => {
54528
54601
  const token2 = process.env.KEVISUAL_TOKEN || storage.getItem("token");
54529
54602
  const fetchURL = new URL(url);
54530
54603
  const check2 = opts?.check ?? false;
54531
- const setToken = opts?.setToken ?? true;
54604
+ const isKevisual = !!url.includes("kevisual");
54605
+ const setToken = opts?.setToken ?? isKevisual;
54532
54606
  if (check2) {
54533
54607
  if (!url.startsWith(baseURL)) {
54534
54608
  throw new Error("url must start with " + baseURL);
@@ -54749,7 +54823,7 @@ import path16 from "node:path";
54749
54823
  var command8 = new Command("sync").option("-d --dir <dir>").description("同步项目").action(() => {
54750
54824
  console.log("同步项目");
54751
54825
  });
54752
- var syncUpload = new Command("upload").option("-d --dir <dir>", "配置目录").option("-s --share <share>", "共享设置").option("-c --config <config>", "配置文件的名字", "kevisual.json").option("-f --file <file>", "操作的对应的文件名").description("上传项目").action(async (opts) => {
54826
+ var syncUpload = new Command("upload").option("-d --dir <dir>", "配置目录").option("-c --config <config>", "配置文件的名字", "kevisual.json").option("-f --file <file>", "操作的对应的文件名").description("上传项目, 上传需要和registry的地址同步。").action(async (opts) => {
54753
54827
  console.log("上传项目");
54754
54828
  const sync = new SyncBase({ dir: opts.dir, baseURL, configFilename: opts.config });
54755
54829
  const syncList = await sync.getSyncList({ getFile: true });
@@ -54759,10 +54833,8 @@ var syncUpload = new Command("upload").option("-d --dir <dir>", "配置目录").
54759
54833
  const meta = {
54760
54834
  ...sync.config.metadata
54761
54835
  };
54762
- if (opts.share) {
54763
- meta.share = opts.share;
54764
- }
54765
54836
  const filepath = sync.getRelativePath(opts.file);
54837
+ const newInfos = [];
54766
54838
  for (const item of syncList) {
54767
54839
  if (!item.auth || !item.exist) {
54768
54840
  nodonwArr.push(item);
@@ -54781,19 +54853,26 @@ var syncUpload = new Command("upload").option("-d --dir <dir>", "配置目录").
54781
54853
  url: item.url,
54782
54854
  needHash: true,
54783
54855
  hash: item.hash,
54784
- meta
54856
+ meta: item.metadata ?? meta
54785
54857
  });
54786
54858
  if (res.code === 200) {
54787
54859
  if (res.data?.isNew) {
54788
- logger.info("上传成功", item.key, chalk2.green(item.url), chalk2.green("文件上传"));
54860
+ newInfos.push(["上传成功", item.key, chalk2.green(item.url), chalk2.green("文件上传")]);
54789
54861
  } else if (res.data?.isNewMeta) {
54790
- logger.info("上传成功", item.key, chalk2.green(item.url), chalk2.green("元数据更新"));
54862
+ newInfos.push(["上传成功", item.key, chalk2.green(item.url), chalk2.green("元数据更新")]);
54791
54863
  } else {
54792
54864
  logger.info("上传成功", item.key, chalk2.green(item.url), chalk2.blue("文件未更新"));
54793
54865
  }
54794
54866
  }
54795
54867
  logger.debug(res);
54796
54868
  }
54869
+ if (newInfos.length) {
54870
+ logger.info(`上传成功的文件
54871
+ `);
54872
+ newInfos.forEach((item) => {
54873
+ logger.info(...item);
54874
+ });
54875
+ }
54797
54876
  if (nodonwArr.length && !filepath) {
54798
54877
  logger.warn(`以下文件未上传
54799
54878
  `, nodonwArr.map((item) => item.key).join(","));
@@ -54829,17 +54908,20 @@ var syncDownload = new Command("download").option("-d --dir <dir>", "配置目
54829
54908
  logger.warn("以下文件未下载", nodonwArr.map((item) => item.key).join(","));
54830
54909
  }
54831
54910
  });
54832
- var syncList = new Command("list").option("-d --dir <dir>", "配置目录").option("-c --config <config>", "配置文件的名字", "kevisual.json").description("列出同步列表").action(async (opts) => {
54911
+ var syncList = new Command("list").option("-d --dir <dir>", "配置目录").option("-c --config <config>", "配置文件的名字", "kevisual.json").option("-a --all", "显示所有的文件").description("列出同步列表").action(async (opts) => {
54833
54912
  const sync = new SyncBase({ dir: opts.dir, baseURL, configFilename: opts.config });
54834
54913
  const syncList2 = await sync.getSyncList();
54835
54914
  logger.debug(syncList2);
54836
54915
  logger.info(`同步列表
54837
54916
  `);
54838
54917
  syncList2.forEach((item) => {
54839
- logger.info(chalk2.blue(item.key), chalk2.gray(item.type), chalk2.green(item.url));
54918
+ if (opts.all) {
54919
+ logger.info(item);
54920
+ } else
54921
+ logger.info(chalk2.blue(item.key), chalk2.gray(item.type), chalk2.green(item.url));
54840
54922
  });
54841
54923
  });
54842
- var syncCreateList = new Command("create").option("-d --dir <dir>", "配置目录").option("-c --config <config>", "配置文件的名字", "kevisual.json").option("-o --output <output>", "输出文件").description("创建文件").action(async (opts) => {
54924
+ var syncCreateList = new Command("create").option("-d --dir <dir>", "配置目录").option("-c --config <config>", "配置文件的名字", "kevisual.json").option("-o --output <output>", "输出文件").description("创建文件, 获取远程的目录列表,然后创建新的配置文件").action(async (opts) => {
54843
54925
  const sync = new SyncBase({ dir: opts.dir, baseURL, configFilename: opts.config });
54844
54926
  const syncList2 = await sync.getSyncList();
54845
54927
  logger.debug(syncList2);
@@ -54932,17 +55014,6 @@ command8.addCommand(syncCreateList);
54932
55014
  command8.addCommand(checkDir);
54933
55015
  program.addCommand(command8);
54934
55016
 
54935
- // src/query/app-manager/query-app.ts
54936
- var queryApp = async (params, opts) => {
54937
- return await query.post({
54938
- path: "app",
54939
- key: "getApp",
54940
- data: {
54941
- ...params
54942
- }
54943
- }, opts);
54944
- };
54945
-
54946
55017
  // src/command/app/front-app/index.ts
54947
55018
  import fs24 from "fs";
54948
55019
  import path17 from "path";