Skip to content

Commit 8410335

Browse files
committed
update npm to esm
1 parent 473b0ba commit 8410335

File tree

7 files changed

+56
-44
lines changed

7 files changed

+56
-44
lines changed

oomph.tar.gz

221 KB
Binary file not shown.

registry.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import { serveFile } from "https://deno.land/std/http/file_server.ts";
22

33
Deno.serve({ port: 8002 }, (req) => {
4-
const { pathname } = new URL(req.url);
4+
const { pathname } = new URL(req.url);
55

6-
console.log(`./${pathname}`)
7-
return serveFile(req, `./${pathname}`)
8-
9-
});
6+
console.log(`./${pathname}`);
7+
return serveFile(req, `./${pathname}`);
8+
});

src/components/app-head.jsx

Lines changed: 39 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,48 +18,65 @@ const AppHeader = ({ name = "oomph", icon = "/favicon.png" }) => {
1818
<link rel="stylesheet" href="/output.css" />
1919
<link rel="manifest" href="/manifest.json" />
2020
<meta property="og:title" content="Sauveur Dev" />
21-
<meta
21+
<meta
2222
property="og:description"
2323
content="For the people who shape culture, Glimpse into the future of trade."
24-
/>
25-
<meta property="og:image" content="/background.jpg" />
26-
<meta property="og:url" content="https://sauveur.dev" />
24+
/>
25+
<meta property="og:image" content="/background.jpg" />
26+
<meta property="og:url" content="https://sauveur.dev" />
2727

28-
<meta name="twitter:title" content="Sauveur Dev" />
29-
<meta
28+
<meta name="twitter:title" content="Sauveur Dev" />
29+
<meta
3030
name="twitter:description"
3131
content="For the people who shape culture, Glimpse into the future of trade."
32-
/>
33-
<meta name="twitter:image" content="/background.jpg" />
34-
<meta name="twitter:card" content="summary_large_image" />
35-
<meta
32+
/>
33+
<meta name="twitter:image" content="/background.jpg" />
34+
<meta name="twitter:card" content="summary_large_image" />
35+
<meta
3636
name="description"
3737
content="For the people who shape culture, Glimpse into the future of trade."
38-
/>
38+
/>
3939

4040
{/*https://developer.mozilla.org/en-US/docs/Web/Manifest*/}
4141
</head>
4242
);
4343
};
4444
export default async ({ name, icon }) => {
4545
let manifest = { name: "oomph", icon: "/favicon.png" };
46-
// const manifest_path = `file:///${window._cwd}/src/public/manifest.json`;
47-
46+
const manifest_path = `${window._cwd}/src/public/manifest.json`;
47+
48+
// file:///$
49+
try {
50+
console.log(await exists(manifest_path), "manifest exists");
51+
const { default: _manifest } = await import(
52+
manifest_path,
53+
{
54+
assert: {
55+
type: "json",
56+
},
57+
}
58+
);
59+
60+
console.log(_manifest, "manifest file");
61+
} catch (err) {
62+
console.log(err);
63+
}
64+
4865
// if (exists(manifest_path)) {
4966
// console.log(manifest_path, "it exists")
50-
// const { default: _manifest } = await import(
51-
// manifest_path,
52-
// {
53-
// assert: {
54-
// type: "json",
55-
// },
56-
// }
57-
// );
67+
// const { default: _manifest } = await import(
68+
// manifest_path,
69+
// {
70+
// assert: {
71+
// type: "json",
72+
// },
73+
// }
74+
// );
5875
// manifest.name = _manifest.name;
5976
// manifest.icon = _manifest.icons[0].src;
6077
// }
6178

6279
return renderToString(
6380
<AppHeader name={manifest.name} icon={manifest.icon} />,
64-
);
81+
);
6582
};

src/middleware/asset.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import postcss from "npm:postcss";
44
import autoprefixer from "npm:autoprefixer";
55
import tailwindcss from "npm:tailwindcss";
66
// https://lightningcss.dev/docs.html
7-
import { transform } from "npm:lightningcss";
8-
//import init, { transform } from 'https://esm.run/lightningcss-wasm';
7+
// import { transform } from "npm:lightningcss";
8+
import init, { transform } from 'https://esm.run/lightningcss-wasm';
99

1010
const asset_middlware = async (request, type) => {
1111
const _cwd = window._cwd;
@@ -44,7 +44,7 @@ const asset_middlware = async (request, type) => {
4444
}
4545
} catch (err) {
4646
err.log();
47-
// throw new Error("File Does Not Exist");
47+
// throw new Error("File Does Not Exist");
4848
return new Response("Internal Server Error", {
4949
status: 500,
5050
});

src/middleware/html.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ const html_middleware = async (req, isProd) => {
4141

4242
const getManifest = async (isProd) => {
4343
const app_path = window._app;
44-
let manifest_path = `file:///${app_path}/src/public/manifest.json`
44+
let manifest_path = `file:///${app_path}/src/public/manifest.json`;
4545

4646
if (!Deno.build.os === "windows" && isProd) {
4747
manifest_path = `app/${app_path}/src/public/manifest.json`;
48-
} else if (!Deno.build.os === "windows" && !isProd){
48+
} else if (!Deno.build.os === "windows" && !isProd) {
4949
manifest_path = await import(`${app_path}/src/public/manifest.json`);
5050
}
5151

@@ -57,9 +57,9 @@ const getManifest = async (isProd) => {
5757
type: "json",
5858
},
5959
}
60-
);
60+
);
6161
}
62-
}
62+
};
6363

6464
const set_error = () => {
6565
isError = true;

src/middleware/script.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ const script_middleware = async (req, isProd) => {
1212
res = await import(`app/${app_path}${_pathname}`);
1313
}
1414

15-
1615
if (res.onServer) {
1716
onServerResult = await res.onServer(_pathname, req);
1817
}

src/middleware/utls/components/index.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ const getComponentsAtributes = (component) => {
1010
return component.match(atribute_regex);
1111
};
1212

13-
1413
const getGlobalElementPath = (element_name) => {
1514
return `../../../components/${element_name}.jsx`;
1615
};
@@ -47,7 +46,7 @@ export const compileDoc = async (html, elements, path, isProd) => {
4746
await Promise.all(elements.map(async (element) => {
4847
const element_name_regex = /<([a-z]+-[a-z]+)(\s+[^>]+)?\/>/;
4948
const element_name_match = element.match(element_name_regex);
50-
49+
5150
const element_name = element_name_match ? element_name_match[1] : undefined;
5251

5352
const paths = [
@@ -64,17 +63,16 @@ export const compileDoc = async (html, elements, path, isProd) => {
6463
}, //global
6564
];
6665

67-
6866
let element_src;
6967
for (let { path, included } of paths) {
70-
console.log(path,await exists(path) )
68+
console.log(path, await exists(path));
7169
if (await exists(path) || included) {
72-
if(included){
70+
if (included) {
7371
element_src = await import(path);
74-
}else{
75-
element_src = await import(`${isProd ? "app/": "file:///"}${path}`);
72+
} else {
73+
element_src = await import(`${isProd ? "app/" : "file:///"}${path}`);
7674
}
77-
75+
7876
break;
7977
}
8078
}
@@ -92,7 +90,6 @@ export const compileDoc = async (html, elements, path, isProd) => {
9290
});
9391
}
9492

95-
9693
new_doc = new_doc.replace(element, await element_src.default(atrributes));
9794
}
9895
}));

0 commit comments

Comments
 (0)