ESM preview.

This commit is contained in:
Sean Morris committed 2023-10-10 12:23:08 -04:00
1 parent ab20aebdc4
commit 31e1262f84
8 files changed
+346 -9

No files matched your search

+3
View File
@@ -1,4 +1,5 @@
/php*.js
/php*.mjs
/php*.wasm
/php*.wat
/php*.wasm.map
@@ -9,7 +10,9 @@ docs-source/app/assets/php*.wat
docs-source/app/assets/php*.wasm.map
docs-source/app/assets/php*.data
/Php*.js
/Php*.mjs
/*.js
/*.mjs
/node_modules
configured
.env
+4 -4
View File
@@ -61,9 +61,9 @@ DOCKER_RUN_IN_ICONV =${DOCKER_ENV_SIDE} -w /src/third_party/libiconv-1.17/ emsc
TIMER=(which pv > /dev/null && pv --name '${@}' || cat)
.PHONY: web all clean show-ports image js hooks push-image pull-image
all: php-web-drupal.js php-web.js php-webview.js php-node.js php-shell.js php-worker.js \
php-web-drupal.mjs php-web.mjs php-webview.mjs php-node.mjs php-shell.mjs php-worker.mjs \
js
all: cjs mjs js
cjs: php-web-drupal.js php-web.js php-webview.js php-node.js php-shell.js php-worker.js
mjs: php-web-drupal.mjs php-web.mjs php-webview.mjs php-node.mjs php-shell.mjs php-worker.mjs
web-drupal: php-web-drupal.wasm php-web-drupal.mjs
web: php-web.wasm php-web.mjs
@ echo "Done!"
@@ -371,7 +371,7 @@ show-files:
hooks:
@ git config core.hooksPath githooks
js:
js: cjs mjs
@ echo -e "\e[33mBuilding JS"
@ npm install
@ npx babel source --out-dir .
+2 -2
View File
@@ -216,11 +216,11 @@ self.addEventListener('message', function (event) {});
self.addEventListener('push', function (event) {
console.log(event);
});
});
require.register("___globals___", function(exports, require, module) {
});})();require('___globals___');
require('DrupalWorker');
require('DrupalWorker');
//# sourceMappingURL=DrupalWorker.js.map
+295 -1
View File
@@ -1 +1,295 @@
@font-face{src:url(fsex302-webfont.woff) format('woff');font-weight:400;font-style:normal;font-family:fixedsys}body{font-family:fixedsys;display:flex;flex-direction:column;align-items:stretch;height:100vh;padding:0;margin:0;background-color:#aaa}.output .scroller{background-color:#eee}.output div.scroller{white-space:pre}.output .row{background-color:#fff;padding:.5em .5em;border-bottom:1px #fff solid}.row.toolbar{margin:.5em;padding:.5em 0;border:2px solid;border-image:url(border-inset.png) 2 2 2 2;align-items:center}.row.toolbar>div{display:flex;justify-content:flex-end;padding:0 .5em;flex:1;flex-direction:row}.row.toolbar>div .start{align-items:center;flex:1}.row.toolbar button[data-run]{padding:.75em;font-weight:700;border:2px solid;align-self:center;margin-right:.5em}button{border-image:url(border.png) 2 2 2 2}button[data-run]:not([disabled])::after{position:absolute;top:-2px;left:-2px;bottom:-2px;right:-2px;content:'';background-color:red!important;mix-blend-mode:darken;opacity:.5}.header button[data-run]{position:relative;font-weight:700;font-size:13pt;box-sizing:border-box}:focus{outline-style:dotted;outline-color:#000}.row:focus{background-color:#000082;border-bottom:1px #000082 solid;color:#fff}.row.toolbar.header{background-color:#bbb}.row.toolbar.status{padding:0}.row.toolbar.status>div{padding:.25em}h1{margin:0;margin:.25em;white-space:nowrap}.row{display:flex;flex-direction:row}body>div{display:flex;flex-direction:row}.row.body{flex-grow:1}.collapse{flex-grow:0;flex-shrink:1}div.column{position:relative;flex:1}div.column .scroller{position:absolute;top:0;left:0;bottom:0;right:0;width:100%;height:100%;overflow-y:auto;overflow-x:auto;font-size:.9rem}div.panel{font-family:fixedsys;display:flex;position:relative;background-color:#aaa;flex-direction:column;box-sizing:border-box;margin:.5em;flex:1;border-right:1px solid rgba(0,0,0,.5);border-bottom:1px solid rgba(0,0,0,.5)}div.panel div.input{background-color:#272822}div.panel>div{background-color:#fff;border:2px solid;border-image:url(border-inset.png) 2 2 2 2;flex-direction:column;display:flex;flex:1}.liquid{display:flex;flex-direction:column;flex:1}.panel label,button{user-select:none;border:2px solid;border-image:url(border.png) 2 2 2 2!important;background-color:#c3c3c3;padding:.25em}.input,.output .scroller,iframe{user-select:normal}.panel .cols{margin-top:-1px}.panel label[tabindex]:first-child{margin-left:-1px}.panel .cols>label[tabindex]:last-child{margin-right:-3px}.ace_editor{margin-right:-2px}button:active,label[tabindex]:active{border:2px solid;border-image:url(border-inset.png) 2 2 2 2!important;position:relative;z-index:100}.header label{display:flex;align-items:center;justify-content:flex-end}.header label p{text-align:right}pre{flex:1;margin-top:0;margin-bottom:0}.round{border-radius:50%;height:49px;margin-right:5px}.credit{padding-right:.5em;padding-left:.5em}.column .row{white-space:pre}.cols{display:flex;flex-direction:row!important}.rows{display:flex;flex-direction:column!important}.cols label{flex:1}label{user-select:none}.collapse{flex:0!important;white-space:nowrap}.header.row{align-items:flex-start}iframe{border:none}input[type=file]{display:none}.header select{font-size:1rem}
@font-face {
src: url('fsex302-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
font-family: 'fixedsys';
}
body {
font-family: 'fixedsys';
display: flex;
flex-direction: column;
align-items: stretch;
height: 100vh;
padding: 0px;
margin: 0px;
background-color: #aaa;
}
.output {
}
.output .scroller {
background-color: #EEE;
}
.output div.scroller {
white-space: pre;
}
.output .row {
background-color: #FFF;
padding: 0.5em 0.5em;
border-bottom: 1px white solid;
}
.row.toolbar {
margin: 0.5em;
padding: 0.5em 0em;
border: 2px solid;
border-image: url(border-inset.png) 2 2 2 2;
align-items: center;
}
.row.toolbar > div{
display: flex;
justify-content: flex-end;
padding: 0em 0.5em;
flex: 1;
flex-direction: row;
}
.row.toolbar > div .start{
align-items: center;
flex: 1;
}
.row.toolbar button[data-run] {
padding: 0.75em;
font-weight: bold;
border: 2px solid;
align-self: center;
margin-right: 0.5em;
}
button {
border-image: url(border.png) 2 2 2 2;
}
button[data-run]:not([disabled])::after {
position: absolute;
top: -2px;
left:-2px;
bottom:-2px;
right:-2px;
content: '';
background-color: #F00 !important;
mix-blend-mode: darken;
opacity: 0.5;
}
.header button[data-run] {
position: relative;
font-weight: bold;
font-size: 13pt;
box-sizing: border-box;
}
*:focus {
outline-style: dotted;
outline-color: black;
}
.row:focus {
background-color: #000082;
border-bottom: 1px #000082 solid;
color: #FFF;
}
.row.toolbar.header{
background-color: #BBB;
}
.row.toolbar.status {
padding: 0;
}
.row.toolbar.status > div {
padding: 0.25em;
}
h1 {
margin: 0em;
margin: 0.25em;
white-space: nowrap;
}
.row {
display: flex;
flex-direction: row;
}
body > div {
display: flex;
flex-direction: row;
}
.row.body {
flex-grow: 1;
}
.collapse {
flex-grow: 0;
flex-shrink: 1;
}
div.column {
position: relative;
flex: 1;
}
div.column .scroller {
position: absolute;
top: 0px;
left: 0px;
bottom: 0px;
right: 0px;
width: 100%;
height: 100%;
overflow-y: auto;
overflow-x: auto;
font-size: 0.9rem;
}
div.panel {
font-family: 'fixedsys';
display: flex;
position: relative;
background-color: #aaa;
flex-direction: column;
box-sizing: border-box;
margin: 0.5em;
flex: 1;
border-right: 1px solid rgba(0,0,0,0.5);
border-bottom: 1px solid rgba(0,0,0,0.5);
}
div.panel div.input {
background-color: #272822;
}
div.panel > div {
background-color: white;
border: 2px solid;
border-image: url(border-inset.png) 2 2 2 2;
flex-direction: column;
display: flex;
flex: 1;
}
.liquid{
display: flex;
flex-direction: column;
flex: 1;
}
button,
.panel label {
user-select: none;
border: 2px solid;
border-image: url(border.png) 2 2 2 2 !important;
background-color: #c3c3c3;
padding: 0.25em;
}
.input, .output .scroller, iframe {
user-select: normal;
}
.panel .cols {
margin-top: -1px;
}
.panel label[tabindex]:first-child {
margin-left: -1px;
}
.panel .cols > label[tabindex]:last-child {
margin-right: -3px;
}
.ace_editor {
margin-right: -2px;
}
label[tabindex]:active,
button:active {
border: 2px solid;
border-image: url(border-inset.png) 2 2 2 2 !important;
position: relative;
z-index: 100;
}
.header label {
display: flex;
align-items: center;
justify-content: flex-end;
}
.header label p {
text-align: right;
}
pre {
flex: 1;
margin-top: 0px;
margin-bottom: 0px;
}
.round {
border-radius: 50%;
height: 49px;
margin-right: 5px;
}
.credit{
padding-right: 0.5em;
padding-left: 0.5em;
}
.column .row {
white-space: pre;
}
.cols {
display: flex;
flex-direction: row !important;
}
.rows {
display: flex;
flex-direction: column !important;
}
.cols label {
flex: 1;
}
label {
user-select: none;
}
.collapse {
flex: 0 !important;
white-space: nowrap;
}
.header.row {
align-items: flex-start;
}
iframe {
border: none;
}
input[type=file] {
display: none;
}
.header select {
font-size: 1rem;
}
/*# sourceMappingURL=app.css.map*/
+26 -1
View File
@@ -510,6 +510,30 @@ var UniqueIndex = function UniqueIndex() {
exports.UniqueIndex = UniqueIndex;
})();
});
require.register("php-wasm/php-web-drupal.js", function(exports, require, module) {
require = __makeRelativeRequire(require, {}, "php-wasm");
(function() {
var PHP = (() => {
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
return (
function(moduleArg = {}) {
var Module=moduleArg;var readyPromiseResolve,readyPromiseReject;Module["ready"]=new Promise(((resolve,reject)=>{readyPromiseResolve=resolve;readyPromiseReject=reject}));if(!Module.expectedDataFileDownloads){Module.expectedDataFileDownloads=0}Module.expectedDataFileDownloads++;(function(){if(Module["ENVIRONMENT_IS_PTHREAD"]||Module["$ww"])return;var loadPackage=function(metadata){var PACKAGE_PATH="";if(typeof window==="object"){PACKAGE_PATH=window["encodeURIComponent"](window.location.pathname.toString().substring(0,window.location.pathname.toString().lastIndexOf("/"))+"/")}else if(typeof process==="undefined"&&typeof location!=="undefined"){PACKAGE_PATH=encodeURIComponent(location.pathname.toString().substring(0,location.pathname.toString().lastIndexOf("/"))+"/")}var PACKAGE_NAME="../../build/php-web-drupal.data";var REMOTE_PACKAGE_BASE="php-web-drupal.data";if(typeof Module["locateFilePackage"]==="function"&&!Module["locateFile"]){Module["locateFile"]=Module["locateFilePackage"];err("warning: you defined Module.locateFilePackage, that has been renamed to Module.locateFile (using your locateFilePackage for now)")}var REMOTE_PACKAGE_NAME=Module["locateFile"]?Module["locateFile"](REMOTE_PACKAGE_BASE,""):REMOTE_PACKAGE_BASE;var REMOTE_PACKAGE_SIZE=metadata["remote_package_size"];function fetchRemotePackage(packageName,packageSize,callback,errback){var xhr=new XMLHttpRequest;xhr.open("GET",packageName,true);xhr.responseType="arraybuffer";xhr.onprogress=function(event){var url=packageName;var size=packageSize;if(event.total)size=event.total;if(event.loaded){if(!xhr.addedTotal){xhr.addedTotal=true;if(!Module.dataFileDownloads)Module.dataFileDownloads={};Module.dataFileDownloads[url]={loaded:event.loaded,total:size}}else{Module.dataFileDownloads[url].loaded=event.loaded}var total=0;var loaded=0;var num=0;for(var download in Module.dataFileDownloads){var data=Module.dataFileDownloads[download];total+=data.total;loaded+=data.loaded;num++}total=Math.ceil(total*Module.expectedDataFileDownloads/num);if(Module["setStatus"])Module["setStatus"](`Downloading data... (${loaded}/${total})`)}else if(!Module.dataFileDownloads){if(Module["setStatus"])Module["setStatus"]("Downloading data...")}};xhr.onerror=function(event){throw new Error("NetworkError for: "+packageName)};xhr.onload=function(event){if(xhr.status==200||xhr.status==304||xhr.status==206||xhr.status==0&&xhr.response){var packageData=xhr.response;callback(packageData)}else{throw new Error(xhr.statusText+" : "+xhr.responseURL)}};xhr.send(null)}function handleError(error){console.error("package error:",error)}var fetchedCallback=null;var fetched=Module["getPreloadedPackage"]?Module["getPreloadedPackage"](REMOTE_PACKAGE_NAME,REMOTE_PACKAGE_SIZE):null;if(!fetched)fetchRemotePackage(REMOTE_PACKAGE_NAME,REMOTE_PACKAGE_SIZE,(function(data){if(fetchedCallback){fetchedCallback(data);fetchedCallback=null}else{fetched=data}}),handleError);function runWithFS(){function assert(check,msg){if(!check)throw msg+(new Error).stack}Module["FS_createPath"]("/","preload",true,true);Module["FS_createPath"]("/preload","Zend",true,true);Module["FS_createPath"]("/preload","drupal-7.95",true,true);Module["FS_createPath"]("/preload/drupal-7.95","includes",true,true);Module["FS_createPath"]("/preload/drupal-7.95/includes","database",true,true);Module["FS_createPath"]("/preload/drupal-7.95/includes/database","mysql",true,true);Module["FS_createPath"]("/preload/drupal-7.95/includes/database","pgsql",true,true);Module["FS_createPath"]("/preload/drupal-7.95/includes/database","sqlite",true,true);Module["FS_createPath"]("/preload/drupal-7.95/includes","filetransfer",true,true);Module["FS_createPath"]("/preload/drupal-7.95","misc",true,true);Module["FS_createPath"]("/preload/drupal-7.95/misc","brumann",true,true);Module["FS_createPath"]("/preload/drupal-7.95/misc/brumann","polyfill-unserialize",true,true);Module["FS_createPath"]("/preload/drupal-7.95/misc/brumann/polyfill-unserialize","src",true,true);Module["FS_createPath"]("/preload/drupal-7.95/misc","farbtastic",true,true);Module["FS_createPath"]("/preload/drupal-7.95/misc","typo3",true,true);Module["FS_createPath"]("/preload/drupal-7.95/misc/typo3","drupal-security",true,true);Module["FS_createPath"]("/preload/drupal-7.95/misc/typo3","phar-stream-wrapper",true,true);Module["FS_createPath"]("/preload/drupal-7.95/misc/typo3/phar-stream-wrapper","src",true,true);Module["FS_createPath"]("/preload/drupal-7.95/misc/typo3/phar-stream-wrapper/src","Interceptor",true,true);Module["FS_createPath"]("/preload/drupal-7.95/misc/typo3/phar-stream-wrapper/src","Phar",true,true);Module["FS_createPath"]("/preload/drupal-7.95/misc/typo3/phar-stream-wrapper/src","Resolver",true,true);Module["FS_createPath"]("/preload/drupal-7.95/misc","ui",true,true);Module["FS_createPath"]("/preload/drupal-7.95/misc/ui","images",true,true);Module["FS_createPath"]("/preload/drupal-7.95","modules",true,true);Module["FS_createPath"]("/preload/drupal-7.95/modules","aggregator",true,trLine truncated
return moduleArg.ready
}
);
})();
if (typeof exports === 'object' && typeof module === 'object')
module.exports = PHP;
else if (typeof define === 'function' && define['amd'])
define([], () => PHP);
})();
});
require.register("initialize.js", function(exports, require, module) {
"use strict";
@@ -857,10 +881,11 @@ document.addEventListener('DOMContentLoaded', function () {
});
});
});
});
require.register("___globals___", function(exports, require, module) {
});})();require('___globals___');
//# sourceMappingURL=app.js.map
+2
View File
@@ -160,3 +160,5 @@ module.exports = "<?php\nini_set('session.save_path', '/home/web_user');\nsessio
});})();require('___globals___');
//# sourceMappingURL=include.js.map
+1 -1
View File
@@ -3,7 +3,7 @@
"description": "Run PHP right in the browser.",
"repository": "https://github.com/seanmorris/pib",
"author": "Oraoto <oraoto@outlook.com>",
"version": "0.0.0-esm-preview-4",
"version": "0.0.0-esm-preview-5",
"license": "Apache-2.0",
"dependencies": {},
"devDependencies": {
+13
View File
@@ -62,6 +62,19 @@ diff --git a/third_party/php8.2-src/ext/pdo_sqlite/pdo_sqlite.c b/third_party/ph
#include "php_pdo_sqlite.h"
#include "php_pdo_sqlite_int.h"
#include "zend_exceptions.h"
diff --git a/ext/pdo_sqlite/php_pdo_sqlite.h b/ext/pdo_sqlite/php_pdo_sqlite.h
index 1bba9e35..62cf4a5f 100644
--- a/ext/pdo_sqlite/php_pdo_sqlite.h
+++ b/ext/pdo_sqlite/php_pdo_sqlite.h
@@ -17,7 +17,7 @@
#ifndef PHP_PDO_SQLITE_H
#define PHP_PDO_SQLITE_H
-extern zend_module_entry pdo_sqlite_module_entry;
+zend_module_entry pdo_sqlite_module_entry;
#define phpext_pdo_sqlite_ptr &pdo_sqlite_module_entry
#include "php_version.h"
diff --git a/third_party/php8.2-src/ext/pdo_sqlite/sqlite_driver.c b/third_party/php8.2-src/ext/pdo_sqlite/sqlite_driver.c
index 83ea2d60..7265bfc7 100644
--- a/third_party/php8.2-src/ext/pdo_sqlite/sqlite_driver.c