-
Notifications
You must be signed in to change notification settings - Fork 4
fix: Use ESM internally but bundle the extension as CommonJS. #247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📝 WalkthroughWalkthroughRemoves several Node ESM helper scripts and a runtime proxy entry, changes build outputs/externals (adds vega‑lite external, removes createRequire banner, drops proxy build), removes "type":"module" and updates package.json main and jsonc-parser, replaces esmUtils helpers with __filename/require usage, adds a dynamic vega‑lite wrapper (isVegaLiteAvailable/compile/ensureVegaLiteLoaded), adds DeepnoteDataConverter.initialize() and awaits it during notebook deserialization; multiple tests updated to match the new runtime setup. Sequence Diagram(s)sequenceDiagram
participant Serializer as DeepnoteNotebookSerializer
participant Converter as DeepnoteDataConverter
participant Wrapper as vegaLiteWrapper
participant Vega as vega-lite
Serializer->>Converter: deserializeNotebook(...)
Converter->>Converter: check cancellation
Converter->>Converter: await initialize()
Converter->>Wrapper: ensureVegaLiteLoaded()
activate Wrapper
Wrapper->>Vega: dynamic import("vega-lite")
Vega-->>Wrapper: compile function (or throw)
Wrapper-->>Converter: load resolved (or mark failure)
deactivate Wrapper
Converter->>Wrapper: compile(spec) [if available]
alt vega conversion available
Wrapper-->>Converter: { spec: VegaSpec }
Converter-->>Serializer: include Vega output
else vega unavailable
Converter-->>Serializer: skip Vega conversion
end
Possibly related PRs
Suggested reviewers
Pre-merge checks❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #247 +/- ##
===========================
===========================
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 7
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (35)
build/add-js-extensions.mjs(0 hunks)build/esbuild/build.ts(3 hunks)build/fix-directory-imports.mjs(0 hunks)build/mocha-esm-loader.js(2 hunks)build/remove-js-extensions.mjs(0 hunks)package.json(2 hunks)src/extension.node.proxy.ts(0 hunks)src/kernels/deepnote/deepnoteLspClientManager.node.ts(2 hunks)src/kernels/raw/finder/jupyterPaths.node.unit.test.ts(4 hunks)src/kernels/raw/launcher/kernelLauncher.unit.test.ts(0 hunks)src/kernels/raw/launcher/kernelProcess.node.unit.test.ts(0 hunks)src/kernels/raw/session/rawSessionConnection.node.unit.test.ts(1 hunks)src/kernels/raw/session/zeromq.node.ts(1 hunks)src/notebooks/controllers/ipywidgets/scriptSourceProvider/localWidgetScriptSourceProvider.unit.test.ts(0 hunks)src/notebooks/controllers/ipywidgets/scriptSourceProvider/nbExtensionsPathProvider.unit.test.ts(0 hunks)src/notebooks/deepnote/deepnoteDataConverter.ts(3 hunks)src/notebooks/deepnote/deepnoteSerializer.ts(1 hunks)src/notebooks/deepnote/vegaLiteWrapper.ts(1 hunks)src/notebooks/notebookEnvironmentService.node.ts(1 hunks)src/platform/common/esmUtils.node.ts(0 hunks)src/platform/common/variables/systemVariables.node.ts(1 hunks)src/platform/constants.node.ts(1 hunks)src/platform/interpreter/filter/completionProvider.node.ts(1 hunks)src/test/analysisEngineTest.node.ts(0 hunks)src/test/common.node.ts(0 hunks)src/test/common/variables/envVarsService.vscode.test.ts(0 hunks)src/test/constants.node.ts(0 hunks)src/test/debuggerTest.node.ts(0 hunks)src/test/extension.serviceRegistry.vscode.test.ts(0 hunks)src/test/index.node.ts(0 hunks)src/test/pythonEnvironments/constants.ts(0 hunks)src/test/smokeTest.node.ts(0 hunks)src/test/standardTest.node.ts(0 hunks)src/test/testRunner.ts(1 hunks)src/test/unittests.ts(1 hunks)
💤 Files with no reviewable changes (19)
- src/platform/common/esmUtils.node.ts
- src/test/smokeTest.node.ts
- src/extension.node.proxy.ts
- src/kernels/raw/launcher/kernelLauncher.unit.test.ts
- src/test/analysisEngineTest.node.ts
- src/test/index.node.ts
- build/add-js-extensions.mjs
- src/test/pythonEnvironments/constants.ts
- src/test/extension.serviceRegistry.vscode.test.ts
- src/test/constants.node.ts
- build/fix-directory-imports.mjs
- src/test/common/variables/envVarsService.vscode.test.ts
- src/notebooks/controllers/ipywidgets/scriptSourceProvider/nbExtensionsPathProvider.unit.test.ts
- src/test/debuggerTest.node.ts
- build/remove-js-extensions.mjs
- src/test/common.node.ts
- src/notebooks/controllers/ipywidgets/scriptSourceProvider/localWidgetScriptSourceProvider.unit.test.ts
- src/kernels/raw/launcher/kernelProcess.node.unit.test.ts
- src/test/standardTest.node.ts
🧰 Additional context used
📓 Path-based instructions (10)
**/*.node.ts
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Platform Implementation - Desktop: Use
.node.tsfiles for full file system access and Python environments
Files:
src/platform/interpreter/filter/completionProvider.node.tssrc/kernels/deepnote/deepnoteLspClientManager.node.tssrc/notebooks/notebookEnvironmentService.node.tssrc/platform/common/variables/systemVariables.node.tssrc/kernels/raw/session/zeromq.node.tssrc/platform/constants.node.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.{ts,tsx}: Usel10n.t()for all user-facing strings in TypeScript files
Use typed error classes fromsrc/platform/errors/instead of generic errors
UseILoggerservice instead of console.log for logging
Preserve error details in error messages while scrubbing personally identifiable information (PII)
Prefer async/await over promise chains
Handle cancellation with CancellationTokenOrder method, fields and properties first by accessibility (public/private/protected) and then by alphabetical order
Files:
src/platform/interpreter/filter/completionProvider.node.tssrc/test/unittests.tssrc/kernels/raw/finder/jupyterPaths.node.unit.test.tssrc/kernels/raw/session/rawSessionConnection.node.unit.test.tssrc/notebooks/deepnote/deepnoteSerializer.tssrc/notebooks/deepnote/deepnoteDataConverter.tssrc/kernels/deepnote/deepnoteLspClientManager.node.tssrc/notebooks/deepnote/vegaLiteWrapper.tssrc/notebooks/notebookEnvironmentService.node.tssrc/test/testRunner.tssrc/platform/common/variables/systemVariables.node.tsbuild/esbuild/build.tssrc/kernels/raw/session/zeromq.node.tssrc/platform/constants.node.ts
src/platform/**/*.ts
📄 CodeRabbit inference engine (.github/instructions/platform.instructions.md)
src/platform/**/*.ts: Use Inversify-based dependency injection with IServiceManager and IServiceContainer for managing service relationships and dependencies
Define service interfaces using Symbol-based exports (e.g.,export const IFileSystem = Symbol('IFileSystem')) paired with corresponding TypeScript interfaces
Register types using the patternserviceManager.addSingleton<IService>(IService, ServiceImplementation)in registerTypes functions
Use @Injectable() and @Inject() decorators from Inversify for class dependency injection configuration
Implement unified interfaces for cross-platform services (IFileSystem, IPlatformService, etc.) with graceful degradation for web environment limitations
Use structured logging with context via logger.info, logger.error, etc. rather than console.log
Provide platform capability checks and feature detection before using advanced platform-specific features
Register separate service implementations for desktop and web environments, allowing the DI container to resolve the correct platform implementation
Files:
src/platform/interpreter/filter/completionProvider.node.tssrc/platform/common/variables/systemVariables.node.tssrc/platform/constants.node.ts
src/platform/**/*.{node,web}.ts
📄 CodeRabbit inference engine (.github/instructions/platform.instructions.md)
Create separate implementations with
.node.tsand.web.tsfile suffixes for platform-specific code (e.g.,fileSystem.node.tsfor Node.js,fileSystem.web.tsfor browser)
Files:
src/platform/interpreter/filter/completionProvider.node.tssrc/platform/common/variables/systemVariables.node.tssrc/platform/constants.node.ts
**/*.ts
📄 CodeRabbit inference engine (.github/instructions/typescript.instructions.md)
**/*.ts: ALWAYS check the 'Core - Build' task output for TypeScript compilation errors before running any script or declaring work complete
ALWAYS runnpm run format-fixbefore committing changes to ensure proper code formatting
FIX all TypeScript compilation errors before moving forward with development
Usenpm run format-fixto auto-fix TypeScript formatting issues before committing
Usenpm run lintto check for linter issues in TypeScript files and attempt to fix before committing
Files:
src/platform/interpreter/filter/completionProvider.node.tssrc/test/unittests.tssrc/kernels/raw/finder/jupyterPaths.node.unit.test.tssrc/kernels/raw/session/rawSessionConnection.node.unit.test.tssrc/notebooks/deepnote/deepnoteSerializer.tssrc/notebooks/deepnote/deepnoteDataConverter.tssrc/kernels/deepnote/deepnoteLspClientManager.node.tssrc/notebooks/deepnote/vegaLiteWrapper.tssrc/notebooks/notebookEnvironmentService.node.tssrc/test/testRunner.tssrc/platform/common/variables/systemVariables.node.tsbuild/esbuild/build.tssrc/kernels/raw/session/zeromq.node.tssrc/platform/constants.node.ts
src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
src/**/*.{ts,tsx}: Don't add the Microsoft copyright header to new files
UseUri.joinPath()for constructing file paths instead of string concatenation with/to ensure platform-correct path separators
Follow established patterns when importing new packages, using helper imports rather than direct imports (e.g., useimport { generateUuid } from '../platform/common/uuid'instead of importing uuid directly)
Add blank lines after const groups and before return statements for readability
Separate third-party and local file imports
Files:
src/platform/interpreter/filter/completionProvider.node.tssrc/test/unittests.tssrc/kernels/raw/finder/jupyterPaths.node.unit.test.tssrc/kernels/raw/session/rawSessionConnection.node.unit.test.tssrc/notebooks/deepnote/deepnoteSerializer.tssrc/notebooks/deepnote/deepnoteDataConverter.tssrc/kernels/deepnote/deepnoteLspClientManager.node.tssrc/notebooks/deepnote/vegaLiteWrapper.tssrc/notebooks/notebookEnvironmentService.node.tssrc/test/testRunner.tssrc/platform/common/variables/systemVariables.node.tssrc/kernels/raw/session/zeromq.node.tssrc/platform/constants.node.ts
**/*.unit.test.ts
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Create unit tests in
*.unit.test.tsfiles
**/*.unit.test.ts: Unit tests use Mocha/Chai framework with.unit.test.tsextension
Test files should be placed alongside the source files they test
Useassert.deepStrictEqual()for object comparisons instead of checking individual properties
Files:
src/kernels/raw/finder/jupyterPaths.node.unit.test.tssrc/kernels/raw/session/rawSessionConnection.node.unit.test.ts
**/*.test.ts
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Create integration tests in
*.test.tsfiles (not*.unit.test.ts)
**/*.test.ts: ALWAYS check the 'Unittest - Build' task output for TypeScript compilation errors before running any script or declaring work complete
When a mock is returned from a promise in unit tests, ensure the mocked instance has an undefinedthenproperty to avoid hanging tests
Usenpm run test:unittestsfor TypeScript unit tests before committing changes
Files:
src/kernels/raw/finder/jupyterPaths.node.unit.test.tssrc/kernels/raw/session/rawSessionConnection.node.unit.test.ts
src/kernels/**/*.ts
📄 CodeRabbit inference engine (.github/instructions/kernel.instructions.md)
src/kernels/**/*.ts: RespectCancellationTokenin all async operations across kernel execution, session communication, and finder operations
Implement proper error handling in files using custom error types fromerrors/directory (KernelDeadError,KernelConnectionTimeoutError,KernelInterruptTimeoutError,JupyterInvalidKernelError,KernelDependencyError)
Files:
src/kernels/raw/finder/jupyterPaths.node.unit.test.tssrc/kernels/raw/session/rawSessionConnection.node.unit.test.tssrc/kernels/deepnote/deepnoteLspClientManager.node.tssrc/kernels/raw/session/zeromq.node.ts
src/notebooks/deepnote/**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
Deepnote integration located in
src/notebooks/deepnote/with refactored architecture:deepnoteTypes.ts(type definitions),deepnoteNotebookManager.ts(state management),deepnoteNotebookSelector.ts(UI selection logic),deepnoteDataConverter.ts(data transformations),deepnoteSerializer.ts(main serializer/orchestration),deepnoteActivationService.ts(VSCode activation)
Files:
src/notebooks/deepnote/deepnoteSerializer.tssrc/notebooks/deepnote/deepnoteDataConverter.tssrc/notebooks/deepnote/vegaLiteWrapper.ts
🧬 Code graph analysis (4)
src/notebooks/deepnote/deepnoteDataConverter.ts (2)
src/notebooks/deepnote/vegaLiteWrapper.ts (1)
ensureVegaLiteLoaded(50-52)src/test/mocks/vsc/extHostedTypes.ts (1)
NotebookCellOutputItem(16-69)
src/notebooks/deepnote/vegaLiteWrapper.ts (1)
src/platform/logging/index.ts (1)
logger(35-48)
src/notebooks/notebookEnvironmentService.node.ts (1)
src/platform/common/utils/encoder.ts (1)
toPythonSafePath(4-6)
src/platform/common/variables/systemVariables.node.ts (2)
src/platform/common/variables/systemVariables.web.ts (1)
workspaceFolder(41-43)build/mocha-esm-loader.js (1)
__dirname(11-11)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Lint & Format
- GitHub Check: Build & Test
- GitHub Check: Build & Package Extension
🔇 Additional comments (15)
src/platform/common/variables/systemVariables.node.ts (1)
26-26: LGTM! Correct migration to CommonJS global.The switch from
getDirname(import.meta.url)to__dirnameis appropriate for CommonJS bundling. Both resolve to the same location (the compiled module's directory), maintaining equivalent behavior.src/platform/interpreter/filter/completionProvider.node.ts (1)
78-80: LGTM! Good defensive coding.Prevents NPE when
parseTreereturnsundefined. Consistent with the existing error-handling pattern.src/kernels/raw/session/zeromq.node.ts (3)
42-142: Helper functions properly implemented.The telemetry and platform detection helpers correctly use
loggerfor diagnostics and handle errors gracefully. The once-only telemetry flag prevents duplicates.
24-25: The fallback path todist/node_modules/zeromqoldis not an assumption. The esbuild configuration (build/esbuild/build.ts lines 512–513) explicitly copies zeromqold from node_modules to dist/node_modules during the build process. Additionally, zeromqold is declared as a dependency in package.json, ensuring it's installed. This fallback mechanism is intentional and properly configured.
16-17: No issues found. The build configuration confirms thatzeromqandzeromqoldare externalized (copied todist/node_modules, not bundled), and.node.tsfiles are compiled to CommonJS format at runtime. The barerequire()calls are correct for this setup, and the eslint-disable comments are appropriate.src/kernels/raw/session/rawSessionConnection.node.unit.test.ts (1)
36-38: Directrequirefor JupyterLab kernel default is reasonable hereUsing a single, scoped CommonJS
requireto grabKernelConnectionfor stubbing fits the test’s needs, and the eslint disable is correctly limited to that one line. Only caveat: if you later bump@jupyterlab/servicesor its entrypoints, please re‑verify that@jupyterlab/services/lib/kernel/defaultstill resolves and exposesKernelConnectionas expected.src/test/unittests.ts (1)
8-9: LGTM. Directrequire('module')is cleaner for CommonJS context.src/kernels/raw/finder/jupyterPaths.node.unit.test.ts (2)
340-350: LGTM. Using__filenameas test path input is valid. The ESM loader shim injects this global.
362-373: Consistent with previous test. Same pattern applied correctly.src/notebooks/notebookEnvironmentService.node.ts (1)
151-160: Remove or reconsider the__filenamepath check. The code executes Python on a remote kernel but gates thesys.executableoutput on whether the local extension file exists remotely—this will fail on all truly remote kernels (GitHub Codespaces, remote servers, etc.). Either remove the conditional or replace it with a path that actually exists in the remote environment.src/platform/constants.node.ts (1)
16-17: Node‑specificrequireoverride looks fine.Using a direct
requirewith the lint suppression here is appropriate for this.node.tsCJS entry; no changes needed.src/kernels/deepnote/deepnoteLspClientManager.node.ts (1)
13-16: Directrequireusage in the desktop LSP manager is appropriate.Given this file compiles into the CJS desktop bundle and
vscode-languageclient/nodeis handled via esbuild externals, switching fromcreateRequireto plainrequire/require.resolvewith lint suppression is a reasonable simplification.Also applies to: 541-546
package.json (1)
64-64: Desktop entrypoint + jsonc‑parser bump look consistent; please verify the ESM path.Pointing
"main"at./dist/extension.node.jsmatches the new esbuild desktop build target and removal of the proxy entry. Forjsonc-parser@3.3.1, the build now relies on its ESM entry vialib/esm/main.js; double‑check that this file exists in that version so the desktop alias used inbuild/esbuild/build.tsdoesn’t hit a module‑not‑found at bundle or runtime.Also applies to: 2535-2535
build/esbuild/build.ts (2)
60-67: Additional externals look reasonable.Pulling
@azure/functions-core, thenode:built‑ins, andansi-regexintocommonExternalskeeps the desktop/web configs consistent and avoids duplicated polyfills; no changes needed here.
242-259: Alias consolidation and explicit CJS/ESM formats align with the PR’s goals.Centralizing the alias map (including the desktop‑only override) and setting
formatto CJS for desktop and ESM for web makes the build behavior much clearer and matches the “CJS desktop / ESM web” objective; I don’t see issues in this block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (4)
build/mocha-esm-loader.js(3 hunks)src/notebooks/deepnote/deepnoteSerializer.ts(1 hunks)src/notebooks/deepnote/vegaLiteWrapper.ts(1 hunks)src/test/testRunner.ts(0 hunks)
💤 Files with no reviewable changes (1)
- src/test/testRunner.ts
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.{ts,tsx}: Usel10n.t()for all user-facing strings in TypeScript files
Use typed error classes fromsrc/platform/errors/instead of generic errors
UseILoggerservice instead of console.log for logging
Preserve error details in error messages while scrubbing personally identifiable information (PII)
Prefer async/await over promise chains
Handle cancellation with CancellationTokenOrder method, fields and properties first by accessibility (public/private/protected) and then by alphabetical order
Files:
src/notebooks/deepnote/deepnoteSerializer.tssrc/notebooks/deepnote/vegaLiteWrapper.ts
**/*.ts
📄 CodeRabbit inference engine (.github/instructions/typescript.instructions.md)
**/*.ts: ALWAYS check the 'Core - Build' task output for TypeScript compilation errors before running any script or declaring work complete
ALWAYS runnpm run format-fixbefore committing changes to ensure proper code formatting
FIX all TypeScript compilation errors before moving forward with development
Usenpm run format-fixto auto-fix TypeScript formatting issues before committing
Usenpm run lintto check for linter issues in TypeScript files and attempt to fix before committing
Files:
src/notebooks/deepnote/deepnoteSerializer.tssrc/notebooks/deepnote/vegaLiteWrapper.ts
src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
src/**/*.{ts,tsx}: Don't add the Microsoft copyright header to new files
UseUri.joinPath()for constructing file paths instead of string concatenation with/to ensure platform-correct path separators
Follow established patterns when importing new packages, using helper imports rather than direct imports (e.g., useimport { generateUuid } from '../platform/common/uuid'instead of importing uuid directly)
Add blank lines after const groups and before return statements for readability
Separate third-party and local file imports
Files:
src/notebooks/deepnote/deepnoteSerializer.tssrc/notebooks/deepnote/vegaLiteWrapper.ts
src/notebooks/deepnote/**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
Deepnote integration located in
src/notebooks/deepnote/with refactored architecture:deepnoteTypes.ts(type definitions),deepnoteNotebookManager.ts(state management),deepnoteNotebookSelector.ts(UI selection logic),deepnoteDataConverter.ts(data transformations),deepnoteSerializer.ts(main serializer/orchestration),deepnoteActivationService.ts(VSCode activation)
Files:
src/notebooks/deepnote/deepnoteSerializer.tssrc/notebooks/deepnote/vegaLiteWrapper.ts
🧬 Code graph analysis (2)
src/notebooks/deepnote/deepnoteSerializer.ts (1)
src/kernels/execution/cellExecutionCreator.ts (1)
token(41-43)
src/notebooks/deepnote/vegaLiteWrapper.ts (1)
src/platform/logging/index.ts (1)
logger(35-48)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Build & Test
🔇 Additional comments (9)
src/notebooks/deepnote/deepnoteSerializer.ts (1)
78-83: LGTM! Past review feedback addressed.The cancellation check after
initialize()ensures we don't proceed with parsing if cancelled during the async load. Implementation is clean.src/notebooks/deepnote/vegaLiteWrapper.ts (5)
1-12: Clean module setup.Type-only imports and module-level state properly initialized. Comment explains the ESM/CJS interop issue clearly.
14-40: Robust loading with proper guards.Past review feedback implemented:
typeof === 'function'checks prevent invalid states. Concurrent load prevention vialoadPromisepattern is correct. Graceful degradation on failure.
45-47: LGTM!Consistent with the
typeof === 'function'guards used throughout. Past review feedback addressed.
53-59: Proper guard and graceful degradation.Returns
undefinedwhen unavailable. Consistent with other guards in file.
61-63: Simple and correct.Clean public API for triggering the load.
build/mocha-esm-loader.js (3)
16-48: Centralized Python extension mock looks good; just ensure it covers your real usage.Nice consolidation into
PYTHON_EXTENSION_MOCK, removing duplication and keeping the mock shape in one place. Please double‑check that your code/tests only rely on thePythonExtension.api().environmentssurface and the exported constants/types you’ve stubbed here, so there’s no hidden dependency on unmocked behavior.
391-398: Reuse ofPYTHON_EXTENSION_MOCKfor the vscode-mock URL path is correct.Hooking
moduleName === 'python-extension'here and returning the sharedPYTHON_EXTENSION_MOCKkeeps the mock consistent between specifier‑based resolution and directvscode-mock:///python-extensionloads; no issues from my side.
414-432: CJS globals shim for/out/*.jsis reasonable; scope and semantics look fine.Injecting
__filename,__dirname, andrequireforfile://URLs under/out/lines up with the rest of the PR (ESM build but CJS‑style globals in compiled output). The hook is narrowly scoped and shouldn’t affect non‑outmodules; only side effect is added imports and a few extra top‑of‑file lines in stack traces, which seems acceptable for tests.
OlegWock
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and everything works (but please update package command)
| compileFunction = null; | ||
| loadFailed = true; | ||
| logger.warn( | ||
| 'vega-lite module loaded but compile function is missing or not a function. ' + | ||
| `Got: ${typeof vegaLite.compile}. Vega-lite chart conversion will be skipped.` | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In which cases this could happen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It shouldn't, but as its loaded at runtime, it can fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But then it would go into catch block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah its probably cleaner to throw an error here and let the catch handle it 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
npm run package fails with sh: vsce: command not found, can be fixed by running vsce with npx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added @vscode/vsce to the dev dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That doesn't work with the licenses so we can't have it as a direct dependency :(
5d69e3f
This reverts commit 5d69e3f.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (2)
package.json(2 hunks)src/notebooks/deepnote/vegaLiteWrapper.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.{ts,tsx}: Usel10n.t()for all user-facing strings in TypeScript files
Use typed error classes fromsrc/platform/errors/instead of generic errors
UseILoggerservice instead of console.log for logging
Preserve error details in error messages while scrubbing personally identifiable information (PII)
Prefer async/await over promise chains
Handle cancellation with CancellationTokenOrder method, fields and properties first by accessibility (public/private/protected) and then by alphabetical order
Files:
src/notebooks/deepnote/vegaLiteWrapper.ts
**/*.ts
📄 CodeRabbit inference engine (.github/instructions/typescript.instructions.md)
**/*.ts: ALWAYS check the 'Core - Build' task output for TypeScript compilation errors before running any script or declaring work complete
ALWAYS runnpm run format-fixbefore committing changes to ensure proper code formatting
FIX all TypeScript compilation errors before moving forward with development
Usenpm run format-fixto auto-fix TypeScript formatting issues before committing
Usenpm run lintto check for linter issues in TypeScript files and attempt to fix before committing
Files:
src/notebooks/deepnote/vegaLiteWrapper.ts
src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
src/**/*.{ts,tsx}: Don't add the Microsoft copyright header to new files
UseUri.joinPath()for constructing file paths instead of string concatenation with/to ensure platform-correct path separators
Follow established patterns when importing new packages, using helper imports rather than direct imports (e.g., useimport { generateUuid } from '../platform/common/uuid'instead of importing uuid directly)
Add blank lines after const groups and before return statements for readability
Separate third-party and local file imports
Files:
src/notebooks/deepnote/vegaLiteWrapper.ts
src/notebooks/deepnote/**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
Deepnote integration located in
src/notebooks/deepnote/with refactored architecture:deepnoteTypes.ts(type definitions),deepnoteNotebookManager.ts(state management),deepnoteNotebookSelector.ts(UI selection logic),deepnoteDataConverter.ts(data transformations),deepnoteSerializer.ts(main serializer/orchestration),deepnoteActivationService.ts(VSCode activation)
Files:
src/notebooks/deepnote/vegaLiteWrapper.ts
🧬 Code graph analysis (1)
src/notebooks/deepnote/vegaLiteWrapper.ts (2)
src/platform/webviews/webview.ts (1)
loadFailed(21-23)src/platform/logging/index.ts (1)
logger(35-48)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Build & Test
🔇 Additional comments (5)
package.json (1)
64-64: Main entry change aligns with CommonJS bundling strategy.Removing the proxy layer is consistent with the PR's goal to bundle as CommonJS internally.
src/notebooks/deepnote/vegaLiteWrapper.ts (4)
1-13: LGTM! Clear explanation and appropriate state management.The comment explains why this wrapper exists, and the state variables support proper loading semantics.
14-37: Solid error handling and race-condition prevention.The loadPromise pattern prevents concurrent loads, and the early-return guards are correct. The fail-fast approach (no retry on loadFailed) is appropriate for bundled modules.
39-56: Consistent guard checks ensure safe access.Both functions properly check
typeof compileFunction === 'function', addressing the earlier review feedback.
58-60: LGTM! Clean public API.Simple and effective interface for triggering the load.
The VS Code ecosystem is not ready for ESM, so we need to make sure we bundle everything as CommonJS.
microsoft/vscode#130367
I've used https://github.com/mike-lischke/vscode-antlr4 as a refence.
Fixes #246
Summary by CodeRabbit
New Features
Bug Fixes
Chores
✏️ Tip: You can customize this high-level summary in your review settings.