@deepnote/convert 2.3.1 → 3.0.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/bin.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- const require_src = require('./src-DfBtDvXJ.cjs');
2
+ const require_src = require('./src-BR6PqlNA.cjs');
3
3
  let cleye = require("cleye");
4
4
  cleye = require_src.__toESM(cleye);
5
5
  let node_fs_promises = require("node:fs/promises");
@@ -90,7 +90,7 @@ async function convert(options) {
90
90
  format: "percent",
91
91
  ...directoryOptions
92
92
  });
93
- throw new Error("No supported notebook files found in the specified directory (.ipynb, .qmd, .py)");
93
+ throw new require_src.UnsupportedFormatError("No supported notebook files found in the specified directory (.ipynb, .qmd, .py)");
94
94
  }
95
95
  const ext = (0, node_path.extname)(absolutePath).toLowerCase();
96
96
  const fileOptions = {
@@ -105,10 +105,10 @@ async function convert(options) {
105
105
  const content = await node_fs_promises.default.readFile(absolutePath, "utf-8");
106
106
  if (require_src.isMarimoContent(content)) return convertMarimoToDeepnote(fileOptions);
107
107
  if (require_src.isPercentContent(content)) return convertPercentToDeepnote(fileOptions);
108
- throw new Error("Unsupported Python file format. File must be a percent format (# %% markers) or Marimo notebook (@app.cell decorators).");
108
+ throw new require_src.UnsupportedFormatError("Unsupported Python file format. File must be a percent format (# %% markers) or Marimo notebook (@app.cell decorators).", { filename: absolutePath });
109
109
  }
110
110
  if (ext === ".deepnote") return convertDeepnoteToFormat(absolutePath, outputFormat, customOutputPath, cwd);
111
- throw new Error("Unsupported file type. Please provide a .ipynb, .qmd, .py (percent/marimo), or .deepnote file.");
111
+ throw new require_src.UnsupportedFormatError("Unsupported file type. Please provide a .ipynb, .qmd, .py (percent/marimo), or .deepnote file.", { filename: absolutePath });
112
112
  }
113
113
  async function convertDirectory(options) {
114
114
  const { dirPath, files, format, resolveProjectName, resolveOutputPath, singleFile } = options;
package/dist/bin.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { G as convertDeepnoteFileToPercentFiles, I as readAndConvertIpynbFiles, R as isMarimoContent, S as mergeSnapshotIntoSource, T as loadLatestSnapshot, V as convertDeepnoteFileToQuartoFiles, Y as convertDeepnoteFileToMarimoFiles, d as readAndConvertPercentFiles, et as convertDeepnoteFileToJupyterFiles, g as readAndConvertMarimoFiles, o as readAndConvertQuartoFiles, t as writeDeepnoteFile, z as isPercentContent } from "./src-D0_X_RDD.js";
2
+ import { G as convertDeepnoteFileToPercentFiles, I as readAndConvertIpynbFiles, R as isMarimoContent, S as mergeSnapshotIntoSource, T as loadLatestSnapshot, V as convertDeepnoteFileToQuartoFiles, Y as convertDeepnoteFileToMarimoFiles, d as readAndConvertPercentFiles, g as readAndConvertMarimoFiles, it as convertDeepnoteFileToJupyterFiles, o as readAndConvertQuartoFiles, t as writeDeepnoteFile, tt as UnsupportedFormatError, z as isPercentContent } from "./src-BN4Mwc-V.js";
3
3
  import { cli } from "cleye";
4
4
  import fs from "node:fs/promises";
5
5
  import { basename, dirname, extname, resolve } from "node:path";
@@ -83,7 +83,7 @@ async function convert(options) {
83
83
  format: "percent",
84
84
  ...directoryOptions
85
85
  });
86
- throw new Error("No supported notebook files found in the specified directory (.ipynb, .qmd, .py)");
86
+ throw new UnsupportedFormatError("No supported notebook files found in the specified directory (.ipynb, .qmd, .py)");
87
87
  }
88
88
  const ext = extname(absolutePath).toLowerCase();
89
89
  const fileOptions = {
@@ -98,10 +98,10 @@ async function convert(options) {
98
98
  const content = await fs.readFile(absolutePath, "utf-8");
99
99
  if (isMarimoContent(content)) return convertMarimoToDeepnote(fileOptions);
100
100
  if (isPercentContent(content)) return convertPercentToDeepnote(fileOptions);
101
- throw new Error("Unsupported Python file format. File must be a percent format (# %% markers) or Marimo notebook (@app.cell decorators).");
101
+ throw new UnsupportedFormatError("Unsupported Python file format. File must be a percent format (# %% markers) or Marimo notebook (@app.cell decorators).", { filename: absolutePath });
102
102
  }
103
103
  if (ext === ".deepnote") return convertDeepnoteToFormat(absolutePath, outputFormat, customOutputPath, cwd);
104
- throw new Error("Unsupported file type. Please provide a .ipynb, .qmd, .py (percent/marimo), or .deepnote file.");
104
+ throw new UnsupportedFormatError("Unsupported file type. Please provide a .ipynb, .qmd, .py (percent/marimo), or .deepnote file.", { filename: absolutePath });
105
105
  }
106
106
  async function convertDirectory(options) {
107
107
  const { dirPath, files, format, resolveProjectName, resolveOutputPath, singleFile } = options;
package/dist/index.cjs CHANGED
@@ -1,5 +1,9 @@
1
- const require_src = require('./src-DfBtDvXJ.cjs');
1
+ const require_src = require('./src-BR6PqlNA.cjs');
2
2
 
3
+ exports.FileReadError = require_src.FileReadError;
4
+ exports.FileWriteError = require_src.FileWriteError;
5
+ exports.JsonParseError = require_src.JsonParseError;
6
+ exports.UnsupportedFormatError = require_src.UnsupportedFormatError;
3
7
  exports.addContentHashes = require_src.addContentHashes;
4
8
  exports.computeContentHash = require_src.computeContentHash;
5
9
  exports.computeSnapshotHash = require_src.computeSnapshotHash;
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { DeepnoteBlock, DeepnoteFile, DeepnoteSnapshot, Environment, Execution } from "@deepnote/blocks";
1
+ import { DeepnoteBlock, DeepnoteError, DeepnoteFile, DeepnoteSnapshot, Environment, Execution, ParseError } from "@deepnote/blocks";
2
2
 
3
3
  //#region src/types/jupyter.d.ts
4
4
 
@@ -445,6 +445,39 @@ declare function serializeQuartoFormat(document: QuartoDocument): string;
445
445
  */
446
446
  declare function convertDeepnoteFileToQuartoFiles(deepnoteFilePath: string, options: ConvertDeepnoteFileToQuartoOptions): Promise<void>;
447
447
  //#endregion
448
+ //#region src/errors.d.ts
449
+ /**
450
+ * Thrown when a file cannot be read from disk.
451
+ */
452
+ declare class FileReadError extends DeepnoteError {
453
+ filePath: string;
454
+ constructor(message: string, options: ErrorOptions & {
455
+ filePath: string;
456
+ });
457
+ }
458
+ /**
459
+ * Thrown when a file cannot be written to disk.
460
+ */
461
+ declare class FileWriteError extends DeepnoteError {
462
+ filePath: string;
463
+ constructor(message: string, options: ErrorOptions & {
464
+ filePath: string;
465
+ });
466
+ }
467
+ /**
468
+ * Thrown when JSON parsing fails.
469
+ */
470
+ declare class JsonParseError extends ParseError {}
471
+ /**
472
+ * Thrown when a file format is not supported.
473
+ */
474
+ declare class UnsupportedFormatError extends DeepnoteError {
475
+ filename?: string;
476
+ constructor(message: string, options?: ErrorOptions & {
477
+ filename?: string;
478
+ });
479
+ }
480
+ //#endregion
448
481
  //#region src/format-detection.d.ts
449
482
  type NotebookFormat = 'jupyter' | 'deepnote' | 'marimo' | 'percent' | 'quarto';
450
483
  /**
@@ -961,4 +994,4 @@ interface WriteDeepnoteFileResult {
961
994
  */
962
995
  declare function writeDeepnoteFile(options: WriteDeepnoteFileOptions): Promise<WriteDeepnoteFileResult>;
963
996
  //#endregion
964
- export { type BlockOutput, type ConvertBlocksToJupyterOptions, type ConvertDeepnoteFileToMarimoOptions, type ConvertDeepnoteFileToPercentOptions, type ConvertDeepnoteFileToQuartoOptions, type ConvertIpynbFilesToDeepnoteFileOptions, type ConvertJupyterNotebookOptions, type ConvertMarimoAppOptions, type ConvertMarimoAppsToDeepnoteOptions, type ConvertMarimoFilesToDeepnoteFileOptions, type ConvertPercentFilesToDeepnoteFileOptions, type ConvertPercentNotebookOptions, type ConvertQuartoDocumentOptions, type ConvertQuartoFilesToDeepnoteFileOptions, type JupyterCell, type JupyterNotebook, type JupyterNotebookInput, type MarimoApp, type MarimoAppInput, type MarimoCell, type MergeOptions, type NotebookFormat, type PercentCell, type PercentNotebook, type PercentNotebookInput, type QuartoCell, type QuartoCellOptions, type QuartoDocument, type QuartoDocumentInput, type QuartoFrontmatter, type ReadAndConvertIpynbFilesOptions, type ReadAndConvertMarimoFilesOptions, type ReadAndConvertPercentFilesOptions, type ReadAndConvertQuartoFilesOptions, type SnapshotInfo, type SnapshotOptions, type SplitResult, type WriteDeepnoteFileOptions, type WriteDeepnoteFileResult, addContentHashes, computeContentHash, computeSnapshotHash, convertBlockToJupyterCell, convertBlocksToJupyterNotebook, convertBlocksToMarimoApp, convertBlocksToPercentNotebook, convertBlocksToQuartoDocument, convertDeepnoteFileToJupyterFiles, convertDeepnoteFileToMarimoFiles, convertDeepnoteFileToPercentFiles, convertDeepnoteFileToQuartoFiles, convertDeepnoteToJupyterNotebooks, convertDeepnoteToMarimoApps, convertDeepnoteToPercentNotebooks, convertDeepnoteToQuartoDocuments, convertIpynbFilesToDeepnoteFile, convertJupyterNotebookToBlocks, convertJupyterNotebooksToDeepnote, convertMarimoAppToBlocks, convertMarimoAppsToDeepnote, convertMarimoFilesToDeepnoteFile, convertPercentFilesToDeepnoteFile, convertPercentNotebookToBlocks, convertPercentNotebooksToDeepnote, convertQuartoDocumentToBlocks, convertQuartoDocumentsToDeepnote, convertQuartoFilesToDeepnoteFile, countBlocksWithOutputs, detectFormat, findSnapshotsForProject, generateSnapshotFilename, getSnapshotDir, hasOutputs, loadLatestSnapshot, loadSnapshotFile, mergeSnapshotIntoSource, parseMarimoFormat, parsePercentFormat, parseQuartoFormat, parseSnapshotFilename, parseSourceFilePath, readAndConvertIpynbFiles, readAndConvertMarimoFiles, readAndConvertPercentFiles, readAndConvertQuartoFiles, serializeMarimoFormat, serializePercentFormat, serializeQuartoFormat, slugifyProjectName, snapshotExists, splitDeepnoteFile, writeDeepnoteFile };
997
+ export { type BlockOutput, type ConvertBlocksToJupyterOptions, type ConvertDeepnoteFileToMarimoOptions, type ConvertDeepnoteFileToPercentOptions, type ConvertDeepnoteFileToQuartoOptions, type ConvertIpynbFilesToDeepnoteFileOptions, type ConvertJupyterNotebookOptions, type ConvertMarimoAppOptions, type ConvertMarimoAppsToDeepnoteOptions, type ConvertMarimoFilesToDeepnoteFileOptions, type ConvertPercentFilesToDeepnoteFileOptions, type ConvertPercentNotebookOptions, type ConvertQuartoDocumentOptions, type ConvertQuartoFilesToDeepnoteFileOptions, FileReadError, FileWriteError, JsonParseError, type JupyterCell, type JupyterNotebook, type JupyterNotebookInput, type MarimoApp, type MarimoAppInput, type MarimoCell, type MergeOptions, type NotebookFormat, type PercentCell, type PercentNotebook, type PercentNotebookInput, type QuartoCell, type QuartoCellOptions, type QuartoDocument, type QuartoDocumentInput, type QuartoFrontmatter, type ReadAndConvertIpynbFilesOptions, type ReadAndConvertMarimoFilesOptions, type ReadAndConvertPercentFilesOptions, type ReadAndConvertQuartoFilesOptions, type SnapshotInfo, type SnapshotOptions, type SplitResult, UnsupportedFormatError, type WriteDeepnoteFileOptions, type WriteDeepnoteFileResult, addContentHashes, computeContentHash, computeSnapshotHash, convertBlockToJupyterCell, convertBlocksToJupyterNotebook, convertBlocksToMarimoApp, convertBlocksToPercentNotebook, convertBlocksToQuartoDocument, convertDeepnoteFileToJupyterFiles, convertDeepnoteFileToMarimoFiles, convertDeepnoteFileToPercentFiles, convertDeepnoteFileToQuartoFiles, convertDeepnoteToJupyterNotebooks, convertDeepnoteToMarimoApps, convertDeepnoteToPercentNotebooks, convertDeepnoteToQuartoDocuments, convertIpynbFilesToDeepnoteFile, convertJupyterNotebookToBlocks, convertJupyterNotebooksToDeepnote, convertMarimoAppToBlocks, convertMarimoAppsToDeepnote, convertMarimoFilesToDeepnoteFile, convertPercentFilesToDeepnoteFile, convertPercentNotebookToBlocks, convertPercentNotebooksToDeepnote, convertQuartoDocumentToBlocks, convertQuartoDocumentsToDeepnote, convertQuartoFilesToDeepnoteFile, countBlocksWithOutputs, detectFormat, findSnapshotsForProject, generateSnapshotFilename, getSnapshotDir, hasOutputs, loadLatestSnapshot, loadSnapshotFile, mergeSnapshotIntoSource, parseMarimoFormat, parsePercentFormat, parseQuartoFormat, parseSnapshotFilename, parseSourceFilePath, readAndConvertIpynbFiles, readAndConvertMarimoFiles, readAndConvertPercentFiles, readAndConvertQuartoFiles, serializeMarimoFormat, serializePercentFormat, serializeQuartoFormat, slugifyProjectName, snapshotExists, splitDeepnoteFile, writeDeepnoteFile };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { DeepnoteBlock, DeepnoteFile, DeepnoteSnapshot, Environment, Execution } from "@deepnote/blocks";
1
+ import { DeepnoteBlock, DeepnoteError, DeepnoteFile, DeepnoteSnapshot, Environment, Execution, ParseError } from "@deepnote/blocks";
2
2
 
3
3
  //#region src/types/jupyter.d.ts
4
4
 
@@ -445,6 +445,39 @@ declare function serializeQuartoFormat(document: QuartoDocument): string;
445
445
  */
446
446
  declare function convertDeepnoteFileToQuartoFiles(deepnoteFilePath: string, options: ConvertDeepnoteFileToQuartoOptions): Promise<void>;
447
447
  //#endregion
448
+ //#region src/errors.d.ts
449
+ /**
450
+ * Thrown when a file cannot be read from disk.
451
+ */
452
+ declare class FileReadError extends DeepnoteError {
453
+ filePath: string;
454
+ constructor(message: string, options: ErrorOptions & {
455
+ filePath: string;
456
+ });
457
+ }
458
+ /**
459
+ * Thrown when a file cannot be written to disk.
460
+ */
461
+ declare class FileWriteError extends DeepnoteError {
462
+ filePath: string;
463
+ constructor(message: string, options: ErrorOptions & {
464
+ filePath: string;
465
+ });
466
+ }
467
+ /**
468
+ * Thrown when JSON parsing fails.
469
+ */
470
+ declare class JsonParseError extends ParseError {}
471
+ /**
472
+ * Thrown when a file format is not supported.
473
+ */
474
+ declare class UnsupportedFormatError extends DeepnoteError {
475
+ filename?: string;
476
+ constructor(message: string, options?: ErrorOptions & {
477
+ filename?: string;
478
+ });
479
+ }
480
+ //#endregion
448
481
  //#region src/format-detection.d.ts
449
482
  type NotebookFormat = 'jupyter' | 'deepnote' | 'marimo' | 'percent' | 'quarto';
450
483
  /**
@@ -961,4 +994,4 @@ interface WriteDeepnoteFileResult {
961
994
  */
962
995
  declare function writeDeepnoteFile(options: WriteDeepnoteFileOptions): Promise<WriteDeepnoteFileResult>;
963
996
  //#endregion
964
- export { type BlockOutput, type ConvertBlocksToJupyterOptions, type ConvertDeepnoteFileToMarimoOptions, type ConvertDeepnoteFileToPercentOptions, type ConvertDeepnoteFileToQuartoOptions, type ConvertIpynbFilesToDeepnoteFileOptions, type ConvertJupyterNotebookOptions, type ConvertMarimoAppOptions, type ConvertMarimoAppsToDeepnoteOptions, type ConvertMarimoFilesToDeepnoteFileOptions, type ConvertPercentFilesToDeepnoteFileOptions, type ConvertPercentNotebookOptions, type ConvertQuartoDocumentOptions, type ConvertQuartoFilesToDeepnoteFileOptions, type JupyterCell, type JupyterNotebook, type JupyterNotebookInput, type MarimoApp, type MarimoAppInput, type MarimoCell, type MergeOptions, type NotebookFormat, type PercentCell, type PercentNotebook, type PercentNotebookInput, type QuartoCell, type QuartoCellOptions, type QuartoDocument, type QuartoDocumentInput, type QuartoFrontmatter, type ReadAndConvertIpynbFilesOptions, type ReadAndConvertMarimoFilesOptions, type ReadAndConvertPercentFilesOptions, type ReadAndConvertQuartoFilesOptions, type SnapshotInfo, type SnapshotOptions, type SplitResult, type WriteDeepnoteFileOptions, type WriteDeepnoteFileResult, addContentHashes, computeContentHash, computeSnapshotHash, convertBlockToJupyterCell, convertBlocksToJupyterNotebook, convertBlocksToMarimoApp, convertBlocksToPercentNotebook, convertBlocksToQuartoDocument, convertDeepnoteFileToJupyterFiles, convertDeepnoteFileToMarimoFiles, convertDeepnoteFileToPercentFiles, convertDeepnoteFileToQuartoFiles, convertDeepnoteToJupyterNotebooks, convertDeepnoteToMarimoApps, convertDeepnoteToPercentNotebooks, convertDeepnoteToQuartoDocuments, convertIpynbFilesToDeepnoteFile, convertJupyterNotebookToBlocks, convertJupyterNotebooksToDeepnote, convertMarimoAppToBlocks, convertMarimoAppsToDeepnote, convertMarimoFilesToDeepnoteFile, convertPercentFilesToDeepnoteFile, convertPercentNotebookToBlocks, convertPercentNotebooksToDeepnote, convertQuartoDocumentToBlocks, convertQuartoDocumentsToDeepnote, convertQuartoFilesToDeepnoteFile, countBlocksWithOutputs, detectFormat, findSnapshotsForProject, generateSnapshotFilename, getSnapshotDir, hasOutputs, loadLatestSnapshot, loadSnapshotFile, mergeSnapshotIntoSource, parseMarimoFormat, parsePercentFormat, parseQuartoFormat, parseSnapshotFilename, parseSourceFilePath, readAndConvertIpynbFiles, readAndConvertMarimoFiles, readAndConvertPercentFiles, readAndConvertQuartoFiles, serializeMarimoFormat, serializePercentFormat, serializeQuartoFormat, slugifyProjectName, snapshotExists, splitDeepnoteFile, writeDeepnoteFile };
997
+ export { type BlockOutput, type ConvertBlocksToJupyterOptions, type ConvertDeepnoteFileToMarimoOptions, type ConvertDeepnoteFileToPercentOptions, type ConvertDeepnoteFileToQuartoOptions, type ConvertIpynbFilesToDeepnoteFileOptions, type ConvertJupyterNotebookOptions, type ConvertMarimoAppOptions, type ConvertMarimoAppsToDeepnoteOptions, type ConvertMarimoFilesToDeepnoteFileOptions, type ConvertPercentFilesToDeepnoteFileOptions, type ConvertPercentNotebookOptions, type ConvertQuartoDocumentOptions, type ConvertQuartoFilesToDeepnoteFileOptions, FileReadError, FileWriteError, JsonParseError, type JupyterCell, type JupyterNotebook, type JupyterNotebookInput, type MarimoApp, type MarimoAppInput, type MarimoCell, type MergeOptions, type NotebookFormat, type PercentCell, type PercentNotebook, type PercentNotebookInput, type QuartoCell, type QuartoCellOptions, type QuartoDocument, type QuartoDocumentInput, type QuartoFrontmatter, type ReadAndConvertIpynbFilesOptions, type ReadAndConvertMarimoFilesOptions, type ReadAndConvertPercentFilesOptions, type ReadAndConvertQuartoFilesOptions, type SnapshotInfo, type SnapshotOptions, type SplitResult, UnsupportedFormatError, type WriteDeepnoteFileOptions, type WriteDeepnoteFileResult, addContentHashes, computeContentHash, computeSnapshotHash, convertBlockToJupyterCell, convertBlocksToJupyterNotebook, convertBlocksToMarimoApp, convertBlocksToPercentNotebook, convertBlocksToQuartoDocument, convertDeepnoteFileToJupyterFiles, convertDeepnoteFileToMarimoFiles, convertDeepnoteFileToPercentFiles, convertDeepnoteFileToQuartoFiles, convertDeepnoteToJupyterNotebooks, convertDeepnoteToMarimoApps, convertDeepnoteToPercentNotebooks, convertDeepnoteToQuartoDocuments, convertIpynbFilesToDeepnoteFile, convertJupyterNotebookToBlocks, convertJupyterNotebooksToDeepnote, convertMarimoAppToBlocks, convertMarimoAppsToDeepnote, convertMarimoFilesToDeepnoteFile, convertPercentFilesToDeepnoteFile, convertPercentNotebookToBlocks, convertPercentNotebooksToDeepnote, convertQuartoDocumentToBlocks, convertQuartoDocumentsToDeepnote, convertQuartoFilesToDeepnoteFile, countBlocksWithOutputs, detectFormat, findSnapshotsForProject, generateSnapshotFilename, getSnapshotDir, hasOutputs, loadLatestSnapshot, loadSnapshotFile, mergeSnapshotIntoSource, parseMarimoFormat, parsePercentFormat, parseQuartoFormat, parseSnapshotFilename, parseSourceFilePath, readAndConvertIpynbFiles, readAndConvertMarimoFiles, readAndConvertPercentFiles, readAndConvertQuartoFiles, serializeMarimoFormat, serializePercentFormat, serializeQuartoFormat, slugifyProjectName, snapshotExists, splitDeepnoteFile, writeDeepnoteFile };
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import { $ as convertBlocksToJupyterNotebook, A as addContentHashes, B as convertBlocksToQuartoDocument, C as findSnapshotsForProject, D as parseSnapshotFilename, E as loadSnapshotFile, F as convertJupyterNotebooksToDeepnote, G as convertDeepnoteFileToPercentFiles, H as convertDeepnoteToQuartoDocuments, I as readAndConvertIpynbFiles, J as convertBlocksToMarimoApp, K as convertDeepnoteToPercentNotebooks, L as detectFormat, M as computeSnapshotHash, N as convertIpynbFilesToDeepnoteFile, O as parseSourceFilePath, P as convertJupyterNotebookToBlocks, Q as convertBlockToJupyterCell, S as mergeSnapshotIntoSource, T as loadLatestSnapshot, U as serializeQuartoFormat, V as convertDeepnoteFileToQuartoFiles, W as convertBlocksToPercentNotebook, X as convertDeepnoteToMarimoApps, Y as convertDeepnoteFileToMarimoFiles, Z as serializeMarimoFormat, _ as generateSnapshotFilename, a as parseQuartoFormat, b as splitDeepnoteFile, c as convertPercentNotebookToBlocks, d as readAndConvertPercentFiles, et as convertDeepnoteFileToJupyterFiles, f as convertMarimoAppToBlocks, g as readAndConvertMarimoFiles, h as parseMarimoFormat, i as convertQuartoFilesToDeepnoteFile, j as computeContentHash, k as snapshotExists, l as convertPercentNotebooksToDeepnote, m as convertMarimoFilesToDeepnoteFile, n as convertQuartoDocumentToBlocks, o as readAndConvertQuartoFiles, p as convertMarimoAppsToDeepnote, q as serializePercentFormat, r as convertQuartoDocumentsToDeepnote, s as convertPercentFilesToDeepnoteFile, t as writeDeepnoteFile, tt as convertDeepnoteToJupyterNotebooks, u as parsePercentFormat, v as hasOutputs, w as getSnapshotDir, x as countBlocksWithOutputs, y as slugifyProjectName } from "./src-D0_X_RDD.js";
1
+ import { $ as FileWriteError, A as addContentHashes, B as convertBlocksToQuartoDocument, C as findSnapshotsForProject, D as parseSnapshotFilename, E as loadSnapshotFile, F as convertJupyterNotebooksToDeepnote, G as convertDeepnoteFileToPercentFiles, H as convertDeepnoteToQuartoDocuments, I as readAndConvertIpynbFiles, J as convertBlocksToMarimoApp, K as convertDeepnoteToPercentNotebooks, L as detectFormat, M as computeSnapshotHash, N as convertIpynbFilesToDeepnoteFile, O as parseSourceFilePath, P as convertJupyterNotebookToBlocks, Q as FileReadError, S as mergeSnapshotIntoSource, T as loadLatestSnapshot, U as serializeQuartoFormat, V as convertDeepnoteFileToQuartoFiles, W as convertBlocksToPercentNotebook, X as convertDeepnoteToMarimoApps, Y as convertDeepnoteFileToMarimoFiles, Z as serializeMarimoFormat, _ as generateSnapshotFilename, a as parseQuartoFormat, at as convertDeepnoteToJupyterNotebooks, b as splitDeepnoteFile, c as convertPercentNotebookToBlocks, d as readAndConvertPercentFiles, et as JsonParseError, f as convertMarimoAppToBlocks, g as readAndConvertMarimoFiles, h as parseMarimoFormat, i as convertQuartoFilesToDeepnoteFile, it as convertDeepnoteFileToJupyterFiles, j as computeContentHash, k as snapshotExists, l as convertPercentNotebooksToDeepnote, m as convertMarimoFilesToDeepnoteFile, n as convertQuartoDocumentToBlocks, nt as convertBlockToJupyterCell, o as readAndConvertQuartoFiles, p as convertMarimoAppsToDeepnote, q as serializePercentFormat, r as convertQuartoDocumentsToDeepnote, rt as convertBlocksToJupyterNotebook, s as convertPercentFilesToDeepnoteFile, t as writeDeepnoteFile, tt as UnsupportedFormatError, u as parsePercentFormat, v as hasOutputs, w as getSnapshotDir, x as countBlocksWithOutputs, y as slugifyProjectName } from "./src-BN4Mwc-V.js";
2
2
 
3
- export { addContentHashes, computeContentHash, computeSnapshotHash, convertBlockToJupyterCell, convertBlocksToJupyterNotebook, convertBlocksToMarimoApp, convertBlocksToPercentNotebook, convertBlocksToQuartoDocument, convertDeepnoteFileToJupyterFiles, convertDeepnoteFileToMarimoFiles, convertDeepnoteFileToPercentFiles, convertDeepnoteFileToQuartoFiles, convertDeepnoteToJupyterNotebooks, convertDeepnoteToMarimoApps, convertDeepnoteToPercentNotebooks, convertDeepnoteToQuartoDocuments, convertIpynbFilesToDeepnoteFile, convertJupyterNotebookToBlocks, convertJupyterNotebooksToDeepnote, convertMarimoAppToBlocks, convertMarimoAppsToDeepnote, convertMarimoFilesToDeepnoteFile, convertPercentFilesToDeepnoteFile, convertPercentNotebookToBlocks, convertPercentNotebooksToDeepnote, convertQuartoDocumentToBlocks, convertQuartoDocumentsToDeepnote, convertQuartoFilesToDeepnoteFile, countBlocksWithOutputs, detectFormat, findSnapshotsForProject, generateSnapshotFilename, getSnapshotDir, hasOutputs, loadLatestSnapshot, loadSnapshotFile, mergeSnapshotIntoSource, parseMarimoFormat, parsePercentFormat, parseQuartoFormat, parseSnapshotFilename, parseSourceFilePath, readAndConvertIpynbFiles, readAndConvertMarimoFiles, readAndConvertPercentFiles, readAndConvertQuartoFiles, serializeMarimoFormat, serializePercentFormat, serializeQuartoFormat, slugifyProjectName, snapshotExists, splitDeepnoteFile, writeDeepnoteFile };
3
+ export { FileReadError, FileWriteError, JsonParseError, UnsupportedFormatError, addContentHashes, computeContentHash, computeSnapshotHash, convertBlockToJupyterCell, convertBlocksToJupyterNotebook, convertBlocksToMarimoApp, convertBlocksToPercentNotebook, convertBlocksToQuartoDocument, convertDeepnoteFileToJupyterFiles, convertDeepnoteFileToMarimoFiles, convertDeepnoteFileToPercentFiles, convertDeepnoteFileToQuartoFiles, convertDeepnoteToJupyterNotebooks, convertDeepnoteToMarimoApps, convertDeepnoteToPercentNotebooks, convertDeepnoteToQuartoDocuments, convertIpynbFilesToDeepnoteFile, convertJupyterNotebookToBlocks, convertJupyterNotebooksToDeepnote, convertMarimoAppToBlocks, convertMarimoAppsToDeepnote, convertMarimoFilesToDeepnoteFile, convertPercentFilesToDeepnoteFile, convertPercentNotebookToBlocks, convertPercentNotebooksToDeepnote, convertQuartoDocumentToBlocks, convertQuartoDocumentsToDeepnote, convertQuartoFilesToDeepnoteFile, countBlocksWithOutputs, detectFormat, findSnapshotsForProject, generateSnapshotFilename, getSnapshotDir, hasOutputs, loadLatestSnapshot, loadSnapshotFile, mergeSnapshotIntoSource, parseMarimoFormat, parsePercentFormat, parseQuartoFormat, parseSnapshotFilename, parseSourceFilePath, readAndConvertIpynbFiles, readAndConvertMarimoFiles, readAndConvertPercentFiles, readAndConvertQuartoFiles, serializeMarimoFormat, serializePercentFormat, serializeQuartoFormat, slugifyProjectName, snapshotExists, splitDeepnoteFile, writeDeepnoteFile };
@@ -1,6 +1,6 @@
1
1
  import fs from "node:fs/promises";
2
2
  import { basename, dirname, extname, join, resolve } from "node:path";
3
- import { createMarkdown, createPythonCode, deepnoteBlockSchema, deepnoteSnapshotSchema, deserializeDeepnoteFile, environmentSchema, executionSchema, isExecutableBlockType } from "@deepnote/blocks";
3
+ import { DeepnoteError, InvalidValueError, ParseError, createMarkdown, createPythonCode, deepnoteBlockSchema, deepnoteSnapshotSchema, deserializeDeepnoteFile, environmentSchema, executionSchema, isExecutableBlockType } from "@deepnote/blocks";
4
4
  import { parse, stringify } from "yaml";
5
5
  import { createHash, randomUUID } from "node:crypto";
6
6
 
@@ -16,7 +16,7 @@ function createSortingKey(index) {
16
16
  const maxLength = 6;
17
17
  const chars = "0123456789abcdefghijklmnopqrstuvwxyz";
18
18
  const base = 36;
19
- if (index < 0) throw new Error("Index must be non-negative");
19
+ if (index < 0) throw new InvalidValueError("Index must be non-negative", { value: index });
20
20
  let result = "";
21
21
  let num = index + 1;
22
22
  let iterations = 0;
@@ -26,7 +26,7 @@ function createSortingKey(index) {
26
26
  num = Math.floor(num / base);
27
27
  iterations++;
28
28
  }
29
- if (num > 0) throw new Error(`Index ${index} exceeds maximum key length of ${maxLength}`);
29
+ if (num > 0) throw new InvalidValueError(`Index ${index} exceeds maximum key length of ${maxLength}`, { value: index });
30
30
  return result;
31
31
  }
32
32
  /**
@@ -222,6 +222,43 @@ function convertNotebookToJupyter(deepnoteFile, notebook) {
222
222
  });
223
223
  }
224
224
 
225
+ //#endregion
226
+ //#region src/errors.ts
227
+ /**
228
+ * Thrown when a file cannot be read from disk.
229
+ */
230
+ var FileReadError = class extends DeepnoteError {
231
+ filePath;
232
+ constructor(message, options) {
233
+ super(message, options);
234
+ this.filePath = options.filePath;
235
+ }
236
+ };
237
+ /**
238
+ * Thrown when a file cannot be written to disk.
239
+ */
240
+ var FileWriteError = class extends DeepnoteError {
241
+ filePath;
242
+ constructor(message, options) {
243
+ super(message, options);
244
+ this.filePath = options.filePath;
245
+ }
246
+ };
247
+ /**
248
+ * Thrown when JSON parsing fails.
249
+ */
250
+ var JsonParseError = class extends ParseError {};
251
+ /**
252
+ * Thrown when a file format is not supported.
253
+ */
254
+ var UnsupportedFormatError = class extends DeepnoteError {
255
+ filename;
256
+ constructor(message, options) {
257
+ super(message, options);
258
+ this.filename = options?.filename;
259
+ }
260
+ };
261
+
225
262
  //#endregion
226
263
  //#region src/deepnote-to-marimo.ts
227
264
  /** Current Marimo version for generated files */
@@ -336,8 +373,10 @@ async function convertDeepnoteFileToMarimoFiles(deepnoteFilePath, options) {
336
373
  const content = serializeMarimoFormat(app);
337
374
  await fs.writeFile(filePath, content, "utf-8");
338
375
  } catch (err) {
339
- const errorMessage = err instanceof Error ? err.message : String(err);
340
- throw new Error(`Failed to write ${filename}: ${errorMessage}`, { cause: err });
376
+ throw new FileWriteError(`Failed to write ${filename}: ${err instanceof Error ? err.message : String(err)}`, {
377
+ cause: err,
378
+ filePath
379
+ });
341
380
  }
342
381
  }
