@deepnote/convert 3.0.0 → 3.1.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/dist/bin.cjs +2 -4
- package/dist/bin.js +3 -4
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/{src-BN4Mwc-V.js → src-BcZ91Lsd.js} +9 -9
- package/dist/{src-BR6PqlNA.cjs → src-h056eQNO.cjs} +9 -9
- package/package.json +2 -2
package/dist/bin.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const require_src = require('./src-
|
|
2
|
+
const require_src = require('./src-h056eQNO.cjs');
|
|
3
3
|
let cleye = require("cleye");
|
|
4
4
|
cleye = require_src.__toESM(cleye);
|
|
5
5
|
let node_fs_promises = require("node:fs/promises");
|
|
@@ -12,8 +12,6 @@ let chalk = require("chalk");
|
|
|
12
12
|
chalk = require_src.__toESM(chalk);
|
|
13
13
|
let ora = require("ora");
|
|
14
14
|
ora = require_src.__toESM(ora);
|
|
15
|
-
let yaml = require("yaml");
|
|
16
|
-
yaml = require_src.__toESM(yaml);
|
|
17
15
|
|
|
18
16
|
//#region src/cli.ts
|
|
19
17
|
async function convert(options) {
|
|
@@ -218,7 +216,7 @@ async function convertDeepnoteToFormat(absolutePath, outputFormat, customOutputP
|
|
|
218
216
|
const tempDir = await node_fs_promises.default.mkdtemp((0, node_path.resolve)((0, node_path.dirname)(absolutePath), ".deepnote-merge-"));
|
|
219
217
|
const tempPath = (0, node_path.resolve)(tempDir, `${filenameWithoutExtension}.merged.deepnote`);
|
|
220
218
|
try {
|
|
221
|
-
const mergedYaml = (0,
|
|
219
|
+
const mergedYaml = (0, __deepnote_blocks.serializeDeepnoteFile)(deepnoteFile);
|
|
222
220
|
await node_fs_promises.default.writeFile(tempPath, mergedYaml, "utf-8");
|
|
223
221
|
switch (outputFormat) {
|
|
224
222
|
case "jupyter":
|
package/dist/bin.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
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, g as readAndConvertMarimoFiles, it as convertDeepnoteFileToJupyterFiles, o as readAndConvertQuartoFiles, t as writeDeepnoteFile, tt as UnsupportedFormatError, z as isPercentContent } from "./src-
|
|
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-BcZ91Lsd.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";
|
|
6
|
-
import { deserializeDeepnoteFile } from "@deepnote/blocks";
|
|
6
|
+
import { deserializeDeepnoteFile, serializeDeepnoteFile } from "@deepnote/blocks";
|
|
7
7
|
import chalk from "chalk";
|
|
8
8
|
import ora from "ora";
|
|
9
|
-
import { stringify } from "yaml";
|
|
10
9
|
|
|
11
10
|
//#region src/cli.ts
|
|
12
11
|
async function convert(options) {
|
|
@@ -211,7 +210,7 @@ async function convertDeepnoteToFormat(absolutePath, outputFormat, customOutputP
|
|
|
211
210
|
const tempDir = await fs.mkdtemp(resolve(dirname(absolutePath), ".deepnote-merge-"));
|
|
212
211
|
const tempPath = resolve(tempDir, `${filenameWithoutExtension}.merged.deepnote`);
|
|
213
212
|
try {
|
|
214
|
-
const mergedYaml =
|
|
213
|
+
const mergedYaml = serializeDeepnoteFile(deepnoteFile);
|
|
215
214
|
await fs.writeFile(tempPath, mergedYaml, "utf-8");
|
|
216
215
|
switch (outputFormat) {
|
|
217
216
|
case "jupyter":
|
package/dist/index.cjs
CHANGED
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DeepnoteBlock, DeepnoteError, DeepnoteFile, DeepnoteSnapshot, Environment, Execution, ParseError } from "@deepnote/blocks";
|
|
1
|
+
import { DeepnoteBlock, DeepnoteError, DeepnoteFile, DeepnoteSnapshot, Environment, Execution, ParseError, SnapshotHashInput, SnapshotHashInput as SnapshotHashInput$1 } from "@deepnote/blocks";
|
|
2
2
|
|
|
3
3
|
//#region src/types/jupyter.d.ts
|
|
4
4
|
|
|
@@ -778,7 +778,7 @@ declare function computeContentHash(content: string): string;
|
|
|
778
778
|
* @param file - The DeepnoteFile to compute hash for
|
|
779
779
|
* @returns Hash string in format 'sha256:{hex}'
|
|
780
780
|
*/
|
|
781
|
-
declare function computeSnapshotHash(file:
|
|
781
|
+
declare function computeSnapshotHash(file: SnapshotHashInput$1): string;
|
|
782
782
|
/**
|
|
783
783
|
* Adds content hashes to all blocks in a DeepnoteFile that don't already have them.
|
|
784
784
|
* Returns a new DeepnoteFile with hashes added (does not mutate the input).
|
|
@@ -994,4 +994,4 @@ interface WriteDeepnoteFileResult {
|
|
|
994
994
|
*/
|
|
995
995
|
declare function writeDeepnoteFile(options: WriteDeepnoteFileOptions): Promise<WriteDeepnoteFileResult>;
|
|
996
996
|
//#endregion
|
|
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 };
|
|
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 SnapshotHashInput, 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, DeepnoteError, DeepnoteFile, DeepnoteSnapshot, Environment, Execution, ParseError } from "@deepnote/blocks";
|
|
1
|
+
import { DeepnoteBlock, DeepnoteError, DeepnoteFile, DeepnoteSnapshot, Environment, Execution, ParseError, SnapshotHashInput, SnapshotHashInput as SnapshotHashInput$1 } from "@deepnote/blocks";
|
|
2
2
|
|
|
3
3
|
//#region src/types/jupyter.d.ts
|
|
4
4
|
|
|
@@ -778,7 +778,7 @@ declare function computeContentHash(content: string): string;
|
|
|
778
778
|
* @param file - The DeepnoteFile to compute hash for
|
|
779
779
|
* @returns Hash string in format 'sha256:{hex}'
|
|
780
780
|
*/
|
|
781
|
-
declare function computeSnapshotHash(file:
|
|
781
|
+
declare function computeSnapshotHash(file: SnapshotHashInput$1): string;
|
|
782
782
|
/**
|
|
783
783
|
* Adds content hashes to all blocks in a DeepnoteFile that don't already have them.
|
|
784
784
|
* Returns a new DeepnoteFile with hashes added (does not mutate the input).
|
|
@@ -994,4 +994,4 @@ interface WriteDeepnoteFileResult {
|
|
|
994
994
|
*/
|
|
995
995
|
declare function writeDeepnoteFile(options: WriteDeepnoteFileOptions): Promise<WriteDeepnoteFileResult>;
|
|
996
996
|
//#endregion
|
|
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 };
|
|
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 SnapshotHashInput, 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 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-
|
|
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-BcZ91Lsd.js";
|
|
2
2
|
|
|
3
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,8 +1,8 @@
|
|
|
1
1
|
import fs from "node:fs/promises";
|
|
2
2
|
import { basename, dirname, extname, join, resolve } from "node:path";
|
|
3
|
-
import { DeepnoteError, InvalidValueError, ParseError, createMarkdown, createPythonCode, deepnoteBlockSchema, deepnoteSnapshotSchema, deserializeDeepnoteFile, environmentSchema, executionSchema, isExecutableBlockType } from "@deepnote/blocks";
|
|
4
|
-
import { parse, stringify } from "yaml";
|
|
3
|
+
import { DeepnoteError, InvalidValueError, ParseError, createMarkdown, createPythonCode, deepnoteBlockSchema, deepnoteSnapshotSchema, deserializeDeepnoteFile, environmentSchema, executionSchema, isExecutableBlockType, serializeDeepnoteFile, serializeDeepnoteSnapshot } from "@deepnote/blocks";
|
|
5
4
|
import { createHash, randomUUID } from "node:crypto";
|
|
5
|
+
import { parse } from "yaml";
|
|
6
6
|
|
|
7
7
|
//#region src/utils.ts
|
|
8
8
|
/**
|
|
@@ -848,7 +848,7 @@ async function readAndConvertIpynbFiles(inputFilePaths, options) {
|
|
|
848
848
|
* Converts multiple Jupyter Notebook (.ipynb) files into a single Deepnote project file.
|
|
849
849
|
*/
|
|
850
850
|
async function convertIpynbFilesToDeepnoteFile(inputFilePaths, options) {
|
|
851
|
-
const yamlContent =
|
|
851
|
+
const yamlContent = serializeDeepnoteFile(await readAndConvertIpynbFiles(inputFilePaths, { projectName: options.projectName }));
|
|
852
852
|
const parentDir = dirname(options.outputPath);
|
|
853
853
|
await fs.mkdir(parentDir, { recursive: true });
|
|
854
854
|
await fs.writeFile(options.outputPath, yamlContent, "utf-8");
|
|
@@ -1654,7 +1654,7 @@ async function convertMarimoFilesToDeepnoteFile(inputFilePaths, options) {
|
|
|
1654
1654
|
filePath
|
|
1655
1655
|
});
|
|
1656
1656
|
}
|
|
1657
|
-
const yamlContent =
|
|
1657
|
+
const yamlContent = serializeDeepnoteFile(convertMarimoAppsToDeepnoteFile(apps, { projectName: options.projectName }));
|
|
1658
1658
|
const parentDir = dirname(options.outputPath);
|
|
1659
1659
|
await fs.mkdir(parentDir, { recursive: true });
|
|
1660
1660
|
await fs.writeFile(options.outputPath, yamlContent, "utf-8");
|
|
@@ -1827,7 +1827,7 @@ async function readAndConvertPercentFiles(inputFilePaths, options) {
|
|
|
1827
1827
|
* Converts multiple percent format (.py) files into a single Deepnote project file.
|
|
1828
1828
|
*/
|
|
1829
1829
|
async function convertPercentFilesToDeepnoteFile(inputFilePaths, options) {
|
|
1830
|
-
const yamlContent =
|
|
1830
|
+
const yamlContent = serializeDeepnoteFile(await readAndConvertPercentFiles(inputFilePaths, { projectName: options.projectName }));
|
|
1831
1831
|
const parentDir = dirname(options.outputPath);
|
|
1832
1832
|
await fs.mkdir(parentDir, { recursive: true });
|
|
1833
1833
|
await fs.writeFile(options.outputPath, yamlContent, "utf-8");
|
|
@@ -2100,7 +2100,7 @@ async function readAndConvertQuartoFiles(inputFilePaths, options) {
|
|
|
2100
2100
|
* Converts multiple Quarto (.qmd) files into a single Deepnote project file.
|
|
2101
2101
|
*/
|
|
2102
2102
|
async function convertQuartoFilesToDeepnoteFile(inputFilePaths, options) {
|
|
2103
|
-
const yamlContent =
|
|
2103
|
+
const yamlContent = serializeDeepnoteFile(await readAndConvertQuartoFiles(inputFilePaths, { projectName: options.projectName }));
|
|
2104
2104
|
const parentDir = dirname(options.outputPath);
|
|
2105
2105
|
await fs.mkdir(parentDir, { recursive: true });
|
|
2106
2106
|
await fs.writeFile(options.outputPath, yamlContent, "utf-8");
|
|
@@ -2146,15 +2146,15 @@ async function writeDeepnoteFile(options) {
|
|
|
2146
2146
|
const parentDir = dirname(outputPath);
|
|
2147
2147
|
await fs.mkdir(parentDir, { recursive: true });
|
|
2148
2148
|
if (singleFile || !hasOutputs(file)) {
|
|
2149
|
-
const yamlContent =
|
|
2149
|
+
const yamlContent = serializeDeepnoteFile(file);
|
|
2150
2150
|
await fs.writeFile(outputPath, yamlContent, "utf-8");
|
|
2151
2151
|
return { sourcePath: outputPath };
|
|
2152
2152
|
}
|
|
2153
2153
|
const { source, snapshot } = splitDeepnoteFile(file);
|
|
2154
2154
|
const snapshotDir = getSnapshotDir(outputPath);
|
|
2155
2155
|
const snapshotPath = resolve(snapshotDir, generateSnapshotFilename(slugifyProjectName(projectName) || "project", file.project.id));
|
|
2156
|
-
const sourceYaml =
|
|
2157
|
-
const snapshotYaml =
|
|
2156
|
+
const sourceYaml = serializeDeepnoteFile(source);
|
|
2157
|
+
const snapshotYaml = serializeDeepnoteSnapshot(snapshot);
|
|
2158
2158
|
await fs.mkdir(snapshotDir, { recursive: true });
|
|
2159
2159
|
await Promise.all([fs.writeFile(outputPath, sourceYaml, "utf-8"), fs.writeFile(snapshotPath, snapshotYaml, "utf-8")]);
|
|
2160
2160
|
return {
|
|
@@ -27,10 +27,10 @@ let node_path = require("node:path");
|
|
|
27
27
|
node_path = __toESM(node_path);
|
|
28
28
|
let __deepnote_blocks = require("@deepnote/blocks");
|
|
29
29
|
__deepnote_blocks = __toESM(__deepnote_blocks);
|
|
30
|
-
let yaml = require("yaml");
|
|
31
|
-
yaml = __toESM(yaml);
|
|
32
30
|
let node_crypto = require("node:crypto");
|
|
33
31
|
node_crypto = __toESM(node_crypto);
|
|
32
|
+
let yaml = require("yaml");
|
|
33
|
+
yaml = __toESM(yaml);
|
|
34
34
|
|
|
35
35
|
//#region src/utils.ts
|
|
36
36
|
/**
|
|
@@ -876,7 +876,7 @@ async function readAndConvertIpynbFiles(inputFilePaths, options) {
|
|
|
876
876
|
* Converts multiple Jupyter Notebook (.ipynb) files into a single Deepnote project file.
|
|
877
877
|
*/
|
|
878
878
|
async function convertIpynbFilesToDeepnoteFile(inputFilePaths, options) {
|
|
879
|
-
const yamlContent = (0,
|
|
879
|
+
const yamlContent = (0, __deepnote_blocks.serializeDeepnoteFile)(await readAndConvertIpynbFiles(inputFilePaths, { projectName: options.projectName }));
|
|
880
880
|
const parentDir = (0, node_path.dirname)(options.outputPath);
|
|
881
881
|
await node_fs_promises.default.mkdir(parentDir, { recursive: true });
|
|
882
882
|
await node_fs_promises.default.writeFile(options.outputPath, yamlContent, "utf-8");
|
|
@@ -1682,7 +1682,7 @@ async function convertMarimoFilesToDeepnoteFile(inputFilePaths, options) {
|
|
|
1682
1682
|
filePath
|
|
1683
1683
|
});
|
|
1684
1684
|
}
|
|
1685
|
-
const yamlContent = (0,
|
|
1685
|
+
const yamlContent = (0, __deepnote_blocks.serializeDeepnoteFile)(convertMarimoAppsToDeepnoteFile(apps, { projectName: options.projectName }));
|
|
1686
1686
|
const parentDir = (0, node_path.dirname)(options.outputPath);
|
|
1687
1687
|
await node_fs_promises.default.mkdir(parentDir, { recursive: true });
|
|
1688
1688
|
await node_fs_promises.default.writeFile(options.outputPath, yamlContent, "utf-8");
|
|
@@ -1855,7 +1855,7 @@ async function readAndConvertPercentFiles(inputFilePaths, options) {
|
|
|
1855
1855
|
* Converts multiple percent format (.py) files into a single Deepnote project file.
|
|
1856
1856
|
*/
|
|
1857
1857
|
async function convertPercentFilesToDeepnoteFile(inputFilePaths, options) {
|
|
1858
|
-
const yamlContent = (0,
|
|
1858
|
+
const yamlContent = (0, __deepnote_blocks.serializeDeepnoteFile)(await readAndConvertPercentFiles(inputFilePaths, { projectName: options.projectName }));
|
|
1859
1859
|
const parentDir = (0, node_path.dirname)(options.outputPath);
|
|
1860
1860
|
await node_fs_promises.default.mkdir(parentDir, { recursive: true });
|
|
1861
1861
|
await node_fs_promises.default.writeFile(options.outputPath, yamlContent, "utf-8");
|
|
@@ -2128,7 +2128,7 @@ async function readAndConvertQuartoFiles(inputFilePaths, options) {
|
|
|
2128
2128
|
* Converts multiple Quarto (.qmd) files into a single Deepnote project file.
|
|
2129
2129
|
*/
|
|
2130
2130
|
async function convertQuartoFilesToDeepnoteFile(inputFilePaths, options) {
|
|
2131
|
-
const yamlContent = (0,
|
|
2131
|
+
const yamlContent = (0, __deepnote_blocks.serializeDeepnoteFile)(await readAndConvertQuartoFiles(inputFilePaths, { projectName: options.projectName }));
|
|
2132
2132
|
const parentDir = (0, node_path.dirname)(options.outputPath);
|
|
2133
2133
|
await node_fs_promises.default.mkdir(parentDir, { recursive: true });
|
|
2134
2134
|
await node_fs_promises.default.writeFile(options.outputPath, yamlContent, "utf-8");
|
|
@@ -2174,15 +2174,15 @@ async function writeDeepnoteFile(options) {
|
|
|
2174
2174
|
const parentDir = (0, node_path.dirname)(outputPath);
|
|
2175
2175
|
await node_fs_promises.default.mkdir(parentDir, { recursive: true });
|
|
2176
2176
|
if (singleFile || !hasOutputs(file)) {
|
|
2177
|
-
const yamlContent = (0,
|
|
2177
|
+
const yamlContent = (0, __deepnote_blocks.serializeDeepnoteFile)(file);
|
|
2178
2178
|
await node_fs_promises.default.writeFile(outputPath, yamlContent, "utf-8");
|
|
2179
2179
|
return { sourcePath: outputPath };
|
|
2180
2180
|
}
|
|
2181
2181
|
const { source, snapshot } = splitDeepnoteFile(file);
|
|
2182
2182
|
const snapshotDir = getSnapshotDir(outputPath);
|
|
2183
2183
|
const snapshotPath = (0, node_path.resolve)(snapshotDir, generateSnapshotFilename(slugifyProjectName(projectName) || "project", file.project.id));
|
|
2184
|
-
const sourceYaml = (0,
|
|
2185
|
-
const snapshotYaml = (0,
|
|
2184
|
+
const sourceYaml = (0, __deepnote_blocks.serializeDeepnoteFile)(source);
|
|
2185
|
+
const snapshotYaml = (0, __deepnote_blocks.serializeDeepnoteSnapshot)(snapshot);
|
|
2186
2186
|
await node_fs_promises.default.mkdir(snapshotDir, { recursive: true });
|
|
2187
2187
|
await Promise.all([node_fs_promises.default.writeFile(outputPath, sourceYaml, "utf-8"), node_fs_promises.default.writeFile(snapshotPath, snapshotYaml, "utf-8")]);
|
|
2188
2188
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepnote/convert",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.1",
|
|
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": "4.
|
|
37
|
+
"@deepnote/blocks": "4.2.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/node": "^22.0.0",
|