Skip to content

Commit

Permalink
Update jupyter lab packages (#208)
Browse files Browse the repository at this point in the history
* Update to latest widget package

* fixes

* Fix linter warnings
  • Loading branch information
DonJayamanne authored Aug 1, 2024
1 parent 845b579 commit 963366c
Show file tree
Hide file tree
Showing 15 changed files with 10,493 additions and 13,623 deletions.
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
"src/**/*.d.ts"
],
"rules": {
"no-unused-vars": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/adjacent-overload-signatures": "off"
Expand Down
12 changes: 0 additions & 12 deletions build/postInstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,6 @@
const path = require('path');
const fs = require('fs');

function fixJupyterLabRenderers() {
const filePath = path.join(__dirname, '..', 'node_modules/@jupyterlab/rendermime/lib/renderers.js');
const textToReplace = `import marked from 'marked'`;
const textToReplaceWith = `import { marked } from 'marked'`;
const fileContents = fs.readFileSync(filePath, 'utf8').toString();
if (fileContents.indexOf(textToReplace) === -1 && fileContents.indexOf(textToReplaceWith) === -1) {
throw new Error('Unable to find Jupyter marked usage to replace!');
}
fs.writeFileSync(filePath, fileContents.replace(textToReplace, textToReplaceWith));
}

function fixPlotlyRenderer() {
const filePath = path.join(__dirname, '..', 'node_modules/@nteract/transform-plotly/lib/index.js');
const textsToReplace = [
Expand All @@ -38,5 +27,4 @@ function fixPlotlyRenderer() {
fs.writeFileSync(filePath, replacedFileContents);
}

fixJupyterLabRenderers();
fixPlotlyRenderer();
24 changes: 16 additions & 8 deletions build/webpack/webpack.client.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,14 @@ const defaultConfig = {
externals: ['vscode', 'commonjs'],
plugins: [
new ForkTsCheckerWebpackPlugin({
checkSyntacticErrors: true,
tsconfig: configFileName,
reportFiles: ['src/client/**/*.{ts,tsx}'],
memoryLimit: 9096
typescript: {
diagnosticOptions: {
syntactic: true
},
configFile: configFileName,
memoryLimit: 9096
// reportFiles: ['src/client/**/*.{ts,tsx}'],
}
}),
new DefinePlugin({
scriptUrl: 'import.meta.url',
Expand Down Expand Up @@ -200,10 +204,14 @@ const preloadConfig = {
devtool: isProdBuild ? 'source-map' : 'inline-source-map',
plugins: [
new ForkTsCheckerWebpackPlugin({
checkSyntacticErrors: true,
tsconfig: configFileName,
reportFiles: ['src/client/**/*.{ts,tsx}'],
memoryLimit: 9096
typescript: {
diagnosticOptions: {
syntactic: true
},
configFile: configFileName,
memoryLimit: 9096
// reportFiles: ['src/client/**/*.{ts,tsx}'],
}
}),
new DefinePlugin({
scriptUrl: 'import.meta.url',
Expand Down
23,911 changes: 10,440 additions & 13,471 deletions package-lock.json

Large diffs are not rendered by default.

60 changes: 23 additions & 37 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "jupyter-renderers",
"displayName": "Jupyter Notebook Renderers",
"description": "Renderers for Jupyter Notebooks (with plotly, vega, gif, png, svg, jpeg and other such outputs)",
"version": "1.0.19",
"version": "1.0.20",
"engines": {
"vscode": "^1.80.0"
},
Expand Down Expand Up @@ -129,12 +129,10 @@
},
"scripts": {
"vscode:prepublish": "npm run compile:webpack",
"dev": "concurrently -r npm:compile:extension:watch npm:compile:client:watch npm:compile:test:watch",
"compile": "npm run compile:extension && npm run compile:test && npm run compile:client",
"dev": "concurrently -r npm:compile:extension:watch npm:compile:client:watch",
"compile": "npm run compile:extension && npm run compile:client",
"compile:extension": "tsc -p src/extension",
"compile:extension:watch": "tsc -p src/extension --watch",
"compile:test": "tsc -p src/test",
"compile:test:watch": "tsc -p src/test --watch",
"compile:webpack": "npm run build:client && npm run build:extension",
"compile:client": "webpack --config=build/webpack/webpack.client.config.js",
"build:client": "webpack --config=build/webpack/webpack.client.config.js --mode=production",
Expand All @@ -144,30 +142,21 @@
"lint-format": "npx prettier 'src/**/*.ts*' --check && npx prettier 'build/**/*.js' --check",
"watch": "tsc -watch -p ./",
"package": "vsce package -o ms-notebook-renderers.vsix",
"test": "node ./out/test/runTest.js",
"prettier-fix": "prettier 'src/**/*.ts*' --write && prettier 'build/**/*.js' --write",
"postinstall": "node ./build/postInstall.js"
},
"dependencies": {
"@babel/helper-validator-identifier": "^7.22.20",
"@blueprintjs/core": "^3.7.0",
"@blueprintjs/select": "^3.2.0",
"@jupyter-widgets/base": "^4.1.0",
"@jupyter-widgets/controls": "^3.1.0",
"@jupyter-widgets/jupyterlab-manager": "^3.1.0",
"@jupyter-widgets/output": "^4.1.0",
"@jupyterlab/coreutils": "^5.4.2",
"@jupyterlab/nbformat": "^3.4.2",
"@jupyterlab/nbformat": "^4.2.4",
"@loadable/component": "^5.12.0",
"@nteract/transform-dataresource": "^3.0.2",
"@nteract/transform-geojson": "^3.2.3",
"@nteract/transform-model-debug": "^3.2.3",
"@nteract/transform-plotly": "^7.0.0",
"@nteract/transform-vega": "7.0.10",
"@nteract/transforms": "^3.2.0",
"@phosphor/widgets": "^1.9.3",
"@vscode/jupyter-ipywidgets7": "^2.0.1",
"@vscode/jupyter-ipywidgets8": "^1.0.2",
"@vscode/jupyter-ipywidgets8": "^1.0.3",
"canvas": "^2.11.2",
"chownr": "^2.0.0",
"fs-minipass": "^2.1.0",
Expand Down Expand Up @@ -198,38 +187,35 @@
"@types/loadable__component": "^5.10.0",
"@types/lodash": "^4.14.158",
"@types/markdown-it": "^12.2.3",
"@types/mocha": "^7.0.2",
"@types/node": "^12.11.7",
"@types/react": "^16.9.35",
"@types/react-dom": "^16.9.8",
"@types/uuid": "^8.0.0",
"@types/vscode": "^1.60.0",
"@types/vscode-notebook-renderer": "^1.60.0",
"@typescript-eslint/eslint-plugin": "^3.1.0",
"@typescript-eslint/parser": "^3.1.0",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"concurrently": "^5.2.0",
"copy-webpack-plugin": "^6.4.1",
"css-loader": "^3.5.3",
"eslint": "^7.1.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-prettier": "^3.1.3",
"fork-ts-checker-webpack-plugin": "^4.1.6",
"copy-webpack-plugin": "^12.0.2",
"css-loader": "^7.1.2",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"fork-ts-checker-webpack-plugin": "^9.0.2",
"glob": "^7.1.6",
"install": "^0.13.0",
"less": "^3.11.3",
"mocha": "^10.1.0",
"less": "^4.2.0",
"node-loader": "^2.0.0",
"prettier": "^2.0.5",
"style-loader": "^1.2.1",
"prettier": "^3.3.3",
"style-loader": "^4.0.0",
"svg-inline-loader": "^0.8.2",
"thread-loader": "^3.0.4",
"ts-loader": "^9.3.1",
"typescript": "^4.7.4",
"url-loader": "^4.1.0",
"vscode-test": "^1.4.0",
"webpack": "^5.76.3",
"webpack-bundle-analyzer": "^4.8.0",
"webpack-cli": "^5.0.1",
"thread-loader": "^4.0.2",
"ts-loader": "^9.5.1",
"typescript": "^5.5.4",
"url-loader": "^4.1.1",
"webpack": "^5.93.0",
"webpack-bundle-analyzer": "^4.10.2",
"webpack-cli": "^5.1.4",
"webpack-fix-default-import-plugin": "^1.0.3"
},
"overrides": {
Expand Down
2 changes: 1 addition & 1 deletion src/client/builtinRendererHooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const getPublicPath = () => {
return new URL(scriptUrl.replace(/[^/]+$/, '')).toString();
};

// eslint-disable-next-line prefer-const
// eslint-disable-next-line prefer-const, no-unused-vars, @typescript-eslint/no-unused-vars
__webpack_public_path__ = getPublicPath();

import type { OutputItem, RendererContext } from 'vscode-notebook-renderer';
Expand Down
3 changes: 2 additions & 1 deletion src/client/clipboard.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
declare const ClipboardItem: {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
prototype: any;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any, no-unused-vars
new (options: any): any;
};
declare interface ClipboardItem {
readonly types: ReadonlyArray<string>;
// eslint-disable-next-line no-unused-vars
getType(type: string): Promise<Blob>;
}

Expand Down
2 changes: 1 addition & 1 deletion src/client/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export type SaveImageAs = {
export declare const ClipboardItem: {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
prototype: any;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any, no-unused-vars
new (options: any): any;
};
export const noop = () => {
Expand Down
4 changes: 2 additions & 2 deletions src/client/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
// Licensed under the MIT License.

// This must be on top, do not change. Required by webpack.
// eslint-disable-next-line no-unused-vars
// eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
declare let __webpack_public_path__: string;
declare const scriptUrl: string;
const getPublicPath = () => {
return new URL(scriptUrl.replace(/[^/]+$/, '')).toString();
};

// eslint-disable-next-line prefer-const
// eslint-disable-next-line prefer-const, @typescript-eslint/no-unused-vars, no-unused-vars
__webpack_public_path__ = getPublicPath();
// This must be on top, do not change. Required by webpack.
import './index.css';
Expand Down
8 changes: 6 additions & 2 deletions src/client/transforms.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ import Loadable, { LoadableComponent } from '@loadable/component';
class TransformData {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
private cachedPromise: undefined | Promise<any>;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(public mimeType: string, private importer: () => Promise<any>) {}
constructor(
// eslint-disable-next-line no-unused-vars
public mimeType: string,
// eslint-disable-next-line @typescript-eslint/no-explicit-any, no-unused-vars
private importer: () => Promise<any>
) {}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public getComponent(): Promise<any> {
if (!this.cachedPromise) {
Expand Down
2 changes: 1 addition & 1 deletion src/client/vegaRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const getPublicPath = () => {
return new URL(scriptUrl.replace(/[^/]+$/, '')).toString();
};

// eslint-disable-next-line prefer-const
// eslint-disable-next-line prefer-const, @typescript-eslint/no-unused-vars, no-unused-vars
__webpack_public_path__ = getPublicPath();

import * as vegaEmbed from 'vega-embed';
Expand Down
23 changes: 0 additions & 23 deletions src/test/runTest.ts

This file was deleted.

15 changes: 0 additions & 15 deletions src/test/suite/extension.test.ts

This file was deleted.

38 changes: 0 additions & 38 deletions src/test/suite/index.ts

This file was deleted.

11 changes: 0 additions & 11 deletions src/test/tsconfig.json

This file was deleted.

0 comments on commit 963366c

Please sign in to comment.