mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-13 14:30:02 -04:00
add treeshaking + bugfix
This commit is contained in:
parent
3b27792325
commit
0729a3efa8
5 changed files with 22 additions and 15 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -4,4 +4,5 @@ static/scramjet*
|
||||||
static/bare-mux.js
|
static/bare-mux.js
|
||||||
static/bare-client.js
|
static/bare-client.js
|
||||||
static/curl-client.js
|
static/curl-client.js
|
||||||
static/epoxy-client.js
|
static/epoxy-client.js
|
||||||
|
meta.json
|
||||||
|
|
10
esbuild.js
10
esbuild.js
|
@ -1,7 +1,8 @@
|
||||||
import { build } from "esbuild";
|
import { build } from "esbuild";
|
||||||
import time from "esbuild-plugin-time";
|
import time from "esbuild-plugin-time";
|
||||||
|
// import { writeFileSync } from "fs"
|
||||||
|
|
||||||
build({
|
const scramjetBuild = await build({
|
||||||
entryPoints: {
|
entryPoints: {
|
||||||
client: "./src/client/index.ts",
|
client: "./src/client/index.ts",
|
||||||
bundle: "./src/bundle/index.ts",
|
bundle: "./src/bundle/index.ts",
|
||||||
|
@ -16,4 +17,9 @@ build({
|
||||||
time()
|
time()
|
||||||
],
|
],
|
||||||
logLevel: "info",
|
logLevel: "info",
|
||||||
});
|
// metafile: true,
|
||||||
|
treeShaking: true,
|
||||||
|
minify: true
|
||||||
|
});
|
||||||
|
|
||||||
|
// writeFileSync("./meta.json", JSON.stringify(scramjetBuild.metafile));
|
||||||
|
|
|
@ -31,8 +31,7 @@ function traverseParsedHtml(node, origin?: URL) {
|
||||||
if (hasAttrib(node, "data")) node.attribs.data = encodeUrl(node.attribs.data, origin);
|
if (hasAttrib(node, "data")) node.attribs.data = encodeUrl(node.attribs.data, origin);
|
||||||
if (hasAttrib(node, "action")) node.attribs.action = encodeUrl(node.attribs.action, origin);
|
if (hasAttrib(node, "action")) node.attribs.action = encodeUrl(node.attribs.action, origin);
|
||||||
if (hasAttrib(node, "formaction")) node.attribs.formaction = encodeUrl(node.attribs.formaction, origin);
|
if (hasAttrib(node, "formaction")) node.attribs.formaction = encodeUrl(node.attribs.formaction, origin);
|
||||||
if (hasAttrib(node, "form")) node.attribs.action = encodeUrl(node.attribs.action, origin);
|
|
||||||
|
|
||||||
/* other */
|
/* other */
|
||||||
if (hasAttrib(node, "srcdoc")) node.attribs.srcdoc = rewriteHtml(node.attribs.srcdoc, origin);
|
if (hasAttrib(node, "srcdoc")) node.attribs.srcdoc = rewriteHtml(node.attribs.srcdoc, origin);
|
||||||
if (hasAttrib(node, "srcset")) node.attribs.srcset = rewriteSrcset(node.attribs.srcset, origin);
|
if (hasAttrib(node, "srcset")) node.attribs.srcset = rewriteSrcset(node.attribs.srcset, origin);
|
||||||
|
@ -84,4 +83,4 @@ export function rewriteSrcset(srcset: string, origin?: URL) {
|
||||||
});
|
});
|
||||||
|
|
||||||
return rewrittenUrls.join("");
|
return rewrittenUrls.join("");
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,6 +85,7 @@ function App() {
|
||||||
<button on:click=${() => BareMux.SetTransport("CurlMod.LibcurlClient", { wisp: store.wispurl })}>use libcurl.js</button>
|
<button on:click=${() => BareMux.SetTransport("CurlMod.LibcurlClient", { wisp: store.wispurl })}>use libcurl.js</button>
|
||||||
<button on:click=${() => BareMux.SetTransport("EpxMod.EpoxyClient", { wisp: store.wispurl })}>use epoxy</button>
|
<button on:click=${() => BareMux.SetTransport("EpxMod.EpoxyClient", { wisp: store.wispurl })}>use epoxy</button>
|
||||||
<button on:click=${() => BareMux.SetSingletonTransport(new BareMod.BareClient(store.bareurl))}>use bare server 3 (remote)</button>
|
<button on:click=${() => BareMux.SetSingletonTransport(new BareMod.BareClient(store.bareurl))}>use bare server 3 (remote)</button>
|
||||||
|
<button on:click=${() => window.open(this.urlencoded)}>open in fullscreen</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<input class="bar" bind:value=${use(store.url)} on:input=${(e) => (store.url = e.target.value)} on:keyup=${(e) => e.keyCode == 13 && console.log(this.urlencoded = __scramjet$config.prefix + __scramjet$config.codec.encode(e.target.value))} />
|
<input class="bar" bind:value=${use(store.url)} on:input=${(e) => (store.url = e.target.value)} on:keyup=${(e) => e.keyCode == 13 && console.log(this.urlencoded = __scramjet$config.prefix + __scramjet$config.codec.encode(e.target.value))} />
|
||||||
|
@ -95,4 +96,4 @@ function App() {
|
||||||
|
|
||||||
window.addEventListener("load", () => {
|
window.addEventListener("load", () => {
|
||||||
document.body.appendChild(h(App))
|
document.body.appendChild(h(App))
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
// "allowJs": true,
|
// "allowJs": true,
|
||||||
"allowImportingTsExtensions": true,
|
"allowImportingTsExtensions": true,
|
||||||
"rootDir": "./src",
|
"rootDir": "./src",
|
||||||
"target": "ES2020",
|
"target": "ES2020",
|
||||||
"moduleResolution": "Bundler",
|
"moduleResolution": "Bundler",
|
||||||
"noEmit": true,
|
"noEmit": true
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue