diff --git a/packages/website/src/components/DocsSection/Docs.mdx b/packages/website/src/components/DocsSection/Docs.mdx
index cdc2bfc..85a4eb8 100644
--- a/packages/website/src/components/DocsSection/Docs.mdx
+++ b/packages/website/src/components/DocsSection/Docs.mdx
@@ -1,12 +1,13 @@
+import Anchor from "../Anchor.astro";
import Snippets from "./Snippets.astro";
import ProductHunt from "../ProductHunt.astro";
import VisitCounter from "./VisitCounter/VisitCounter.astro";
diff --git a/packages/website/src/components/ThemeSwitch.tsx b/packages/website/src/components/ThemeSwitch.tsx
index d88488c..d5b4288 100644
--- a/packages/website/src/components/ThemeSwitch.tsx
+++ b/packages/website/src/components/ThemeSwitch.tsx
@@ -18,7 +18,10 @@ export function ThemeSwitch() {
onMount(() => {
html = html ?? document.querySelector('html');
ref.value = themeGet(html);
- themeSet(ref.value, html);
+
+ requestAnimationFrame(() => {
+ themeSet(ref.value, html);
+ });
});
return (
diff --git a/packages/website/src/pages/about.mdx b/packages/website/src/pages/about.mdx
index c7be8d6..a626159 100644
--- a/packages/website/src/pages/about.mdx
+++ b/packages/website/src/pages/about.mdx
@@ -14,17 +14,17 @@ import Anchor from "../components/Anchor.astro";
I used
monaco-editor for the code-editor,
esbuild as bundler and treeshaker respectively,
deno\_brotli as a wasm port of gzip,
denoflate as a wasm port of brotli,
deno\_lz4 as a wasm port of lz4,
bytes to convert the compressed size to human readable values,
esbuild-visualizer to visualize and analyze your esbuild bundle to see which modules are taking up space,
umami for private, publicly available analytics and general usage stats all without cookies, and
countapi-js to keep track of the number of page visits, in a private and secure way.
-This project was greatly influenced by [@hardfists](https://github.com/hardfist) [neo-tools](https://github.com/hardfist/neo-tools) and [@mizchi's](https://github.com/mizchi) [uniroll](https://github.com/mizchi/uniroll) project.
+This project was greatly influenced by
@hardfists neo-tools and
@mizchi's uniroll project.
-> Some of bundlejs's latest features were inspired by [egoist/play-esbuild](https://github.com/egoist/play-esbuild) and [hyrious/esbuild-repl](https://github.com/hyrious/esbuild-repl), check them out they each use esbuild in different ways.
+> Some of bundlejs's latest features were inspired by
egoist/play-esbuild and
hyrious/esbuild-repl, check them out they each use esbuild in different ways.
The project isn't perfect, I am still working on an autocomplete, better mobile support and the high memory usage of **esbuild** and **monaco** as well as some edge case packages, e.g. **monaco-editor.**
-If there is something I missed, a mistake, or a feature you would like added please create an issue or a pull request and I'll try to get to it. You can contribute to this project at [okikio/bundle.](https://github.com/okikio/bundle)
+If there is something I missed, a mistake, or a feature you would like added please create an issue or a pull request and I'll try to get to it. You can contribute to this project at
okikio/bundle.
-**bundle** uses [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) as the style of commit, and the [Commitizen CLI](http://commitizen.github.io/cz-cli/) to make commits easier.
+**bundle** uses
Conventional Commits as the style of commit, and the
Commitizen CLI to make commits easier.
-You can join the discussion on [github discussions](https://github.com/okikio/bundle/discussions).
+You can join the discussion on
github discussions.
\ No newline at end of file
diff --git a/packages/website/src/pages/faq.mdx b/packages/website/src/pages/faq.mdx
index 1a1ae62..7005926 100644
--- a/packages/website/src/pages/faq.mdx
+++ b/packages/website/src/pages/faq.mdx
@@ -4,12 +4,14 @@ title: FAQ - bundlejs
description: Frequently Asked Questions. I frequently get asked what was the point in building bundlejs, this is a short, quick, and simple summary of frequently asked questions and my reasons for building bundlejs.
---
+import Anchor from "../components/Anchor.astro";
+
# FAQ
I frequently get asked what was the point in building bundlejs, this is a short, quick, and simple summary of frequently asked questions and my reasons for building bundlejs.
-## What is the advantage over [bundlephobia](https://bundlephobia.com)?
+## What is the advantage over
bundlephobia?
There are a couple reasons for this, but the main one is that `bundlephobia` wasn't reliable enough.
@@ -18,7 +20,7 @@ There are a couple reasons for this, but the main one is that `bundlephobia` was
Right now `bundlephobia`, is a bit hit or miss when it comes to treeshaking. So, I built **bundlejs.com**, which can treeshake bundles accurately.
-For example, try treeshaking the `Event` class from `@okikio/emitter` using [bundlephobia](https://bundlephobia.com/package/@okikio/emitter) and try treeshaking the `Event` class using [bundlejs.com](/?bundle&q=@okikio/emitter&treeshake=Event).
+For example, try treeshaking the `Event` class from `@okikio/emitter` using
bundlephobia and try treeshaking the `Event` class using
bundlejs.com.
```ts
export { Event } from "@okikio/emitter";
@@ -41,13 +43,13 @@ Another problem with `bundlephobia` is the lack of good error reporting if (for
this just isn't very useful for debugging.
-On the other hand, since, `bundlejs.com` runs locally right on your computer, when an error occurs it logs the exact error you would see when using [esbuild](https://esbuild.github.io/) or other bundlers in your build process, making it much easier to know exactly what is wrong with your js bundle.
+On the other hand, since, `bundlejs.com` runs locally right on your computer, when an error occurs it logs the exact error you would see when using
esbuild or other bundlers in your build process, making it much easier to know exactly what is wrong with your js bundle.
## Wait, locally as in no external servers?
-Yes, locally right on your browser, I used [esbuild-wasm](https://esbuild.github.io/getting-started/#wasm) for the main bundler and [rollup](https://rollupjs.org/guide/en/) for more accurate treeshaking.
+Yes, locally right on your browser, I used
esbuild-wasm for the main bundler and
rollup for more accurate treeshaking.
diff --git a/packages/website/src/scripts/theme.ts b/packages/website/src/scripts/theme.ts
index be22255..9df2297 100644
--- a/packages/website/src/scripts/theme.ts
+++ b/packages/website/src/scripts/theme.ts
@@ -49,7 +49,12 @@ function sendMessage
(message: T) {
try {
const iframe = document.querySelector('iframe.giscus-frame');
if (!iframe) return;
- iframe?.contentWindow?.postMessage?.({ giscus: message }, "https://giscus.bundlejs.com");
+
+ const iframeOrigin = "https://giscus.bundlejs.com";
+ if (iframe?.contentWindow?.location) {
+ console.log(iframe?.contentWindow)
+ iframe?.contentWindow?.postMessage?.({ giscus: message }, iframeOrigin);
+ }
} catch (e) {
console.warn(e);
}
diff --git a/packages/website/src/snippets/aliases.mdx b/packages/website/src/snippets/aliases.mdx
index 09c0f3c..abe3027 100644
--- a/packages/website/src/snippets/aliases.mdx
+++ b/packages/website/src/snippets/aliases.mdx
@@ -4,6 +4,8 @@ id: aliases
priority: 3
---
+import Anchor from "../components/Anchor.astro";
+
Aliases act as a redirect for modules, they are for replacing packages with different ones, e.g. replace `fs` with `memfs`, so, it can work on the web, etc..
You use aliases like this:
@@ -16,6 +18,6 @@ You use aliases like this:
}
```
-> You can try out an example of using aliases, [`bundlejs.com/?config={"alias":{"@okikio/animate":"react-dom"}}`](https://bundlejs.com/?config={"alias":{"@okikio/animate":"react-dom"}})
+> You can try out an example of using aliases, `bundlejs.com/?config={"alias":{"@okikio/animate":"react-dom"}}`
> ⚠️ **Warning**: aliases currently don't care about the original packages version, e.g. `@okikio/animate@beta` will be redirected to `react-dom` regardless of the package version in use.
\ No newline at end of file
diff --git a/packages/website/src/snippets/badges.mdx b/packages/website/src/snippets/badges.mdx
index a3c1f41..1a1bcf7 100644
--- a/packages/website/src/snippets/badges.mdx
+++ b/packages/website/src/snippets/badges.mdx
@@ -4,6 +4,8 @@ id: badges
priority: 4
---
+import Anchor from "../components/Anchor.astro";
+
You can also add bundle badges, they look like this,
[](https://bundlejs.com/) [](https://bundlejs.com/)
@@ -14,8 +16,9 @@ All you need to do is to add this to your `README.md`
# Light Mode Badge
[](https://bundlejs.com/)
+
# Dark Mode Badge
[](https://bundlejs.com/)
```
-You can use the [Sharing](#sharing) section above, to create unique bundles, when users clicks on the badge.
\ No newline at end of file
+You can use the Sharing section above, to create unique bundles, when users clicks on the badge.
\ No newline at end of file
diff --git a/packages/website/src/snippets/community.mdx b/packages/website/src/snippets/community.mdx
index 622b4eb..3a39a12 100644
--- a/packages/website/src/snippets/community.mdx
+++ b/packages/website/src/snippets/community.mdx
@@ -4,8 +4,10 @@ id: community
priority: 5
---
-> Tweet at me on [@okikio\_dev](https://twitter.com/@okikio_dev) with what you love and what you think needs improvement in `bundlejs` to get added to the list users.
+import Anchor from "../components/Anchor.astro";
-* [ @sheetjs](https://opencollective.com/bundle/organization/0/website)
-* [ @daniguardio\_la](https://opencollective.com/bundle/individual/0/website)
+> Tweet at me on @okikio\_dev with what you love and what you think needs improvement in `bundlejs` to get added to the list users.
+
+*  @sheetjs
+*  @daniguardio\_la
* And more, etc...
diff --git a/packages/website/src/snippets/discus.mdx b/packages/website/src/snippets/discus.mdx
index b94678b..73655f7 100644
--- a/packages/website/src/snippets/discus.mdx
+++ b/packages/website/src/snippets/discus.mdx
@@ -15,7 +15,7 @@ priority: 6
data-input-position="bottom"
data-theme="preferred_color_scheme"
data-lang="en"
- data-loading="eager"
+ data-loading="lazy"
crossorigin="anonymous"
defer
fetchpriority="low"
diff --git a/packages/website/src/snippets/sharing.mdx b/packages/website/src/snippets/sharing.mdx
index b5494a6..5c748ac 100644
--- a/packages/website/src/snippets/sharing.mdx
+++ b/packages/website/src/snippets/sharing.mdx
@@ -4,8 +4,8 @@ id: sharing
priority: 1
---
+import Anchor from "../components/Anchor.astro";
import Details from "../components/Details.tsx";
-// import Anchor from "../components/Anchor.astro";
You can now use search queries in **bundlejs**, all you need to do is add this to the url
`?q={packages}&treeshake={methods to treeshake}`
@@ -15,25 +15,25 @@ You want `react`, `react-dom`, `vue`, and `@okikio/animate`, but only want the `
You would add this to the url [`?q=react,react-dom,vue,@okikio/animate&treeshake=[*],[*],[*],[{Animate,toStr}]`](/?q=react,react-dom,vue,@okikio/animate&treeshake=[*],[*],[*],[{Animate,toStr}])
-If you only want a couple packages and don't care to treeshake, then all you need is something like this, [?q=react,react-dom,vue,@okikio/animate](/?q=react,react-dom,vue,@okikio/animate) . There is another way to share a reproduciable bundle, the sharable link. Shareble links look like this [/?share=PTAEGEBs...](/?share=PTAEGEBsEsGMGtQCUCuA7UAzA9gJ1AC4AWApqAELoAmkJVoA1KALLRrSbR2OgDiAXtAAOQ7kICGCcQHMyAZ2j8SAKBIAPIXgKgAVFlzYAtqABEAAWzxoV7MHHtD4giRMBuIA) with the string value of the input code editor being compressed into a string and placed into the URL.
+If you only want a couple packages and don't care to treeshake, then all you need is something like this, ?q=react,react-dom,vue,@okikio/animate . There is another way to share a reproduciable bundle, the sharable link. Shareble links look like this /?share=PTAEGEBs... with the string value of the input code editor being compressed into a string and placed into the URL.
In order to create a shareble link, you click the `Share` button, it copies the share url to your clipboard, and from there you can paste where you wish.
{/*
**Auto-bundling shared URL's**
-If you would like to bundle your code when the share URL is loaded, add `bundle` to the url, e.g. [/?bundle&q=@okikio/animate](/?q=@okikio/animate&bundle) or [/?bundle&share=PTAEGEBs...](/?bundle&share=PTAEGEBsEsGMGtQCUCuA7UAzA9gJ1AC4AWApqAELoAmkJVoA1KALLRrSbR2OgDiAXtAAOQ7kICGCcQHMyAZ2j8SAKBIAPIXgKgAVFlzYAtqABEAAWzxoV7MHHtD4giRMBuIA)
+If you would like to bundle your code when the share URL is loaded, add `bundle` to the url, e.g. /?bundle&q=@okikio/animate or /?bundle&share=PTAEGEBs...
*/}
{/* If you would like to bundle your code when the share URL is loaded, add bundle to the url, e.g. /?bundle&q=@okikio/animate or /?bundle&share=PTAEGEBs... */}
- If you would like to bundle your code when the share URL is loaded, add `bundle` to the url, e.g. [/?bundle&q=@okikio/animate](/?q=@okikio/animate&bundle) or [/?bundle&share=PTAEGEBs...](/?bundle&share=PTAEGEBsEsGMGtQCUCuA7UAzA9gJ1AC4AWApqAELoAmkJVoA1KALLRrSbR2OgDiAXtAAOQ7kICGCcQHMyAZ2j8SAKBIAPIXgKgAVFlzYAtqABEAAWzxoV7MHHtD4giRMBuIA)
+ If you would like to bundle your code when the share URL is loaded, add `bundle` to the url, e.g. /?bundle&q=@okikio/animate or /?bundle&share=PTAEGEBs...
\ No newline at end of file
diff --git a/packages/website/src/snippets/usage.mdx b/packages/website/src/snippets/usage.mdx
index 81c6dfd..e33fb23 100644
--- a/packages/website/src/snippets/usage.mdx
+++ b/packages/website/src/snippets/usage.mdx
@@ -4,23 +4,25 @@ id: usage
priority: 0
---
-When bundling packages that also export CSS and other external files, [bundlejs](https://bundlejs.com) now checks the gzip/brotli size of these external files, even though it won't output any code. Keep this in mind this isn't a bug, however, if it causes confusion I am willing to change this behaviour.
+import Anchor from "../components/Anchor.astro";
-Treeshaking is available, but not all CDNs support access to each packages package.json so there might be slight package version conflicts. The only verified CDN with access to the package.json is [unpkg.com](https://unpkg.com).
+When bundling packages that also export CSS and other external files, bundlejs now checks the gzip/brotli size of these external files, even though it won't output any code. Keep this in mind this isn't a bug, however, if it causes confusion I am willing to change this behaviour.
+
+Treeshaking is available, but not all CDNs support access to each packages package.json so there might be slight package version conflicts. The only verified CDN with access to the package.json is unpkg.com.
Check the console for error messages and warnings.
You can use custom protocols to specify which CDN the module should come from.
-* esm.run:react -> [https://esm.run/react](https://esm.run/react)
-* esm.sh:react -> [https://cdn.esm.sh/react](https://cdn.esm.sh/react)
-* esm:react -> [https://cdn.esm.sh/react](https://cdn.esm.sh/react)
-* skypack:react -> [https://cdn.skypack.dev/react](https://cdn.skypack.dev/react)
-* unpkg:react -> [https://unpkg.com/react](https://unpkg.com/react)
-* deno:preact -> [https://deno.land/x/preact](https://deno.land/x/preact)
-* jsdelivr:react -> [https://cdn.jsdelivr.net/npm/react](https://cdn.jsdelivr.net/npm/react)
-* jsdelivr.gh:.../react-dom/index.js -> [https://cdn.jsdelivr.net/gh/.../react-dom/index.js](https://cdn.jsdelivr.net/gh/facebook/react/packages/react-dom/index.js)
-* github:.../react/index.js -> [https://raw.githubusercontent.com/.../react/index.js](https://raw.githubusercontent.com/facebook/react/main/packages/react/index.js)
+* esm.run:react -> {`https://esm.run/react`}
+* esm.sh:react -> {`https://cdn.esm.sh/react`}
+* esm:react -> {`https://cdn.esm.sh/react`}
+* skypack:react -> {`https://cdn.skypack.dev/react`}
+* unpkg:react -> {`https://unpkg.com/react`}
+* deno:preact -> {`https://deno.land/x/preact`}
+* jsdelivr:react -> {`https://cdn.jsdelivr.net/npm/react`}
+* jsdelivr.gh:.../react-dom/index.js -> {`https://cdn.jsdelivr.net/gh/.../react-dom/index.js`}
+* github:.../react/index.js -> {`https://raw.githubusercontent.com/.../react/index.js`}
e.g.
@@ -32,7 +34,7 @@ export * from "esm:@okikio/animate";
export { animate } from "https://cdn.skypack.dev/@okikio/animate";
```
-\* If an error occurs try using a different CDN, by default **bundlejs** uses [unpkg.com](https://unpkg.com) but you can use the others.
+\* If an error occurs try using a different CDN, by default **bundlejs** uses unpkg.com but you can use the others.
\* For some packages an error occurs where the default export is excluded from the treeshaken bundle, the solution for this is to manually include the default export like so,
diff --git a/packages/website/src/styles/base.scss b/packages/website/src/styles/base.scss
index 5c93bba..0822303 100644
--- a/packages/website/src/styles/base.scss
+++ b/packages/website/src/styles/base.scss
@@ -182,6 +182,7 @@ a code {
pre {
@apply rounded-lg cursor-auto p-5;
+ @apply overflow-auto;
code {
@apply p-0;
@@ -251,6 +252,8 @@ details {
}
&.inline-details {
+ @apply bg-white border border-gray-300 dark:bg-elevated dark:border-gray-700;
+
& > summary {
@apply pl-[2ch] py-0;
@@ -288,5 +291,5 @@ details {
}
.accordian:not(:last-child) {
- @apply border-b border-b-quaternary rounded-none;
+ @apply border-b border-b-gray-300 dark:border-b-quaternary rounded-none;
}
diff --git a/vercel.json b/vercel.json
index 7c817d0..5f7e517 100644
--- a/vercel.json
+++ b/vercel.json
@@ -37,6 +37,10 @@
"key": "X-UA-Compatible",
"value": "IE=edge"
},
+ {
+ "key": "Access-Control-Allow-Origin",
+ "value": "*"
+ },
{
"key": "Content-Security-Policy",
"value": "default-src 'self'; font-src 'self' https://fonts.gstatic.com; style-src 'self' 'unsafe-inline'; img-src 'self' https://res.cloudinary.com https://api.producthunt.com https://opencollective.com data:; script-src 'self' https://opencollective.com https://*.bundlejs.com https://bundlejs.com https://cdn.polyfill.io 'unsafe-eval' 'unsafe-inline'; connect-src 'self' https:; block-all-mixed-content; upgrade-insecure-requests; base-uri 'self'; object-src 'none'; worker-src 'self'; manifest-src 'self'; media-src 'self' https://res.cloudinary.com; form-action 'self'; frame-src 'self' https://opencollective.com https://*.bundlejs.com https://bundlejs.com; frame-ancestors 'self' https:;"