Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: extract preview features to vscode-vue-preview
- Loading branch information
1 parent
0934463
commit 719d31a
Showing
19 changed files
with
337 additions
and
164 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
out | ||
src | ||
scripts | ||
tsconfig.build.json | ||
tsconfig.build.tsbuildinfo |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021-present Johnson Chu | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
File renamed without changes
File renamed without changes
File renamed without changes
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,135 @@ | ||
{ | ||
"private": true, | ||
"name": "vscode-vue-preview", | ||
"version": "1.0.24", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/johnsoncodehk/volar.git", | ||
"directory": "packages/vscode-vue-preview" | ||
}, | ||
"sponsor": { | ||
"url": "https://github.com/sponsors/johnsoncodehk" | ||
}, | ||
"displayName": "Vue and Nuxt Preview (from Volar)", | ||
"description": "Component and App Preview For Vue and Nuxt", | ||
"author": "johnsoncodehk", | ||
"publisher": "johnsoncodehk", | ||
"engines": { | ||
"vscode": "^1.67.0" | ||
}, | ||
"activationEvents": [ | ||
"onLanguage:vue", | ||
"onWebviewPanel:preview" | ||
], | ||
"main": "./dist/extension.js", | ||
"contributes": { | ||
"views": { | ||
"explorer": [ | ||
{ | ||
"id": "vueComponentPreview", | ||
"name": "Vue Component Preview", | ||
"type": "webview", | ||
"when": "volar.foundViteDir || volar.foundNuxtDir" | ||
} | ||
] | ||
}, | ||
"languages": [ | ||
{ | ||
"id": "vue", | ||
"extensions": [ | ||
".vue" | ||
] | ||
} | ||
], | ||
"configuration": { | ||
"type": "object", | ||
"title": "Volar", | ||
"properties": { | ||
"volar.preview.script.vite": { | ||
"type": "string", | ||
"default": "node {VITE_BIN} --port={PORT}" | ||
}, | ||
"volar.preview.script.nuxi": { | ||
"type": "string", | ||
"default": "node {NUXI_BIN} dev --port {PORT}" | ||
}, | ||
"volar.preview.port": { | ||
"type": "number", | ||
"default": 3333, | ||
"description": "Default port for component preview server." | ||
}, | ||
"volar.preview.root": { | ||
"type": "string", | ||
"default": ".", | ||
"description": "Component preview root directory. (For Nuxt, it should be \"./src\" by default.)" | ||
}, | ||
"volar.preview.backgroundColor": { | ||
"type": "string", | ||
"default": "#fff", | ||
"description": "Component preview background color." | ||
}, | ||
"volar.preview.transparentGrid": { | ||
"type": "boolean", | ||
"default": false, | ||
"description": "Component preview background style." | ||
} | ||
} | ||
}, | ||
"commands": [ | ||
{ | ||
"command": "volar.action.vite", | ||
"title": "Experimental Features for Vite", | ||
"category": "Volar", | ||
"icon": "images/vite-logo.svg" | ||
}, | ||
{ | ||
"command": "volar.action.nuxt", | ||
"title": "Experimental Features for Nuxt", | ||
"category": "Volar", | ||
"icon": "images/nuxt-logo.svg" | ||
} | ||
], | ||
"menus": { | ||
"commandPalette": [ | ||
{ | ||
"command": "volar.action.vite", | ||
"when": "editorLangId == vue" | ||
}, | ||
{ | ||
"command": "volar.action.nuxt", | ||
"when": "editorLangId == vue" | ||
} | ||
], | ||
"editor/title": [ | ||
{ | ||
"command": "volar.action.vite", | ||
"when": "editorLangId == vue && config.volar.icon.preview && volar.foundViteDir", | ||
"group": "navigation" | ||
}, | ||
{ | ||
"command": "volar.action.nuxt", | ||
"when": "editorLangId == vue && config.volar.icon.preview && volar.foundNuxtDir", | ||
"group": "navigation" | ||
} | ||
] | ||
} | ||
}, | ||
"scripts": { | ||
"prebuild": "cd ../.. && npm run build", | ||
"build": "node scripts/build", | ||
"watch": "npm run build -- --watch", | ||
"prepack": "npm run prebuild && npm run build -- --minify", | ||
"pack": "npm run prepack && vsce package", | ||
"release": "npm run prepack && vsce publish" | ||
}, | ||
"devDependencies": { | ||
"@types/vscode": "1.67.0", | ||
"@volar/preview": "1.0.24", | ||
"@volar/vscode-language-client": "1.2.0-alpha.9", | ||
"esbuild": "0.15.18", | ||
"esbuild-plugin-copy": "latest", | ||
"typesafe-path": "^0.2.2", | ||
"vscode-html-languageservice": "^5.0.4", | ||
"vsce": "latest" | ||
} | ||
} |
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,38 @@ | ||
require('esbuild').build({ | ||
entryPoints: { | ||
extension: './out/extension.js', | ||
}, | ||
bundle: true, | ||
metafile: process.argv.includes('--metafile'), | ||
outdir: './dist', | ||
external: [ | ||
'vscode', | ||
], | ||
format: 'cjs', | ||
platform: 'node', | ||
tsconfig: '../../tsconfig.build.json', | ||
define: { 'process.env.NODE_ENV': '"production"' }, | ||
minify: process.argv.includes('--minify'), | ||
watch: process.argv.includes('--watch'), | ||
plugins: [ | ||
{ | ||
name: 'umd2esm', | ||
setup(build) { | ||
build.onResolve({ filter: /^(vscode-.*|estree-walker|jsonc-parser)/ }, args => { | ||
const pathUmdMay = require.resolve(args.path, { paths: [args.resolveDir] }) | ||
// Call twice the replace is to solve the problem of the path in Windows | ||
const pathEsm = pathUmdMay.replace('/umd/', '/esm/').replace('\\umd\\', '\\esm\\') | ||
return { path: pathEsm } | ||
}) | ||
}, | ||
}, | ||
require('esbuild-plugin-copy').copy({ | ||
resolveFrom: 'cwd', | ||
assets: { | ||
from: ['./node_modules/@volar/preview/bin/**/*'], | ||
to: ['./dist/bin'], | ||
}, | ||
keepStructure: true, | ||
}), | ||
], | ||
}).catch(() => 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
File renamed without changes.
File renamed without changes.
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,16 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"noEmit": false, | ||
"outDir": "out", | ||
"rootDir": "src", | ||
}, | ||
"include": [ | ||
"src", | ||
], | ||
"references": [ | ||
{ | ||
"path": "../preview/tsconfig.build.json" | ||
} | ||
] | ||
} |
Oops, something went wrong.