343
382
  }
@@ -697,12 +736,12 @@ function detectFormat(filename, content) {
697
736
  if (lowercaseFilename.endsWith(".deepnote")) return "deepnote";
698
737
  if (lowercaseFilename.endsWith(".qmd")) return "quarto";
699
738
  if (lowercaseFilename.endsWith(".py")) {
700
- if (!content) throw new Error("Content is required to detect format for .py files");
739
+ if (!content) throw new UnsupportedFormatError("Content is required to detect format for .py files", { filename });
701
740
  if (isMarimoContent(content)) return "marimo";
702
741
  if (isPercentContent(content)) return "percent";
703
- throw new Error("Unsupported Python file format. File must be percent format (# %%) or Marimo (@app.cell).");
742
+ throw new UnsupportedFormatError("Unsupported Python file format. File must be percent format (# %%) or Marimo (@app.cell).", { filename });
704
743
  }
705
- throw new Error(`Unsupported file format: ${filename}`);
744
+ throw new UnsupportedFormatError(`Unsupported file format: ${filename}`, { filename });
706
745
  }
707
746
 
708
747
  //#endregion
@@ -819,14 +858,18 @@ async function parseIpynbFile(filePath) {
819
858
  try {
820
859
  ipynbJson = await fs.readFile(filePath, "utf-8");
821
860
  } catch (error) {
822
- const message = error instanceof Error ? error.message : String(error);
823
- throw new Error(`Failed to read ${filePath}: ${message}`);
861
+ throw new FileReadError(`Failed to read ${filePath}: ${error instanceof Error ? error.message : String(error)}`, {
862
+ cause: error,
863
+ filePath
864
+ });
824
865
  }
825
866
  try {
826
867
  return JSON.parse(ipynbJson);
827
868
  } catch (error) {
828
- const message = error instanceof Error ? error.message : String(error);
829
- throw new Error(`Failed to parse ${filePath}: invalid JSON - ${message}`);
869
+ throw new JsonParseError(`Failed to parse ${filePath}: invalid JSON - ${error instanceof Error ? error.message : String(error)}`, {
870
+ cause: error,
871
+ filePath
872
+ });
830
873
  }
831
874
  }
