Upgrade packages to latest versions

This upgrades nearly all packages to their latest versions. Due to the upgrades, some errors and breaking changes came up. These were fixed as follows:
- Use `Partial<CodeTour>` (and appropriate conditionals) to allow deletion of the usually required `CodeTour.id` property before serialization.
- Do not pass `atBegin` parameter to `debounce` anymore. The default is `false` anyway and `throttle-debounce` has made it an optional trailing parameter.

Additional package notes are below.

# @types/axios
The `@types/axios` package is now unnecessary, as `axios` provides its own type definitions.

# @types/vscode
For now keep `@types/vscode` on the old version, aligned with the declared VS Code engine.

# @vscode/vsce
The `vsce` package is deprecated in favor of the `@vscode/vsce` package. Upgrading also helpfully resolves a security vulnerability (due to an older `markdown-it` package dependency).

# tslint
The `tslint` package is deprecated in favor of `eslint`.

# webpack
When using Node 17+, the webpack commands fail with the error `ERR_OSSL_EVP_UNSUPPORTED`. The solution given by [miken32 on StackOverflow][1] does not work with VS Code since [Electron allows only a subset of NODE_OPTIONS][2]. We should instead upgrade to the latest webpack which works properly with OpenSSL 3.

[1]: https://stackoverflow.com/questions/70582072/npm-run-fails-with-err-ossl-evp-unsupported/70582385#70582385
[2]: https://github.com/electron/electron/blob/main/docs/api/environment-variables.md#node_options
This commit is contained in:
Brian Rogers 2023-03-15 19:34:57 -07:00
Родитель cf8d3ccd37
Коммит c4e79f69c7
6 изменённых файлов: 2889 добавлений и 4052 удалений

6868
package-lock.json сгенерированный

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -32,7 +32,6 @@
],
"activationEvents": [
"onStartupFinished",
"onView:codetour.tours",
"onNotebookEditor:codetour"
],
"main": "./dist/extension-node.js",
@ -654,29 +653,31 @@
},
"dependencies": {
"@types/jexl": "^2.2.0",
"axios": "^0.21.1",
"axios": "^0.21.4",
"jexl": "^2.3.0",
"mobx": "^5.14.2",
"os-browserify": "0.3.0",
"path-browserify": "1.0.1",
"throttle-debounce": "^3.0.1",
"vsls": "^1.0.2532"
},
"devDependencies": {
"@types/axios": "^0.14.0",
"@types/node": "^8.10.66",
"@types/throttle-debounce": "^2.1.0",
"@types/vscode": "^1.60.0",
"ts-loader": "^7.0.4",
"tslint": "^5.8.0",
"typescript": "^3.1.4",
"vsce": "^1.95.0",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11",
"webpack-merge": "^4.2.2"
"@types/node": "^18.14.0",
"@types/throttle-debounce": "^5.0.0",
"@types/vscode": "^1.60",
"@vscode/vsce": "^2.17.0",
"debug": "^4.3.4",
"eslint": "^8.34.0",
"ts-loader": "^9.4.2",
"typescript": "^4.9.5",
"webpack": "^5.75.0",
"webpack-cli": "^5.0.1",
"webpack-merge": "^5.8.0"
},
"scripts": {
"build": "webpack --mode production",
"vscode:prepublish": "npm run build",
"watch": "webpack --mode development --watch --info-verbosity verbose",
"watch": "webpack --mode development --watch",
"package": "vsce package"
},
"prettier": {

Просмотреть файл

@ -28,11 +28,11 @@ export class CodeTourFileSystemProvider implements FileSystemProvider {
updateTour(tour: CodeTour) {
const tourUri = Uri.parse(tour.id);
const newTour = {
const newTour: Partial<CodeTour> = {
...tour
};
delete newTour.id;
newTour.steps.forEach(step => {
newTour.steps?.forEach(step => {
delete step.markerTitle;
});

Просмотреть файл

@ -7,7 +7,7 @@ import * as vscode from "vscode";
import { store } from "../store";
import { saveTour } from "./commands";
const debouncedSaveTour = debounce(5000, false, saveTour);
const debouncedSaveTour = debounce(5000, saveTour);
const changeWatcher = async (e: vscode.TextDocumentChangeEvent) => {
if (!store.activeEditorSteps) {
return;

Просмотреть файл

@ -209,28 +209,30 @@ export async function startDefaultTour(
}
export async function exportTour(tour: CodeTour) {
const newTour = {
const newTour: Partial<CodeTour> = {
...tour
};
newTour.steps = await Promise.all(
newTour.steps.map(async step => {
if (step.contents || step.uri || !step.file) {
return step;
}
if (newTour.steps) {
newTour.steps = await Promise.all(
newTour.steps.map(async step => {
if (step.contents || step.uri || !step.file) {
return step;
}
const workspaceRoot = getWorkspaceUri(tour);
const stepFileUri = await getStepFileUri(step, workspaceRoot, tour.ref);
const contents = await readUriContents(stepFileUri);
const workspaceRoot = getWorkspaceUri(tour);
const stepFileUri = await getStepFileUri(step, workspaceRoot, tour.ref);
const contents = await readUriContents(stepFileUri);
delete step.markerTitle;
delete step.markerTitle;
return {
...step,
contents
};
})
);
return {
...step,
contents
};
})
);
}
delete newTour.id;
delete newTour.ref;

Просмотреть файл

@ -8,6 +8,10 @@ const config = {
vscode: "commonjs vscode"
},
resolve: {
fallback: {
os: require.resolve("os-browserify/browser"),
path: require.resolve("path-browserify")
},
extensions: [".ts", ".js", ".json"]
},
node: {