diff --git a/lib/css-plugin.js b/lib/css-plugin.js index 1e1ba6d1..b97bc1f9 100644 --- a/lib/css-plugin.js +++ b/lib/css-plugin.js @@ -41,6 +41,7 @@ const assetRe = new RegExp('/fake/path/to/asset/([^/]+)/', 'g'); const appendCssModule = '\0appendCss'; const appendCssSource = ` export default function appendCss(css) { + if (__PRERENDER__) return; const style = document.createElement('style'); style.textContent = css; document.head.append(style); diff --git a/lib/initial-css-plugin.js b/lib/initial-css-plugin.js index 055a2740..54461570 100644 --- a/lib/initial-css-plugin.js +++ b/lib/initial-css-plugin.js @@ -30,7 +30,7 @@ export default function initialCssPlugin() { async load(id) { if (id !== initialCssModule) return; - const matches = await globP('shared/initial-app/**/*.css', { + const matches = await globP('shared/prerendered-app/**/*.css', { nodir: true, cwd: path.join(process.cwd(), 'src'), }); diff --git a/src/client/initial-app/App/index.tsx b/src/client/initial-app/App/index.tsx index e4700312..36d92a8a 100644 --- a/src/client/initial-app/App/index.tsx +++ b/src/client/initial-app/App/index.tsx @@ -1,16 +1,16 @@ import type { FileDropEvent } from 'file-drop-element'; -import type SnackBarElement from 'shared/initial-app/custom-els/snack-bar'; -import type { SnackOptions } from 'shared/initial-app/custom-els/snack-bar'; +import type SnackBarElement from 'shared/custom-els/snack-bar'; +import type { SnackOptions } from 'shared/custom-els/snack-bar'; import { h, Component } from 'preact'; -import { linkRef } from 'shared/initial-app/util'; +import { linkRef } from 'shared/prerendered-app/util'; import * as style from './style.css'; import 'add-css:./style.css'; import 'file-drop-element'; -import 'shared/initial-app/custom-els/snack-bar'; -import Intro from 'shared/initial-app/Intro'; -import 'shared/initial-app/custom-els/loading-spinner'; +import 'shared/custom-els/snack-bar'; +import Intro from 'shared/prerendered-app/Intro'; +import 'shared/custom-els/loading-spinner'; const ROUTE_EDITOR = '/editor'; diff --git a/src/client/initial-app/custom-els/missing-types.d.ts b/src/client/initial-app/custom-els/missing-types.d.ts index 37aa4e00..d2c41034 100644 --- a/src/client/initial-app/custom-els/missing-types.d.ts +++ b/src/client/initial-app/custom-els/missing-types.d.ts @@ -1,5 +1,5 @@ -/// -/// +/// +/// import type { FileDropElement, FileDropEvent } from 'file-drop-element'; interface FileDropAttributes extends preact.JSX.HTMLAttributes { diff --git a/src/client/lazy-app/Compress/Options/Range/index.tsx b/src/client/lazy-app/Compress/Options/Range/index.tsx index e4ed66b9..da6e37e2 100644 --- a/src/client/lazy-app/Compress/Options/Range/index.tsx +++ b/src/client/lazy-app/Compress/Options/Range/index.tsx @@ -3,7 +3,7 @@ import * as style from './style.css'; import 'add-css:./style.css'; import RangeInputElement from './custom-els/RangeInput'; import './custom-els/RangeInput'; -import { linkRef } from 'shared/initial-app/util'; +import { linkRef } from 'shared/prerendered-app/util'; interface Props extends preact.JSX.HTMLAttributes {} interface State {} diff --git a/src/client/lazy-app/Compress/Output/index.tsx b/src/client/lazy-app/Compress/Output/index.tsx index 94a653a9..c459c2b3 100644 --- a/src/client/lazy-app/Compress/Output/index.tsx +++ b/src/client/lazy-app/Compress/Output/index.tsx @@ -18,7 +18,7 @@ import { twoUpHandle } from './custom-els/TwoUp/styles.css'; import type { PreprocessorState } from '../../feature-meta'; import { cleanSet } from '../../util/clean-modify'; import type { SourceImage } from '../../Compress'; -import { linkRef } from 'shared/initial-app/util'; +import { linkRef } from 'shared/prerendered-app/util'; interface Props { source?: SourceImage; diff --git a/src/client/lazy-app/Compress/Output/style.css b/src/client/lazy-app/Compress/Output/style.css index ab56f174..ba3f6f70 100644 --- a/src/client/lazy-app/Compress/Output/style.css +++ b/src/client/lazy-app/Compress/Output/style.css @@ -1,5 +1,5 @@ .output { - composes: abs-fill from '../../../../shared/initial-app/util.css'; + composes: abs-fill from '../../../../shared/prerendered-app/util.css'; &::before { content: ''; @@ -19,12 +19,12 @@ } .two-up { - composes: abs-fill from '../../../../shared/initial-app/util.css'; + composes: abs-fill from '../../../../shared/prerendered-app/util.css'; --accent-color: var(--button-fg); } .pinch-zoom { - composes: abs-fill from '../../../../shared/initial-app/util.css'; + composes: abs-fill from '../../../../shared/prerendered-app/util.css'; outline: none; display: flex; justify-content: center; diff --git a/src/client/lazy-app/Compress/Results/index.tsx b/src/client/lazy-app/Compress/Results/index.tsx index 57f8e73d..647c5fce 100644 --- a/src/client/lazy-app/Compress/Results/index.tsx +++ b/src/client/lazy-app/Compress/Results/index.tsx @@ -8,7 +8,7 @@ import { CopyAcrossIcon, CopyAcrossIconProps, } from 'client/lazy-app/icons'; -import 'shared/initial-app/custom-els/loading-spinner'; +import 'shared/custom-els/loading-spinner'; import { SourceImage } from '../'; interface Props { diff --git a/src/client/lazy-app/Compress/Results/style.css b/src/client/lazy-app/Compress/Results/style.css index 1918c841..f3c8e68e 100644 --- a/src/client/lazy-app/Compress/Results/style.css +++ b/src/client/lazy-app/Compress/Results/style.css @@ -124,7 +124,7 @@ .copy-to-other { grid-row: 1; grid-column: copy-button; - composes: unbutton from '../../../../shared/initial-app/util.css'; + composes: unbutton from '../../../../shared/prerendered-app/util.css'; composes: download; background: #656565; diff --git a/src/client/lazy-app/Compress/index.tsx b/src/client/lazy-app/Compress/index.tsx index bcd84242..0b56d8fb 100644 --- a/src/client/lazy-app/Compress/index.tsx +++ b/src/client/lazy-app/Compress/index.tsx @@ -30,7 +30,7 @@ import './custom-els/MultiPanel'; import Results from './Results'; import WorkerBridge from '../worker-bridge'; import { resize } from 'features/processors/resize/client'; -import type SnackBarElement from 'shared/initial-app/custom-els/snack-bar'; +import type SnackBarElement from 'shared/custom-els/snack-bar'; import { CopyAcrossIconProps, ExpandIcon } from '../icons'; export type OutputType = EncoderType | 'identity'; diff --git a/src/client/lazy-app/sw-bridge/index.ts b/src/client/lazy-app/sw-bridge/index.ts index 13322685..d500955a 100644 --- a/src/client/lazy-app/sw-bridge/index.ts +++ b/src/client/lazy-app/sw-bridge/index.ts @@ -1,4 +1,4 @@ -import type SnackBarElement from 'shared/initial-app/custom-els/snack-bar'; +import type SnackBarElement from 'shared/custom-els/snack-bar'; import { get, set } from 'idb-keyval'; diff --git a/src/client/missing-types.d.ts b/src/client/missing-types.d.ts index a176b0a8..a3af0bcd 100644 --- a/src/client/missing-types.d.ts +++ b/src/client/missing-types.d.ts @@ -11,7 +11,7 @@ * limitations under the License. */ /// -/// +/// interface Navigator { readonly standalone: boolean; diff --git a/src/features/processors/resize/client/index.tsx b/src/features/processors/resize/client/index.tsx index 5f048a8b..6b82da5b 100644 --- a/src/features/processors/resize/client/index.tsx +++ b/src/features/processors/resize/client/index.tsx @@ -22,7 +22,7 @@ import { inputFieldChecked, } from 'client/lazy-app/util'; import * as style from 'client/lazy-app/Compress/Options/style.css'; -import { linkRef } from 'shared/initial-app/util'; +import { linkRef } from 'shared/prerendered-app/util'; import Select from 'client/lazy-app/Compress/Options/Select'; import Expander from 'client/lazy-app/Compress/Options/Expander'; import Checkbox from 'client/lazy-app/Compress/Options/Checkbox'; diff --git a/src/shared/initial-app/custom-els/loading-spinner/index.ts b/src/shared/custom-els/loading-spinner/index.ts similarity index 98% rename from src/shared/initial-app/custom-els/loading-spinner/index.ts rename to src/shared/custom-els/loading-spinner/index.ts index 3abe3108..2985b6d9 100644 --- a/src/shared/initial-app/custom-els/loading-spinner/index.ts +++ b/src/shared/custom-els/loading-spinner/index.ts @@ -1,4 +1,5 @@ import * as styles from './styles.css'; +import 'add-css:./styles.css'; // So it doesn't cause an error when running in node const HTMLEl = ((__PRERENDER__ diff --git a/src/shared/initial-app/custom-els/loading-spinner/missing-types.d.ts b/src/shared/custom-els/loading-spinner/missing-types.d.ts similarity index 100% rename from src/shared/initial-app/custom-els/loading-spinner/missing-types.d.ts rename to src/shared/custom-els/loading-spinner/missing-types.d.ts diff --git a/src/shared/initial-app/custom-els/loading-spinner/styles.css b/src/shared/custom-els/loading-spinner/styles.css similarity index 100% rename from src/shared/initial-app/custom-els/loading-spinner/styles.css rename to src/shared/custom-els/loading-spinner/styles.css diff --git a/src/shared/initial-app/custom-els/snack-bar/index.ts b/src/shared/custom-els/snack-bar/index.ts similarity index 98% rename from src/shared/initial-app/custom-els/snack-bar/index.ts rename to src/shared/custom-els/snack-bar/index.ts index 8e530c46..4c6617f7 100644 --- a/src/shared/initial-app/custom-els/snack-bar/index.ts +++ b/src/shared/custom-els/snack-bar/index.ts @@ -1,4 +1,5 @@ import * as style from './styles.css'; +import 'add-css:./styles.css'; // So it doesn't cause an error when running in node const HTMLEl = ((__PRERENDER__ diff --git a/src/shared/initial-app/custom-els/snack-bar/missing-types.d.ts b/src/shared/custom-els/snack-bar/missing-types.d.ts similarity index 100% rename from src/shared/initial-app/custom-els/snack-bar/missing-types.d.ts rename to src/shared/custom-els/snack-bar/missing-types.d.ts diff --git a/src/shared/initial-app/custom-els/snack-bar/styles.css b/src/shared/custom-els/snack-bar/styles.css similarity index 100% rename from src/shared/initial-app/custom-els/snack-bar/styles.css rename to src/shared/custom-els/snack-bar/styles.css diff --git a/src/shared/initial-app/Intro/blob-anim/index.ts b/src/shared/prerendered-app/Intro/blob-anim/index.ts similarity index 100% rename from src/shared/initial-app/Intro/blob-anim/index.ts rename to src/shared/prerendered-app/Intro/blob-anim/index.ts diff --git a/src/shared/initial-app/Intro/blob-anim/meta.ts b/src/shared/prerendered-app/Intro/blob-anim/meta.ts similarity index 100% rename from src/shared/initial-app/Intro/blob-anim/meta.ts rename to src/shared/prerendered-app/Intro/blob-anim/meta.ts diff --git a/src/shared/initial-app/Intro/imgs/demos/demo-artwork.jpg b/src/shared/prerendered-app/Intro/imgs/demos/demo-artwork.jpg similarity index 100% rename from src/shared/initial-app/Intro/imgs/demos/demo-artwork.jpg rename to src/shared/prerendered-app/Intro/imgs/demos/demo-artwork.jpg diff --git a/src/shared/initial-app/Intro/imgs/demos/demo-device-screen.png b/src/shared/prerendered-app/Intro/imgs/demos/demo-device-screen.png similarity index 100% rename from src/shared/initial-app/Intro/imgs/demos/demo-device-screen.png rename to src/shared/prerendered-app/Intro/imgs/demos/demo-device-screen.png diff --git a/src/shared/initial-app/Intro/imgs/demos/demo-large-photo.jpg b/src/shared/prerendered-app/Intro/imgs/demos/demo-large-photo.jpg similarity index 100% rename from src/shared/initial-app/Intro/imgs/demos/demo-large-photo.jpg rename to src/shared/prerendered-app/Intro/imgs/demos/demo-large-photo.jpg diff --git a/src/shared/initial-app/Intro/imgs/demos/icon-demo-artwork.jpg b/src/shared/prerendered-app/Intro/imgs/demos/icon-demo-artwork.jpg similarity index 100% rename from src/shared/initial-app/Intro/imgs/demos/icon-demo-artwork.jpg rename to src/shared/prerendered-app/Intro/imgs/demos/icon-demo-artwork.jpg diff --git a/src/shared/initial-app/Intro/imgs/demos/icon-demo-device-screen.jpg b/src/shared/prerendered-app/Intro/imgs/demos/icon-demo-device-screen.jpg similarity index 100% rename from src/shared/initial-app/Intro/imgs/demos/icon-demo-device-screen.jpg rename to src/shared/prerendered-app/Intro/imgs/demos/icon-demo-device-screen.jpg diff --git a/src/shared/initial-app/Intro/imgs/demos/icon-demo-large-photo.jpg b/src/shared/prerendered-app/Intro/imgs/demos/icon-demo-large-photo.jpg similarity index 100% rename from src/shared/initial-app/Intro/imgs/demos/icon-demo-large-photo.jpg rename to src/shared/prerendered-app/Intro/imgs/demos/icon-demo-large-photo.jpg diff --git a/src/shared/initial-app/Intro/imgs/demos/icon-demo-logo.png b/src/shared/prerendered-app/Intro/imgs/demos/icon-demo-logo.png similarity index 100% rename from src/shared/initial-app/Intro/imgs/demos/icon-demo-logo.png rename to src/shared/prerendered-app/Intro/imgs/demos/icon-demo-logo.png diff --git a/src/shared/initial-app/Intro/imgs/github-logo.svg b/src/shared/prerendered-app/Intro/imgs/github-logo.svg similarity index 100% rename from src/shared/initial-app/Intro/imgs/github-logo.svg rename to src/shared/prerendered-app/Intro/imgs/github-logo.svg diff --git a/src/shared/initial-app/Intro/imgs/logo-with-text.svg b/src/shared/prerendered-app/Intro/imgs/logo-with-text.svg similarity index 100% rename from src/shared/initial-app/Intro/imgs/logo-with-text.svg rename to src/shared/prerendered-app/Intro/imgs/logo-with-text.svg diff --git a/src/shared/initial-app/Intro/imgs/logo.svg b/src/shared/prerendered-app/Intro/imgs/logo.svg similarity index 100% rename from src/shared/initial-app/Intro/imgs/logo.svg rename to src/shared/prerendered-app/Intro/imgs/logo.svg diff --git a/src/shared/initial-app/Intro/index.tsx b/src/shared/prerendered-app/Intro/index.tsx similarity index 97% rename from src/shared/initial-app/Intro/index.tsx rename to src/shared/prerendered-app/Intro/index.tsx index 73c43884..4b3e4176 100644 --- a/src/shared/initial-app/Intro/index.tsx +++ b/src/shared/prerendered-app/Intro/index.tsx @@ -1,7 +1,7 @@ import { h, Component } from 'preact'; -import { linkRef } from 'shared/initial-app/util'; -import '../custom-els/loading-spinner'; +import { linkRef } from 'shared/prerendered-app/util'; +import '../../custom-els/loading-spinner'; import logo from 'url:./imgs/logo.svg'; import githubLogo from 'url:./imgs/github-logo.svg'; import largePhoto from 'url:./imgs/demos/demo-large-photo.jpg'; @@ -13,8 +13,8 @@ import deviceScreenIcon from 'url:./imgs/demos/icon-demo-device-screen.jpg'; import logoIcon from 'url:./imgs/demos/icon-demo-logo.png'; import logoWithText from 'url:./imgs/logo-with-text.svg'; import * as style from './style.css'; -import type SnackBarElement from 'shared/initial-app/custom-els/snack-bar'; -import 'shared/initial-app/custom-els/snack-bar'; +import type SnackBarElement from 'shared/custom-els/snack-bar'; +import 'shared/custom-els/snack-bar'; import { startBlobs } from './blob-anim/meta'; const demos = [ diff --git a/src/shared/initial-app/Intro/missing-types.d.ts b/src/shared/prerendered-app/Intro/missing-types.d.ts similarity index 100% rename from src/shared/initial-app/Intro/missing-types.d.ts rename to src/shared/prerendered-app/Intro/missing-types.d.ts diff --git a/src/shared/initial-app/Intro/style.css b/src/shared/prerendered-app/Intro/style.css similarity index 100% rename from src/shared/initial-app/Intro/style.css rename to src/shared/prerendered-app/Intro/style.css diff --git a/src/shared/initial-app/colors.css b/src/shared/prerendered-app/colors.css similarity index 100% rename from src/shared/initial-app/colors.css rename to src/shared/prerendered-app/colors.css diff --git a/src/shared/initial-app/util.css b/src/shared/prerendered-app/util.css similarity index 100% rename from src/shared/initial-app/util.css rename to src/shared/prerendered-app/util.css diff --git a/src/shared/initial-app/util.ts b/src/shared/prerendered-app/util.ts similarity index 100% rename from src/shared/initial-app/util.ts rename to src/shared/prerendered-app/util.ts diff --git a/src/static-build/missing-types.d.ts b/src/static-build/missing-types.d.ts index 5c48298c..1de4bdfc 100644 --- a/src/static-build/missing-types.d.ts +++ b/src/static-build/missing-types.d.ts @@ -11,7 +11,7 @@ * limitations under the License. */ /// -/// +/// declare module 'client-bundle:*' { const url: string; diff --git a/src/static-build/pages/index/index.tsx b/src/static-build/pages/index/index.tsx index c2c4ca6f..e1ab1a44 100644 --- a/src/static-build/pages/index/index.tsx +++ b/src/static-build/pages/index/index.tsx @@ -17,7 +17,7 @@ import initialCss from 'initial-css:'; import { allSrc } from 'client-bundle:client/initial-app'; import favicon from 'url:static-build/assets/favicon.ico'; import { escapeStyleScriptContent } from 'static-build/utils'; -import Intro from 'shared/initial-app/Intro'; +import Intro from 'shared/prerendered-app/Intro'; interface Props {}