832
875
  function convertCellToBlock$3(cell, index, idGenerator) {
@@ -1577,10 +1620,13 @@ async function readAndConvertMarimoFiles(inputFilePaths, options) {
1577
1620
  } catch (err) {
1578
1621
  const errorMessage = err instanceof Error ? err.message : String(err);
1579
1622
  const errorStack = err instanceof Error ? err.stack : void 0;
1580
- throw new Error(`Failed to read or parse file ${basename(filePath)}: ${errorMessage}`, { cause: errorStack ? {
1581
- originalError: err,
1582
- stack: errorStack
1583
- } : err });
1623
+ throw new FileReadError(`Failed to read or parse file ${basename(filePath)}: ${errorMessage}`, {
1624
+ cause: errorStack ? {
1625
+ originalError: err,
1626
+ stack: errorStack
1627
+ } : err,
1628
+ filePath
1629
+ });
1584
1630
  }
1585
1631
  return convertMarimoAppsToDeepnoteFile(apps, { projectName: options.projectName });
1586
1632
  }
@@ -1600,10 +1646,13 @@ async function convertMarimoFilesToDeepnoteFile(inputFilePaths, options) {
1600
1646
  } catch (err) {
1601
1647
  const errorMessage = err instanceof Error ? err.message : String(err);
1602
1648
  const errorStack = err instanceof Error ? err.stack : void 0;
1603
- throw new Error(`Failed to read or parse file ${basename(filePath)}: ${errorMessage}`, { cause: errorStack ? {
1604
- originalError: err,
1605
- stack: errorStack
1606
- } : err });
1649
+ throw new FileReadError(`Failed to read or parse file ${basename(filePath)}: ${errorMessage}`, {
1650
+ cause: errorStack ? {
1651
+ originalError: err,
1652
+ stack: errorStack
1653
+ } : err,
1654
+ filePath
1655
+ });
1607
1656
  }
