@tomjs/create-app 1.7.0 → 2.0.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/README.md +1 -1
- package/README.zh_CN.md +1 -1
- package/dist/index.js +10 -22
- package/package.json +48 -51
- package/templates/{base/core → config/base}/.editorconfig +0 -4
- package/templates/config/base/.vscode/settings.json +50 -0
- package/templates/{base/core/_gitignore → config/base/_.gitignore} +1 -3
- package/templates/config/base/_commitlint.config.mjs +3 -0
- package/templates/config/base/_eslint.config.mjs +8 -0
- package/templates/config/base/lint-staged.config.mjs +3 -0
- package/templates/config/base/package.json +24 -0
- package/templates/config/base/pnpm-workspace.yaml +3 -0
- package/templates/config/base/simple-git-hooks.mjs +4 -0
- package/templates/{vscode → config/public}/LICENSE +1 -1
- package/templates/config/public/README.md +20 -0
- package/templates/config/public/README.zh_CN.md +20 -0
- package/templates/config/public/package.json +10 -0
- package/templates/config/style/lint-staged.config.mjs +7 -0
- package/templates/config/style/package.json +12 -0
- package/templates/config/style/stylelint.config.mjs +3 -0
- package/templates/{base/electron → electron-react}/.vscode/launch.json +23 -3
- package/templates/electron-react/.vscode/tasks.json +67 -0
- package/templates/electron-react/README.md +1 -1
- package/templates/electron-react/_eslint.config.mjs +8 -0
- package/templates/electron-react/electron/main/index.ts +71 -40
- package/templates/electron-react/electron/preload/index.ts +4 -0
- package/templates/electron-react/index.html +1 -2
- package/templates/electron-react/package.json +35 -1
- package/templates/electron-react/pnpm-workspace.yaml +6 -0
- package/templates/electron-react/src/App.css +6 -2
- package/templates/electron-react/src/App.tsx +12 -5
- package/templates/electron-react/src/index.css +14 -9
- package/templates/electron-react/tsconfig.json +9 -0
- package/templates/{base/electron → electron-react}/tsconfig.node.json +1 -1
- package/templates/electron-react/vite.config.ts +9 -22
- package/templates/electron-vue/.vscode/launch.json +48 -0
- package/templates/electron-vue/.vscode/tasks.json +67 -0
- package/templates/electron-vue/README.md +1 -1
- package/templates/electron-vue/_eslint.config.mjs +8 -0
- package/templates/electron-vue/electron/env.d.ts +1 -0
- package/templates/electron-vue/electron/main/index.ts +46 -30
- package/templates/electron-vue/electron/preload/index.ts +4 -0
- package/templates/electron-vue/index.html +1 -2
- package/templates/electron-vue/package.json +31 -2
- package/templates/electron-vue/pnpm-workspace.yaml +5 -0
- package/templates/electron-vue/src/App.vue +1 -1
- package/templates/electron-vue/src/style.css +15 -10
- package/templates/electron-vue/tsconfig.json +5 -0
- package/templates/electron-vue/tsconfig.node.json +7 -0
- package/templates/electron-vue/vite.config.ts +3 -21
- package/templates/{node-cli-legacy → node-base}/.vscode/launch.json +3 -6
- package/templates/node-base/package.json +15 -0
- package/templates/node-base/src/index.ts +5 -0
- package/templates/{node-cli-legacy → node-base}/tsconfig.json +1 -1
- package/templates/node-cli/.vscode/i18n-ally-custom-framework.yml +35 -0
- package/templates/node-cli/.vscode/launch.json +3 -6
- package/templates/node-cli/.vscode/settings.json +56 -0
- package/templates/node-cli/_.gitignore +59 -0
- package/templates/node-cli/locales/en-US.json +11 -0
- package/templates/node-cli/locales/zh-Hans.json +11 -0
- package/templates/node-cli/locales/zh-Hant.json +11 -0
- package/templates/node-cli/package.json +20 -20
- package/templates/node-cli/src/app.ts +19 -0
- package/templates/node-cli/src/config.ts +2 -2
- package/templates/node-cli/src/index.ts +77 -1
- package/templates/node-cli/src/types.ts +5 -1
- package/templates/node-cli/src/utils/exec.ts +68 -0
- package/templates/node-cli/src/utils/index.ts +3 -0
- package/templates/node-cli/src/utils/lang.ts +104 -0
- package/templates/node-cli/src/utils/util.ts +20 -0
- package/templates/node-cli/tsconfig.json +2 -2
- package/templates/node-cli/{tsup.config.ts → tsdown.config.ts} +3 -4
- package/templates/node-vite/examples/react/README.md +1 -0
- package/templates/node-vite/examples/react/_eslint.config.mjs +6 -0
- package/templates/{react → node-vite/examples/react}/index.html +1 -2
- package/templates/node-vite/examples/react/package.json +27 -0
- package/templates/{react → node-vite/examples/react}/src/App.css +5 -2
- package/templates/{react → node-vite/examples/react}/src/App.tsx +8 -9
- package/templates/{react → node-vite/examples/react}/src/index.css +15 -11
- package/templates/node-vite/examples/react/src/main.tsx +10 -0
- package/templates/node-vite/examples/react/tsconfig.json +5 -0
- package/templates/node-vite/examples/react/vite.config.ts +14 -0
- package/templates/node-vite/examples/vue/README.md +1 -0
- package/templates/node-vite/examples/vue/_eslint.config.mjs +6 -0
- package/templates/{vue → node-vite/examples/vue}/index.html +1 -2
- package/templates/node-vite/examples/vue/package.json +22 -0
- package/templates/{vue → node-vite/examples/vue}/src/App.vue +3 -3
- package/templates/node-vite/examples/vue/src/components/HelloWorld.vue +19 -0
- package/templates/{vue → node-vite/examples/vue}/src/main.ts +0 -1
- package/templates/{vue → node-vite/examples/vue}/src/style.css +16 -12
- package/templates/{base → node-vite/examples}/vue/tsconfig.json +2 -2
- package/templates/{vue → node-vite/examples/vue}/vite.config.ts +1 -1
- package/templates/node-vite/package.json +16 -0
- package/templates/node-vite/pnpm-lock.yaml +2293 -0
- package/templates/node-vite/pnpm-workspace.yaml +6 -0
- package/templates/{node → node-vite}/tsconfig.json +1 -1
- package/templates/{node-cli-legacy/tsup.config.ts → node-vite/tsdown.config.ts} +4 -5
- package/templates/vscode-base/.vscode/settings.json +59 -0
- package/templates/{vscode → vscode-base}/.vscode/tasks.json +2 -2
- package/templates/{base/node → vscode-base}/LICENSE +1 -1
- package/templates/{vscode/_gitignore → vscode-base/_.gitignore} +1 -0
- package/templates/vscode-base/locales/zh-CN.json +6 -0
- package/templates/{vscode → vscode-base}/package.json +12 -19
- package/templates/vscode-base/resources/logo.png +0 -0
- package/templates/vscode-base/resources/logo.svg +1 -0
- package/templates/{vscode/tsup.config.ts → vscode-base/tsdown.config.ts} +3 -3
- package/templates/{base/vscode → vscode-react}/.vscode/launch.json +14 -1
- package/templates/vscode-react/.vscode/settings.json +59 -0
- package/templates/{base/vscode → vscode-react}/.vscode/tasks.json +10 -1
- package/templates/{base/vscode → vscode-react}/LICENSE +1 -1
- package/templates/vscode-react/README.md +2 -2
- package/templates/{base/vscode/_gitignore → vscode-react/_.gitignore} +2 -1
- package/templates/{base/vscode → vscode-react}/extension/views/helper.ts +5 -4
- package/templates/{base/vscode → vscode-react}/extension/views/panel.ts +2 -1
- package/templates/vscode-react/package.json +65 -1
- package/templates/vscode-react/pnpm-workspace.yaml +5 -0
- package/templates/vscode-react/src/App.css +1 -1
- package/templates/vscode-react/src/App.tsx +16 -10
- package/templates/vscode-react/src/utils/vscode.ts +2 -81
- package/templates/vscode-react/src/vite-env.d.ts +1 -0
- package/templates/vscode-react/tsconfig.json +5 -0
- package/templates/vscode-react/vite.config.ts +4 -5
- package/templates/vscode-vue/.vscode/extensions.json +5 -0
- package/templates/vscode-vue/.vscode/launch.json +34 -0
- package/templates/vscode-vue/.vscode/settings.json +59 -0
- package/templates/{base/electron → vscode-vue}/.vscode/tasks.json +14 -6
- package/templates/vscode-vue/.vscodeignore +73 -0
- package/templates/vscode-vue/LICENSE +21 -0
- package/templates/vscode-vue/README.md +2 -2
- package/templates/vscode-vue/_.gitignore +65 -0
- package/templates/vscode-vue/extension/env.d.ts +1 -0
- package/templates/vscode-vue/extension/index.ts +21 -0
- package/templates/vscode-vue/extension/views/helper.ts +28 -0
- package/templates/vscode-vue/extension/views/panel.ts +49 -0
- package/templates/vscode-vue/locales/en.json +6 -0
- package/templates/vscode-vue/package.json +56 -2
- package/templates/vscode-vue/pnpm-workspace.yaml +4 -0
- package/templates/vscode-vue/src/App.vue +17 -11
- package/templates/vscode-vue/src/utils/vscode.ts +2 -81
- package/templates/vscode-vue/src/vite-env.d.ts +1 -0
- package/templates/vscode-vue/tsconfig.json +5 -0
- package/templates/vscode-vue/tsconfig.node.json +7 -0
- package/templates/vscode-vue/vite.config.ts +0 -4
- package/templates/web-react/README.md +1 -0
- package/templates/web-react/_eslint.config.mjs +6 -0
- package/templates/web-react/index.html +13 -0
- package/templates/web-react/package.json +27 -0
- package/templates/web-react/public/vite.svg +1 -0
- package/templates/web-react/src/App.css +45 -0
- package/templates/web-react/src/App.tsx +31 -0
- package/templates/web-react/src/assets/react.svg +1 -0
- package/templates/web-react/src/index.css +73 -0
- package/templates/web-react/src/main.tsx +10 -0
- package/templates/web-react/tsconfig.app.json +28 -0
- package/templates/web-react/tsconfig.json +7 -0
- package/templates/web-react/tsconfig.node.json +26 -0
- package/templates/web-react/vite.config.ts +14 -0
- package/templates/web-vue/README.md +1 -0
- package/templates/web-vue/_eslint.config.mjs +6 -0
- package/templates/web-vue/index.html +13 -0
- package/templates/web-vue/package.json +22 -0
- package/templates/web-vue/public/vite.svg +1 -0
- package/templates/web-vue/src/App.vue +32 -0
- package/templates/web-vue/src/assets/vue.svg +1 -0
- package/templates/web-vue/src/components/HelloWorld.vue +19 -0
- package/templates/web-vue/src/main.ts +5 -0
- package/templates/web-vue/src/style.css +84 -0
- package/templates/web-vue/tsconfig.app.json +4 -0
- package/templates/web-vue/tsconfig.json +7 -0
- package/templates/web-vue/tsconfig.node.json +7 -0
- package/templates/web-vue/vite.config.ts +7 -0
- package/templates/base/core/.commitlintrc.cjs +0 -3
- package/templates/base/core/.eslintignore +0 -14
- package/templates/base/core/.husky/commit-msg +0 -1
- package/templates/base/core/.husky/pre-commit +0 -1
- package/templates/base/core/.prettierignore +0 -17
- package/templates/base/core/.prettierrc.cjs +0 -1
- package/templates/base/core/_eslintrc.cjs +0 -7
- package/templates/base/core/_lintstagedrc.cjs +0 -4
- package/templates/base/core/package.json +0 -31
- package/templates/base/electron/electron/main/index.ts +0 -111
- package/templates/base/electron/electron/polyfills.ts +0 -4
- package/templates/base/electron/electron/preload/index.ts +0 -1
- package/templates/base/electron/package.json +0 -25
- package/templates/base/node/README.md +0 -13
- package/templates/base/node/README.zh_CN.md +0 -13
- package/templates/base/node/package.json +0 -48
- package/templates/base/node/test/index.test.ts +0 -7
- package/templates/base/package/package.json +0 -8
- package/templates/base/react/_eslintrc.cjs +0 -7
- package/templates/base/react/_lintstagedrc.cjs +0 -6
- package/templates/base/react/package.json +0 -19
- package/templates/base/react/tsconfig.json +0 -5
- package/templates/base/style/.stylelintignore +0 -16
- package/templates/base/style/.stylelintrc.cjs +0 -3
- package/templates/base/style/_lintstagedrc.cjs +0 -5
- package/templates/base/style/package.json +0 -10
- package/templates/base/vscode/.vscode/settings.json +0 -10
- package/templates/base/vscode/package.json +0 -67
- package/templates/base/vue/_eslintrc.cjs +0 -7
- package/templates/base/vue/_lintstagedrc.cjs +0 -6
- package/templates/base/vue/package.json +0 -17
- package/templates/config.json +0 -108
- package/templates/electron-react/public/img/icon.png +0 -0
- package/templates/electron-vue/public/img/icon.png +0 -0
- package/templates/node/package.json +0 -10
- package/templates/node/src/index.ts +0 -3
- package/templates/node/tsup.config.ts +0 -19
- package/templates/node-cli/index.d.ts +0 -5
- package/templates/node-cli/src/cli.ts +0 -68
- package/templates/node-cli/xxx.config.cjs +0 -0
- package/templates/node-cli-legacy/index.d.ts +0 -5
- package/templates/node-cli-legacy/package.json +0 -30
- package/templates/node-cli-legacy/src/cli.ts +0 -45
- package/templates/node-cli-legacy/src/config.ts +0 -28
- package/templates/node-cli-legacy/src/index.ts +0 -3
- package/templates/node-cli-legacy/src/types.ts +0 -1
- package/templates/node-cli-legacy/src/utils.ts +0 -5
- package/templates/node-vite-plugin/package.json +0 -18
- package/templates/node-vite-plugin/test/index.test.ts +0 -7
- package/templates/node-vite-plugin/tsconfig.json +0 -4
- package/templates/node-vite-plugin/tsup.config.ts +0 -18
- package/templates/node-workspaces/package.json +0 -8
- package/templates/react/package.json +0 -12
- package/templates/react/src/main.tsx +0 -11
- package/templates/react/src/vite-env.d.ts +0 -1
- package/templates/react/vite.config.ts +0 -7
- package/templates/schema.json +0 -110
- package/templates/vscode/.vscode/settings.json +0 -10
- package/templates/vscode/README.md +0 -3
- package/templates/vue/package.json +0 -12
- package/templates/vue/src/components/HelloWorld.vue +0 -37
- package/templates/vue/src/vite-env.d.ts +0 -1
- package/templates/{base/core → config/base}/.gitattributes +0 -0
- package/templates/{node-cli-legacy/xxx.config.cjs → config/base/README.md} +0 -0
- package/templates/{base/electron → electron-react}/electron/env.d.ts +0 -0
- package/templates/{react → node-vite/examples/react}/public/vite.svg +0 -0
- package/templates/{react → node-vite/examples/react}/src/assets/react.svg +0 -0
- package/templates/{base → node-vite/examples}/react/tsconfig.node.json +0 -0
- package/templates/{vue → node-vite/examples/vue}/public/vite.svg +0 -0
- package/templates/{vue → node-vite/examples/vue}/src/assets/vue.svg +0 -0
- package/templates/{base → node-vite/examples}/vue/tsconfig.node.json +0 -0
- package/templates/{node-vite-plugin → node-vite}/src/index.ts +0 -0
- package/templates/{node-vite-plugin → node-vite}/src/types.ts +0 -0
- package/templates/{base/vscode → vscode-base}/.vscode/extensions.json +0 -0
- package/templates/{vscode → vscode-base}/.vscode/launch.json +0 -0
- package/templates/{vscode → vscode-base}/.vscodeignore +0 -0
- package/templates/{base/vscode → vscode-base}/README.md +0 -0
- package/templates/{vscode → vscode-base}/locales/en.json +0 -0
- package/templates/{vscode → vscode-base}/src/index.ts +1 -1
- package/templates/{vscode → vscode-base}/tsconfig.json +0 -0
- package/templates/{vscode → vscode-react}/.vscode/extensions.json +0 -0
- package/templates/{base/vscode → vscode-react}/.vscodeignore +0 -0
- package/templates/{base/vscode → vscode-react}/extension/env.d.ts +0 -0
- package/templates/{base/vscode → vscode-react}/extension/index.ts +1 -1
- /package/templates/{base/vscode → vscode-react}/locales/en.json +0 -0
- /package/templates/{base/vscode → vscode-react}/locales/zh-CN.json +0 -0
- /package/templates/{base/vscode → vscode-react}/resources/logo.png +0 -0
- /package/templates/{base/vscode → vscode-react}/resources/logo.svg +0 -0
- /package/templates/{base/vscode → vscode-react}/tsconfig.node.json +0 -0
- /package/templates/{vscode → vscode-vue}/locales/zh-CN.json +0 -0
- /package/templates/{vscode → vscode-vue}/resources/logo.png +0 -0
- /package/templates/{vscode → vscode-vue}/resources/logo.svg +0 -0
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { defineConfig } from '
|
|
1
|
+
import { defineConfig } from 'tsdown';
|
|
2
2
|
|
|
3
|
-
export default defineConfig(options => {
|
|
3
|
+
export default defineConfig((options) => {
|
|
4
4
|
const isDev = !!options.watch;
|
|
5
5
|
|
|
6
6
|
return {
|
|
7
7
|
entry: ['src/index.ts'],
|
|
8
|
-
format:
|
|
9
|
-
target: '
|
|
8
|
+
format: 'esm',
|
|
9
|
+
target: 'node18',
|
|
10
10
|
shims: false,
|
|
11
11
|
clean: true,
|
|
12
12
|
sourcemap: isDev,
|
|
13
|
-
splitting: false,
|
|
14
13
|
env: {
|
|
15
14
|
NODE_ENV: isDev ? 'development' : 'production',
|
|
16
15
|
},
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"i18n-ally.localesPaths": ["locales"],
|
|
3
|
+
"i18n-ally.sourceLanguage": "zh-CN",
|
|
4
|
+
"i18n-ally.displayLanguage": "zh-CN",
|
|
5
|
+
"i18n-ally.keepFulfilled": true,
|
|
6
|
+
"i18n-ally.keystyle": "flat",
|
|
7
|
+
"i18n-ally.sortKeys": true,
|
|
8
|
+
"i18n-ally.translate.promptSource": true,
|
|
9
|
+
"i18n-ally.translate.saveAsCandidates": true,
|
|
10
|
+
|
|
11
|
+
// Disable the default formatter, use eslint instead
|
|
12
|
+
"prettier.enable": false,
|
|
13
|
+
"editor.formatOnSave": false,
|
|
14
|
+
|
|
15
|
+
// Auto fix
|
|
16
|
+
"editor.codeActionsOnSave": {
|
|
17
|
+
"source.fixAll.eslint": "explicit",
|
|
18
|
+
"source.organizeImports": "never"
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
// Silent the stylistic rules in your IDE, but still auto fix them
|
|
22
|
+
"eslint.rules.customizations": [
|
|
23
|
+
{ "rule": "style/*", "severity": "off", "fixable": true },
|
|
24
|
+
{ "rule": "format/*", "severity": "off", "fixable": true },
|
|
25
|
+
{ "rule": "*-indent", "severity": "off", "fixable": true },
|
|
26
|
+
{ "rule": "*-spacing", "severity": "off", "fixable": true },
|
|
27
|
+
{ "rule": "*-spaces", "severity": "off", "fixable": true },
|
|
28
|
+
{ "rule": "*-order", "severity": "off", "fixable": true },
|
|
29
|
+
{ "rule": "*-dangle", "severity": "off", "fixable": true },
|
|
30
|
+
{ "rule": "*-newline", "severity": "off", "fixable": true },
|
|
31
|
+
{ "rule": "*quotes", "severity": "off", "fixable": true },
|
|
32
|
+
{ "rule": "*semi", "severity": "off", "fixable": true }
|
|
33
|
+
],
|
|
34
|
+
|
|
35
|
+
// Enable eslint for all supported languages
|
|
36
|
+
"eslint.validate": [
|
|
37
|
+
"javascript",
|
|
38
|
+
"javascriptreact",
|
|
39
|
+
"typescript",
|
|
40
|
+
"typescriptreact",
|
|
41
|
+
"vue",
|
|
42
|
+
"html",
|
|
43
|
+
"markdown",
|
|
44
|
+
"json",
|
|
45
|
+
"jsonc",
|
|
46
|
+
"yaml",
|
|
47
|
+
"toml",
|
|
48
|
+
"xml",
|
|
49
|
+
"gql",
|
|
50
|
+
"graphql",
|
|
51
|
+
"astro",
|
|
52
|
+
"svelte",
|
|
53
|
+
"css",
|
|
54
|
+
"less",
|
|
55
|
+
"scss",
|
|
56
|
+
"pcss",
|
|
57
|
+
"postcss"
|
|
58
|
+
]
|
|
59
|
+
}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"owner": "typescript",
|
|
11
11
|
"fileLocation": "relative",
|
|
12
12
|
"pattern": {
|
|
13
|
-
"regexp": "^([a-zA-Z]
|
|
13
|
+
"regexp": "^([a-zA-Z]\\:\\/?([\\w\\-]\\/?)+\\.\\w+):(\\d+):(\\d+): (ERROR|WARNING)\\: (.*)$",
|
|
14
14
|
"file": 1,
|
|
15
15
|
"line": 3,
|
|
16
16
|
"column": 4,
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"background": {
|
|
21
21
|
"activeOnStart": true,
|
|
22
22
|
"beginsPattern": "^.*Build start*$",
|
|
23
|
-
"endsPattern": "^.*Build
|
|
23
|
+
"endsPattern": "^.*Build complete.*$"
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"isBackground": true,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) {{dateYear}}-PRESENT {{gitUserName}}
|
|
3
|
+
Copyright (c) {{dateYear}}-PRESENT {{gitUserName}}
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
{
|
|
2
|
+
"publisher": "",
|
|
3
|
+
"name": "vscode-base",
|
|
2
4
|
"displayName": "%displayName%",
|
|
5
|
+
"type": "commonjs",
|
|
3
6
|
"description": "%description%",
|
|
4
|
-
"version": "0.0.0",
|
|
5
|
-
"publisher": "{{gitOrg}}",
|
|
6
7
|
"license": "MIT",
|
|
7
|
-
"engines": {
|
|
8
|
-
"node": ">=14.16.0",
|
|
9
|
-
"vscode": "^1.56.0"
|
|
10
|
-
},
|
|
11
|
-
"main": "dist/index.js",
|
|
12
8
|
"keywords": [
|
|
13
9
|
"vscode"
|
|
14
10
|
],
|
|
15
11
|
"categories": [
|
|
16
12
|
"Other"
|
|
17
13
|
],
|
|
14
|
+
"main": "dist/index.js",
|
|
15
|
+
"icon": "resources/logo.png",
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=14.16.0",
|
|
18
|
+
"vscode": "^1.56.0"
|
|
19
|
+
},
|
|
18
20
|
"activationEvents": [],
|
|
19
21
|
"contributes": {
|
|
20
22
|
"commands": [
|
|
@@ -25,15 +27,6 @@
|
|
|
25
27
|
}
|
|
26
28
|
]
|
|
27
29
|
},
|
|
28
|
-
"repository": {
|
|
29
|
-
"type": "git",
|
|
30
|
-
"url": "git+{{gitUrl}}.git"
|
|
31
|
-
},
|
|
32
|
-
"bugs": {
|
|
33
|
-
"url": "{{gitUrl}}/issues"
|
|
34
|
-
},
|
|
35
|
-
"homepage": "{{gitUrl}}/blob/main/README.md",
|
|
36
|
-
"icon": "resources/logo.png",
|
|
37
30
|
"vsce": {
|
|
38
31
|
"dependencies": false,
|
|
39
32
|
"yarn": false
|
|
@@ -41,8 +34,8 @@
|
|
|
41
34
|
"scripts": {
|
|
42
35
|
"dev": "run-p dev:*",
|
|
43
36
|
"dev:vsd": "vscode-dev --watch",
|
|
44
|
-
"dev:dist": "
|
|
45
|
-
"build": "vscode-dev &&
|
|
37
|
+
"dev:dist": "tsdown --watch",
|
|
38
|
+
"build": "vscode-dev && tsdown --minify"
|
|
46
39
|
},
|
|
47
40
|
"dependencies": {
|
|
48
41
|
"@tomjs/node": "^2.2.3",
|
|
@@ -51,6 +44,6 @@
|
|
|
51
44
|
"devDependencies": {
|
|
52
45
|
"@tomjs/vscode-dev": "^3.0.2",
|
|
53
46
|
"@types/vscode": "^1.56.0",
|
|
54
|
-
"
|
|
47
|
+
"tsdown": "^0.16.8"
|
|
55
48
|
}
|
|
56
49
|
}
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1764389396314" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1261" width="256" height="256" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M0.006384 0h1021.446384v1021.446384H0.006384V0z" fill="#FFFFFF" p-id="1262"></path><path d="M766.091172 924.408978c-1.496419-16.618933 1.910105-31.940628 10.214464-45.965088 17.042833-12.793616 18.743541-27.262404 5.107232-43.411471-13.927421-4.177716-27.548409-3.329915-40.857856 2.553616 7.415701 7.354414 12.522933 15.863062 15.321696 25.53616 2.43615 39.30015-16.286963 60.581985-56.179551 63.840399l-45.965087 5.107231c-2.839621 1.95607-4.540329 4.509686-5.107232 7.660848-27.216439 14.172569-56.159122 18.426893-86.822943 12.76808a2973.767501 2973.767501 0 0 0-53.625935-33.197007l-17.875312 2.553616c-16.700648 25.199082-40.530993 36.261347-71.501247 33.197007-25.112259 1.373845-45.541187-7.992818-61.286783-28.089775l-66.394015-5.107232c-28.968219-11.950923-40.035591-33.232758-33.197007-63.840399a210.683531 210.683531 0 0 1 22.982544-30.643392 453.915451 453.915451 0 0 1-7.660848-143.002494 6026.242554 6026.242554 0 0 1 38.304239-168.538653 377.771731 377.771731 0 0 1-51.072319-74.054863c-11.981566 0.403471-23.048938 4.657796-33.197008 12.76808a22.737397 22.737397 0 0 1-7.660847-10.214464c22.696539-7.318663 32.911002-22.640359 30.643391-45.965087-14.7599-1.133805-28.380888 2.272718-40.857855 10.214464l-5.107232-7.660848c10.418753-12.86001 24.034633-18.82015 40.857855-17.875312v-30.643392c-13.380948-1.368738-26.149027 0.33197-38.304239 5.107232L199.188429 349.845387c14.029566-8.192 29.351262-12.451431 45.965087-12.76808 1.736459-29.902843 11.103122-57.139711 28.089776-81.715711l5.107232-107.25187c4.586294-21.935561 13.94785-41.511581 28.089775-58.733167 20.188888-4.657796 38.917107-1.251272 56.179551 10.214463A709.302584 709.302584 0 0 1 436.674713 168.538653c49.249037-12.665935 98.615541-12.665935 148.109726 0L643.517606 109.805486c20.531072-18.794613 44.366524-25.607661 71.501247-20.428927a133.007641 133.007641 0 0 1 22.982544 38.304239 991.329037 991.329037 0 0 1 10.214463 127.680798c16.000958 26.71593 25.362514 55.658613 28.089776 86.822943h40.857855c1.118484 6.000998-0.582224 11.108229-5.107232 15.321695a78.753516 78.753516 0 0 0-35.750623-5.107232 50.357307 50.357307 0 0 0 5.107232 30.643392 99.662524 99.662524 0 0 1 35.750623 15.321696c-1.700708 5.107232-5.107232 8.513756-10.214464 10.214464a107.415302 107.415302 0 0 0-35.750623-10.214464l-5.107232 30.643391c9.233875-0.045965 17.747631 2.507651 25.53616 7.660848 6.287002 6.041855 6.287002 12.001995 0 17.875312-10.199142-6.368718-20.413606-10.623042-30.643392-12.76808a229.314713 229.314713 0 0 1-51.072319 68.947631c28.176599 79.381706 43.498294 161.097416 45.965087 245.147132 99.044549 2.814085 137.348788 52.180589 114.912718 148.109726-29.049935 44.958963-63.952758 51.77201-104.698254 20.428928z" fill="#121212" p-id="1263"></path><path d="M709.911621 357.506234h40.857855v15.321696c-24.836469-1.634314-48.67192 0.071501-71.501247 5.107232-4.473935-0.66394-7.880459 1.036768-10.214463 5.107232a331.321456 331.321456 0 0 0 81.71571 5.107232c2.987731 14.09596-2.119501 22.609716-15.321695 25.53616a196.694823 196.694823 0 0 0-66.394015-10.214464v15.321695a150.729736 150.729736 0 0 1 71.501246 12.76808c-22.997865 45.607581-58.748489 77.10388-107.25187 94.483791-4.525007 4.213466-6.225716 9.320698-5.107232 15.321696 20.102065 0.112359 38.830284-4.994873 56.179551-15.321696 43.19186 94.146713 55.95994 192.884828 38.30424 296.219451-5.061267 7.349307-11.869207 12.456539-20.428928 15.321696a25.199082 25.199082 0 0 0-2.553616 15.321696c35.883411-0.873337 43.544259 12.747651 22.982544 40.857855-0.929516-17.267551-8.590364-22.374783-22.982544-15.321696 6.154214 7.635312 6.154214 14.443252 0 20.428928h-30.643391a1205.439521 1205.439521 0 0 1-5.107232-143.002494 61.225496 61.225496 0 0 1 5.107232-30.643391c-4.029606-10.153177-9.984638-11.853885-17.875312-5.107232a1294.009137 1294.009137 0 0 0-30.643392 158.324189c23.365586 16.332928 23.365586 33.360439 0 51.072319-8.600579-32.905895-14.560718-32.905895-17.875311 0h-20.428928c-5.623062-26.578035-12.43611-26.578035-20.428928 0a75.791322 75.791322 0 0 1-17.875311-20.428927 1855.692289 1855.692289 0 0 1 12.768079-171.09227l-5.107232-28.089775a18.626075 18.626075 0 0 0-7.660847 5.107232c-6.721117 16.281855-9.274733 33.309367-7.660848 51.072319-3.273736 7.875352-8.380968 14.688399-15.321696 20.428928-15.842633-10.699651-27.757805-24.320638-35.750624-40.857856a263.778314 263.778314 0 0 0-5.107231-35.750623h-15.321696c1.14402 54.601416 4.545436 109.075152 10.214464 163.431421 3.636349 24.126564-4.024499 42.854783-22.982544 56.179551a43.079501 43.079501 0 0 1-2.553616-20.428927h-15.321696v25.536159h-20.428927v-30.643391h-15.321696c-3.125626 32.645426-9.933566 32.645426-20.428928 0a624.675751 624.675751 0 0 0 20.428928-40.857855 14965.451012 14965.451012 0 0 1-28.089776-143.002494c-5.163411-4.274753-11.123551-5.975461-17.875311-5.107232v35.750623c0.8478 37.49219 0 74.943521-2.553616 112.359103a194.248459 194.248459 0 0 1-12.76808 33.197007c-8.345217 2.522973-16.853865 3.370773-25.53616 2.553616v-25.53616h-15.321696c1.338095 7.548489-0.362613 14.356429-5.107232 20.428928-17.655701-27.732269-9.141945-42.206165 25.53616-43.411471 4.274753-5.163411 5.975461-11.123551 5.107232-17.875312-14.535182-1.578135-22.19603-10.086783-22.982544-25.53616-8.769117-96.593077 3.998963-190.22396 38.30424-280.897755a147.93608 147.93608 0 0 0 40.857855 15.321696c7.660848 0.24004 12.76808-3.161377 15.321696-10.214464-48.110125-21.751701-85.561456-54.948708-112.359102-99.591023 20.755791-9.652668 42.885426-14.7599 66.394015-15.321696 2.334005-2.114394 4.034713-4.66801 5.107232-7.660847-24.346175-6.5679-48.176519-4.867192-71.501247 5.107232-7.405486-6.894763-10.81201-15.403411-10.214464-25.53616a331.331671 331.331671 0 0 0 81.715711-5.107232c-28.294065-11.506594-57.231641-13.212409-86.822943-5.107232v-25.53616a376.392778 376.392778 0 0 1 91.930174 15.321696v-15.321696a389.620509 389.620509 0 0 0-61.286783-10.214463c-10.372788-2.410613-18.886544-7.517845-25.536159-15.321696 4.969337-25.301227 14.330893-49.136678 28.089775-71.501247l5.107232-107.25187c4.821227-37.747551 22.696539-45.408399 53.625935-22.982544L426.460249 194.074813c25.546374-7.798743 51.935441-11.205267 79.162095-10.214464a327.286743 327.286743 0 0 1 89.376559 10.214464c27.778234-35.459511 60.975242-64.402195 99.591022-86.822943 12.742544 8.426933 20.403392 20.342105 22.982544 35.750624l5.107232 112.359102c16.710863 24.872219 26.077526 52.109087 28.089775 81.715711a487.388249 487.388249 0 0 0-81.71571 12.76808c-10.515791 6.057177-11.368698 12.012209-2.553616 17.875311 13.477985-7.630204 27.946773-11.036728 43.411471-10.214464z" fill="#FFFFFF" p-id="1264"></path><path d="M413.69217 316.648379c35.025397 3.202234 41.828229 17.671022 20.428927 43.411471-25.515731 3.391202-34.882394-7.671062-28.089775-33.197007 3.661885-2.778334 6.215501-6.179751 7.660848-10.214464z" fill="#131212" p-id="1265"></path><path d="M582.230823 316.648379c31.373726 2.686404 38.181666 17.160299 20.428928 43.411471-25.515731 3.391202-34.882394-7.671062-28.089776-33.197007 3.661885-2.778334 6.215501-6.179751 7.660848-10.214464z" fill="#0C0C0C" p-id="1266"></path><path d="M270.689676 326.862843c6.649616 7.80385 15.163372 12.911082 25.536159 15.321696h-30.643391c-1.210414-6.593436 0.490294-11.700668 5.107232-15.321696z" fill="#5B5B5B" p-id="1267"></path><path d="M485.193416 347.291771a209.074753 209.074753 0 0 1 45.965088 2.553616c7.696599 4.274753 10.250214 10.234893 7.660848 17.875311-25.817057 23.626055-21.562733 36.394135 12.768079 38.30424 7.727242-9.805885 16.240998-16.618933 25.53616-20.428928 5.194055 5.362594 6.046963 11.317626 2.553616 17.875312-19.99992 22.824219-42.982464 26.230743-68.947631 10.214464-21.10819 13.447342-42.390025 13.447342-63.840399 0-5.153197-7.788529-7.706813-16.302284-7.660848-25.53616 11.869207 0.827372 20.382963 6.782404 25.53616 17.875312 17.201157 6.154214 29.121436 1.046983 35.750623-15.321696a201.133007 201.133007 0 0 1-25.536159-28.089776 950.966584 950.966584 0 0 0 10.214463-15.321695z" fill="#131313" p-id="1268"></path><path d="M709.911621 357.506234c14.233855-4.989766 29.555551-6.690474 45.965087-5.107232v25.53616h-76.608479c22.829327-5.035731 46.664778-6.741546 71.501247-5.107232v-15.321696h-40.857855z" fill="#979797" p-id="1269"></path><path d="M352.405387 750.763092c11.332948 33.528978 19.841596 68.426693 25.536159 104.698255-13.013227 13.294125-19.826274 29.463621-20.428928 48.518703-16.409536 1.583242-31.731232-0.117466-45.965087-5.107232 8.682294 0.817157 17.190943-0.030643 25.53616-2.553616a194.248459 194.248459 0 0 0 12.76808-33.197007c2.553616-37.415581 3.401416-74.866913 2.553616-112.359103zM663.946534 755.870324a1205.439521 1205.439521 0 0 0 5.107232 143.002494h30.643391c-11.20016 6.62408-23.120439 6.62408-35.750623 0a137.139392 137.139392 0 0 0-17.875312-30.643392c-0.040858-38.881357 5.914175-76.332688 17.875312-112.359102zM485.193416 745.65586c7.992818 16.537217 19.90799 30.158204 35.750624 40.857856 6.940728-5.740529 12.04796-12.553576 15.321696-20.428928a7343.234234 7343.234234 0 0 1-15.321696 127.680798h-25.53616a2897.409277 2897.409277 0 0 1-10.214464-148.109726z" fill="#FFFFFF" p-id="1270"></path><path d="M776.305636 878.44389h-15.321696c1.210414-6.593436-0.490294-11.700668-5.107232-15.321695-2.798763-9.673097-7.905995-18.181746-15.321696-25.53616 13.309446-5.883531 26.930434-6.731332 40.857856-2.553616 13.636309 16.149067 11.935601 30.617855-5.107232 43.411471z" fill="#EDECEB" p-id="1271"></path><path d="M755.876708 776.299252c47.149965-0.750763 80.346973 19.678165 99.591023 61.286783 5.847781 31.828269-3.513776 58.217337-28.089776 79.162095-27.762913 15.071441-38.830284 7.410594-33.197007-22.982544 32.885466-31.869127 30.33185-59.958903-7.660848-84.269327a127.348828 127.348828 0 0 0-35.750624-2.553616 98.160998 98.160998 0 0 1 5.107232-30.643391z" fill="#FFFFFF" p-id="1272"></path></svg>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { defineConfig } from '
|
|
1
|
+
import { defineConfig } from 'tsdown';
|
|
2
2
|
|
|
3
|
-
export default defineConfig(options => {
|
|
3
|
+
export default defineConfig((options) => {
|
|
4
4
|
return {
|
|
5
5
|
entry: ['src/index.ts'],
|
|
6
6
|
format: ['cjs'],
|
|
7
7
|
target: 'node14',
|
|
8
8
|
external: ['vscode'],
|
|
9
9
|
clean: true,
|
|
10
|
-
splitting: true,
|
|
11
10
|
sourcemap: !!options.watch,
|
|
11
|
+
fixedExtension: false,
|
|
12
12
|
};
|
|
13
13
|
});
|
|
@@ -10,12 +10,25 @@
|
|
|
10
10
|
"type": "extensionHost",
|
|
11
11
|
"request": "launch",
|
|
12
12
|
"args": [
|
|
13
|
+
"--disable-extensions",
|
|
13
14
|
"--extensionDevelopmentPath=${workspaceFolder}"
|
|
14
15
|
],
|
|
15
16
|
"outFiles": [
|
|
16
17
|
"${workspaceFolder}/dist/extension/*.js"
|
|
17
18
|
],
|
|
18
|
-
"preLaunchTask": "
|
|
19
|
+
"preLaunchTask": "npm: dev"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"name": "Preview Extension",
|
|
23
|
+
"type": "extensionHost",
|
|
24
|
+
"request": "launch",
|
|
25
|
+
"args": [
|
|
26
|
+
"--extensionDevelopmentPath=${workspaceFolder}"
|
|
27
|
+
],
|
|
28
|
+
"outFiles": [
|
|
29
|
+
"${workspaceFolder}/dist/extension/*.js"
|
|
30
|
+
],
|
|
31
|
+
"preLaunchTask": "npm: build"
|
|
19
32
|
}
|
|
20
33
|
]
|
|
21
34
|
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"i18n-ally.localesPaths": ["locales"],
|
|
3
|
+
"i18n-ally.sourceLanguage": "zh-CN",
|
|
4
|
+
"i18n-ally.displayLanguage": "zh-CN",
|
|
5
|
+
"i18n-ally.keepFulfilled": true,
|
|
6
|
+
"i18n-ally.keystyle": "flat",
|
|
7
|
+
"i18n-ally.sortKeys": true,
|
|
8
|
+
"i18n-ally.translate.promptSource": true,
|
|
9
|
+
"i18n-ally.translate.saveAsCandidates": true,
|
|
10
|
+
|
|
11
|
+
// Disable the default formatter, use eslint instead
|
|
12
|
+
"prettier.enable": false,
|
|
13
|
+
"editor.formatOnSave": false,
|
|
14
|
+
|
|
15
|
+
// Auto fix
|
|
16
|
+
"editor.codeActionsOnSave": {
|
|
17
|
+
"source.fixAll.eslint": "explicit",
|
|
18
|
+
"source.organizeImports": "never"
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
// Silent the stylistic rules in your IDE, but still auto fix them
|
|
22
|
+
"eslint.rules.customizations": [
|
|
23
|
+
{ "rule": "style/*", "severity": "off", "fixable": true },
|
|
24
|
+
{ "rule": "format/*", "severity": "off", "fixable": true },
|
|
25
|
+
{ "rule": "*-indent", "severity": "off", "fixable": true },
|
|
26
|
+
{ "rule": "*-spacing", "severity": "off", "fixable": true },
|
|
27
|
+
{ "rule": "*-spaces", "severity": "off", "fixable": true },
|
|
28
|
+
{ "rule": "*-order", "severity": "off", "fixable": true },
|
|
29
|
+
{ "rule": "*-dangle", "severity": "off", "fixable": true },
|
|
30
|
+
{ "rule": "*-newline", "severity": "off", "fixable": true },
|
|
31
|
+
{ "rule": "*quotes", "severity": "off", "fixable": true },
|
|
32
|
+
{ "rule": "*semi", "severity": "off", "fixable": true }
|
|
33
|
+
],
|
|
34
|
+
|
|
35
|
+
// Enable eslint for all supported languages
|
|
36
|
+
"eslint.validate": [
|
|
37
|
+
"javascript",
|
|
38
|
+
"javascriptreact",
|
|
39
|
+
"typescript",
|
|
40
|
+
"typescriptreact",
|
|
41
|
+
"vue",
|
|
42
|
+
"html",
|
|
43
|
+
"markdown",
|
|
44
|
+
"json",
|
|
45
|
+
"jsonc",
|
|
46
|
+
"yaml",
|
|
47
|
+
"toml",
|
|
48
|
+
"xml",
|
|
49
|
+
"gql",
|
|
50
|
+
"graphql",
|
|
51
|
+
"astro",
|
|
52
|
+
"svelte",
|
|
53
|
+
"css",
|
|
54
|
+
"less",
|
|
55
|
+
"scss",
|
|
56
|
+
"pcss",
|
|
57
|
+
"postcss"
|
|
58
|
+
]
|
|
59
|
+
}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"owner": "typescript",
|
|
11
11
|
"fileLocation": "relative",
|
|
12
12
|
"pattern": {
|
|
13
|
-
"regexp": "^([a-zA-Z]
|
|
13
|
+
"regexp": "^([a-zA-Z]\\:/?([\\w\\-]/?)+\\.\\w+):(\\d+):(\\d+): (ERROR|WARNING)\\: (.*)$",
|
|
14
14
|
"file": 1,
|
|
15
15
|
"line": 3,
|
|
16
16
|
"column": 4,
|
|
@@ -31,6 +31,15 @@
|
|
|
31
31
|
"kind": "build",
|
|
32
32
|
"isDefault": true
|
|
33
33
|
}
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"type": "npm",
|
|
37
|
+
"script": "build",
|
|
38
|
+
"group": {
|
|
39
|
+
"kind": "build",
|
|
40
|
+
"isDefault": true
|
|
41
|
+
},
|
|
42
|
+
"problemMatcher": []
|
|
34
43
|
}
|
|
35
44
|
]
|
|
36
45
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) {{dateYear}}-PRESENT {{gitUserName}}
|
|
3
|
+
Copyright (c) {{dateYear}}-PRESENT {{gitUserName}}
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
# extension
|
|
1
|
+
# extension
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
vscode extension
|
|
@@ -3,9 +3,11 @@ import { window } from 'vscode';
|
|
|
3
3
|
|
|
4
4
|
export class WebviewHelper {
|
|
5
5
|
public static setupHtml(webview: Webview, context: ExtensionContext) {
|
|
6
|
-
return
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
return __getWebviewHtml__({
|
|
7
|
+
serverUrl: process.env.VITE_DEV_SERVER_URL,
|
|
8
|
+
webview,
|
|
9
|
+
context,
|
|
10
|
+
});
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
public static setupWebviewHooks(webview: Webview, disposables: Disposable[]) {
|
|
@@ -17,7 +19,6 @@ export class WebviewHelper {
|
|
|
17
19
|
switch (command) {
|
|
18
20
|
case 'hello':
|
|
19
21
|
window.showInformationMessage(text);
|
|
20
|
-
return;
|
|
21
22
|
}
|
|
22
23
|
},
|
|
23
24
|
undefined,
|
|
@@ -19,7 +19,8 @@ export class MainPanel {
|
|
|
19
19
|
public static render(context: ExtensionContext) {
|
|
20
20
|
if (MainPanel.currentPanel) {
|
|
21
21
|
MainPanel.currentPanel._panel.reveal(ViewColumn.One);
|
|
22
|
-
}
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
23
24
|
const panel = window.createWebviewPanel('showHelloWorld', 'Hello World', ViewColumn.One, {
|
|
24
25
|
enableScripts: true,
|
|
25
26
|
});
|
|
@@ -1 +1,65 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"publisher": "",
|
|
3
|
+
"name": "vscode-vue",
|
|
4
|
+
"displayName": "%displayName%",
|
|
5
|
+
"type": "commonjs",
|
|
6
|
+
"description": "%description%",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"vscode"
|
|
10
|
+
],
|
|
11
|
+
"categories": [
|
|
12
|
+
"Other"
|
|
13
|
+
],
|
|
14
|
+
"main": "dist/extension/index.js",
|
|
15
|
+
"icon": "resources/logo.png",
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=14.16.0",
|
|
18
|
+
"vscode": "^1.56.0"
|
|
19
|
+
},
|
|
20
|
+
"activationEvents": [],
|
|
21
|
+
"contributes": {
|
|
22
|
+
"commands": [
|
|
23
|
+
{
|
|
24
|
+
"command": "tomjs.xxx.showHello",
|
|
25
|
+
"title": "%tomjs.commands.hello%",
|
|
26
|
+
"category": "%displayName%"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"command": "tomjs.xxx.showPanel",
|
|
30
|
+
"title": "%tomjs.commands.panel%",
|
|
31
|
+
"category": "%displayName%"
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
"vsce": {
|
|
36
|
+
"dependencies": false,
|
|
37
|
+
"yarn": false
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"dev": "run-p dev:*",
|
|
41
|
+
"dev:vsd": "vscode-dev --watch",
|
|
42
|
+
"dev:dist": "vite",
|
|
43
|
+
"build": "vscode-dev && tsc -b && vite build",
|
|
44
|
+
"preview": "vite preview"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@tomjs/node": "^2.2.3",
|
|
48
|
+
"@tomjs/vscode": "^2.5.0",
|
|
49
|
+
"@tomjs/vscode-webview": "^2.0.2",
|
|
50
|
+
"@vscode/webview-ui-toolkit": "^1.4.0",
|
|
51
|
+
"react": "^19.2.0",
|
|
52
|
+
"react-dom": "^19.2.0"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@tomjs/vite-plugin-vscode": "^5.1.0",
|
|
56
|
+
"@tomjs/vscode-dev": "^3.0.2",
|
|
57
|
+
"@types/react": "^19.2.7",
|
|
58
|
+
"@types/react-dom": "^19.2.3",
|
|
59
|
+
"@types/vscode": "^1.56.0",
|
|
60
|
+
"@types/vscode-webview": "^1.57.5",
|
|
61
|
+
"@vitejs/plugin-react": "^5.1.1",
|
|
62
|
+
"@vitejs/plugin-react-swc": "^4.2.2",
|
|
63
|
+
"vite": "^7.2.4"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -5,13 +5,6 @@ import { vscode } from './utils/vscode';
|
|
|
5
5
|
import './App.css';
|
|
6
6
|
|
|
7
7
|
function App() {
|
|
8
|
-
function onPostMessage() {
|
|
9
|
-
vscode.postMessage({
|
|
10
|
-
command: 'hello',
|
|
11
|
-
text: 'Hey there partner! 🤠',
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
|
|
15
8
|
const [message, setMessage] = useState('');
|
|
16
9
|
const [state, setState] = useState('');
|
|
17
10
|
|
|
@@ -19,9 +12,16 @@ function App() {
|
|
|
19
12
|
vscode.setState(state);
|
|
20
13
|
};
|
|
21
14
|
const onGetState = () => {
|
|
22
|
-
setState(vscode.getState() as string);
|
|
15
|
+
setState((vscode.getState() || '') as string);
|
|
23
16
|
};
|
|
24
17
|
|
|
18
|
+
function onPostMessage() {
|
|
19
|
+
vscode.postMessage({
|
|
20
|
+
type: 'hello',
|
|
21
|
+
data: `💬: ${message || 'Empty'}`,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
25
|
return (
|
|
26
26
|
<main>
|
|
27
27
|
<h1>Hello React!</h1>
|
|
@@ -30,13 +30,19 @@ function App() {
|
|
|
30
30
|
<VSCodeTextField value={message} onInput={e => setMessage(e.target.value)}>
|
|
31
31
|
Please enter a message
|
|
32
32
|
</VSCodeTextField>
|
|
33
|
-
<div>
|
|
33
|
+
<div>
|
|
34
|
+
Message is:
|
|
35
|
+
{message}
|
|
36
|
+
</div>
|
|
34
37
|
</div>
|
|
35
38
|
<div>
|
|
36
39
|
<VSCodeTextField value={state} onInput={e => setState(e.target.value)}>
|
|
37
40
|
Please enter a state
|
|
38
41
|
</VSCodeTextField>
|
|
39
|
-
<div>
|
|
42
|
+
<div>
|
|
43
|
+
State is:
|
|
44
|
+
{state}
|
|
45
|
+
</div>
|
|
40
46
|
<div>
|
|
41
47
|
<VSCodeButton onClick={onSetState}>setState</VSCodeButton>
|
|
42
48
|
<VSCodeButton style={{ marginLeft: '8px' }} onClick={onGetState}>
|
|
@@ -1,83 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* A utility wrapper around the acquireVsCodeApi() function, which enables
|
|
5
|
-
* message passing and state management between the webview and extension
|
|
6
|
-
* contexts.
|
|
7
|
-
*
|
|
8
|
-
* This utility also enables webview code to be run in a web browser-based
|
|
9
|
-
* dev server by using native web browser features that mock the functionality
|
|
10
|
-
* enabled by acquireVsCodeApi.
|
|
11
|
-
*/
|
|
12
|
-
class VSCodeAPIWrapper {
|
|
13
|
-
private readonly vsCodeApi: WebviewApi<unknown> | undefined;
|
|
14
|
-
|
|
15
|
-
constructor() {
|
|
16
|
-
// Check if the acquireVsCodeApi function exists in the current development
|
|
17
|
-
// context (i.e. VS Code development window or web browser)
|
|
18
|
-
if (typeof acquireVsCodeApi === 'function') {
|
|
19
|
-
this.vsCodeApi = acquireVsCodeApi();
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// private init() {
|
|
24
|
-
// // TODO 环境变量判断
|
|
25
|
-
// }
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Post a message (i.e. send arbitrary data) to the owner of the webview.
|
|
29
|
-
*
|
|
30
|
-
* @remarks When running webview code inside a web browser, postMessage will instead
|
|
31
|
-
* log the given message to the console.
|
|
32
|
-
*
|
|
33
|
-
* @param message Abitrary data (must be JSON serializable) to send to the extension context.
|
|
34
|
-
*/
|
|
35
|
-
public postMessage(message: unknown) {
|
|
36
|
-
if (this.vsCodeApi) {
|
|
37
|
-
this.vsCodeApi.postMessage(message);
|
|
38
|
-
} else {
|
|
39
|
-
window.parent.postMessage({ type: 'page:message', data: message }, '*');
|
|
40
|
-
console.log(message);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Get the persistent state stored for this webview.
|
|
46
|
-
*
|
|
47
|
-
* @remarks When running webview source code inside a web browser, getState will retrieve state
|
|
48
|
-
* from local storage (https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage).
|
|
49
|
-
*
|
|
50
|
-
* @return The current state or `undefined` if no state has been set.
|
|
51
|
-
*/
|
|
52
|
-
public getState(): unknown | undefined {
|
|
53
|
-
if (this.vsCodeApi) {
|
|
54
|
-
return this.vsCodeApi.getState();
|
|
55
|
-
} else {
|
|
56
|
-
const state = localStorage.getItem('vscodeState');
|
|
57
|
-
return state ? JSON.parse(state) : undefined;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Set the persistent state stored for this webview.
|
|
63
|
-
*
|
|
64
|
-
* @remarks When running webview source code inside a web browser, setState will set the given
|
|
65
|
-
* state using local storage (https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage).
|
|
66
|
-
*
|
|
67
|
-
* @param newState New persisted state. This must be a JSON serializable object. Can be retrieved
|
|
68
|
-
* using {@link getState}.
|
|
69
|
-
*
|
|
70
|
-
* @return The new state.
|
|
71
|
-
*/
|
|
72
|
-
public setState<T extends unknown | undefined>(newState: T): T {
|
|
73
|
-
if (this.vsCodeApi) {
|
|
74
|
-
return this.vsCodeApi.setState(newState);
|
|
75
|
-
} else {
|
|
76
|
-
localStorage.setItem('vscodeState', JSON.stringify(newState));
|
|
77
|
-
return newState;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
1
|
+
import { WebviewApi } from '@tomjs/vscode-webview';
|
|
81
2
|
|
|
82
3
|
// Exports class singleton to prevent multiple invocations of acquireVsCodeApi.
|
|
83
|
-
export const
|
|
4
|
+
export const vscodeApi = new WebviewApi<string>();
|