mirror of
https://github.com/HeyPuter/puter.git
synced 2026-01-05 12:40:26 -06:00
dev: add v86 submodule and app
This commit is contained in:
@@ -81,6 +81,12 @@ class SelfHostedModule extends AdvancedBase {
|
||||
PUTER_JS_URL: ({ global_config: config }) => config.origin + '/sdk/puter.dev.js',
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'emulator:webpack-watch',
|
||||
directory: 'src/emulator',
|
||||
command: 'npm',
|
||||
args: ['run', 'start-webpack'],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
@@ -107,6 +113,18 @@ class SelfHostedModule extends AdvancedBase {
|
||||
prefix: '/builtin/dev-center',
|
||||
path: path_.resolve(__dirname, RELATIVE_PATH, 'src/dev-center'),
|
||||
},
|
||||
{
|
||||
prefix: '/builtin/dev-center',
|
||||
path: path_.resolve(__dirname, RELATIVE_PATH, 'src/dev-center'),
|
||||
},
|
||||
{
|
||||
prefix: '/builtin/emulator',
|
||||
path: path_.resolve(__dirname, RELATIVE_PATH, 'src/emulator/dist'),
|
||||
},
|
||||
{
|
||||
prefix: '/vendor/v86',
|
||||
path: path_.resolve(__dirname, RELATIVE_PATH, 'submodules/v86/build'),
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
|
||||
45
src/emulator/assets/template.html
Normal file
45
src/emulator/assets/template.html
Normal file
@@ -0,0 +1,45 @@
|
||||
<!DOCTYPE html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title><%= htmlWebpackPlugin.options.title || 'Webpack App'%></title>
|
||||
|
||||
<% if (htmlWebpackPlugin.files.favicon) { %>
|
||||
<link rel="shortcut icon" href="<%= htmlWebpackPlugin.files.favicon%>">
|
||||
<% } %>
|
||||
<% if (htmlWebpackPlugin.options.mobile) { %>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<% } %>
|
||||
|
||||
<% for (var css in htmlWebpackPlugin.files.css) { %>
|
||||
<link href="<%= htmlWebpackPlugin.files.css[css] %>" rel="stylesheet">
|
||||
<% } %>
|
||||
|
||||
<script src="/puter.js/v2"></script>
|
||||
<script src="/vendor/v86/libv86.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<% if (htmlWebpackPlugin.options.appMountId) { %>
|
||||
<div id="<%= htmlWebpackPlugin.options.appMountId%>"></div>
|
||||
<% } %>
|
||||
|
||||
<% if (htmlWebpackPlugin.options.appMountIds && htmlWebpackPlugin.options.appMountIds.length > 0) { %>
|
||||
<% for (var index in htmlWebpackPlugin.options.appMountIds) { %>
|
||||
<div id="<%= htmlWebpackPlugin.options.appMountIds[index]%>"></div>
|
||||
<% } %>
|
||||
<% } %>
|
||||
|
||||
<% if (htmlWebpackPlugin.options.window) { %>
|
||||
<script>
|
||||
<% for (var varName in htmlWebpackPlugin.options.window) { %>
|
||||
window['<%=varName%>'] = <%= JSON.stringify(htmlWebpackPlugin.options.window[varName]) %>;
|
||||
<% } %>
|
||||
</script>
|
||||
<% } %>
|
||||
|
||||
<% for (var chunk in htmlWebpackPlugin.files.chunks) { %>
|
||||
<script src="<%= htmlWebpackPlugin.files.chunks[chunk].entry %>"></script>
|
||||
<% } %>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
16
src/emulator/package.json
Normal file
16
src/emulator/package.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "emulator",
|
||||
"version": "1.0.0",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"start-webpack": "webpack --watch --devtool source-map"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "AGPL-3.0-only",
|
||||
"description": "",
|
||||
"devDependencies": {
|
||||
"html-webpack-plugin": "^5.6.0"
|
||||
}
|
||||
}
|
||||
1
src/emulator/src/main.js
Normal file
1
src/emulator/src/main.js
Normal file
@@ -0,0 +1 @@
|
||||
puter.ui.launchApp('editor');
|
||||
12
src/emulator/webpack.config.js
Normal file
12
src/emulator/webpack.config.js
Normal file
@@ -0,0 +1,12 @@
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
|
||||
module.exports = {
|
||||
entry: [
|
||||
'./src/main.js'
|
||||
],
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin({
|
||||
template: 'assets/template.html'
|
||||
}),
|
||||
]
|
||||
};
|
||||
Reference in New Issue
Block a user