✨ feat(vscode): 代码阅读支持 Dockerfile:解析指令、每个 FROM 一个阶段(阶段名能跳过去)、RUN 交给 shell 按命令拆、复制、构建参数 / 环境变量、设置、标签、健康检查、启动,连着写的 ENV / ARG / COPY / LABEL 并成一块加一张表;语法包取自 npm 包 tree-sitter-wasm,打包时复制进扩展
This commit is contained in:
1 parent
0665f35821
commit
d4ec0e7de4
11 files changed
+1619
-4
No files matched your search
@@ -4,6 +4,7 @@ import { createRequire } from 'node:module'
|
||||
import path from 'node:path'
|
||||
import process from 'node:process'
|
||||
import * as esbuild from 'esbuild'
|
||||
import { getWasmPath } from 'tree-sitter-wasm'
|
||||
|
||||
const production = process.argv.includes('--production')
|
||||
const watch = process.argv.includes('--watch')
|
||||
@@ -33,12 +34,17 @@ const TREE_SITTER_WASM = [
|
||||
'tree-sitter-bash.wasm',
|
||||
]
|
||||
|
||||
// @vscode/tree-sitter-wasm 没有的语法包,从 tree-sitter-wasm(预编译、签过名的各家语法包)拿:语言名 → 它的 wasm
|
||||
const EXTRA_GRAMMARS = ['dockerfile']
|
||||
|
||||
function copyTreeSitterWasm() {
|
||||
const from = path.dirname(createRequire(import.meta.url).resolve('@vscode/tree-sitter-wasm'))
|
||||
const to = 'dist/tree-sitter'
|
||||
mkdirSync(to, { recursive: true })
|
||||
for (const file of TREE_SITTER_WASM)
|
||||
copyFileSync(path.join(from, file), path.join(to, file))
|
||||
for (const language of EXTRA_GRAMMARS)
|
||||
copyFileSync(getWasmPath(language), path.join(to, `tree-sitter-${language}.wasm`))
|
||||
}
|
||||
|
||||
async function main() {
|
||||
|
||||
Reference in new issue
Block a user