1608
1657
  const yamlContent = stringify(convertMarimoAppsToDeepnoteFile(apps, { projectName: options.projectName }));
1609
1658
  const parentDir = dirname(options.outputPath);
@@ -2115,4 +2164,4 @@ async function writeDeepnoteFile(options) {
2115
2164
  }
2116
2165
 
2117
2166
  //#endregion
2118
- export { convertBlocksToJupyterNotebook as $, addContentHashes as A, convertBlocksToQuartoDocument as B, findSnapshotsForProject as C, parseSnapshotFilename as D, loadSnapshotFile as E, convertJupyterNotebooksToDeepnote as F, convertDeepnoteFileToPercentFiles as G, convertDeepnoteToQuartoDocuments as H, readAndConvertIpynbFiles as I, convertBlocksToMarimoApp as J, convertDeepnoteToPercentNotebooks as K, detectFormat as L, computeSnapshotHash as M, convertIpynbFilesToDeepnoteFile as N, parseSourceFilePath as O, convertJupyterNotebookToBlocks as P, convertBlockToJupyterCell as Q, isMarimoContent as R, mergeSnapshotIntoSource as S, loadLatestSnapshot as T, serializeQuartoFormat as U, convertDeepnoteFileToQuartoFiles as V, convertBlocksToPercentNotebook as W, convertDeepnoteToMarimoApps as X, convertDeepnoteFileToMarimoFiles as Y, serializeMarimoFormat as Z, generateSnapshotFilename as _, parseQuartoFormat as a, splitDeepnoteFile as b, convertPercentNotebookToBlocks as c, readAndConvertPercentFiles as d, convertDeepnoteFileToJupyterFiles as et, convertMarimoAppToBlocks as f, readAndConvertMarimoFiles as g, parseMarimoFormat as h, convertQuartoFilesToDeepnoteFile as i, computeContentHash as j, snapshotExists as k, convertPercentNotebooksToDeepnote as l, convertMarimoFilesToDeepnoteFile as m, convertQuartoDocumentToBlocks as n, readAndConvertQuartoFiles as o, convertMarimoAppsToDeepnote as p, serializePercentFormat as q, convertQuartoDocumentsToDeepnote as r, convertPercentFilesToDeepnoteFile as s, writeDeepnoteFile as t, convertDeepnoteToJupyterNotebooks as tt, parsePercentFormat as u, hasOutputs as v, getSnapshotDir as w, countBlocksWithOutputs as x, slugifyProjectName as y, isPercentContent as z };
2167
+ export { FileWriteError as $, addContentHashes as A, convertBlocksToQuartoDocument as B, findSnapshotsForProject as C, parseSnapshotFilename as D, loadSnapshotFile as E, convertJupyterNotebooksToDeepnote as F, convertDeepnoteFileToPercentFiles as G, convertDeepnoteToQuartoDocuments as H, readAndConvertIpynbFiles as I, convertBlocksToMarimoApp as J, convertDeepnoteToPercentNotebooks as K, detectFormat as L, computeSnapshotHash as M, convertIpynbFilesToDeepnoteFile as N, parseSourceFilePath as O, convertJupyterNotebookToBlocks as P, FileReadError as Q, isMarimoContent as R, mergeSnapshotIntoSource as S, loadLatestSnapshot as T, serializeQuartoFormat as U, convertDeepnoteFileToQuartoFiles as V, convertBlocksToPercentNotebook as W, convertDeepnoteToMarimoApps as X, convertDeepnoteFileToMarimoFiles as Y, serializeMarimoFormat as Z, generateSnapshotFilename as _, parseQuartoFormat as a, convertDeepnoteToJupyterNotebooks as at, splitDeepnoteFile as b, convertPercentNotebookToBlocks as c, readAndConvertPercentFiles as d, JsonParseError as et, convertMarimoAppToBlocks as f, readAndConvertMarimoFiles as g, parseMarimoFormat as h, convertQuartoFilesToDeepnoteFile as i, convertDeepnoteFileToJupyterFiles as it, computeContentHash as j, snapshotExists as k, convertPercentNotebooksToDeepnote as l, convertMarimoFilesToDeepnoteFile as m, convertQuartoDocumentToBlocks as n, convertBlockToJupyterCell as nt, readAndConvertQuartoFiles as o, convertMarimoAppsToDeepnote as p, serializePercentFormat as q, convertQuartoDocumentsToDeepnote as r, convertBlocksToJupyterNotebook as rt, convertPercentFilesToDeepnoteFile as s, writeDeepnoteFile as t, UnsupportedFormatError as tt, parsePercentFormat as u, hasOutputs as v, getSnapshotDir as w, countBlocksWithOutputs as x, slugifyProjectName as y, isPercentContent as z };
@@ -44,7 +44,7 @@ function createSortingKey(index) {
44
44
  const maxLength = 6;
45
45
  const chars = "0123456789abcdefghijklmnopqrstuvwxyz";
46
46
  const base = 36;
47
- if (index < 0) throw new Error("Index must be non-negative");
47
+ if (index < 0) throw new __deepnote_blocks.InvalidValueError("Index must be non-negative", { value: index });
48
48
  let result = "";
49
49
  let num = index + 1;
50
50
  let iterations = 0;
@@ -54,7 +54,7 @@ function createSortingKey(index) {
54
54
  num = Math.floor(num / base);
55
55
  iterations++;
56
56
  }
57
- if (num > 0) throw new Error(`Index ${index} exceeds maximum key length of ${maxLength}`);
57
+ if (num > 0) throw new __deepnote_blocks.InvalidValueError(`Index ${index} exceeds maximum key length of ${maxLength}`, { value: index });
58
58
  return result;
59
59
  }
60
60
  /**
@@ -250,6 +250,43 @@ function convertNotebookToJupyter(deepnoteFile, notebook) {
250
250
  });
251
251
  }
252
252
 
253
+ //#endregion
254
+ //#region src/errors.ts
255
+ /**
256
+ * Thrown when a file cannot be read from disk.
257
+ */
258
+ var FileReadError = class extends __deepnote_blocks.DeepnoteError {
259
+ filePath;
260
+ constructor(message, options) {
261
+ super(message, options);
262
+ this.filePath = options.filePath;
263
+ }
264
+ };
265
+ /**
266
+ * Thrown when a file cannot be written to disk.
267
+ */
268
+ var FileWriteError = class extends __deepnote_blocks.DeepnoteError {
269
+ filePath;
270
+ constructor(message, options) {
271
+ super(message, options);
272
+ this.filePath = options.filePath;
273
+ }
274
+ };
275
+ /**
276
+ * Thrown when JSON parsing fails.
277
+ */
278
+ var JsonParseError = class extends __deepnote_blocks.ParseError {};
279
+ /**
280
+ * Thrown when a file format is not supported.
281
+ */
282
+ var UnsupportedFormatError = class extends __deepnote_blocks.DeepnoteError {
283
+ filename;
284
+ constructor(message, options) {
285
+ super(message, options);
286
+ this.filename = options?.filename;
287
+ }
288
+ };
289
+
253
290
  //#endregion
