Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions build/mocha-esm-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ export async function resolve(specifier, context, nextResolve) {
};
}

// Intercept @deepnote/convert
// Intercept @deepnote/convert - needed because the real package performs file I/O
// that we need to control in tests
if (specifier === '@deepnote/convert') {
return {
url: 'vscode-mock:///deepnote-convert',
Expand Down Expand Up @@ -306,14 +307,40 @@ export async function load(url, context, nextLoad) {
};
}

// Handle deepnote convert mock
// Handle deepnote convert mock - needed because the real package performs file I/O
if (moduleName === 'deepnote-convert') {
return {
format: 'module',
source: `
export const convertIpynbFilesToDeepnoteFile = async () => {
// Mock implementation - does nothing in tests
};

export const convertDeepnoteToJupyterNotebooks = (deepnoteFile) => {
// Mock implementation that converts Deepnote notebooks to Jupyter format
const notebooks = deepnoteFile?.project?.notebooks || [];
return notebooks.map(nb => ({
filename: nb.name.replace(/[<>:"/\\\\|?*]/g, '_').replace(/\\s+/g, '-') + '.ipynb',
notebook: {
cells: (nb.blocks || []).map(block => ({
cell_type: block.type === 'markdown' ? 'markdown' : 'code',
source: block.content || '',
metadata: {
deepnote_cell_type: block.type,
cell_id: block.id
},
outputs: block.outputs || []
})),
metadata: {
deepnote_notebook_id: nb.id,
deepnote_notebook_name: nb.name,
deepnote_execution_mode: nb.executionMode
},
nbformat: 4,
nbformat_minor: 5
}
}));
};
`,
shortCircuit: true
};
Expand Down
102 changes: 35 additions & 67 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 27 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,18 @@
"category": "Deepnote",
"icon": "$(add)"
},
{
"command": "deepnote.exportProject",
"title": "%deepnote.commands.exportProject.title%",
"category": "Deepnote",
"icon": "$(export)"
},
{
"command": "deepnote.exportNotebook",
"title": "%deepnote.commands.exportNotebook.title%",
"category": "Deepnote",
"icon": "$(export)"
},
{
"command": "dataScience.ClearCache",
"title": "%deepnote.command.dataScience.clearCache.title%",
Expand Down Expand Up @@ -1569,12 +1581,17 @@
{
"command": "deepnote.addNotebookToProject",
"when": "view == deepnoteExplorer && viewItem == projectFile",
"group": "1_project@1"
"group": "1_add@1"
},
{
"command": "deepnote.renameProject",
"when": "view == deepnoteExplorer && viewItem == projectFile",
"group": "2_edit@1"
"group": "2_manage@1"
},
{
"command": "deepnote.exportProject",
"when": "view == deepnoteExplorer && viewItem == projectFile",
"group": "2_manage@2"
},
{
"command": "deepnote.deleteProject",
Expand All @@ -1584,12 +1601,17 @@
{
"command": "deepnote.renameNotebook",
"when": "view == deepnoteExplorer && viewItem == notebook",
"group": "2_edit@1"
"group": "1_edit@1"
},
{
"command": "deepnote.duplicateNotebook",
"when": "view == deepnoteExplorer && viewItem == notebook",
"group": "2_edit@2"
"group": "1_edit@2"
},
{
"command": "deepnote.exportNotebook",
"when": "view == deepnoteExplorer && viewItem == notebook",
"group": "2_export@1"
},
{
"command": "deepnote.deleteNotebook",
Expand Down Expand Up @@ -2480,7 +2502,7 @@
"dependencies": {
"@c4312/evt": "^0.1.1",
"@deepnote/blocks": "^1.3.5",
"@deepnote/convert": "^1.2.0",
"@deepnote/convert": "^1.3.0",
"@deepnote/database-integrations": "^1.3.0",
"@enonic/fnv-plus": "^1.3.0",
"@jupyter-widgets/base": "^6.0.8",
Expand Down
2 changes: 2 additions & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@
"deepnote.commands.deleteNotebook.title": "Delete Notebook",
"deepnote.commands.duplicateNotebook.title": "Duplicate Notebook",
"deepnote.commands.addNotebookToProject.title": "Add Notebook",
"deepnote.commands.exportProject.title": "Export Project...",
"deepnote.commands.exportNotebook.title": "Export Notebook...",
"deepnote.views.explorer.name": "Explorer",
"deepnote.views.explorer.welcome": "No Deepnote notebooks found in this workspace.",
"deepnote.views.environments.name": "Environments",
Expand Down
Loading