@deepnote/convert 2.1.2 → 2.1.3
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 +1 -1
- package/dist/bin.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +1 -1
- package/dist/{src-DI6mrd_2.cjs → src-1XGCb_OZ.cjs} +16 -16
- package/dist/{src-oALQkXiP.js → src-zxlAKpnq.js} +15 -15
- package/package.json +1 -2
package/dist/bin.cjs
CHANGED
package/dist/bin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { M as convertDeepnoteFileToJupyterFiles, O as convertDeepnoteFileToMarimoFiles, _ as isMarimoContent, a as convertPercentFilesToDeepnoteFile, b as convertDeepnoteFileToQuartoFiles, d as convertMarimoFilesToDeepnoteFile, p as convertIpynbFilesToDeepnoteFile, r as convertQuartoFilesToDeepnoteFile, v as isPercentContent, w as convertDeepnoteFileToPercentFiles } from "./src-
|
|
2
|
+
import { M as convertDeepnoteFileToJupyterFiles, O as convertDeepnoteFileToMarimoFiles, _ as isMarimoContent, a as convertPercentFilesToDeepnoteFile, b as convertDeepnoteFileToQuartoFiles, d as convertMarimoFilesToDeepnoteFile, p as convertIpynbFilesToDeepnoteFile, r as convertQuartoFilesToDeepnoteFile, v as isPercentContent, w as convertDeepnoteFileToPercentFiles } from "./src-zxlAKpnq.js";
|
|
3
3
|
import { cli } from "cleye";
|
|
4
4
|
import fs from "node:fs/promises";
|
|
5
5
|
import { basename, extname, resolve } from "node:path";
|
package/dist/index.cjs
CHANGED
package/dist/index.d.cts
CHANGED
|
@@ -409,7 +409,7 @@ interface ConvertIpynbFilesToDeepnoteFileOptions {
|
|
|
409
409
|
projectName: string;
|
|
410
410
|
}
|
|
411
411
|
interface ConvertJupyterNotebookOptions {
|
|
412
|
-
/** Custom ID generator function. Defaults to
|
|
412
|
+
/** Custom ID generator function. Defaults to crypto.randomUUID(). */
|
|
413
413
|
idGenerator?: () => string;
|
|
414
414
|
}
|
|
415
415
|
interface JupyterNotebookInput {
|
|
@@ -457,7 +457,7 @@ interface ConvertMarimoFilesToDeepnoteFileOptions {
|
|
|
457
457
|
projectName: string;
|
|
458
458
|
}
|
|
459
459
|
interface ConvertMarimoAppOptions {
|
|
460
|
-
/** Custom ID generator function. Defaults to
|
|
460
|
+
/** Custom ID generator function. Defaults to crypto.randomUUID(). */
|
|
461
461
|
idGenerator?: () => string;
|
|
462
462
|
}
|
|
463
463
|
interface MarimoAppInput {
|
|
@@ -497,7 +497,7 @@ declare function convertMarimoAppToBlocks(app: MarimoApp, options?: ConvertMarim
|
|
|
497
497
|
interface ConvertMarimoAppsToDeepnoteOptions {
|
|
498
498
|
/** Project name for the Deepnote file */
|
|
499
499
|
projectName: string;
|
|
500
|
-
/** Custom ID generator function. Defaults to
|
|
500
|
+
/** Custom ID generator function. Defaults to crypto.randomUUID(). */
|
|
501
501
|
idGenerator?: () => string;
|
|
502
502
|
}
|
|
503
503
|
/**
|
|
@@ -520,7 +520,7 @@ interface ConvertPercentFilesToDeepnoteFileOptions {
|
|
|
520
520
|
projectName: string;
|
|
521
521
|
}
|
|
522
522
|
interface ConvertPercentNotebookOptions {
|
|
523
|
-
/** Custom ID generator function. Defaults to
|
|
523
|
+
/** Custom ID generator function. Defaults to crypto.randomUUID(). */
|
|
524
524
|
idGenerator?: () => string;
|
|
525
525
|
}
|
|
526
526
|
interface PercentNotebookInput {
|
|
@@ -576,7 +576,7 @@ interface ConvertQuartoFilesToDeepnoteFileOptions {
|
|
|
576
576
|
projectName: string;
|
|
577
577
|
}
|
|
578
578
|
interface ConvertQuartoDocumentOptions {
|
|
579
|
-
/** Custom ID generator function. Defaults to
|
|
579
|
+
/** Custom ID generator function. Defaults to crypto.randomUUID(). */
|
|
580
580
|
idGenerator?: () => string;
|
|
581
581
|
}
|
|
582
582
|
interface QuartoDocumentInput {
|
package/dist/index.d.ts
CHANGED
|
@@ -409,7 +409,7 @@ interface ConvertIpynbFilesToDeepnoteFileOptions {
|
|
|
409
409
|
projectName: string;
|
|
410
410
|
}
|
|
411
411
|
interface ConvertJupyterNotebookOptions {
|
|
412
|
-
/** Custom ID generator function. Defaults to
|
|
412
|
+
/** Custom ID generator function. Defaults to crypto.randomUUID(). */
|
|
413
413
|
idGenerator?: () => string;
|
|
414
414
|
}
|
|
415
415
|
interface JupyterNotebookInput {
|
|
@@ -457,7 +457,7 @@ interface ConvertMarimoFilesToDeepnoteFileOptions {
|
|
|
457
457
|
projectName: string;
|
|
458
458
|
}
|
|
459
459
|
interface ConvertMarimoAppOptions {
|
|
460
|
-
/** Custom ID generator function. Defaults to
|
|
460
|
+
/** Custom ID generator function. Defaults to crypto.randomUUID(). */
|
|
461
461
|
idGenerator?: () => string;
|
|
462
462
|
}
|
|
463
463
|
interface MarimoAppInput {
|
|
@@ -497,7 +497,7 @@ declare function convertMarimoAppToBlocks(app: MarimoApp, options?: ConvertMarim
|
|
|
497
497
|
interface ConvertMarimoAppsToDeepnoteOptions {
|
|
498
498
|
/** Project name for the Deepnote file */
|
|
499
499
|
projectName: string;
|
|
500
|
-
/** Custom ID generator function. Defaults to
|
|
500
|
+
/** Custom ID generator function. Defaults to crypto.randomUUID(). */
|
|
501
501
|
idGenerator?: () => string;
|
|
502
502
|
}
|
|
503
503
|
/**
|
|
@@ -520,7 +520,7 @@ interface ConvertPercentFilesToDeepnoteFileOptions {
|
|
|
520
520
|
projectName: string;
|
|
521
521
|
}
|
|
522
522
|
interface ConvertPercentNotebookOptions {
|
|
523
|
-
/** Custom ID generator function. Defaults to
|
|
523
|
+
/** Custom ID generator function. Defaults to crypto.randomUUID(). */
|
|
524
524
|
idGenerator?: () => string;
|
|
525
525
|
}
|
|
526
526
|
interface PercentNotebookInput {
|
|
@@ -576,7 +576,7 @@ interface ConvertQuartoFilesToDeepnoteFileOptions {
|
|
|
576
576
|
projectName: string;
|
|
577
577
|
}
|
|
578
578
|
interface ConvertQuartoDocumentOptions {
|
|
579
|
-
/** Custom ID generator function. Defaults to
|
|
579
|
+
/** Custom ID generator function. Defaults to crypto.randomUUID(). */
|
|
580
580
|
idGenerator?: () => string;
|
|
581
581
|
}
|
|
582
582
|
interface QuartoDocumentInput {
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as serializeMarimoFormat, C as convertBlocksToPercentNotebook, D as convertBlocksToMarimoApp, E as serializePercentFormat, M as convertDeepnoteFileToJupyterFiles, N as convertDeepnoteToJupyterNotebooks, O as convertDeepnoteFileToMarimoFiles, S as serializeQuartoFormat, T as convertDeepnoteToPercentNotebooks, a as convertPercentFilesToDeepnoteFile, b as convertDeepnoteFileToQuartoFiles, c as parsePercentFormat, d as convertMarimoFilesToDeepnoteFile, f as parseMarimoFormat, g as detectFormat, h as convertJupyterNotebooksToDeepnote, i as parseQuartoFormat, j as convertBlocksToJupyterNotebook, k as convertDeepnoteToMarimoApps, l as convertMarimoAppToBlocks, m as convertJupyterNotebookToBlocks, n as convertQuartoDocumentsToDeepnote, o as convertPercentNotebookToBlocks, p as convertIpynbFilesToDeepnoteFile, r as convertQuartoFilesToDeepnoteFile, s as convertPercentNotebooksToDeepnote, t as convertQuartoDocumentToBlocks, u as convertMarimoAppsToDeepnote, w as convertDeepnoteFileToPercentFiles, x as convertDeepnoteToQuartoDocuments, y as convertBlocksToQuartoDocument } from "./src-
|
|
1
|
+
import { A as serializeMarimoFormat, C as convertBlocksToPercentNotebook, D as convertBlocksToMarimoApp, E as serializePercentFormat, M as convertDeepnoteFileToJupyterFiles, N as convertDeepnoteToJupyterNotebooks, O as convertDeepnoteFileToMarimoFiles, S as serializeQuartoFormat, T as convertDeepnoteToPercentNotebooks, a as convertPercentFilesToDeepnoteFile, b as convertDeepnoteFileToQuartoFiles, c as parsePercentFormat, d as convertMarimoFilesToDeepnoteFile, f as parseMarimoFormat, g as detectFormat, h as convertJupyterNotebooksToDeepnote, i as parseQuartoFormat, j as convertBlocksToJupyterNotebook, k as convertDeepnoteToMarimoApps, l as convertMarimoAppToBlocks, m as convertJupyterNotebookToBlocks, n as convertQuartoDocumentsToDeepnote, o as convertPercentNotebookToBlocks, p as convertIpynbFilesToDeepnoteFile, r as convertQuartoFilesToDeepnoteFile, s as convertPercentNotebooksToDeepnote, t as convertQuartoDocumentToBlocks, u as convertMarimoAppsToDeepnote, w as convertDeepnoteFileToPercentFiles, x as convertDeepnoteToQuartoDocuments, y as convertBlocksToQuartoDocument } from "./src-zxlAKpnq.js";
|
|
2
2
|
|
|
3
3
|
export { convertBlocksToJupyterNotebook, convertBlocksToMarimoApp, convertBlocksToPercentNotebook, convertBlocksToQuartoDocument, convertDeepnoteFileToJupyterFiles as convertDeepnoteFileToJupyter, convertDeepnoteFileToMarimoFiles, convertDeepnoteFileToPercentFiles, convertDeepnoteFileToQuartoFiles, convertDeepnoteToJupyterNotebooks, convertDeepnoteToMarimoApps, convertDeepnoteToPercentNotebooks, convertDeepnoteToQuartoDocuments, convertIpynbFilesToDeepnoteFile, convertJupyterNotebookToBlocks, convertJupyterNotebooksToDeepnote, convertMarimoAppToBlocks, convertMarimoAppsToDeepnote, convertMarimoFilesToDeepnoteFile, convertPercentFilesToDeepnoteFile, convertPercentNotebookToBlocks, convertPercentNotebooksToDeepnote, convertQuartoDocumentToBlocks, convertQuartoDocumentsToDeepnote, convertQuartoFilesToDeepnoteFile, detectFormat, parseMarimoFormat, parsePercentFormat, parseQuartoFormat, serializeMarimoFormat, serializePercentFormat, serializeQuartoFormat };
|
|
@@ -27,8 +27,8 @@ 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
|
|
31
|
-
|
|
30
|
+
let node_crypto = require("node:crypto");
|
|
31
|
+
node_crypto = __toESM(node_crypto);
|
|
32
32
|
let yaml = require("yaml");
|
|
33
33
|
yaml = __toESM(yaml);
|
|
34
34
|
|
|
@@ -696,7 +696,7 @@ function detectFormat(filename, content) {
|
|
|
696
696
|
* ```
|
|
697
697
|
*/
|
|
698
698
|
function convertJupyterNotebookToBlocks(notebook, options) {
|
|
699
|
-
const idGenerator = options?.idGenerator ??
|
|
699
|
+
const idGenerator = options?.idGenerator ?? node_crypto.randomUUID;
|
|
700
700
|
return notebook.cells.map((cell, index) => convertCellToBlock$3(cell, index, idGenerator));
|
|
701
701
|
}
|
|
702
702
|
/**
|
|
@@ -720,13 +720,13 @@ function convertJupyterNotebooksToDeepnote(notebooks, options) {
|
|
|
720
720
|
if (parsed.success) execution = parsed.data;
|
|
721
721
|
}
|
|
722
722
|
}
|
|
723
|
-
const firstNotebookId = notebooks.length > 0 ? notebooks[0].notebook.metadata?.deepnote_notebook_id ?? (0,
|
|
723
|
+
const firstNotebookId = notebooks.length > 0 ? notebooks[0].notebook.metadata?.deepnote_notebook_id ?? (0, node_crypto.randomUUID)() : void 0;
|
|
724
724
|
const deepnoteFile = {
|
|
725
725
|
environment,
|
|
726
726
|
execution,
|
|
727
727
|
metadata: { createdAt: (/* @__PURE__ */ new Date()).toISOString() },
|
|
728
728
|
project: {
|
|
729
|
-
id: (0,
|
|
729
|
+
id: (0, node_crypto.randomUUID)(),
|
|
730
730
|
initNotebookId: firstNotebookId,
|
|
731
731
|
integrations: [],
|
|
732
732
|
name: options.projectName,
|
|
@@ -744,7 +744,7 @@ function convertJupyterNotebooksToDeepnote(notebooks, options) {
|
|
|
744
744
|
const executionMode = notebook.metadata?.deepnote_execution_mode;
|
|
745
745
|
const isModule = notebook.metadata?.deepnote_is_module;
|
|
746
746
|
const workingDirectory = notebook.metadata?.deepnote_working_directory;
|
|
747
|
-
const resolvedNotebookId = i === 0 && firstNotebookId ? firstNotebookId : notebookId ?? (0,
|
|
747
|
+
const resolvedNotebookId = i === 0 && firstNotebookId ? firstNotebookId : notebookId ?? (0, node_crypto.randomUUID)();
|
|
748
748
|
deepnoteFile.project.notebooks.push({
|
|
749
749
|
blocks,
|
|
750
750
|
executionMode: executionMode ?? "block",
|
|
@@ -999,7 +999,7 @@ function parseMarimoFormat(content) {
|
|
|
999
999
|
* @returns Array of DeepnoteBlock objects
|
|
1000
1000
|
*/
|
|
1001
1001
|
function convertMarimoAppToBlocks(app, options) {
|
|
1002
|
-
const idGenerator = options?.idGenerator ??
|
|
1002
|
+
const idGenerator = options?.idGenerator ?? node_crypto.randomUUID;
|
|
1003
1003
|
return app.cells.map((cell, index) => convertCellToBlock$2(cell, index, idGenerator));
|
|
1004
1004
|
}
|
|
1005
1005
|
/**
|
|
@@ -1011,7 +1011,7 @@ function convertMarimoAppToBlocks(app, options) {
|
|
|
1011
1011
|
* @returns A DeepnoteFile object
|
|
1012
1012
|
*/
|
|
1013
1013
|
function convertMarimoAppsToDeepnote(apps, options) {
|
|
1014
|
-
const idGenerator = options.idGenerator ??
|
|
1014
|
+
const idGenerator = options.idGenerator ?? node_crypto.randomUUID;
|
|
1015
1015
|
const firstNotebookId = apps.length > 0 ? idGenerator() : void 0;
|
|
1016
1016
|
const deepnoteFile = {
|
|
1017
1017
|
metadata: { createdAt: (/* @__PURE__ */ new Date()).toISOString() },
|
|
@@ -1169,7 +1169,7 @@ function parsePercentFormat(content) {
|
|
|
1169
1169
|
* @returns Array of DeepnoteBlock objects
|
|
1170
1170
|
*/
|
|
1171
1171
|
function convertPercentNotebookToBlocks(notebook, options) {
|
|
1172
|
-
const idGenerator = options?.idGenerator ??
|
|
1172
|
+
const idGenerator = options?.idGenerator ?? node_crypto.randomUUID;
|
|
1173
1173
|
return notebook.cells.map((cell, index) => convertCellToBlock$1(cell, index, idGenerator));
|
|
1174
1174
|
}
|
|
1175
1175
|
/**
|
|
@@ -1181,11 +1181,11 @@ function convertPercentNotebookToBlocks(notebook, options) {
|
|
|
1181
1181
|
* @returns A DeepnoteFile object
|
|
1182
1182
|
*/
|
|
1183
1183
|
function convertPercentNotebooksToDeepnote(notebooks, options) {
|
|
1184
|
-
const firstNotebookId = notebooks.length > 0 ? (0,
|
|
1184
|
+
const firstNotebookId = notebooks.length > 0 ? (0, node_crypto.randomUUID)() : void 0;
|
|
1185
1185
|
const deepnoteFile = {
|
|
1186
1186
|
metadata: { createdAt: (/* @__PURE__ */ new Date()).toISOString() },
|
|
1187
1187
|
project: {
|
|
1188
|
-
id: (0,
|
|
1188
|
+
id: (0, node_crypto.randomUUID)(),
|
|
1189
1189
|
initNotebookId: firstNotebookId,
|
|
1190
1190
|
integrations: [],
|
|
1191
1191
|
name: options.projectName,
|
|
@@ -1198,7 +1198,7 @@ function convertPercentNotebooksToDeepnote(notebooks, options) {
|
|
|
1198
1198
|
const { filename, notebook } = notebooks[i];
|
|
1199
1199
|
const filenameWithoutExt = (0, node_path.basename)(filename, (0, node_path.extname)(filename)) || "Untitled notebook";
|
|
1200
1200
|
const blocks = convertPercentNotebookToBlocks(notebook);
|
|
1201
|
-
const notebookId = i === 0 && firstNotebookId ? firstNotebookId : (0,
|
|
1201
|
+
const notebookId = i === 0 && firstNotebookId ? firstNotebookId : (0, node_crypto.randomUUID)();
|
|
1202
1202
|
deepnoteFile.project.notebooks.push({
|
|
1203
1203
|
blocks,
|
|
1204
1204
|
executionMode: "block",
|
|
@@ -1420,7 +1420,7 @@ function parseQuartoCellOptions(content) {
|
|
|
1420
1420
|
* @returns Array of DeepnoteBlock objects
|
|
1421
1421
|
*/
|
|
1422
1422
|
function convertQuartoDocumentToBlocks(document, options) {
|
|
1423
|
-
const idGenerator = options?.idGenerator ??
|
|
1423
|
+
const idGenerator = options?.idGenerator ?? node_crypto.randomUUID;
|
|
1424
1424
|
const blocks = [];
|
|
1425
1425
|
if (document.frontmatter?.title) blocks.push({
|
|
1426
1426
|
blockGroup: idGenerator(),
|
|
@@ -1442,11 +1442,11 @@ function convertQuartoDocumentToBlocks(document, options) {
|
|
|
1442
1442
|
* @returns A DeepnoteFile object
|
|
1443
1443
|
*/
|
|
1444
1444
|
function convertQuartoDocumentsToDeepnote(documents, options) {
|
|
1445
|
-
const firstNotebookId = documents.length > 0 ? (0,
|
|
1445
|
+
const firstNotebookId = documents.length > 0 ? (0, node_crypto.randomUUID)() : void 0;
|
|
1446
1446
|
const deepnoteFile = {
|
|
1447
1447
|
metadata: { createdAt: (/* @__PURE__ */ new Date()).toISOString() },
|
|
1448
1448
|
project: {
|
|
1449
|
-
id: (0,
|
|
1449
|
+
id: (0, node_crypto.randomUUID)(),
|
|
1450
1450
|
initNotebookId: firstNotebookId,
|
|
1451
1451
|
integrations: [],
|
|
1452
1452
|
name: options.projectName,
|
|
@@ -1460,7 +1460,7 @@ function convertQuartoDocumentsToDeepnote(documents, options) {
|
|
|
1460
1460
|
const filenameWithoutExt = (0, node_path.basename)(filename, (0, node_path.extname)(filename)) || "Untitled notebook";
|
|
1461
1461
|
const notebookName = document.frontmatter?.title || filenameWithoutExt;
|
|
1462
1462
|
const blocks = convertQuartoDocumentToBlocks(document);
|
|
1463
|
-
const notebookId = i === 0 && firstNotebookId ? firstNotebookId : (0,
|
|
1463
|
+
const notebookId = i === 0 && firstNotebookId ? firstNotebookId : (0, node_crypto.randomUUID)();
|
|
1464
1464
|
deepnoteFile.project.notebooks.push({
|
|
1465
1465
|
blocks,
|
|
1466
1466
|
executionMode: "block",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from "node:fs/promises";
|
|
2
2
|
import { basename, dirname, extname, join } from "node:path";
|
|
3
3
|
import { createMarkdown, createPythonCode, deepnoteBlockSchema, deserializeDeepnoteFile, environmentSchema, executionSchema } from "@deepnote/blocks";
|
|
4
|
-
import {
|
|
4
|
+
import { randomUUID } from "node:crypto";
|
|
5
5
|
import { parse, stringify } from "yaml";
|
|
6
6
|
|
|
7
7
|
//#region src/utils.ts
|
|
@@ -668,7 +668,7 @@ function detectFormat(filename, content) {
|
|
|
668
668
|
* ```
|
|
669
669
|
*/
|
|
670
670
|
function convertJupyterNotebookToBlocks(notebook, options) {
|
|
671
|
-
const idGenerator = options?.idGenerator ??
|
|
671
|
+
const idGenerator = options?.idGenerator ?? randomUUID;
|
|
672
672
|
return notebook.cells.map((cell, index) => convertCellToBlock$3(cell, index, idGenerator));
|
|
673
673
|
}
|
|
674
674
|
/**
|
|
@@ -692,13 +692,13 @@ function convertJupyterNotebooksToDeepnote(notebooks, options) {
|
|
|
692
692
|
if (parsed.success) execution = parsed.data;
|
|
693
693
|
}
|
|
694
694
|
}
|
|
695
|
-
const firstNotebookId = notebooks.length > 0 ? notebooks[0].notebook.metadata?.deepnote_notebook_id ??
|
|
695
|
+
const firstNotebookId = notebooks.length > 0 ? notebooks[0].notebook.metadata?.deepnote_notebook_id ?? randomUUID() : void 0;
|
|
696
696
|
const deepnoteFile = {
|
|
697
697
|
environment,
|
|
698
698
|
execution,
|
|
699
699
|
metadata: { createdAt: (/* @__PURE__ */ new Date()).toISOString() },
|
|
700
700
|
project: {
|
|
701
|
-
id:
|
|
701
|
+
id: randomUUID(),
|
|
702
702
|
initNotebookId: firstNotebookId,
|
|
703
703
|
integrations: [],
|
|
704
704
|
name: options.projectName,
|
|
@@ -716,7 +716,7 @@ function convertJupyterNotebooksToDeepnote(notebooks, options) {
|
|
|
716
716
|
const executionMode = notebook.metadata?.deepnote_execution_mode;
|
|
717
717
|
const isModule = notebook.metadata?.deepnote_is_module;
|
|
718
718
|
const workingDirectory = notebook.metadata?.deepnote_working_directory;
|
|
719
|
-
const resolvedNotebookId = i === 0 && firstNotebookId ? firstNotebookId : notebookId ??
|
|
719
|
+
const resolvedNotebookId = i === 0 && firstNotebookId ? firstNotebookId : notebookId ?? randomUUID();
|
|
720
720
|
deepnoteFile.project.notebooks.push({
|
|
721
721
|
blocks,
|
|
722
722
|
executionMode: executionMode ?? "block",
|
|
@@ -971,7 +971,7 @@ function parseMarimoFormat(content) {
|
|
|
971
971
|
* @returns Array of DeepnoteBlock objects
|
|
972
972
|
*/
|
|
973
973
|
function convertMarimoAppToBlocks(app, options) {
|
|
974
|
-
const idGenerator = options?.idGenerator ??
|
|
974
|
+
const idGenerator = options?.idGenerator ?? randomUUID;
|
|
975
975
|
return app.cells.map((cell, index) => convertCellToBlock$2(cell, index, idGenerator));
|
|
976
976
|
}
|
|
977
977
|
/**
|
|
@@ -983,7 +983,7 @@ function convertMarimoAppToBlocks(app, options) {
|
|
|
983
983
|
* @returns A DeepnoteFile object
|
|
984
984
|
*/
|
|
985
985
|
function convertMarimoAppsToDeepnote(apps, options) {
|
|
986
|
-
const idGenerator = options.idGenerator ??
|
|
986
|
+
const idGenerator = options.idGenerator ?? randomUUID;
|
|
987
987
|
const firstNotebookId = apps.length > 0 ? idGenerator() : void 0;
|
|
988
988
|
const deepnoteFile = {
|
|
989
989
|
metadata: { createdAt: (/* @__PURE__ */ new Date()).toISOString() },
|
|
@@ -1141,7 +1141,7 @@ function parsePercentFormat(content) {
|
|
|
1141
1141
|
* @returns Array of DeepnoteBlock objects
|
|
1142
1142
|
*/
|
|
1143
1143
|
function convertPercentNotebookToBlocks(notebook, options) {
|
|
1144
|
-
const idGenerator = options?.idGenerator ??
|
|
1144
|
+
const idGenerator = options?.idGenerator ?? randomUUID;
|
|
1145
1145
|
return notebook.cells.map((cell, index) => convertCellToBlock$1(cell, index, idGenerator));
|
|
1146
1146
|
}
|
|
1147
1147
|
/**
|
|
@@ -1153,11 +1153,11 @@ function convertPercentNotebookToBlocks(notebook, options) {
|
|
|
1153
1153
|
* @returns A DeepnoteFile object
|
|
1154
1154
|
*/
|
|
1155
1155
|
function convertPercentNotebooksToDeepnote(notebooks, options) {
|
|
1156
|
-
const firstNotebookId = notebooks.length > 0 ?
|
|
1156
|
+
const firstNotebookId = notebooks.length > 0 ? randomUUID() : void 0;
|
|
1157
1157
|
const deepnoteFile = {
|
|
1158
1158
|
metadata: { createdAt: (/* @__PURE__ */ new Date()).toISOString() },
|
|
1159
1159
|
project: {
|
|
1160
|
-
id:
|
|
1160
|
+
id: randomUUID(),
|
|
1161
1161
|
initNotebookId: firstNotebookId,
|
|
1162
1162
|
integrations: [],
|
|
1163
1163
|
name: options.projectName,
|
|
@@ -1170,7 +1170,7 @@ function convertPercentNotebooksToDeepnote(notebooks, options) {
|
|
|
1170
1170
|
const { filename, notebook } = notebooks[i];
|
|
1171
1171
|
const filenameWithoutExt = basename(filename, extname(filename)) || "Untitled notebook";
|
|
1172
1172
|
const blocks = convertPercentNotebookToBlocks(notebook);
|
|
1173
|
-
const notebookId = i === 0 && firstNotebookId ? firstNotebookId :
|
|
1173
|
+
const notebookId = i === 0 && firstNotebookId ? firstNotebookId : randomUUID();
|
|
1174
1174
|
deepnoteFile.project.notebooks.push({
|
|
1175
1175
|
blocks,
|
|
1176
1176
|
executionMode: "block",
|
|
@@ -1392,7 +1392,7 @@ function parseQuartoCellOptions(content) {
|
|
|
1392
1392
|
* @returns Array of DeepnoteBlock objects
|
|
1393
1393
|
*/
|
|
1394
1394
|
function convertQuartoDocumentToBlocks(document, options) {
|
|
1395
|
-
const idGenerator = options?.idGenerator ??
|
|
1395
|
+
const idGenerator = options?.idGenerator ?? randomUUID;
|
|
1396
1396
|
const blocks = [];
|
|
1397
1397
|
if (document.frontmatter?.title) blocks.push({
|
|
1398
1398
|
blockGroup: idGenerator(),
|
|
@@ -1414,11 +1414,11 @@ function convertQuartoDocumentToBlocks(document, options) {
|
|
|
1414
1414
|
* @returns A DeepnoteFile object
|
|
1415
1415
|
*/
|
|
1416
1416
|
function convertQuartoDocumentsToDeepnote(documents, options) {
|
|
1417
|
-
const firstNotebookId = documents.length > 0 ?
|
|
1417
|
+
const firstNotebookId = documents.length > 0 ? randomUUID() : void 0;
|
|
1418
1418
|
const deepnoteFile = {
|
|
1419
1419
|
metadata: { createdAt: (/* @__PURE__ */ new Date()).toISOString() },
|
|
1420
1420
|
project: {
|
|
1421
|
-
id:
|
|
1421
|
+
id: randomUUID(),
|
|
1422
1422
|
initNotebookId: firstNotebookId,
|
|
1423
1423
|
integrations: [],
|
|
1424
1424
|
name: options.projectName,
|
|
@@ -1432,7 +1432,7 @@ function convertQuartoDocumentsToDeepnote(documents, options) {
|
|
|
1432
1432
|
const filenameWithoutExt = basename(filename, extname(filename)) || "Untitled notebook";
|
|
1433
1433
|
const notebookName = document.frontmatter?.title || filenameWithoutExt;
|
|
1434
1434
|
const blocks = convertQuartoDocumentToBlocks(document);
|
|
1435
|
-
const notebookId = i === 0 && firstNotebookId ? firstNotebookId :
|
|
1435
|
+
const notebookId = i === 0 && firstNotebookId ? firstNotebookId : randomUUID();
|
|
1436
1436
|
deepnoteFile.project.notebooks.push({
|
|
1437
1437
|
blocks,
|
|
1438
1438
|
executionMode: "block",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepnote/convert",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"repository": {
|
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
"chalk": "^5.6.2",
|
|
34
34
|
"cleye": "^2.0.0",
|
|
35
35
|
"ora": "^9.0.0",
|
|
36
|
-
"uuid": "^13.0.0",
|
|
37
36
|
"yaml": "^2.8.1",
|
|
38
37
|
"@deepnote/blocks": "3.0.1"
|
|
39
38
|
},
|