254
291
  //#region src/deepnote-to-marimo.ts
255
292
  /** Current Marimo version for generated files */
@@ -364,8 +401,10 @@ async function convertDeepnoteFileToMarimoFiles(deepnoteFilePath, options) {
364
401
  const content = serializeMarimoFormat(app);
365
402
  await node_fs_promises.default.writeFile(filePath, content, "utf-8");
366
403
  } catch (err) {
367
- const errorMessage = err instanceof Error ? err.message : String(err);
368
- throw new Error(`Failed to write ${filename}: ${errorMessage}`, { cause: err });
404
+ throw new FileWriteError(`Failed to write ${filename}: ${err instanceof Error ? err.message : String(err)}`, {
405
+ cause: err,
406
+ filePath
407
+ });
369
408
  }
370
409
  }
371
410
  }
@@ -725,12 +764,12 @@ function detectFormat(filename, content) {
725
764
  if (lowercaseFilename.endsWith(".deepnote")) return "deepnote";
726
765
  if (lowercaseFilename.endsWith(".qmd")) return "quarto";
727
766
  if (lowercaseFilename.endsWith(".py")) {
728
- if (!content) throw new Error("Content is required to detect format for .py files");
767
+ if (!content) throw new UnsupportedFormatError("Content is required to detect format for .py files", { filename });
729
768
  if (isMarimoContent(content)) return "marimo";
730
769
  if (isPercentContent(content)) return "percent";
731
- throw new Error("Unsupported Python file format. File must be percent format (# %%) or Marimo (@app.cell).");
770
+ throw new UnsupportedFormatError("Unsupported Python file format. File must be percent format (# %%) or Marimo (@app.cell).", { filename });
732
771
  }
733
- throw new Error(`Unsupported file format: ${filename}`);
772
+ throw new UnsupportedFormatError(`Unsupported file format: ${filename}`, { filename });
734
773
  }
