-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
707 additions
and
1,258 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
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 |
---|---|---|
|
@@ -15,4 +15,5 @@ vsc-extension-quickstart.md | |
examples/** | ||
demo.gif | ||
.cssrem | ||
.yarnrc.yml | ||
.yarnrc.yml | ||
scripts/** |
This file was deleted.
Oops, something went wrong.
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,34 +1,34 @@ | ||
import typescriptEslint from '@typescript-eslint/eslint-plugin'; | ||
import tsParser from '@typescript-eslint/parser'; | ||
import typescriptEslint from "@typescript-eslint/eslint-plugin"; | ||
import tsParser from "@typescript-eslint/parser"; | ||
|
||
export default [ | ||
{ | ||
files: ['**/*.ts'], | ||
files: ["**/*.ts"], | ||
}, | ||
{ | ||
plugins: { | ||
'@typescript-eslint': typescriptEslint, | ||
"@typescript-eslint": typescriptEslint, | ||
}, | ||
|
||
languageOptions: { | ||
parser: tsParser, | ||
ecmaVersion: 2022, | ||
sourceType: 'module', | ||
sourceType: "module", | ||
}, | ||
|
||
rules: { | ||
'@typescript-eslint/naming-convention': [ | ||
'warn', | ||
"@typescript-eslint/naming-convention": [ | ||
"warn", | ||
{ | ||
selector: 'import', | ||
format: ['camelCase', 'PascalCase'], | ||
selector: "import", | ||
format: ["camelCase", "PascalCase"], | ||
}, | ||
], | ||
|
||
// curly: "warn", | ||
// eqeqeq: "warn", | ||
'no-throw-literal': 'warn', | ||
semi: 'warn', | ||
"no-throw-literal": "warn", | ||
semi: "warn", | ||
}, | ||
}, | ||
]; |
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,78 @@ | ||
import * as esbuild from "esbuild"; | ||
|
||
const production = process.argv.includes("--production"); | ||
const watch = process.argv.includes("--watch"); | ||
const buildType = watch ? "watch" : "build"; | ||
|
||
function esbuildProblemMatcherPlugin(type: "web" | "node"): esbuild.Plugin { | ||
const prefix = `[${buildType}/${type}]`; | ||
return { | ||
name: "esbuild-problem-matcher", | ||
setup(build) { | ||
build.onStart(() => { | ||
console.log(prefix + " started"); | ||
}); | ||
build.onEnd((result) => { | ||
result.errors.forEach(({ text, location }) => { | ||
console.error(`✘ [ERROR] ${text}`); | ||
if (location) { | ||
console.error( | ||
` ${location.file}:${location.line}:${location.column}:` | ||
); | ||
} | ||
}); | ||
console.log(prefix + " finished"); | ||
}); | ||
}, | ||
}; | ||
} | ||
|
||
const main = async () => { | ||
const nodeContext = await esbuild.context({ | ||
entryPoints: ["src/extension.ts"], | ||
bundle: true, | ||
format: "cjs", | ||
minify: production, | ||
sourcemap: !production, | ||
sourcesContent: false, | ||
platform: "node", | ||
outfile: "out/extension.js", | ||
mainFields: ["module", "main"], | ||
external: ["vscode"], | ||
logLevel: "silent", | ||
plugins: [esbuildProblemMatcherPlugin("node")], | ||
}); | ||
|
||
const browserContext = await esbuild.context({ | ||
entryPoints: ["src/extension.ts"], | ||
bundle: true, | ||
format: "cjs", | ||
minify: production, | ||
sourcemap: !production, | ||
sourcesContent: false, | ||
platform: "browser", | ||
outfile: "out/extension.web.js", | ||
mainFields: ["browser", "module", "main"], | ||
external: ["vscode"], | ||
logLevel: "silent", | ||
plugins: [esbuildProblemMatcherPlugin("web")], | ||
// Node.js global to browser globalThis | ||
define: { | ||
global: "globalThis", | ||
}, | ||
}); | ||
|
||
if (watch) { | ||
await Promise.all([nodeContext.watch(), browserContext.watch()]); | ||
} else { | ||
await nodeContext.rebuild(); | ||
await browserContext.rebuild(); | ||
await nodeContext.dispose(); | ||
await browserContext.dispose(); | ||
} | ||
}; | ||
|
||
main().catch((e) => { | ||
console.error(e); | ||
process.exit(1); | ||
}); |
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
Oops, something went wrong.