From efd8f8c2344e79a33b2488d8333ce29b359f754d Mon Sep 17 00:00:00 2001 From: Julia Silge Date: Wed, 5 Nov 2025 08:27:12 -0700 Subject: [PATCH 1/2] Extract `utils` into separate package and bundle it when building --- apps/lsp/package.json | 1 + apps/lsp/src/r-utils.ts | 2 +- apps/lsp/tsconfig.json | 5 +---- apps/vscode-quarto-utils/package.json | 16 ++++++++++++++++ apps/vscode-quarto-utils/src/index.ts | 16 ++++++++++++++++ .../src}/r-utils.ts | 0 apps/vscode/package.json | 1 + apps/vscode/src/r-utils.ts | 2 +- apps/vscode/tsconfig.json | 5 +---- 9 files changed, 38 insertions(+), 10 deletions(-) create mode 100644 apps/vscode-quarto-utils/package.json create mode 100644 apps/vscode-quarto-utils/src/index.ts rename apps/{utils => vscode-quarto-utils/src}/r-utils.ts (100%) diff --git a/apps/lsp/package.json b/apps/lsp/package.json index 752bcbf1..2c896252 100644 --- a/apps/lsp/package.json +++ b/apps/lsp/package.json @@ -21,6 +21,7 @@ "node-html-parser": "^6.1.5", "picomatch": "^2.3.1", "quarto-core": "*", + "vscode-quarto-utils": "*", "uuid": "^8.3.2", "vscode-languageserver": "^8.1.0", "vscode-languageserver-textdocument": "^1.0.4", diff --git a/apps/lsp/src/r-utils.ts b/apps/lsp/src/r-utils.ts index 3845186a..e0d03b76 100644 --- a/apps/lsp/src/r-utils.ts +++ b/apps/lsp/src/r-utils.ts @@ -13,7 +13,7 @@ * */ -import { isRPackage as isRPackageImpl } from "@utils/r-utils"; +import { isRPackage as isRPackageImpl } from "vscode-quarto-utils"; import { IWorkspace } from './service'; // Version that selects workspace folder diff --git a/apps/lsp/tsconfig.json b/apps/lsp/tsconfig.json index 18511316..035d6a58 100644 --- a/apps/lsp/tsconfig.json +++ b/apps/lsp/tsconfig.json @@ -4,10 +4,7 @@ "module": "CommonJS", "outDir": "./dist", "sourceMap": true, - "resolveJsonModule": true, - "paths": { - "@utils/*": ["../utils/*"] - } + "resolveJsonModule": true }, "exclude": ["node_modules"], "extends": "tsconfig/base.json", diff --git a/apps/vscode-quarto-utils/package.json b/apps/vscode-quarto-utils/package.json new file mode 100644 index 00000000..d016ee24 --- /dev/null +++ b/apps/vscode-quarto-utils/package.json @@ -0,0 +1,16 @@ +{ + "name": "vscode-quarto-utils", + "version": "0.0.0", + "private": true, + "license": "agpl-3.0", + "main": "./src/index.ts", + "types": "./src/index.ts", + "dependencies": { + "tsconfig": "*", + "typescript": "^4.5.2", + "vscode-uri": "^3.0.3" + }, + "devDependencies": { + "@types/node": "^20.10.6" + } +} diff --git a/apps/vscode-quarto-utils/src/index.ts b/apps/vscode-quarto-utils/src/index.ts new file mode 100644 index 00000000..ecd26f7f --- /dev/null +++ b/apps/vscode-quarto-utils/src/index.ts @@ -0,0 +1,16 @@ +/* + * index.ts + * + * Copyright (C) 2025 by Posit Software, PBC + * + * Unless you have received this program directly from Posit Software pursuant + * to the terms of a commercial license agreement with Posit Software, then + * this program is licensed to you under the terms of version 3 of the + * GNU Affero General Public License. This program is distributed WITHOUT + * ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT, + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the + * AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details. + * + */ + +export * from './r-utils'; diff --git a/apps/utils/r-utils.ts b/apps/vscode-quarto-utils/src/r-utils.ts similarity index 100% rename from apps/utils/r-utils.ts rename to apps/vscode-quarto-utils/src/r-utils.ts diff --git a/apps/vscode/package.json b/apps/vscode/package.json index 906214ac..3ac14f16 100644 --- a/apps/vscode/package.json +++ b/apps/vscode/package.json @@ -1467,6 +1467,7 @@ "@posit-dev/positron": "^0.1.0", "quarto-core": "*", "quarto-lsp": "*", + "vscode-quarto-utils": "*", "quarto-vscode-editor": "*", "quarto-vscode-markdownit": "*", "semver": "^7.3.8", diff --git a/apps/vscode/src/r-utils.ts b/apps/vscode/src/r-utils.ts index 5067b5fe..4c030b27 100644 --- a/apps/vscode/src/r-utils.ts +++ b/apps/vscode/src/r-utils.ts @@ -14,7 +14,7 @@ */ import * as vscode from 'vscode'; -import { isRPackage as isRPackageImpl } from "@utils/r-utils"; +import { isRPackage as isRPackageImpl } from "vscode-quarto-utils"; // Version that selects workspace folder export async function isRPackage(): Promise { diff --git a/apps/vscode/tsconfig.json b/apps/vscode/tsconfig.json index 99af7b45..a39e9c99 100644 --- a/apps/vscode/tsconfig.json +++ b/apps/vscode/tsconfig.json @@ -5,10 +5,7 @@ "outDir": "out", "lib": ["ES2021"], "sourceMap": true, - "strict": true, - "paths": { - "@utils/*": ["../utils/*"] - } + "strict": true /* enable all strict type-checking options */ /* Additional Checks */ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ From 0f8e4228fc06f59a7aa1622ccfa48d4b8db7ee23 Mon Sep 17 00:00:00 2001 From: Julia Silge Date: Thu, 6 Nov 2025 13:12:04 -0700 Subject: [PATCH 2/2] Rename `vscode-quarto-utils` to `quarto-utils` --- apps/lsp/package.json | 2 +- apps/lsp/src/r-utils.ts | 2 +- apps/{vscode-quarto-utils => quarto-utils}/package.json | 2 +- apps/{vscode-quarto-utils => quarto-utils}/src/index.ts | 0 apps/{vscode-quarto-utils => quarto-utils}/src/r-utils.ts | 0 apps/vscode/package.json | 2 +- apps/vscode/src/r-utils.ts | 2 +- 7 files changed, 5 insertions(+), 5 deletions(-) rename apps/{vscode-quarto-utils => quarto-utils}/package.json (89%) rename apps/{vscode-quarto-utils => quarto-utils}/src/index.ts (100%) rename apps/{vscode-quarto-utils => quarto-utils}/src/r-utils.ts (100%) diff --git a/apps/lsp/package.json b/apps/lsp/package.json index 2c896252..f1820d9e 100644 --- a/apps/lsp/package.json +++ b/apps/lsp/package.json @@ -21,7 +21,7 @@ "node-html-parser": "^6.1.5", "picomatch": "^2.3.1", "quarto-core": "*", - "vscode-quarto-utils": "*", + "quarto-utils": "*", "uuid": "^8.3.2", "vscode-languageserver": "^8.1.0", "vscode-languageserver-textdocument": "^1.0.4", diff --git a/apps/lsp/src/r-utils.ts b/apps/lsp/src/r-utils.ts index e0d03b76..aaf3f271 100644 --- a/apps/lsp/src/r-utils.ts +++ b/apps/lsp/src/r-utils.ts @@ -13,7 +13,7 @@ * */ -import { isRPackage as isRPackageImpl } from "vscode-quarto-utils"; +import { isRPackage as isRPackageImpl } from "quarto-utils"; import { IWorkspace } from './service'; // Version that selects workspace folder diff --git a/apps/vscode-quarto-utils/package.json b/apps/quarto-utils/package.json similarity index 89% rename from apps/vscode-quarto-utils/package.json rename to apps/quarto-utils/package.json index d016ee24..bc0191ff 100644 --- a/apps/vscode-quarto-utils/package.json +++ b/apps/quarto-utils/package.json @@ -1,5 +1,5 @@ { - "name": "vscode-quarto-utils", + "name": "quarto-utils", "version": "0.0.0", "private": true, "license": "agpl-3.0", diff --git a/apps/vscode-quarto-utils/src/index.ts b/apps/quarto-utils/src/index.ts similarity index 100% rename from apps/vscode-quarto-utils/src/index.ts rename to apps/quarto-utils/src/index.ts diff --git a/apps/vscode-quarto-utils/src/r-utils.ts b/apps/quarto-utils/src/r-utils.ts similarity index 100% rename from apps/vscode-quarto-utils/src/r-utils.ts rename to apps/quarto-utils/src/r-utils.ts diff --git a/apps/vscode/package.json b/apps/vscode/package.json index 3ac14f16..45d70986 100644 --- a/apps/vscode/package.json +++ b/apps/vscode/package.json @@ -1467,7 +1467,7 @@ "@posit-dev/positron": "^0.1.0", "quarto-core": "*", "quarto-lsp": "*", - "vscode-quarto-utils": "*", + "quarto-utils": "*", "quarto-vscode-editor": "*", "quarto-vscode-markdownit": "*", "semver": "^7.3.8", diff --git a/apps/vscode/src/r-utils.ts b/apps/vscode/src/r-utils.ts index 4c030b27..d923e8f4 100644 --- a/apps/vscode/src/r-utils.ts +++ b/apps/vscode/src/r-utils.ts @@ -14,7 +14,7 @@ */ import * as vscode from 'vscode'; -import { isRPackage as isRPackageImpl } from "vscode-quarto-utils"; +import { isRPackage as isRPackageImpl } from "quarto-utils"; // Version that selects workspace folder export async function isRPackage(): Promise {