735
774
 
736
775
  //#endregion
@@ -847,14 +886,18 @@ async function parseIpynbFile(filePath) {
847
886
  try {
848
887
  ipynbJson = await node_fs_promises.default.readFile(filePath, "utf-8");
849
888
  } catch (error) {
850
- const message = error instanceof Error ? error.message : String(error);
851
- throw new Error(`Failed to read ${filePath}: ${message}`);
889
+ throw new FileReadError(`Failed to read ${filePath}: ${error instanceof Error ? error.message : String(error)}`, {
890
+ cause: error,
891
+ filePath
892
+ });
852
893
  }
853
894
  try {
854
895
  return JSON.parse(ipynbJson);
855
896
  } catch (error) {
856
- const message = error instanceof Error ? error.message : String(error);
857
- throw new Error(`Failed to parse ${filePath}: invalid JSON - ${message}`);
897
+ throw new JsonParseError(`Failed to parse ${filePath}: invalid JSON - ${error instanceof Error ? error.message : String(error)}`, {
898
+ cause: error,
899
+ filePath
900
+ });
858
901
  }
859
902
  }
860
903
  function convertCellToBlock$3(cell, index, idGenerator) {
@@ -1605,10 +1648,13 @@ async function readAndConvertMarimoFiles(inputFilePaths, options) {
1605
1648
  } catch (err) {
1606
1649
  const errorMessage = err instanceof Error ? err.message : String(err);
1607
1650
  const errorStack = err instanceof Error ? err.stack : void 0;
1608
- throw new Error(`Failed to read or parse file ${(0, node_path.basename)(filePath)}: ${errorMessage}`, { cause: errorStack ? {
1609
- originalError: err,
1610
- stack: errorStack
1611
- } : err });
1651
+ throw new FileReadError(`Failed to read or parse file ${(0, node_path.basename)(filePath)}: ${errorMessage}`, {
1652
+ cause: errorStack ? {
1653
+ originalError: err,
1654
+ stack: errorStack
1655
+ } : err,
1656
+ filePath
1657
+ });
1612
1658
  }
1613
1659
  return convertMarimoAppsToDeepnoteFile(apps, { projectName: options.projectName });
1614
1660
  }
@@ -1628,10 +1674,13 @@ async function convertMarimoFilesToDeepnoteFile(inputFilePaths, options) {
1628
1674
  } catch (err) {
1629
1675
  const errorMessage = err instanceof Error ? err.message : String(err);
1630
1676
  const errorStack = err instanceof Error ? err.stack : void 0;
1631
- throw new Error(`Failed to read or parse file ${(0, node_path.basename)(filePath)}: ${errorMessage}`, { cause: errorStack ? {
1632
- originalError: err,
1633
- stack: errorStack
1634
- } : err });
1677
+ throw new FileReadError(`Failed to read or parse file ${(0, node_path.basename)(filePath)}: ${errorMessage}`, {
1678
+ cause: errorStack ? {
1679
+ originalError: err,
1680
+ stack: errorStack
1681
+ } : err,
1682
+ filePath
1683
+ });
1635
1684
  }
1636
1685
  const yamlContent = (0, yaml.stringify)(convertMarimoAppsToDeepnoteFile(apps, { projectName: options.projectName }));
1637
1686
  const parentDir = (0, node_path.dirname)(options.outputPath);
@@ -2143,6 +2192,30 @@ async function writeDeepnoteFile(options) {
2143
2192
  }
2144
2193
 
2145
2194
  //#endregion
2195
+ Object.defineProperty(exports, 'FileReadError', {
2196
+ enumerable: true,
2197
+ get: function () {
2198
+ return FileReadError;
2199
+ }
2200
+ });
2201
+ Object.defineProperty(exports, 'FileWriteError', {
2202
+ enumerable: true,
2203
+ get: function () {
2204
+ return FileWriteError;
2205
+ }
2206
+ });
2207
+ Object.defineProperty(exports, 'JsonParseError', {
2208
+ enumerable: true,
2209
+ get: function () {
2210
+ return JsonParseError;
2211
+ }
2212
+ });
2213
+ Object.defineProperty(exports, 'UnsupportedFormatError', {
2214
+ enumerable: true,
2215
+ get: function () {
2216
+ return UnsupportedFormatError;
2217
+ }
2218
+ });
2146
2219
  Object.defineProperty(exports, '__toESM', {
2147
2220
  enumerable: true,
2148
2221
  get: function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepnote/convert",
3
- "version": "2.3.1",
3
+ "version": "3.0.0",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "repository": {
@@ -34,7 +34,7 @@
34
34
  "cleye": "^2.0.0",
35
35
  "ora": "^9.0.0",
36
36
  "yaml": "^2.8.1",
37
- "@deepnote/blocks": "3.2.1"
37
+ "@deepnote/blocks": "4.0.0"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/node": "^22.0.0",