dev: add v86 submodule and app

This commit is contained in:
KernelDeimos
2024-09-02 20:49:48 -04:00
parent 5ab3d88393
commit d07929da1b
8 changed files with 445 additions and 0 deletions

View File

@@ -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'),
},
],
});

View 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
View 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
View File

@@ -0,0 +1 @@
puter.ui.launchApp('editor');

View File

@@ -0,0 +1,12 @@
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: [
'./src/main.js'
],
plugins: [
new HtmlWebpackPlugin({
template: 'assets/template.html'
}),
]
};