@rushstack/heft-vscode-extension-plugin 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,24 @@
1
+ @rushstack/heft-vscode-extension-plugin
2
+
3
+ Copyright (c) Microsoft Corporation. All rights reserved.
4
+
5
+ MIT License
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining
8
+ a copy of this software and associated documentation files (the
9
+ "Software"), to deal in the Software without restriction, including
10
+ without limitation the rights to use, copy, modify, merge, publish,
11
+ distribute, sublicense, and/or sell copies of the Software, and to
12
+ permit persons to whom the Software is furnished to do so, subject to
13
+ the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be
16
+ included in all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,12 @@
1
+ # @rushstack/heft-vscode-extension-plugin
2
+
3
+ This is a Heft plugin for packaging Visual Studio Code extensions using the `vsce` tool.
4
+
5
+ ## Links
6
+
7
+ - [CHANGELOG.md](
8
+ https://github.com/microsoft/rushstack/blob/main/heft-plugins/heft-vscode-extension-plugin/CHANGELOG.md) - Find
9
+ out what's new in the latest version
10
+ - [@rushstack/heft](https://www.npmjs.com/package/@rushstack/heft) - Heft is a config-driven toolchain that invokes popular tools such as TypeScript, ESLint, Jest, Webpack, and API Extractor.
11
+
12
+ Heft is part of the [Rush Stack](https://rushstack.io/) family of projects.
@@ -0,0 +1,10 @@
1
+ {
2
+ "$schema": "https://developer.microsoft.com/json-schemas/heft/v0/heft-plugin.schema.json",
3
+
4
+ "taskPlugins": [
5
+ {
6
+ "pluginName": "vscode-extension-package-plugin",
7
+ "entryPoint": "./lib/VSCodeExtensionPackagePlugin.js"
8
+ }
9
+ ]
10
+ }
@@ -0,0 +1,19 @@
1
+ import type { HeftConfiguration, IHeftTaskPlugin, IHeftTaskSession } from '@rushstack/heft';
2
+ interface IVSCodeExtensionPackagePluginOptions {
3
+ /**
4
+ * The folder where the unpacked VSIX files are located.
5
+ * This is typically the output folder of the VSCode extension build.
6
+ */
7
+ unpackedFolderPath: string;
8
+ /**
9
+ * The path where the packaged VSIX file will be saved.
10
+ * This can be a directory or a full vsix file path.
11
+ * If a directory is provided, the VSIX file will be named based on the extension's `package.json` name and version.
12
+ */
13
+ vsixPath: string;
14
+ }
15
+ export default class VSCodeExtensionPackagePlugin implements IHeftTaskPlugin<IVSCodeExtensionPackagePluginOptions> {
16
+ apply(heftTaskSession: IHeftTaskSession, heftConfiguration: HeftConfiguration, pluginOptions: IVSCodeExtensionPackagePluginOptions): void;
17
+ }
18
+ export {};
19
+ //# sourceMappingURL=VSCodeExtensionPackagePlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VSCodeExtensionPackagePlugin.d.ts","sourceRoot":"","sources":["../src/VSCodeExtensionPackagePlugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAEjB,MAAM,iBAAiB,CAAC;AAMzB,UAAU,oCAAoC;IAC5C;;;OAGG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB;AAOD,MAAM,CAAC,OAAO,OAAO,4BACnB,YAAW,eAAe,CAAC,oCAAoC,CAAC;IAEzD,KAAK,CACV,eAAe,EAAE,gBAAgB,EACjC,iBAAiB,EAAE,iBAAiB,EACpC,aAAa,EAAE,oCAAoC,GAClD,IAAI;CA4CR"}
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3
+ // See LICENSE in the project root for license information.
4
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
+ if (k2 === undefined) k2 = k;
6
+ var desc = Object.getOwnPropertyDescriptor(m, k);
7
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
+ desc = { enumerable: true, get: function() { return m[k]; } };
9
+ }
10
+ Object.defineProperty(o, k2, desc);
11
+ }) : (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ o[k2] = m[k];
14
+ }));
15
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
16
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
17
+ }) : function(o, v) {
18
+ o["default"] = v;
19
+ });
20
+ var __importStar = (this && this.__importStar) || (function () {
21
+ var ownKeys = function(o) {
22
+ ownKeys = Object.getOwnPropertyNames || function (o) {
23
+ var ar = [];
24
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
25
+ return ar;
26
+ };
27
+ return ownKeys(o);
28
+ };
29
+ return function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ })();
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
+ const node_core_library_1 = require("@rushstack/node-core-library");
39
+ const path = __importStar(require("node:path"));
40
+ const terminal_1 = require("@rushstack/terminal");
41
+ const PLUGIN_NAME = 'vscode-extension-package-plugin';
42
+ const vsceBasePackagePath = require.resolve('@vscode/vsce/package.json');
43
+ const vsceScript = path.resolve(vsceBasePackagePath, '../vsce');
44
+ class VSCodeExtensionPackagePlugin {
45
+ apply(heftTaskSession, heftConfiguration, pluginOptions) {
46
+ heftTaskSession.hooks.run.tapPromise(PLUGIN_NAME, async (runOptions) => {
47
+ var _a, _b;
48
+ const { unpackedFolderPath, vsixPath } = pluginOptions;
49
+ const { logger: { terminal } } = heftTaskSession;
50
+ terminal.writeLine(`Using VSCE script: ${vsceScript}`);
51
+ terminal.writeLine(`Packaging VSIX from ${unpackedFolderPath} to ${vsixPath}`);
52
+ const terminalOutStream = new terminal_1.TerminalStreamWritable({
53
+ terminal,
54
+ severity: terminal_1.TerminalProviderSeverity.log
55
+ });
56
+ const terminalErrorStream = new terminal_1.TerminalStreamWritable({
57
+ terminal,
58
+ severity: terminal_1.TerminalProviderSeverity.error
59
+ });
60
+ const childProcess = node_core_library_1.Executable.spawn('node', [vsceScript, 'package', '--no-dependencies', '--out', `${path.resolve(vsixPath)}`], {
61
+ currentWorkingDirectory: path.resolve(unpackedFolderPath),
62
+ stdio: [
63
+ 'ignore', // stdin
64
+ 'pipe', // stdout
65
+ 'pipe' // stderr
66
+ ]
67
+ });
68
+ (_a = childProcess.stdout) === null || _a === void 0 ? void 0 : _a.pipe(terminalOutStream);
69
+ (_b = childProcess.stderr) === null || _b === void 0 ? void 0 : _b.pipe(terminalErrorStream);
70
+ const result = await node_core_library_1.Executable.waitForExitAsync(childProcess, {
71
+ encoding: 'utf8'
72
+ });
73
+ if (result.exitCode !== 0) {
74
+ throw new Error(`VSIX packaging failed with exit code ${result.exitCode}`);
75
+ }
76
+ terminal.writeLine('VSIX successfully packaged.');
77
+ });
78
+ }
79
+ }
80
+ exports.default = VSCodeExtensionPackagePlugin;
81
+ //# sourceMappingURL=VSCodeExtensionPackagePlugin.js.map
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@rushstack/heft-vscode-extension-plugin",
3
+ "version": "0.1.0",
4
+ "description": "Heft plugin for building vscode extensions.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/microsoft/rushstack.git",
8
+ "directory": "heft-plugins/heft-vscode-extension-plugin"
9
+ },
10
+ "homepage": "https://rushstack.io/pages/heft/overview/",
11
+ "license": "MIT",
12
+ "main": "lib/index.js",
13
+ "types": "lib/index.d.ts",
14
+ "peerDependencies": {
15
+ "@rushstack/heft": "^0.74.1"
16
+ },
17
+ "devDependencies": {
18
+ "eslint": "~9.25.1",
19
+ "@types/node": "20.17.19",
20
+ "@rushstack/heft": "0.74.1",
21
+ "@rushstack/heft-node-rig": "2.9.1"
22
+ },
23
+ "dependencies": {
24
+ "@vscode/vsce": "3.3.2",
25
+ "@rushstack/terminal": "0.15.4",
26
+ "@rushstack/node-core-library": "5.14.0"
27
+ },
28
+ "sideEffects": false,
29
+ "scripts": {
30
+ "build": "heft build --clean",
31
+ "start": "heft test --clean --watch",
32
+ "_phase:build": "heft run --only build -- --clean",
33
+ "_phase:test": "heft run --only test -- --clean"
34
+ }
35
+ }