Compare commits
1 Commits
f111c83817
...
3a94c90251
| Author | SHA1 | Date | |
|---|---|---|---|
|
3a94c90251
|
10
package-lock.json
generated
10
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "oxygen-ui",
|
||||
"version": "1.0.1-SNAPSHOT",
|
||||
"version": "1.0.0-SNAPSHOT",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "oxygen-ui",
|
||||
"version": "1.0.1-SNAPSHOT",
|
||||
"version": "1.0.0-SNAPSHOT",
|
||||
"dependencies": {
|
||||
"@ant-design/icons": "^5.3.7",
|
||||
"@dnd-kit/core": "^6.1.0",
|
||||
@@ -2153,9 +2153,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/acorn": {
|
||||
"version": "8.12.1",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz",
|
||||
"integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==",
|
||||
"version": "8.11.3",
|
||||
"resolved": "https://registry.npmmirror.com/acorn/-/acorn-8.11.3.tgz",
|
||||
"integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"acorn": "bin/acorn"
|
||||
|
||||
@@ -32,7 +32,7 @@ const Preview = ({
|
||||
Compiler.compile(files, importMap, entryPoint)
|
||||
.then((result) => {
|
||||
setCompiledCode(
|
||||
`(()=>{${preExpansionCode}})();\n(()=>{${result.outputFiles[0].text}})();\n(()=>{${postExpansionCode}})();`
|
||||
`${preExpansionCode}\n${result.outputFiles[0].text}\n${postExpansionCode}`
|
||||
)
|
||||
setErrorMsg('')
|
||||
})
|
||||
|
||||
@@ -2,7 +2,7 @@ import esbuild, { Loader, OnLoadArgs, Plugin, PluginBuild } from 'esbuild-wasm'
|
||||
import localforage from 'localforage'
|
||||
import axios from 'axios'
|
||||
import { IFiles, IImportMap } from '@/components/Playground/shared'
|
||||
import { addReactImport, cssToJs, jsonToJs } from '@/components/Playground/files'
|
||||
import { cssToJs, jsonToJs, addReactImport } from '@/components/Playground/files'
|
||||
|
||||
class Compiler {
|
||||
private init = false
|
||||
@@ -73,7 +73,8 @@ class Compiler {
|
||||
files: IFiles,
|
||||
importMap: IImportMap,
|
||||
entryPoint: string
|
||||
): Plugin => ({
|
||||
): Plugin => {
|
||||
return {
|
||||
name: 'file-resolver-plugin',
|
||||
setup: (build: PluginBuild) => {
|
||||
build.onResolve({ filter: /.*/ }, (args: esbuild.OnResolveArgs) => {
|
||||
@@ -215,7 +216,8 @@ class Compiler {
|
||||
return result
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default new Compiler()
|
||||
|
||||
@@ -27,7 +27,7 @@ const Execute = () => {
|
||||
const output = result.outputFiles[0].text
|
||||
setCompiledCode('')
|
||||
setTimeout(() => {
|
||||
setCompiledCode(`(() => {${output}})();\n(() => {${baseDist}})();`)
|
||||
setCompiledCode(`${output}\n${baseDist}`)
|
||||
}, 100)
|
||||
})
|
||||
.catch((reason) => {
|
||||
|
||||
@@ -145,7 +145,7 @@ const Create = () => {
|
||||
.compile(files, importMap, template.entryPoint)
|
||||
.then((result) => {
|
||||
const output = result.outputFiles[0].text
|
||||
setCompiledCode(`(() => {${output}})();\n(() => {${baseDist}})();`)
|
||||
setCompiledCode(`${output}\n${baseDist}`)
|
||||
})
|
||||
.catch((reason) => {
|
||||
void message.error(`编译失败:${reason}`)
|
||||
|
||||
@@ -34,7 +34,7 @@ const View = () => {
|
||||
const output = result.outputFiles[0].text
|
||||
setCompiledCode('')
|
||||
setTimeout(() => {
|
||||
setCompiledCode(`(() => {${output}})();\n(() => {${baseDist}})();`)
|
||||
setCompiledCode(`${output}\n${baseDist}`)
|
||||
}, 100)
|
||||
})
|
||||
.catch((reason) => {
|
||||
@@ -49,7 +49,7 @@ const View = () => {
|
||||
const dist = base64ToStr(toolVo.dist.data!)
|
||||
setCompiledCode('')
|
||||
setTimeout(() => {
|
||||
setCompiledCode(`(() => {${dist}})();\n(() => {${baseDist}})();`)
|
||||
setCompiledCode(`${dist}\n${baseDist}`)
|
||||
}, 100)
|
||||
} catch (e) {
|
||||
void message.error('载入工具失败')
|
||||
|
||||
Reference in New Issue
Block a user