Skip to content

Commit

Permalink
Remove named-js-group and @types/uglify-js (#12035)
Browse files Browse the repository at this point in the history
uglify-js doesn't appear to be in the project anymore and it seems that
was the only reason it was included based on a comment? Regardless,
support is good for named capture group in all browsers/node now.

Part of #11996

Co-authored-by: Don Jayamanne <don.jayamanne@outlook.com>
  • Loading branch information
Tyriar and DonJayamanne authored Nov 17, 2022
1 parent 4ff4a83 commit c5e071e
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 20 deletions.
11 changes: 0 additions & 11 deletions package-lock.json

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

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2163,7 +2163,6 @@
"jsonc-parser": "^2.0.3",
"lodash": "^4.17.21",
"marked": "^4.0.10",
"named-js-regexp": "^1.3.3",
"node-fetch": "^2.6.7",
"node-stream-zip": "^1.6.0",
"pdfkit": "^0.13.0",
Expand Down
4 changes: 1 addition & 3 deletions src/kernels/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

// Helper functions for dealing with kernels and kernelspecs

// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports
const NamedRegexp = require('named-js-regexp') as typeof import('named-js-regexp');
import * as path from '../platform/vscode-path/path';
import * as uriPath from '../platform/vscode-path/resources';
import * as nbformat from '@jupyterlab/nbformat';
Expand Down Expand Up @@ -574,7 +572,7 @@ export function areKernelConnectionsEqual(
}
// Check if a name is a default python kernel name and pull the version
export function detectDefaultKernelName(name: string) {
const regEx = NamedRegexp('python\\s*(?<version>(\\d+))', 'g');
const regEx = new RegExp('python\\s*(?<version>(\\d+))', 'g');
return regEx.exec(name.toLowerCase());
}

Expand Down
4 changes: 1 addition & 3 deletions src/kernels/jupyter/launcher/jupyterConnection.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ import { getJupyterConnectionDisplayName } from './helpers';
import { arePathsSame } from '../../../platform/common/platform/fileUtils';
import { getFilePath } from '../../../platform/common/platform/fs-paths';

// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires, @typescript-eslint/no-explicit-any
const namedRegexp = require('named-js-regexp');
const urlMatcher = namedRegexp(RegExpValues.UrlPatternRegEx);
const urlMatcher = new RegExp(RegExpValues.UrlPatternRegEx);

/**
* When starting a local jupyter server, this object waits for the server to come up.
Expand Down
2 changes: 0 additions & 2 deletions src/platform/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,6 @@ export namespace EditorContexts {
export namespace RegExpValues {
export const PythonCellMarker = /^(#\s*%%|#\s*\<codecell\>|#\s*In\[\d*?\]|#\s*In\[ \])/;
export const PythonMarkdownCellMarker = /^(#\s*%%\s*\[markdown\]|#\s*\<markdowncell\>)/;
// This next one has to be a string because uglifyJS isn't handling the groups. We use named-js-regexp to parse it
// instead.
export const UrlPatternRegEx =
'(?<PREFIX>https?:\\/\\/)((\\(.+\\s+or\\s+(?<IP>.+)\\))|(?<LOCAL>[^\\s]+))(?<REST>:.+)';
export interface IUrlPatternGroupType {
Expand Down

0 comments on commit c5e071e

Please sign in to comment.