sandstone-cli 2.4.0 → 2.4.1

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/lib/index.js CHANGED
@@ -8045,8 +8045,8 @@ var require_adm_zip = __commonJS((exports, module) => {
8045
8045
  return null;
8046
8046
  }
8047
8047
  function fixPath(zipPath) {
8048
- const { join: join2, normalize, sep } = pth.posix;
8049
- return join2(".", normalize(sep + zipPath.split("\\").join(sep) + sep));
8048
+ const { join, normalize, sep } = pth.posix;
8049
+ return join(".", normalize(sep + zipPath.split("\\").join(sep) + sep));
8050
8050
  }
8051
8051
  function filenameFilter(filterfn) {
8052
8052
  if (filterfn instanceof RegExp) {
@@ -24421,7 +24421,7 @@ var {
24421
24421
  import figlet from "figlet";
24422
24422
 
24423
24423
  // src/version.ts
24424
- var CLI_VERSION = "2.4.0";
24424
+ var CLI_VERSION = "2.4.1";
24425
24425
 
24426
24426
  // src/commands/build/index.ts
24427
24427
  var import_fs_extra4 = __toESM(require_lib(), 1);
@@ -24999,11 +24999,14 @@ async function logWorkerMain(level, ...args) {
24999
24999
  return;
25000
25000
  }
25001
25001
  const chunks = [];
25002
- chunks.push(`[${new Date().toISOString()}]${level !== false ? ` [${level}]` : ""} `);
25002
+ const prefix = `[${new Date().toISOString()}]${level !== false ? ` [${level}]` : ""} `;
25003
+ chunks.push(prefix);
25003
25004
  for (let i = 0;i < args.length; i++) {
25004
25005
  const arg = args[i];
25005
25006
  if (typeof arg === "string") {
25006
- chunks.push(stripVTControlCharacters(arg));
25007
+ chunks.push(stripVTControlCharacters(arg).replaceAll(`
25008
+ `, `
25009
+ ${" ".repeat(prefix.length)}`));
25007
25010
  } else if (Buffer.isBuffer(arg) || arg instanceof Uint8Array) {
25008
25011
  chunks.push(arg);
25009
25012
  } else if (arg instanceof ArrayBuffer) {
@@ -25011,7 +25014,9 @@ async function logWorkerMain(level, ...args) {
25011
25014
  } else if (arg instanceof Blob) {
25012
25015
  chunks.push(new Uint8Array(await arg.arrayBuffer()));
25013
25016
  } else {
25014
- chunks.push(format("%O", arg));
25017
+ chunks.push(stripVTControlCharacters(format("%O", arg)).replaceAll(`
25018
+ `, `
25019
+ ${" ".repeat(prefix.length)}`));
25015
25020
  }
25016
25021
  if (i < args.length - 1) {
25017
25022
  chunks.push(" ");
@@ -25184,15 +25189,15 @@ var $SourceMapConsumer = require_source_map_consumer().SourceMapConsumer;
25184
25189
  var $SourceNode = require_source_node().SourceNode;
25185
25190
 
25186
25191
  // src/utils/source-map.ts
25187
- import { readFile } from "fs/promises";
25192
+ import { readFileSync } from "fs";
25188
25193
  import { dirname, resolve } from "path";
25189
25194
  var sourceMapCache = new Map;
25190
- async function loadSourceMap(jsFilePath) {
25195
+ function loadSourceMapSync(jsFilePath) {
25191
25196
  if (sourceMapCache.has(jsFilePath)) {
25192
25197
  return sourceMapCache.get(jsFilePath) ?? null;
25193
25198
  }
25194
25199
  try {
25195
- const jsContent = await readFile(jsFilePath, "utf8");
25200
+ const jsContent = readFileSync(jsFilePath, "utf8");
25196
25201
  const match = jsContent.match(/\/\/[#@]\s*sourceMappingURL=(.+)$/m);
25197
25202
  if (!match) {
25198
25203
  sourceMapCache.set(jsFilePath, null);
@@ -25200,21 +25205,18 @@ async function loadSourceMap(jsFilePath) {
25200
25205
  }
25201
25206
  const sourceMappingURL = match[1].trim();
25202
25207
  let mapPath;
25208
+ let mapContent;
25203
25209
  if (sourceMappingURL.startsWith("data:")) {
25204
25210
  const base64Match = sourceMappingURL.match(/base64,(.+)/);
25205
25211
  if (!base64Match) {
25206
25212
  sourceMapCache.set(jsFilePath, null);
25207
25213
  return null;
25208
25214
  }
25209
- const mapContent2 = Buffer.from(base64Match[1], "base64").toString("utf8");
25210
- const rawMap2 = JSON.parse(mapContent2);
25211
- const consumer2 = new $SourceMapConsumer(rawMap2);
25212
- sourceMapCache.set(jsFilePath, consumer2);
25213
- return consumer2;
25215
+ mapContent = Buffer.from(base64Match[1], "base64").toString("utf8");
25214
25216
  } else {
25215
25217
  mapPath = resolve(dirname(jsFilePath), sourceMappingURL);
25218
+ mapContent = readFileSync(mapPath, "utf8");
25216
25219
  }
25217
- const mapContent = await readFile(mapPath, "utf8");
25218
25220
  const rawMap = JSON.parse(mapContent);
25219
25221
  const consumer = new $SourceMapConsumer(rawMap);
25220
25222
  sourceMapCache.set(jsFilePath, consumer);
@@ -25253,7 +25255,7 @@ function parseStackLine(line) {
25253
25255
  }
25254
25256
  return { original: line };
25255
25257
  }
25256
- async function resolveStackFrame(frame) {
25258
+ function resolveStackFrame(frame) {
25257
25259
  if (!frame.filePath || !frame.line || !frame.column) {
25258
25260
  return frame.original;
25259
25261
  }
@@ -25261,7 +25263,7 @@ async function resolveStackFrame(frame) {
25261
25263
  return frame.original;
25262
25264
  }
25263
25265
  try {
25264
- const consumer = await loadSourceMap(frame.filePath);
25266
+ const consumer = loadSourceMapSync(frame.filePath);
25265
25267
  if (!consumer) {
25266
25268
  return frame.original;
25267
25269
  }
@@ -25282,14 +25284,14 @@ async function resolveStackFrame(frame) {
25282
25284
  } catch {}
25283
25285
  return frame.original;
25284
25286
  }
25285
- async function resolveStackTrace(stack) {
25287
+ function resolveStackTrace(stack) {
25286
25288
  const lines = stack.split(`
25287
25289
  `);
25288
25290
  const resolvedLines = [];
25289
25291
  for (const line of lines) {
25290
25292
  if (line.trimStart().startsWith("at ")) {
25291
25293
  const frame = parseStackLine(line);
25292
- const resolved = await resolveStackFrame(frame);
25294
+ const resolved = resolveStackFrame(frame);
25293
25295
  resolvedLines.push(resolved);
25294
25296
  } else {
25295
25297
  resolvedLines.push(line);
@@ -25851,7 +25853,7 @@ async function _buildCommand(opts, _folder, existingContext, watching = false) {
25851
25853
  const traceStart = stackLines.findIndex((line) => line.trimStart().startsWith("at "));
25852
25854
  const stackTrace = traceStart >= 0 ? stackLines.slice(traceStart).join(`
25853
25855
  `) : "";
25854
- const resolvedStackTrace = stackTrace ? await resolveStackTrace(stackTrace) : "";
25856
+ const resolvedStackTrace = stackTrace ? resolveStackTrace(stackTrace) : "";
25855
25857
  const formattedError = resolvedStackTrace ? `${errorMessage}
25856
25858
  ${resolvedStackTrace}` : errorMessage;
25857
25859
  return {
@@ -25887,7 +25889,7 @@ async function buildCommand(opts, _folder, silent2 = false) {
25887
25889
  const traceStart = stackLines.findIndex((line) => line.trimStart().startsWith("at "));
25888
25890
  const stackTrace = traceStart >= 0 ? stackLines.slice(traceStart).join(`
25889
25891
  `) : "";
25890
- const resolvedStackTrace = stackTrace ? await resolveStackTrace(stackTrace) : "";
25892
+ const resolvedStackTrace = stackTrace ? resolveStackTrace(stackTrace) : "";
25891
25893
  const formattedError = resolvedStackTrace ? `${errorMessage}
25892
25894
  ${resolvedStackTrace}` : errorMessage;
25893
25895
  if (!silent2) {
@@ -26466,7 +26468,7 @@ async function createCommand2(_project, opts) {
26466
26468
  default: false
26467
26469
  }) === true ? "library" : "pack";
26468
26470
  const sv = (v) => new import_semver.SemVer(v);
26469
- const versions = [[sv("1.0.0-beta.4"), sv(CLI_VERSION)], [sv("1.0.0-beta.3"), sv("2.3.2")]];
26471
+ const versions = [[sv("1.0.0-beta.5"), sv(CLI_VERSION)]];
26470
26472
  const version = await select({
26471
26473
  message: "Which version of Sandstone do you want to use? These are the only supported versions for new projects.",
26472
26474
  choices: versions.map((v) => {
@@ -32645,7 +32647,7 @@ globalThis.hot = hot;
32645
32647
 
32646
32648
  // src/commands/watch.ts
32647
32649
  var import_fs_extra7 = __toESM(require_lib(), 1);
32648
- import { join as join3, relative } from "path";
32650
+ import { join as join2, relative } from "path";
32649
32651
  var originalConsole = globalThis.console;
32650
32652
  var consoleWrapped = false;
32651
32653
  function enableConsoleCapture() {
@@ -32661,8 +32663,14 @@ function enableConsoleCapture() {
32661
32663
  const traceObj = { stack: "" };
32662
32664
  Error.captureStackTrace(traceObj, globalThis.console.trace);
32663
32665
  const cleanedStack = traceObj.stack.replace(/^Error\n/, "").replace(/\?hot-hook=\d+/g, "").replace(/file:\/\/\/?/g, "");
32666
+ const stackLines = cleanedStack.split(`
32667
+ `);
32668
+ const traceStart = stackLines.findIndex((line) => line.trimStart().startsWith("at "));
32669
+ const stackTrace = traceStart >= 0 ? stackLines.slice(traceStart).join(`
32670
+ `) : "";
32671
+ const resolvedStack = stackTrace ? resolveStackTrace(stackTrace) : cleanedStack;
32664
32672
  logTrace(...args, `
32665
- ` + cleanedStack);
32673
+ ` + resolvedStack);
32666
32674
  };
32667
32675
  }
32668
32676
  function disableConsoleCapture() {
@@ -32681,7 +32689,7 @@ async function watchCommand(opts) {
32681
32689
  let buildContext;
32682
32690
  let hotInitialized = false;
32683
32691
  let lastBuildFailed = false;
32684
- const folder = opts.library ? join3(opts.path, "test") : opts.path;
32692
+ const folder = opts.library ? join2(opts.path, "test") : opts.path;
32685
32693
  let subscription;
32686
32694
  initLogger(folder);
32687
32695
  setLiveLogCallback((level, args) => {
@@ -32728,7 +32736,7 @@ async function watchCommand(opts) {
32728
32736
  }
32729
32737
  if (!hotInitialized) {
32730
32738
  await hot.init({
32731
- root: join3(folder, JSON.parse(await import_fs_extra7.default.readFile(join3(folder, "package.json"), "utf-8"))["module"]),
32739
+ root: join2(folder, JSON.parse(await import_fs_extra7.default.readFile(join2(folder, "package.json"), "utf-8"))["module"]),
32732
32740
  globalSingletons: ["**/node_modules/sandstone/**", "**/sandstone/dist/**"],
32733
32741
  watch: false
32734
32742
  });
@@ -32761,9 +32769,9 @@ async function watchCommand(opts) {
32761
32769
  hot.notifyFileChange(change.path);
32762
32770
  }
32763
32771
  if (libChanges.length !== 0) {
32764
- const libModuleFiles = await import_fs_extra7.default.readdir(join3(opts.path, "lib"), { recursive: true });
32772
+ const libModuleFiles = await import_fs_extra7.default.readdir(join2(opts.path, "lib"), { recursive: true });
32765
32773
  for (const file of libModuleFiles) {
32766
- hot.notifyFileChange(join3(opts.path, "lib", file));
32774
+ hot.notifyFileChange(join2(opts.path, "lib", file));
32767
32775
  }
32768
32776
  }
32769
32777
  if (changes.length > 0) {
@@ -32964,4 +32972,4 @@ CLI.command("uninstall").alias("remove").description("Uninstall Vanilla Smithed
32964
32972
  CLI.command("refresh").description("Clear & update cached Smithed libraries. \u26CF").action(refreshCommand);
32965
32973
  CLI.parse(process.argv);
32966
32974
 
32967
- //# debugId=8C70F595B134AADB64756E2164756E21
32975
+ //# debugId=CA02D3AA5926561C64756E2164756E21