1.0.2 • Published 2 years ago

@timshaw9791/repl v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@embracex/repl

  • fork自 @vue/repl - Vue SFC REPL as a Vue 3 component.
  • 目的是为webworker或者dom环境下提供一个直接能编译vue3 sfc+ts入口的lib,便于weblock项目为预览进行编译。
  • vue-playground项目中体验深入分析而来。

如何跟踪

Advanced Usage

import { VueCompiler } from ''@embracex/repl'
//准备源代码
let files:Record<String,String>=...
files['src/components/Login.vue']='....'
files['src/main.ts']='.....';
let mainFileName='src/main.ts'

//构建响应式store,并给定源代码
const replStore:ReplStore=createReplStore(files,mainFileName);

//从入口编译各模块,因此会把没用到的文件省略编译。如果没有制定入口文件,则编译所有的文件。
const resultModules:string[]= await replStore.compileFiles();

//模块window全局化,便于互相引用。
const modules:string[] =compileModulesForPreview(store);

publish to npm : npm bulish --access public

TODO

  • ts/js/vue(setup) 支持
  • 支持多层目录
  • 获取构建时的错误提示
  • 部分文件修改后的响应式

1.0.2

2 years ago

1.0.0

2 years ago