forked from microsoft/vscode-webview-ui-toolkit-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Description of changes - Updates all extensions to the latest version of the toolkit - Changes all default extensions to use esbuild - Adds a hello-world-webpack sample that demonstrates how to use webpack - Updates all default extensions to use the toolkit component registration APIs
- Loading branch information
1 parent
f28c8d4
commit 65b37c0
Showing
119 changed files
with
18,669 additions
and
9,867 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,18 @@ | ||
{ | ||
"root": true, | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": 6, | ||
"sourceType": "module" | ||
}, | ||
"plugins": [ | ||
"@typescript-eslint" | ||
], | ||
"rules": { | ||
"@typescript-eslint/naming-convention": "warn", | ||
"@typescript-eslint/semi": "warn", | ||
"curly": "warn", | ||
"eqeqeq": "warn", | ||
"no-throw-literal": "warn", | ||
"semi": "off" | ||
} | ||
"root": true, | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": 6, | ||
"sourceType": "module" | ||
}, | ||
"plugins": ["@typescript-eslint"], | ||
"rules": { | ||
"@typescript-eslint/naming-convention": "warn", | ||
"@typescript-eslint/semi": "warn", | ||
"curly": "warn", | ||
"eqeqeq": "warn", | ||
"no-throw-literal": "warn", | ||
"semi": "off" | ||
}, | ||
"ignorePatterns": ["out", "dist", "**/*.d.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
/coverage | ||
|
||
# production | ||
/out | ||
/build | ||
/dist | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,4 @@ | |
"bracketSpacing": true, | ||
"jsxBracketSameLine": true, | ||
"arrowParens": "always" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
{ | ||
// See http://go.microsoft.com/fwlink/?LinkId=827846 | ||
// for the documentation about the extensions.json format | ||
"recommendations": [ | ||
"dbaeumer.vscode-eslint" | ||
] | ||
// See http://go.microsoft.com/fwlink/?LinkId=827846 | ||
// for the documentation about the extensions.json format | ||
"recommendations": ["dbaeumer.vscode-eslint", "connor4312.esbuild-problem-matchers"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
// Place your settings in this file to overwrite default and user settings. | ||
{ | ||
"files.exclude": { | ||
"out": false // set this to true to hide the "out" folder with the compiled JS files | ||
}, | ||
"search.exclude": { | ||
"out": true // set this to false to include "out" folder in search results | ||
}, | ||
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts | ||
"typescript.tsc.autoDetect": "off" | ||
} | ||
"files.exclude": { | ||
"out": false, // set this to true to hide the "out" folder with the compiled JS files | ||
}, | ||
"search.exclude": { | ||
"out": true, // set this to false to include "out" folder in search results | ||
}, | ||
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts | ||
"typescript.tsc.autoDetect": "off" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
// See https://go.microsoft.com/fwlink/?LinkId=733558 | ||
// for the documentation about the tasks.json format | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"type": "npm", | ||
"script": "watch", | ||
"problemMatcher": "$tsc-watch", | ||
"isBackground": true, | ||
"presentation": { | ||
"reveal": "never" | ||
}, | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
} | ||
} | ||
] | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"type": "npm", | ||
"script": "watch", | ||
"problemMatcher": "$esbuild-watch", | ||
"isBackground": true, | ||
"presentation": { | ||
"reveal": "never" | ||
}, | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
const { build } = require("esbuild"); | ||
const { copy } = require("esbuild-plugin-copy"); | ||
|
||
//@ts-check | ||
/** @typedef {import('esbuild').BuildOptions} BuildOptions **/ | ||
|
||
/** @type BuildOptions */ | ||
const baseConfig = { | ||
bundle: true, | ||
minify: process.env.NODE_ENV === "production", | ||
sourcemap: process.env.NODE_ENV !== "production", | ||
}; | ||
|
||
// Config for extension source code (to be run in a Node-based context) | ||
/** @type BuildOptions */ | ||
const extensionConfig = { | ||
...baseConfig, | ||
platform: "node", | ||
format: "cjs", | ||
entryPoints: ["./src/extension.ts"], | ||
outfile: "./out/extension.js", | ||
external: ["vscode"], | ||
}; | ||
|
||
// Config for webview source code (to be run in a web-based context) | ||
/** @type BuildOptions */ | ||
const webviewConfig = { | ||
...baseConfig, | ||
target: "es2020", | ||
format: "esm", | ||
entryPoints: ["./src/webview/main.ts"], | ||
outfile: "./out/webview.js", | ||
plugins: [ | ||
// Copy webview css and ttf files to `out` directory unaltered | ||
copy({ | ||
resolveFrom: "cwd", | ||
assets: { | ||
from: ["./src/webview/*.css", "./src/webview/*.ttf"], | ||
to: ["./out"], | ||
}, | ||
}), | ||
], | ||
}; | ||
|
||
// This watch config adheres to the conventions of the esbuild-problem-matchers | ||
// extension (https://github.com/connor4312/esbuild-problem-matchers#esbuild-via-js) | ||
/** @type BuildOptions */ | ||
const watchConfig = { | ||
watch: { | ||
onRebuild(error, result) { | ||
console.log("[watch] build started"); | ||
if (error) { | ||
error.errors.forEach((error) => | ||
console.error( | ||
`> ${error.location.file}:${error.location.line}:${error.location.column}: error: ${error.text}` | ||
) | ||
); | ||
} else { | ||
console.log("[watch] build finished"); | ||
} | ||
}, | ||
}, | ||
}; | ||
|
||
// Build script | ||
(async () => { | ||
const args = process.argv.slice(2); | ||
try { | ||
if (args.includes("--watch")) { | ||
// Build and watch extension and webview code | ||
console.log("[watch] build started"); | ||
await build({ | ||
...extensionConfig, | ||
...watchConfig, | ||
}); | ||
await build({ | ||
...webviewConfig, | ||
...watchConfig, | ||
}); | ||
console.log("[watch] build finished"); | ||
} else { | ||
// Build extension and webview code | ||
await build(extensionConfig); | ||
await build(webviewConfig); | ||
console.log("build complete"); | ||
} | ||
} catch (err) { | ||
process.stderr.write(err.stderr); | ||
process.exit(1); | ||
} | ||
})(); |
Oops, something went wrong.