Skip to content

Commit 42d4ea9

Browse files
authored
Merge branch 'main' into dependabot/npm_and_yarn/src/test/vscode-notebook-perf/js-yaml-4.1.1
2 parents 55f738e + f20507c commit 42d4ea9

File tree

179 files changed

+4478
-3273
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

179 files changed

+4478
-3273
lines changed

.eslintrc.js renamed to .eslintrc.cjs

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ module.exports = {
4747
'@typescript-eslint/no-explicit-any': 'error',
4848
'@typescript-eslint/no-non-null-assertion': 'off',
4949
'no-unused-vars': 'off',
50-
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '_\\w*' }],
50+
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '_\\w*', varsIgnorePattern: '_\\w*' }],
5151
'no-use-before-define': 'off',
5252
'@typescript-eslint/no-use-before-define': [
5353
'error',
@@ -74,7 +74,14 @@ module.exports = {
7474
'import/no-unresolved': [
7575
'error',
7676
{
77-
ignore: ['monaco-editor', 'vscode', 'react-error-boundary']
77+
ignore: [
78+
'monaco-editor',
79+
'vscode',
80+
'react-error-boundary',
81+
'vega-lite',
82+
'vega-embed',
83+
'why-is-node-running'
84+
]
7885
}
7986
],
8087
'import/prefer-default-export': 'off',
@@ -225,18 +232,32 @@ module.exports = {
225232
'import/no-restricted-paths': ['off']
226233
}
227234
},
235+
{
236+
files: ['src/kernels/**/*.ts'],
237+
rules: {
238+
'@typescript-eslint/no-restricted-imports': 'off'
239+
}
240+
},
241+
{
242+
files: ['src/notebooks/**/*.ts', 'src/webviews/**/*.ts'],
243+
rules: {
244+
'@typescript-eslint/no-restricted-imports': 'off'
245+
}
246+
},
228247
{
229248
files: ['**/*.test.ts'],
230249
rules: {
231250
'@typescript-eslint/no-explicit-any': 'off',
232-
'@typescript-eslint/no-restricted-imports': 'off'
251+
'@typescript-eslint/no-restricted-imports': 'off',
252+
'@typescript-eslint/no-empty-function': 'off'
233253
}
234254
},
235255
{
236256
files: ['src/test/**/*.ts'],
237257
rules: {
238258
'@typescript-eslint/no-explicit-any': 'off',
239-
'@typescript-eslint/no-restricted-imports': 'off'
259+
'@typescript-eslint/no-restricted-imports': 'off',
260+
'@typescript-eslint/no-empty-function': 'off'
240261
}
241262
},
242263
{

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,4 @@ tmp
7373
vscode.d.ts
7474
vscode.proposed.*.d.ts
7575
xunit-test-results.xml
76+
tsconfig.tsbuildinfo
File renamed without changes.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010

1111
</div>
1212

13-
# Deepnote in VS Code, Cursor and Windsurf
13+
# Deepnote in VS Code, Cursor, Windsurf, and Antigravity
1414

15-
A powerful [Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=Deepnote.vscode-deepnote), [Cursor](https://open-vsx.org/extension/Deepnote/vscode-deepnote) and [Windsurf](https://open-vsx.org/extension/Deepnote/vscode-deepnote) extension that brings [Deepnote](https://deepnote.com/) notebook capabilities directly into your favorite editor. Work with sleek AI notebooks featuring SQL blocks, database integrations, and reactive blocks - all within VS Code.
15+
A powerful [Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=Deepnote.vscode-deepnote), [Cursor](https://open-vsx.org/extension/Deepnote/vscode-deepnote), [Windsurf](https://open-vsx.org/extension/Deepnote/vscode-deepnote), and [Antigravity](https://open-vsx.org/extension/Deepnote/vscode-deepnote) extension that brings [Deepnote](https://deepnote.com/) notebook capabilities directly into your favorite editor. Work with sleek AI notebooks featuring SQL blocks, database integrations, and reactive blocks - all within your IDE.
1616

1717
![Deepnote Projects](./assets/deepnote-projects.png)
1818

build/.mocha-multi-reporters.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"reporterEnabled": "./build/ci/scripts/spec_with_pid,mocha-junit-reporter",
2+
"reporterEnabled": "./build/ci/scripts/spec_with_pid.js,mocha-junit-reporter",
33
"mochaJunitReporterReporterOptions": {
44
"includePending": true
55
}

build/.mocha.unittests.js.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
22
"spec": "./out/**/*.unit.test.js",
3-
"require": ["source-map-support/register", "out/test/unittests.js"],
4-
"reporter": "mocha-multi-reporters",
5-
"reporter-option": "configFile=build/.mocha-multi-reporters.config",
3+
"loader": ["./build/mocha-esm-loader.js"],
4+
"require": ["./out/test/unittests.js"],
5+
"reporter": "spec",
66
"ui": "tdd",
77
"recursive": true,
8-
"colors": true
8+
"colors": true,
9+
"node-option": ["no-warnings=ExperimentalWarning", "loader=./build/mocha-esm-loader.js"]
910
}

build/.mocha.unittests.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
22
"spec": "./out/**/*.unit.test.js",
3-
"require": ["out/test/unittests.js"],
3+
"loader": ["./build/mocha-esm-loader.js"],
44
"reporter": "mocha-multi-reporters",
55
"reporter-option": "configFile=build/.mocha-multi-reporters.config",
66
"ui": "tdd",
77
"recursive": true,
8-
"colors": true
8+
"colors": true,
9+
"node-option": ["--no-warnings=ExperimentalWarning"]
910
}

build/.mocha.unittests.ts.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
2-
"require": ["ts-node/register", "out/test/unittests.js"],
2+
"loader": ["ts-node/esm", "./build/mocha-esm-loader.js"],
33
"reporter": "mocha-multi-reporters",
44
"reporter-option": "configFile=build/.mocha-multi-reporters.config",
55
"ui": "tdd",
66
"recursive": true,
7-
"colors": true
7+
"colors": true,
8+
"node-option": ["--no-warnings=ExperimentalWarning"]
89
}

build/add-js-extensions.mjs

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
#!/usr/bin/env node
2+
// Script to add .js extensions to all relative imports in TypeScript files
3+
// This is required for ESM compatibility
4+
5+
import { promises as fs } from 'fs';
6+
import path from 'path';
7+
import { fileURLToPath } from 'url';
8+
9+
const __filename = fileURLToPath(import.meta.url);
10+
const __dirname = path.dirname(__filename);
11+
12+
const rootDir = path.join(__dirname, '..');
13+
const srcDir = path.join(rootDir, 'src');
14+
15+
// Regex patterns to match import statements with relative paths
16+
// Updated to handle multi-line imports/exports by using [\s\S] to match newlines
17+
const importPatterns = [
18+
// import ... from './path' or '../path' (supports multi-line named imports)
19+
/^(\s*import\s+[\s\S]+?from\s+['"])(\.\/.+?|\.\.?\/.+?)(['"])/gm,
20+
// export ... from './path' or '../path' (supports multi-line named exports)
21+
/^(\s*export\s+[\s\S]+?from\s+['"])(\.\/.+?|\.\.?\/.+?)(['"])/gm,
22+
// import('./path') or import('../path') (supports newlines before parentheses and quotes)
23+
/(\bimport[\s\S]*?\([\s\S]*?['"])(\.\/.+?|\.\.?\/.+?)(['"])/gm,
24+
// await import('./path') (supports newlines in await import statements)
25+
/(\bawait\s+import[\s\S]*?\([\s\S]*?['"])(\.\/.+?|\.\.?\/.+?)(['"])/gm,
26+
];
27+
28+
async function getAllTsFiles(dir) {
29+
const files = [];
30+
const entries = await fs.readdir(dir, { withFileTypes: true });
31+
32+
for (const entry of entries) {
33+
const fullPath = path.join(dir, entry.name);
34+
35+
if (entry.isDirectory()) {
36+
// Skip node_modules, out, dist, etc.
37+
if (!['node_modules', 'out', 'dist', '.git', '.vscode', 'resources'].includes(entry.name)) {
38+
files.push(...(await getAllTsFiles(fullPath)));
39+
}
40+
} else if ((entry.name.endsWith('.ts') || entry.name.endsWith('.tsx')) && !entry.name.endsWith('.d.ts')) {
41+
// Include .ts and .tsx files, but exclude .d.ts declaration files
42+
files.push(fullPath);
43+
}
44+
}
45+
46+
return files;
47+
}
48+
49+
function addJsExtension(content) {
50+
let modified = content;
51+
let changeCount = 0;
52+
53+
for (const pattern of importPatterns) {
54+
modified = modified.replace(pattern, (match, before, importPath, after) => {
55+
// Skip if already has an extension
56+
if (/\.(js|ts|tsx|json|css|less|svg|png|jpg)$/i.test(importPath)) {
57+
return match;
58+
}
59+
60+
changeCount++;
61+
return `${before}${importPath}.js${after}`;
62+
});
63+
}
64+
65+
return { content: modified, changed: changeCount > 0, changeCount };
66+
}
67+
68+
async function main() {
69+
console.log('🔍 Finding all TypeScript files in src/...');
70+
const tsFiles = await getAllTsFiles(srcDir);
71+
console.log(`📁 Found ${tsFiles.length} TypeScript files\n`);
72+
73+
let totalFilesChanged = 0;
74+
let totalImportsChanged = 0;
75+
76+
for (const file of tsFiles) {
77+
const content = await fs.readFile(file, 'utf-8');
78+
const { content: newContent, changed, changeCount } = addJsExtension(content);
79+
80+
if (changed) {
81+
await fs.writeFile(file, newContent, 'utf-8');
82+
totalFilesChanged++;
83+
totalImportsChanged += changeCount;
84+
const relativePath = path.relative(rootDir, file);
85+
console.log(`✅ ${relativePath} (${changeCount} import${changeCount > 1 ? 's' : ''})`);
86+
}
87+
}
88+
89+
console.log(`\n✨ Done!`);
90+
console.log(`📊 Modified ${totalFilesChanged} files`);
91+
console.log(`🔗 Updated ${totalImportsChanged} import statements`);
92+
}
93+
94+
main().catch(error => {
95+
console.error('❌ Error:', error);
96+
process.exit(1);
97+
});

build/ci/postInstall.js

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
3-
'use strict';
43

5-
const { EOL } = require('os');
6-
const colors = require('colors/safe');
7-
const fs = require('fs-extra');
8-
const path = require('path');
9-
const constants = require('../constants');
10-
const common = require('../webpack/common');
11-
const { downloadZMQ } = require('@vscode/zeromq');
4+
import { EOL } from 'node:os';
5+
import colors from 'colors/safe.js';
6+
import fs from 'fs-extra';
7+
import path from 'node:path';
8+
import { ExtensionRootDir } from '../constants.js';
9+
import { getBundleConfiguration, bundleConfiguration } from '../webpack/common.js';
10+
import { downloadZMQ } from '@vscode/zeromq';
11+
import { fileURLToPath } from 'node:url';
12+
import { dirname } from 'node:path';
13+
14+
const __filename = fileURLToPath(import.meta.url);
15+
const __dirname = dirname(__filename);
1216

1317
function fixVariableNameInKernelDefaultJs() {
1418
var relativePath = path.join('node_modules', '@jupyterlab', 'services', 'lib', 'kernel', 'default.js');
15-
var filePath = path.join(constants.ExtensionRootDir, relativePath);
19+
var filePath = path.join(ExtensionRootDir, relativePath);
1620
if (!fs.existsSync(filePath)) {
1721
throw new Error(
1822
"Jupyter lab default kernel not found '" + filePath + "' (Jupyter Extension post install script)"
@@ -32,7 +36,7 @@ function fixVariableNameInKernelDefaultJs() {
3236
}
3337
function removeUnnecessaryLoggingFromKernelDefault() {
3438
var relativePath = path.join('node_modules', '@jupyterlab', 'services', 'lib', 'kernel', 'default.js');
35-
var filePath = path.join(constants.ExtensionRootDir, relativePath);
39+
var filePath = path.join(ExtensionRootDir, relativePath);
3640
if (!fs.existsSync(filePath)) {
3741
throw new Error(
3842
"Jupyter lab default kernel not found '" + filePath + "' (Jupyter Extension post install script)"
@@ -61,7 +65,7 @@ function makeVariableExplorerAlwaysSorted() {
6165
'case g.NONE:e=r?g.DESC:g.ASC;break;case g.ASC:e=r?g.NONE:g.DESC;break;case g.DESC:e=r?g.ASC:g.NONE';
6266
for (const fileName of fileNames) {
6367
var relativePath = path.join('node_modules', 'react-data-grid', 'dist', fileName);
64-
var filePath = path.join(constants.ExtensionRootDir, relativePath);
68+
var filePath = path.join(ExtensionRootDir, relativePath);
6569
if (!fs.existsSync(filePath)) {
6670
throw new Error("react-data-grid dist file not found '" + filePath + "' (pvsc post install script)");
6771
}
@@ -134,7 +138,8 @@ exports.javascript = {
134138
* See comments here build/webpack/moment.js
135139
*/
136140
function verifyMomentIsOnlyUsedByJupyterLabCoreUtils() {
137-
const packageLock = require(path.join(__dirname, '..', '..', 'package-lock.json'));
141+
const packageLockPath = path.join(__dirname, '..', '..', 'package-lock.json');
142+
const packageLock = JSON.parse(fs.readFileSync(packageLockPath, 'utf8'));
138143
const packagesAllowedToUseMoment = ['node_modules/@jupyterlab/coreutils', '@jupyterlab/coreutils'];
139144
const otherPackagesUsingMoment = [];
140145
['packages', 'dependencies'].forEach((key) => {
@@ -167,7 +172,7 @@ function verifyMomentIsOnlyUsedByJupyterLabCoreUtils() {
167172
}
168173
}
169174
async function downloadZmqBinaries() {
170-
if (common.getBundleConfiguration() === common.bundleConfiguration.web) {
175+
if (getBundleConfiguration() === bundleConfiguration.web) {
171176
// No need to download zmq binaries for web.
172177
return;
173178
}

0 commit comments

Comments
 (0)