Skip to content

Commit 0e923c1

Browse files
committed
test: add fixture for bundled extension
1 parent 0063ded commit 0e923c1

File tree

9 files changed

+602
-16
lines changed

9 files changed

+602
-16
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ node_modules
22
dist
33
.vitest-testdirs
44

5-
**/fixtures/**/*/out/**
5+
**/fixtures/**/*/out

pnpm-lock.yaml

+477
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.vscode/**
2+
src/**
3+
.gitignore
4+
**/tsconfig.json
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024-PRESENT Lucas Nørgård
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Bundled Extension
2+
3+
> [!NOTE]
4+
> A really simple Visual Studio Code extension, which is bundled.
5+
> Only used for vsix-builder tests
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"name": "bundled-extension",
3+
"displayName": "Bundled Extension",
4+
"description": "A simple extension for vsix-builder tests",
5+
"version": "0.0.1",
6+
"engines": {
7+
"vscode": "^1.90.0"
8+
},
9+
"categories": [
10+
"Other"
11+
],
12+
"repository": {
13+
"type": "git",
14+
"url": "git+https://github.com/luxass/vsix-builder.git"
15+
},
16+
"activationEvents": [],
17+
"main": "./out/extension.js",
18+
"contributes": {
19+
"commands": [
20+
{
21+
"command": "bundled-extension.helloWorld",
22+
"title": "Hello World"
23+
}
24+
]
25+
},
26+
"scripts": {
27+
"vscode:prepublish": "pnpm run build",
28+
"build": "tsup src/extension.ts --external vscode --out-dir out",
29+
"dev": "tsup src/extension.ts --external vscode --watch --out-dir out",
30+
"package": "pnpm vsce package --no-dependencies"
31+
},
32+
"devDependencies": {
33+
"@babel/core": "^7.26.0",
34+
"@babel/preset-typescript": "^7.26.0",
35+
"@types/babel__core": "^7.20.5",
36+
"@types/node": "^20",
37+
"@types/vscode": "^1.90.0",
38+
"@vscode/vsce": "^3.2.1",
39+
"tsup": "^8.3.0",
40+
"typescript": "^5.6.3"
41+
}
42+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { parse } from "@babel/core";
2+
import * as vscode from "vscode";
3+
4+
export function activate(context: vscode.ExtensionContext) {
5+
console.log('Congratulations, your extension "bundled-extension" is now active!');
6+
7+
const disposable = vscode.commands.registerCommand("bundled-extension.helloWorld", () => {
8+
const code = "const a = 1; const b = 2; console.log(a + b);";
9+
10+
const result = parse(code, {
11+
sourceType: "script",
12+
plugins: ["jsx"],
13+
});
14+
15+
console.log(result);
16+
17+
18+
vscode.window.showInformationMessage("Hello World from Bundled Extension!");
19+
});
20+
21+
context.subscriptions.push(disposable);
22+
}
23+
24+
export function deactivate() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es2017",
4+
"lib": ["esnext"],
5+
"module": "esnext",
6+
"moduleResolution": "node",
7+
"resolveJsonModule": true,
8+
"strict": true,
9+
"strictNullChecks": true,
10+
"esModuleInterop": true,
11+
"skipDefaultLibCheck": true,
12+
"skipLibCheck": true,
13+
"outDir": "out"
14+
}
15+
}
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
{
2-
"compilerOptions": {
3-
"module": "Node16",
4-
"target": "ES2022",
5-
"outDir": "out",
6-
"lib": [
7-
"ES2022"
8-
],
9-
"sourceMap": true,
10-
"rootDir": "src",
11-
"strict": true /* enable all strict type-checking options */
12-
/* Additional Checks */
13-
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
14-
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
15-
// "noUnusedParameters": true, /* Report errors on unused parameters. */
16-
}
2+
"compilerOptions": {
3+
"target": "es2017",
4+
"lib": ["esnext"],
5+
"module": "esnext",
6+
"moduleResolution": "node",
7+
"resolveJsonModule": true,
8+
"strict": true,
9+
"strictNullChecks": true,
10+
"esModuleInterop": true,
11+
"skipDefaultLibCheck": true,
12+
"skipLibCheck": true,
13+
"outDir": "out"
14+
}
1715
}

0 commit comments

Comments
 (0)