├── examples └── demo │ ├── .env.development │ ├── .env │ ├── .env.development.local │ ├── .env.local │ ├── src │ ├── outside-b.js │ └── outside.js │ ├── public │ ├── pages │ │ ├── environment │ │ │ ├── foo.js │ │ │ ├── style.css │ │ │ └── index.js │ │ ├── foo.json │ │ ├── about │ │ │ ├── style.module.css │ │ │ └── index.js │ │ ├── home │ │ │ └── style.module.css │ │ ├── files │ │ │ ├── img.jpg │ │ │ ├── unreferenced.jpg │ │ │ └── index.js │ │ ├── _404.js │ │ ├── alias-outside.js │ │ ├── compat.js │ │ ├── class-fields.js │ │ └── json.js │ ├── foo │ │ ├── alias-inside.js │ │ └── lib │ │ │ └── test.ts │ └── prerender.tsx │ ├── wmr.config.ts │ └── tsconfig.json ├── packages ├── sw-plugin │ ├── .gitignore │ ├── example │ │ ├── public │ │ │ ├── index.js │ │ │ ├── sw.js │ │ │ └── index.html │ │ ├── wmr.config.mjs │ │ └── package.json │ └── types.d.ts ├── wmr │ ├── test │ │ ├── fixtures │ │ │ ├── 200 │ │ │ │ ├── index.js │ │ │ │ ├── 200.html │ │ │ │ └── index.html │ │ │ ├── empty │ │ │ │ └── public │ │ │ │ │ └── .gitkeep │ │ │ ├── css-less-absolute │ │ │ │ ├── index.js │ │ │ │ ├── bar.less │ │ │ │ ├── foo.less │ │ │ │ └── index.html │ │ │ ├── css-sass-absolute │ │ │ │ ├── index.js │ │ │ │ ├── bar.scss │ │ │ │ ├── foo.scss │ │ │ │ └── index.html │ │ │ ├── empty-nopublic │ │ │ │ └── .gitkeep │ │ │ ├── base64-html │ │ │ │ └── public │ │ │ │ │ ├── index.js │ │ │ │ │ └── index.html │ │ │ ├── config-reload-env │ │ │ │ ├── .env │ │ │ │ └── index.html │ │ │ ├── css-less-html │ │ │ │ └── public │ │ │ │ │ ├── index.js │ │ │ │ │ ├── style.less │ │ │ │ │ └── index.html │ │ │ ├── css-sass-html │ │ │ │ └── public │ │ │ │ │ ├── index.js │ │ │ │ │ ├── style.scss │ │ │ │ │ └── index.html │ │ │ ├── plugin-error │ │ │ │ ├── public │ │ │ │ │ ├── index.js │ │ │ │ │ └── index.html │ │ │ │ └── wmr.config.mjs │ │ │ ├── serve-fallback │ │ │ │ ├── foo │ │ │ │ │ └── bar │ │ │ │ ├── public │ │ │ │ │ ├── .foo │ │ │ │ │ ├── extensionless │ │ │ │ │ ├── index.html │ │ │ │ │ ├── 10-seconds-of-silence.mp3 │ │ │ │ │ └── index.js │ │ │ │ └── wmr.config.mjs │ │ │ ├── css-less-nested-relative │ │ │ │ ├── index.js │ │ │ │ ├── foo.less │ │ │ │ ├── style.less │ │ │ │ └── index.html │ │ │ ├── css-module-hmr │ │ │ │ ├── styles │ │ │ │ │ └── foo.module.css │ │ │ │ ├── index.html │ │ │ │ └── index.js │ │ │ ├── plugin-config-falsy │ │ │ │ ├── public │ │ │ │ │ ├── index.js │ │ │ │ │ └── index.html │ │ │ │ └── wmr.config.mjs │ │ │ ├── css-less-import-hash-html │ │ │ │ └── public │ │ │ │ │ ├── index.js │ │ │ │ │ ├── 2.less │ │ │ │ │ └── index.html │ │ │ ├── css-sass-import-hash-html │ │ │ │ └── public │ │ │ │ │ ├── index.js │ │ │ │ │ ├── 2.scss │ │ │ │ │ └── index.html │ │ │ ├── env │ │ │ │ ├── .env.development │ │ │ │ ├── .env │ │ │ │ ├── .env.development.local │ │ │ │ ├── .env.local │ │ │ │ └── public │ │ │ │ │ ├── index.html │ │ │ │ │ └── index.js │ │ │ ├── plugin-output-options │ │ │ │ ├── public │ │ │ │ │ ├── index.js │ │ │ │ │ └── index.html │ │ │ │ └── wmr.config.mjs │ │ │ ├── config-reload-package-json │ │ │ │ ├── package.json │ │ │ │ └── index.html │ │ │ ├── css-duplicates │ │ │ │ ├── a.css │ │ │ │ ├── b.css │ │ │ │ ├── lazy.js │ │ │ │ ├── c.css │ │ │ │ ├── index.html │ │ │ │ └── index.js │ │ │ ├── css-less-alias │ │ │ │ ├── foo │ │ │ │ │ └── foo.less │ │ │ │ ├── public │ │ │ │ │ ├── style.less │ │ │ │ │ └── index.html │ │ │ │ └── wmr.config.mjs │ │ │ ├── css-sass-alias │ │ │ │ ├── foo │ │ │ │ │ └── foo.scss │ │ │ │ ├── public │ │ │ │ │ ├── style.scss │ │ │ │ │ └── index.html │ │ │ │ └── wmr.config.mjs │ │ │ ├── hmr │ │ │ │ ├── store │ │ │ │ │ └── index.js │ │ │ │ ├── index.css │ │ │ │ ├── style.module.css │ │ │ │ ├── useCounter.js │ │ │ │ ├── index.html │ │ │ │ ├── home.js │ │ │ │ └── index.js │ │ │ ├── json │ │ │ │ ├── data.json │ │ │ │ ├── data2.json │ │ │ │ ├── index.js │ │ │ │ ├── index.html │ │ │ │ └── using-prefix.js │ │ │ ├── alias-outside │ │ │ │ ├── foo │ │ │ │ │ ├── it.js │ │ │ │ │ └── works.js │ │ │ │ ├── forbidden │ │ │ │ │ └── forbidden.js │ │ │ │ ├── wmr.config.mjs │ │ │ │ └── public │ │ │ │ │ ├── index.html │ │ │ │ │ ├── forbidden.js │ │ │ │ │ └── index.js │ │ │ ├── alias-src │ │ │ │ ├── src │ │ │ │ │ ├── it.js │ │ │ │ │ └── works.js │ │ │ │ └── public │ │ │ │ │ ├── index.html │ │ │ │ │ └── index.js │ │ │ ├── config-multiple │ │ │ │ ├── index.html │ │ │ │ ├── wmr.config.js │ │ │ │ ├── wmr.config.mjs │ │ │ │ └── wmr.config.ts │ │ │ ├── config-reload │ │ │ │ ├── index.html │ │ │ │ └── wmr.config.mjs │ │ │ ├── css-entry │ │ │ │ ├── a.css │ │ │ │ ├── b.css │ │ │ │ ├── empty.css │ │ │ │ ├── c.css │ │ │ │ ├── index.js │ │ │ │ └── index.html │ │ │ ├── css-less-nested-alias │ │ │ │ ├── src │ │ │ │ │ ├── bar.less │ │ │ │ │ └── foo.less │ │ │ │ ├── public │ │ │ │ │ ├── style.less │ │ │ │ │ └── index.html │ │ │ │ └── wmr.config.mjs │ │ │ ├── css-sass-nested-alias │ │ │ │ ├── src │ │ │ │ │ ├── bar.scss │ │ │ │ │ └── foo.scss │ │ │ │ ├── public │ │ │ │ │ ├── style.scss │ │ │ │ │ └── index.html │ │ │ │ └── wmr.config.mjs │ │ │ ├── plugin-emit │ │ │ │ └── public │ │ │ │ │ ├── index.js │ │ │ │ │ ├── worker.js │ │ │ │ │ └── index.html │ │ │ ├── process-import │ │ │ │ ├── foo.js │ │ │ │ ├── index.html │ │ │ │ └── index.js │ │ │ ├── commonjs │ │ │ │ ├── default.js │ │ │ │ ├── named.cjs │ │ │ │ ├── default.cjs │ │ │ │ ├── named.js │ │ │ │ ├── mixed.js │ │ │ │ ├── node_modules │ │ │ │ │ └── fake-lib │ │ │ │ │ │ ├── package.json │ │ │ │ │ │ └── fake-lib.js │ │ │ │ ├── index.js │ │ │ │ ├── index.html │ │ │ │ ├── cjs-imports.cjs │ │ │ │ ├── mixed.cjs │ │ │ │ └── foo.cjs │ │ │ ├── config-node-builtins │ │ │ │ ├── index.html │ │ │ │ ├── wmr │ │ │ │ │ └── a.mjs │ │ │ │ └── wmr.config.mjs │ │ │ ├── config-reload-client │ │ │ │ ├── foo.js │ │ │ │ ├── index.html │ │ │ │ ├── wmr.config.mjs │ │ │ │ └── index.js │ │ │ ├── css-less-alias-relative │ │ │ │ ├── src │ │ │ │ │ ├── bar.less │ │ │ │ │ └── foo.less │ │ │ │ ├── public │ │ │ │ │ ├── style.less │ │ │ │ │ └── index.html │ │ │ │ └── wmr.config.mjs │ │ │ ├── css-module-compose-warn │ │ │ │ ├── index.js │ │ │ │ ├── index.html │ │ │ │ └── foo.css │ │ │ ├── css-sass-alias-relative │ │ │ │ ├── src │ │ │ │ │ ├── bar.scss │ │ │ │ │ └── foo.scss │ │ │ │ ├── public │ │ │ │ │ ├── style.scss │ │ │ │ │ └── index.html │ │ │ │ └── wmr.config.mjs │ │ │ ├── define-config-fn │ │ │ │ ├── public │ │ │ │ │ └── index.html │ │ │ │ └── wmr.config.mjs │ │ │ ├── define-config │ │ │ │ ├── public │ │ │ │ │ └── index.html │ │ │ │ └── wmr.config.mjs │ │ │ ├── file-import │ │ │ │ ├── fake-font.ttf │ │ │ │ ├── index.html │ │ │ │ ├── img.jpg │ │ │ │ └── index.js │ │ │ ├── hmr-css │ │ │ │ └── public │ │ │ │ │ ├── home.css │ │ │ │ │ ├── index.css │ │ │ │ │ └── index.html │ │ │ ├── hmr-scss │ │ │ │ ├── home.scss │ │ │ │ ├── index.scss │ │ │ │ ├── index.js │ │ │ │ └── index.html │ │ │ ├── import-assertions │ │ │ │ ├── foo.json │ │ │ │ ├── index.html │ │ │ │ └── index.js │ │ │ ├── import-priority │ │ │ │ ├── foo.js │ │ │ │ ├── foo.ts │ │ │ │ ├── index.html │ │ │ │ └── index.js │ │ │ ├── import-relative │ │ │ │ ├── foo.js │ │ │ │ ├── index.html │ │ │ │ └── index.js │ │ │ ├── json-alias │ │ │ │ ├── public │ │ │ │ │ ├── index.js │ │ │ │ │ └── index.html │ │ │ │ ├── src │ │ │ │ │ ├── bar.json │ │ │ │ │ └── foo.js │ │ │ │ └── wmr.config.mjs │ │ │ ├── prerender-resource-fetch │ │ │ │ ├── content.md │ │ │ │ ├── index.js │ │ │ │ └── index.html │ │ │ ├── watch │ │ │ │ ├── public │ │ │ │ │ ├── foo.js │ │ │ │ │ ├── index.js │ │ │ │ │ └── index.html │ │ │ │ └── wmr.config.mjs │ │ │ ├── worker-esm │ │ │ │ ├── dep-a.js │ │ │ │ ├── dep-b.js │ │ │ │ ├── entry-1.js │ │ │ │ ├── index.html │ │ │ │ ├── foo.worker.js │ │ │ │ └── index.js │ │ │ ├── worker-relative │ │ │ │ ├── index.js │ │ │ │ ├── foo │ │ │ │ │ ├── foo.worker.js │ │ │ │ │ └── index.js │ │ │ │ └── index.html │ │ │ ├── worker │ │ │ │ ├── dep-a.js │ │ │ │ ├── dep-b.js │ │ │ │ ├── entry-1.js │ │ │ │ ├── index.html │ │ │ │ ├── foo.worker.js │ │ │ │ └── index.js │ │ │ ├── alias-css │ │ │ │ ├── foo │ │ │ │ │ └── style.css │ │ │ │ ├── wmr.config.mjs │ │ │ │ └── public │ │ │ │ │ ├── index.html │ │ │ │ │ └── index.js │ │ │ ├── config-typescript-cjs │ │ │ │ ├── index.html │ │ │ │ └── wmr.config.ts │ │ │ ├── css-imports │ │ │ │ ├── a.css │ │ │ │ ├── styles │ │ │ │ │ ├── b.css │ │ │ │ │ ├── a.css │ │ │ │ │ └── img.jpg │ │ │ │ ├── index.js │ │ │ │ └── index.html │ │ │ ├── css-less-nested-alias-relative │ │ │ │ ├── src │ │ │ │ │ ├── bar.less │ │ │ │ │ └── foo.less │ │ │ │ ├── public │ │ │ │ │ ├── style.less │ │ │ │ │ ├── index.js │ │ │ │ │ └── index.html │ │ │ │ └── wmr.config.mjs │ │ │ ├── css-less-resolve-error │ │ │ │ ├── public │ │ │ │ │ ├── style.less │ │ │ │ │ ├── foo.less │ │ │ │ │ └── index.html │ │ │ │ └── wmr.config.mjs │ │ │ ├── css-sass-resolve-error │ │ │ │ ├── public │ │ │ │ │ ├── style.scss │ │ │ │ │ ├── foo.scss │ │ │ │ │ └── index.html │ │ │ │ └── wmr.config.mjs │ │ │ ├── directory-import │ │ │ │ ├── public │ │ │ │ │ ├── foo │ │ │ │ │ │ ├── a.js │ │ │ │ │ │ ├── b.js │ │ │ │ │ │ └── c.js │ │ │ │ │ ├── index.html │ │ │ │ │ ├── invalid.js │ │ │ │ │ └── index.js │ │ │ │ └── wmr.config.mjs │ │ │ ├── hmr-css-no-public │ │ │ │ ├── home.css │ │ │ │ ├── index.css │ │ │ │ └── index.html │ │ │ ├── import-absolute │ │ │ │ ├── public │ │ │ │ │ ├── foo.js │ │ │ │ │ ├── index.html │ │ │ │ │ └── index.js │ │ │ │ └── wmr.config.js │ │ │ ├── middleware-custom │ │ │ │ ├── bar.js │ │ │ │ ├── foo.js │ │ │ │ ├── index.html │ │ │ │ ├── index.js │ │ │ │ └── wmr.config.mjs │ │ │ ├── overwrite-loader-json │ │ │ │ ├── bar.json │ │ │ │ ├── baz.json │ │ │ │ ├── foo.json │ │ │ │ ├── index.html │ │ │ │ └── index.js │ │ │ ├── process-import2 │ │ │ │ ├── bar.js │ │ │ │ ├── foo.js │ │ │ │ ├── index.html │ │ │ │ └── index.js │ │ │ ├── publicpath │ │ │ │ ├── public │ │ │ │ │ ├── constants.js │ │ │ │ │ ├── index.css │ │ │ │ │ ├── math.css │ │ │ │ │ ├── index.js │ │ │ │ │ ├── math.js │ │ │ │ │ └── index.html │ │ │ │ └── wmr.config.js │ │ │ ├── script-type │ │ │ │ └── public │ │ │ │ │ ├── foo.js │ │ │ │ │ ├── index.html │ │ │ │ │ └── index.js │ │ │ ├── virtual-id-at │ │ │ │ ├── public │ │ │ │ │ ├── index.js │ │ │ │ │ └── index.html │ │ │ │ └── wmr.config.mjs │ │ │ ├── alias-parent │ │ │ │ ├── foo │ │ │ │ │ └── style.css │ │ │ │ ├── wmr.config.mjs │ │ │ │ └── public │ │ │ │ │ ├── index.html │ │ │ │ │ └── index.js │ │ │ ├── alias-src-public │ │ │ │ ├── src │ │ │ │ │ ├── foo.js │ │ │ │ │ ├── index.html │ │ │ │ │ └── index.js │ │ │ │ └── wmr.config.mjs │ │ │ ├── css-less-import-hash │ │ │ │ └── public │ │ │ │ │ ├── index.js │ │ │ │ │ ├── 2.less │ │ │ │ │ └── index.html │ │ │ ├── css-sass-import-hash │ │ │ │ └── public │ │ │ │ │ ├── index.js │ │ │ │ │ ├── 2.scss │ │ │ │ │ └── index.html │ │ │ ├── define-config-fn-return │ │ │ │ ├── public │ │ │ │ │ └── index.html │ │ │ │ └── wmr.config.mjs │ │ │ ├── define-config-typescript │ │ │ │ ├── public │ │ │ │ │ └── index.html │ │ │ │ ├── package.json │ │ │ │ └── wmr.config.ts │ │ │ ├── import-assertions-dynamic │ │ │ │ ├── foo.json │ │ │ │ ├── index.html │ │ │ │ └── index.js │ │ │ ├── plugin-config │ │ │ │ └── public │ │ │ │ │ └── index.html │ │ │ ├── plugin-hooks │ │ │ │ ├── public │ │ │ │ │ └── index.html │ │ │ │ └── wmr.config.mjs │ │ │ ├── prerender-missing-export │ │ │ │ ├── index.js │ │ │ │ └── index.html │ │ │ ├── this-undefined │ │ │ │ ├── -node_modules │ │ │ │ │ └── foo │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── package.json │ │ │ │ ├── index.js │ │ │ │ └── index.html │ │ │ ├── alias │ │ │ │ ├── index.html │ │ │ │ ├── package.json │ │ │ │ └── index.js │ │ │ ├── config │ │ │ │ ├── index.html │ │ │ │ ├── package.json │ │ │ │ └── style.module.css │ │ │ ├── css-less-file-error │ │ │ │ └── public │ │ │ │ │ ├── style.less │ │ │ │ │ └── index.html │ │ │ ├── css-less-nested-alias-relative-2 │ │ │ │ ├── src │ │ │ │ │ ├── style │ │ │ │ │ │ ├── bar.less │ │ │ │ │ │ └── foo.less │ │ │ │ │ └── index.js │ │ │ │ ├── public │ │ │ │ │ ├── index.js │ │ │ │ │ ├── style.less │ │ │ │ │ └── index.html │ │ │ │ └── wmr.config.mjs │ │ │ ├── css-module │ │ │ │ ├── foo.module.css │ │ │ │ ├── index.html │ │ │ │ └── index.js │ │ │ ├── css-sass-file-error │ │ │ │ └── public │ │ │ │ │ ├── style.scss │ │ │ │ │ └── index.html │ │ │ ├── css │ │ │ │ ├── style.module.css │ │ │ │ ├── home │ │ │ │ │ ├── style.module.css │ │ │ │ │ └── index.js │ │ │ │ ├── profile │ │ │ │ │ ├── style.module.css │ │ │ │ │ └── index.js │ │ │ │ ├── index.html │ │ │ │ └── style.css │ │ │ ├── define-config-fn-conditional │ │ │ │ ├── public │ │ │ │ │ └── index.html │ │ │ │ └── wmr.config.mjs │ │ │ ├── define-config-typescript-cjs │ │ │ │ ├── public │ │ │ │ │ └── index.html │ │ │ │ └── wmr.config.ts │ │ │ ├── env-precedence │ │ │ │ ├── .env │ │ │ │ ├── index.html │ │ │ │ ├── index.js │ │ │ │ └── wmr.config.mjs │ │ │ ├── package-exports │ │ │ │ ├── node_modules │ │ │ │ │ ├── main │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── package.json │ │ │ │ │ ├── no-mainfield │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── package.json │ │ │ │ │ ├── exports-multi │ │ │ │ │ │ ├── exports-multi.js │ │ │ │ │ │ ├── exports-multi-other.js │ │ │ │ │ │ └── package.json │ │ │ │ │ ├── exports-fallbacks-defaultfallback │ │ │ │ │ │ ├── other.js │ │ │ │ │ │ ├── default.js │ │ │ │ │ │ ├── require.js │ │ │ │ │ │ └── package.json │ │ │ │ │ ├── exports-fallbacks-defaultfirst │ │ │ │ │ │ ├── default.js │ │ │ │ │ │ ├── import.js │ │ │ │ │ │ ├── module.js │ │ │ │ │ │ ├── require.js │ │ │ │ │ │ └── package.json │ │ │ │ │ ├── exports-fallbacks-importfirst │ │ │ │ │ │ ├── default.js │ │ │ │ │ │ ├── import.js │ │ │ │ │ │ ├── module.js │ │ │ │ │ │ ├── require.js │ │ │ │ │ │ └── package.json │ │ │ │ │ ├── exports-fallbacks-requirefallback │ │ │ │ │ │ ├── other.js │ │ │ │ │ │ ├── default.js │ │ │ │ │ │ ├── require.js │ │ │ │ │ │ └── package.json │ │ │ │ │ ├── exports-fallbacks-requirefirst │ │ │ │ │ │ ├── default.js │ │ │ │ │ │ ├── import.js │ │ │ │ │ │ ├── module.js │ │ │ │ │ │ ├── require.js │ │ │ │ │ │ └── package.json │ │ │ │ │ ├── exports-single │ │ │ │ │ │ ├── exports-single.js │ │ │ │ │ │ └── package.json │ │ │ │ │ └── no-mainfield-module │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ └── package.json │ │ │ │ └── index.html │ │ │ ├── plugin-middlewares │ │ │ │ ├── public │ │ │ │ │ └── index.html │ │ │ │ └── wmr.config.mjs │ │ │ ├── process-present │ │ │ │ ├── foo.js │ │ │ │ ├── index.html │ │ │ │ └── index.js │ │ │ ├── publicpath-typescript │ │ │ │ ├── package.json │ │ │ │ ├── public │ │ │ │ │ ├── constants.js │ │ │ │ │ ├── math.css │ │ │ │ │ ├── index.css │ │ │ │ │ ├── index.js │ │ │ │ │ ├── math.js │ │ │ │ │ └── index.html │ │ │ │ └── wmr.config.ts │ │ │ ├── node-builtins │ │ │ │ └── http.js │ │ │ ├── plugin-config-multiple │ │ │ │ ├── public │ │ │ │ │ └── index.html │ │ │ │ └── wmr.config.mjs │ │ │ ├── prod-prerender-json │ │ │ │ ├── foo.json │ │ │ │ ├── index.html │ │ │ │ └── index.js │ │ │ ├── _unit-transform-imports │ │ │ │ ├── dynamic-import.js │ │ │ │ ├── import-meta.js │ │ │ │ ├── import-meta.expected.js │ │ │ │ ├── dynamic-import.expected.js │ │ │ │ ├── import-meta-long.expected.js │ │ │ │ ├── import-meta-long.js │ │ │ │ ├── import-assertion.js │ │ │ │ ├── import-assertion.expected.js │ │ │ │ ├── static-import-relative.js │ │ │ │ ├── static-import-relative.expected.js │ │ │ │ ├── import-assertion-dynamic.js │ │ │ │ ├── dynamic-import-inline.expected.js │ │ │ │ ├── dynamic-import-inline.js │ │ │ │ ├── dynamic-import-comment.js │ │ │ │ ├── import-assertion-dynamic.expected.js │ │ │ │ ├── static-import-empty.js │ │ │ │ ├── dynamic-import-comment.expected.js │ │ │ │ ├── static-import.expected.js │ │ │ │ ├── static-import.js │ │ │ │ ├── static-import-empty.expected.js │ │ │ │ ├── import-meta-inline.expected.js │ │ │ │ └── import-meta-inline.js │ │ │ ├── css-module-clash │ │ │ │ └── public │ │ │ │ │ ├── bar │ │ │ │ │ ├── styles.module.css │ │ │ │ │ └── bar.js │ │ │ │ │ ├── foo │ │ │ │ │ ├── styles.module.css │ │ │ │ │ └── foo.js │ │ │ │ │ ├── index.js │ │ │ │ │ └── index.html │ │ │ ├── dynamic-import │ │ │ │ ├── index.html │ │ │ │ ├── pages │ │ │ │ │ ├── one.js │ │ │ │ │ └── two.js │ │ │ │ └── index.js │ │ │ ├── hmr-index │ │ │ │ ├── index.js │ │ │ │ └── index.html │ │ │ ├── css-less │ │ │ │ └── public │ │ │ │ │ ├── style.less │ │ │ │ │ └── index.html │ │ │ ├── css-sass │ │ │ │ └── public │ │ │ │ │ ├── style.scss │ │ │ │ │ └── index.html │ │ │ ├── exports │ │ │ │ ├── node_modules │ │ │ │ │ └── test │ │ │ │ │ │ ├── browser.mjs │ │ │ │ │ │ ├── node.mjs │ │ │ │ │ │ └── package.json │ │ │ │ └── public │ │ │ │ │ ├── index.js │ │ │ │ │ └── index.html │ │ │ ├── preact-jsx │ │ │ │ ├── app.js │ │ │ │ ├── index.html │ │ │ │ └── index.js │ │ │ ├── simple │ │ │ │ └── public │ │ │ │ │ ├── index.js │ │ │ │ │ └── index.html │ │ │ ├── alias-deprecated │ │ │ │ ├── public │ │ │ │ │ ├── index.html │ │ │ │ │ └── index.js │ │ │ │ └── wmr.config.mjs │ │ │ ├── prerender-additional-links │ │ │ │ ├── index.js │ │ │ │ ├── wmr.config.mjs │ │ │ │ └── index.html │ │ │ ├── process │ │ │ │ ├── index.js │ │ │ │ └── index.html │ │ │ ├── prod-routes │ │ │ │ ├── about.js │ │ │ │ ├── _404.js │ │ │ │ ├── header.js │ │ │ │ └── index.html │ │ │ ├── cli-minify │ │ │ │ ├── index.html │ │ │ │ └── index.js │ │ │ ├── prerender-crash │ │ │ │ ├── index.js │ │ │ │ └── index.html │ │ │ ├── prerender-error │ │ │ │ ├── index.js │ │ │ │ └── index.html │ │ │ ├── transformations │ │ │ │ ├── jsx-escaped.js │ │ │ │ ├── jsx-escaped.expected.js │ │ │ │ ├── jsx-self-closed.js │ │ │ │ ├── jsx-self-closed.expected.js │ │ │ │ ├── jsx-member.js │ │ │ │ ├── jsx-member.expected.js │ │ │ │ ├── jsx-comment.expected.js │ │ │ │ └── jsx-comment.js │ │ │ ├── alias-asset │ │ │ │ ├── wmr.config.mjs │ │ │ │ ├── public │ │ │ │ │ ├── index.html │ │ │ │ │ └── index.js │ │ │ │ └── foo │ │ │ │ │ └── img.jpg │ │ │ ├── class-fields │ │ │ │ ├── index.html │ │ │ │ └── index.js │ │ │ ├── css-less-module │ │ │ │ └── public │ │ │ │ │ ├── index.html │ │ │ │ │ ├── style.module.less │ │ │ │ │ └── index.js │ │ │ ├── css-sass-module │ │ │ │ └── public │ │ │ │ │ ├── index.html │ │ │ │ │ ├── style.module.scss │ │ │ │ │ └── index.js │ │ │ ├── env-vars │ │ │ │ ├── index.html │ │ │ │ └── index.js │ │ │ ├── import-meta-env │ │ │ │ ├── index.js │ │ │ │ └── index.html │ │ │ ├── url-prefix │ │ │ │ ├── index.html │ │ │ │ └── index.js │ │ │ ├── preact-no-jsx │ │ │ │ ├── index.html │ │ │ │ └── index.js │ │ │ ├── process-complex │ │ │ │ ├── index.html │ │ │ │ ├── other.js │ │ │ │ └── index.js │ │ │ ├── process-object │ │ │ │ ├── index.html │ │ │ │ └── index.js │ │ │ ├── worker-multi │ │ │ │ ├── bar.worker.js │ │ │ │ ├── foo.worker.js │ │ │ │ ├── index.html │ │ │ │ └── index.js │ │ │ ├── class-fields-private │ │ │ │ ├── index.html │ │ │ │ └── index.js │ │ │ ├── class-fields-static │ │ │ │ ├── index.html │ │ │ │ └── index.js │ │ │ ├── index-fallback │ │ │ │ ├── index.js │ │ │ │ └── index.html │ │ │ ├── logical-assignment │ │ │ │ ├── index.html │ │ │ │ └── index.js │ │ │ ├── markdown │ │ │ │ ├── index.js │ │ │ │ ├── index.html │ │ │ │ └── wmr.config.mjs │ │ │ ├── overwrite-loader-url │ │ │ │ ├── index.html │ │ │ │ ├── foo.svg │ │ │ │ └── index.js │ │ │ ├── plugin-enforce │ │ │ │ └── public │ │ │ │ │ ├── scripts.js │ │ │ │ │ └── index.html │ │ │ ├── virtual-id │ │ │ │ ├── public │ │ │ │ │ ├── index.html │ │ │ │ │ └── index.js │ │ │ │ └── wmr.config.mjs │ │ │ ├── plugin-resolve │ │ │ │ ├── public │ │ │ │ │ ├── index.html │ │ │ │ │ └── index.js │ │ │ │ └── wmr.config.mjs │ │ │ ├── sourcemap-ts │ │ │ │ ├── index.html │ │ │ │ └── index.ts │ │ │ ├── plugin-resolve-prefix │ │ │ │ ├── public │ │ │ │ │ ├── index.html │ │ │ │ │ └── index.js │ │ │ │ └── wmr.config.mjs │ │ │ ├── process-present-import-id │ │ │ │ ├── index.html │ │ │ │ ├── process.js │ │ │ │ ├── index.js │ │ │ │ └── bar.js │ │ │ ├── process-present-import-ns │ │ │ │ ├── index.html │ │ │ │ ├── process.js │ │ │ │ ├── index.js │ │ │ │ └── bar.js │ │ │ ├── sourcemap-jsx │ │ │ │ ├── index.html │ │ │ │ └── index.jsx │ │ │ ├── process-present-import-default │ │ │ │ ├── index.html │ │ │ │ ├── process.js │ │ │ │ ├── index.js │ │ │ │ └── bar.js │ │ │ ├── htmlonly-nopublic │ │ │ │ └── index.html │ │ │ ├── htmlonly │ │ │ │ └── public │ │ │ │ │ └── index.html │ │ │ ├── rmwc │ │ │ │ ├── index.html │ │ │ │ └── package.json │ │ │ ├── prerender-data │ │ │ │ ├── index.js │ │ │ │ └── index.html │ │ │ ├── prerender-external │ │ │ │ ├── index.js │ │ │ │ └── index.html │ │ │ ├── prerender-missing-entry │ │ │ │ ├── index.tsx │ │ │ │ └── index.html │ │ │ ├── css-module-reserved │ │ │ │ ├── foo.module.css │ │ │ │ ├── index.html │ │ │ │ └── index.js │ │ │ ├── _unit │ │ │ │ ├── jsx-nesting.js │ │ │ │ └── jsx-nesting.expected.js │ │ │ ├── prerender-external-resource-fetch │ │ │ │ ├── index.js │ │ │ │ └── index.html │ │ │ ├── typescript-override │ │ │ │ ├── index.ts │ │ │ │ └── index.html │ │ │ ├── external-scripts │ │ │ │ ├── index.js │ │ │ │ ├── index.html │ │ │ │ └── external.umd.js │ │ │ ├── prod-head │ │ │ │ ├── index.html │ │ │ │ └── index.js │ │ │ └── pwa │ │ │ │ └── public │ │ │ │ ├── sw.js │ │ │ │ ├── manifest.json │ │ │ │ ├── style.css │ │ │ │ ├── index.js │ │ │ │ └── home.js │ │ └── global.d.ts │ ├── src │ │ ├── lib │ │ │ ├── ~empty.js │ │ │ ├── ~inherits.js │ │ │ ├── ~readable-stream-duplex.js │ │ │ ├── ~fsevents.js │ │ │ ├── mimetypes.js │ │ │ ├── http2.js │ │ │ ├── ~readable-stream.js │ │ │ └── fs-watcher.js │ │ ├── global.d.ts │ │ └── plugins │ │ │ ├── wmr │ │ │ ├── styles │ │ │ │ └── sass.js │ │ │ └── client-prod.js │ │ │ ├── external-urls-plugin.js │ │ │ └── absolute-path-plugin.js │ ├── index.js │ ├── jest-puppeteer.config.cjs │ └── tsconfig.json ├── directory-plugin │ ├── .gitignore │ ├── example │ │ ├── wmr.config.mjs │ │ ├── package.json │ │ └── public │ │ │ ├── pages │ │ │ └── about.js │ │ │ └── index.html │ └── types.d.ts ├── create-wmr │ └── tpl │ │ ├── _gitignore │ │ ├── public │ │ ├── pages │ │ │ ├── about │ │ │ │ ├── style.module.css │ │ │ │ └── index.js │ │ │ ├── home │ │ │ │ └── style.module.css │ │ │ └── _404.js │ │ ├── header.js │ │ └── index.html │ │ ├── wmr.config.mjs │ │ ├── package.json │ │ └── tsconfig.json ├── preact-iso │ ├── hydrate.d.ts │ ├── index.d.ts │ ├── lazy.d.ts │ ├── index.js │ ├── prerender.d.ts │ └── hydrate.js └── nomodule-plugin │ ├── CHANGELOG.md │ └── README.md ├── .changeset ├── moody-shirts-smash.md ├── thick-apes-relax.md └── config.json ├── docs ├── public │ ├── assets │ │ ├── arrow.svg │ │ ├── wmr-shadow.svg │ │ ├── auto.svg │ │ ├── dark.svg │ │ └── teatime.svg │ ├── components │ │ ├── meta.js │ │ ├── footer.js │ │ └── markup.js │ ├── content │ │ └── _config.yml │ └── index.html ├── global.d.ts ├── wmr.config.js ├── tsconfig.json └── package.json ├── .prettierignore ├── .gitignore ├── .editorconfig └── .github └── workflows └── release.yml /examples/demo/.env.development: -------------------------------------------------------------------------------- 1 | FOO_DEV="bar" 2 | -------------------------------------------------------------------------------- /packages/sw-plugin/.gitignore: -------------------------------------------------------------------------------- 1 | sw-plugin.cjs 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/empty/public/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-absolute/index.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-sass-absolute/index.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/empty-nopublic/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/demo/.env: -------------------------------------------------------------------------------- 1 | FOO="bar" 2 | OVERRIDE=1 3 | EMPTY= 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/base64-html/public/index.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/config-reload-env/.env: -------------------------------------------------------------------------------- 1 | FOO="foo" -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-html/public/index.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-sass-html/public/index.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/plugin-error/public/index.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/serve-fallback/foo/bar: -------------------------------------------------------------------------------- 1 | foobar -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/serve-fallback/public/.foo: -------------------------------------------------------------------------------- 1 | asdf -------------------------------------------------------------------------------- /examples/demo/.env.development.local: -------------------------------------------------------------------------------- 1 | FOO_DEV_LOCAL="bar" 2 | -------------------------------------------------------------------------------- /examples/demo/.env.local: -------------------------------------------------------------------------------- 1 | FOO_LOCAL="bar" 2 | OVERRIDE=11 3 | -------------------------------------------------------------------------------- /packages/directory-plugin/.gitignore: -------------------------------------------------------------------------------- 1 | directory-plugin.cjs 2 | -------------------------------------------------------------------------------- /packages/wmr/src/lib/~empty.js: -------------------------------------------------------------------------------- 1 | export default undefined; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-nested-relative/index.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-module-hmr/styles/foo.module.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/plugin-config-falsy/public/index.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/demo/src/outside-b.js: -------------------------------------------------------------------------------- 1 | export const value = 'it works'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-import-hash-html/public/index.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-sass-import-hash-html/public/index.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/env/.env.development: -------------------------------------------------------------------------------- 1 | FOO_DEV="bar" 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/plugin-output-options/public/index.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/serve-fallback/public/extensionless: -------------------------------------------------------------------------------- 1 | asdf -------------------------------------------------------------------------------- /examples/demo/public/pages/environment/foo.js: -------------------------------------------------------------------------------- 1 | export const foo = 42; 2 | -------------------------------------------------------------------------------- /examples/demo/src/outside.js: -------------------------------------------------------------------------------- 1 | export { value } from './outside-b.js'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/config-reload-package-json/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-duplicates/a.css: -------------------------------------------------------------------------------- 1 | a { color: #f00; } 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-duplicates/b.css: -------------------------------------------------------------------------------- 1 | a { color: #f00; } 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-duplicates/lazy.js: -------------------------------------------------------------------------------- 1 | import './b.css'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-absolute/bar.less: -------------------------------------------------------------------------------- 1 | @color: red; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-alias/foo/foo.less: -------------------------------------------------------------------------------- 1 | @color: red; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-sass-absolute/bar.scss: -------------------------------------------------------------------------------- 1 | $color: red; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-sass-alias/foo/foo.scss: -------------------------------------------------------------------------------- 1 | $color: red; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/hmr/store/index.js: -------------------------------------------------------------------------------- 1 | export const FOO = 42; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/json/data.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo" 3 | } 4 | -------------------------------------------------------------------------------- /examples/demo/public/foo/alias-inside.js: -------------------------------------------------------------------------------- 1 | export const value = 'it works'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/alias-outside/foo/it.js: -------------------------------------------------------------------------------- 1 | export const it = 'it'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/alias-src/src/it.js: -------------------------------------------------------------------------------- 1 | export const it = 'it'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/config-multiple/index.html: -------------------------------------------------------------------------------- 1 |

Hello world

2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/config-reload/index.html: -------------------------------------------------------------------------------- 1 |

Hello world

2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-entry/a.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | color: #f00; 3 | } 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-entry/b.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | color: #f00; 3 | } 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-nested-alias/src/bar.less: -------------------------------------------------------------------------------- 1 | @color: red; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-nested-relative/foo.less: -------------------------------------------------------------------------------- 1 | @color: red; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-sass-nested-alias/src/bar.scss: -------------------------------------------------------------------------------- 1 | $color: red; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/env/.env: -------------------------------------------------------------------------------- 1 | FOO="bar" 2 | OVERRIDE=1 3 | EMPTY= 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/env/.env.development.local: -------------------------------------------------------------------------------- 1 | FOO_DEV_LOCAL="bar" 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/env/.env.local: -------------------------------------------------------------------------------- 1 | FOO_LOCAL="bar" 2 | OVERRIDE=11 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/hmr/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | color: #333; 3 | } 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/plugin-emit/public/index.js: -------------------------------------------------------------------------------- 1 | console.log('hey'); 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/process-import/foo.js: -------------------------------------------------------------------------------- 1 | export const foo = 42; 2 | -------------------------------------------------------------------------------- /examples/demo/public/pages/foo.json: -------------------------------------------------------------------------------- 1 | { 2 | "foo": 42, 3 | "bar": "bar" 4 | } 5 | -------------------------------------------------------------------------------- /packages/wmr/src/lib/~inherits.js: -------------------------------------------------------------------------------- 1 | module.exports = require('util').inherits; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/alias-src/src/works.js: -------------------------------------------------------------------------------- 1 | export const works = 'works'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/commonjs/default.js: -------------------------------------------------------------------------------- 1 | export default { a: 1, b: 2 }; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/commonjs/named.cjs: -------------------------------------------------------------------------------- 1 | exports.a = 1; 2 | exports.b = 2; 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/config-node-builtins/index.html: -------------------------------------------------------------------------------- 1 |

Hello world

2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/config-reload-client/foo.js: -------------------------------------------------------------------------------- 1 | export const foo = 42; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/config-reload-env/index.html: -------------------------------------------------------------------------------- 1 |

Hello world

2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-entry/empty.css: -------------------------------------------------------------------------------- 1 | h2 { 2 | color: yellow; 3 | } 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-alias-relative/src/bar.less: -------------------------------------------------------------------------------- 1 | @color: red; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-module-compose-warn/index.js: -------------------------------------------------------------------------------- 1 | import './foo.css'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-sass-alias-relative/src/bar.scss: -------------------------------------------------------------------------------- 1 | $color: red; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/define-config-fn/public/index.html: -------------------------------------------------------------------------------- 1 |

it works

2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/define-config/public/index.html: -------------------------------------------------------------------------------- 1 |

it works

2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/file-import/fake-font.ttf: -------------------------------------------------------------------------------- 1 | this is not a real font. 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/hmr-css/public/home.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | color: #333; 3 | } 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/hmr-scss/home.scss: -------------------------------------------------------------------------------- 1 | main { 2 | color: #333; 3 | } 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/import-assertions/foo.json: -------------------------------------------------------------------------------- 1 | { 2 | "foo": "bar" 3 | } 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/import-priority/foo.js: -------------------------------------------------------------------------------- 1 | export const foo = 'foo.js'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/import-priority/foo.ts: -------------------------------------------------------------------------------- 1 | export const foo = 'foo.ts'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/import-relative/foo.js: -------------------------------------------------------------------------------- 1 | export const foo = 'foo'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/json-alias/public/index.js: -------------------------------------------------------------------------------- 1 | import '../src/foo.js'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/prerender-resource-fetch/content.md: -------------------------------------------------------------------------------- 1 | # hello world 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/watch/public/foo.js: -------------------------------------------------------------------------------- 1 | export const value = 'it works'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/worker-esm/dep-a.js: -------------------------------------------------------------------------------- 1 | export { value } from './dep-b'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/worker-esm/dep-b.js: -------------------------------------------------------------------------------- 1 | export const value = 'it works'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/worker-relative/index.js: -------------------------------------------------------------------------------- 1 | import './foo/index.js'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/worker/dep-a.js: -------------------------------------------------------------------------------- 1 | export { value } from './dep-b'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/worker/dep-b.js: -------------------------------------------------------------------------------- 1 | export const value = 'it works'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/worker/entry-1.js: -------------------------------------------------------------------------------- 1 | export { value } from './dep-a'; 2 | -------------------------------------------------------------------------------- /examples/demo/public/foo/lib/test.ts: -------------------------------------------------------------------------------- 1 | export const test = 'I am a tsconfig path'; 2 | -------------------------------------------------------------------------------- /packages/create-wmr/tpl/_gitignore: -------------------------------------------------------------------------------- 1 | .cache 2 | node_modules 3 | dist 4 | stats.html 5 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/alias-css/foo/style.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | color: peachpuff; 3 | } 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/alias-outside/foo/works.js: -------------------------------------------------------------------------------- 1 | export const works = 'works'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/commonjs/default.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { a: 1, b: 2 }; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/config-typescript-cjs/index.html: -------------------------------------------------------------------------------- 1 |

Hello world

2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-imports/a.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | background: peachpuff; 3 | } 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-imports/styles/b.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | color: #f00; 3 | } 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-nested-alias-relative/src/bar.less: -------------------------------------------------------------------------------- 1 | @color: red; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-resolve-error/public/style.less: -------------------------------------------------------------------------------- 1 | @import 'bar'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-sass-resolve-error/public/style.scss: -------------------------------------------------------------------------------- 1 | @import 'bar'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/directory-import/public/foo/a.js: -------------------------------------------------------------------------------- 1 | export const a = 'a'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/directory-import/public/foo/b.js: -------------------------------------------------------------------------------- 1 | export const b = 'b'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/directory-import/public/foo/c.js: -------------------------------------------------------------------------------- 1 | export const c = 'c'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/hmr-css-no-public/home.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | color: #333; 3 | } 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/import-absolute/public/foo.js: -------------------------------------------------------------------------------- 1 | export const foo = 'foo'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/json-alias/src/bar.json: -------------------------------------------------------------------------------- 1 | { 2 | "value": "it works" 3 | } 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/middleware-custom/bar.js: -------------------------------------------------------------------------------- 1 | export const works = 'works'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/overwrite-loader-json/bar.json: -------------------------------------------------------------------------------- 1 | { 2 | "bar": "bar" 3 | } 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/overwrite-loader-json/baz.json: -------------------------------------------------------------------------------- 1 | { 2 | "baz": "baz" 3 | } 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/overwrite-loader-json/foo.json: -------------------------------------------------------------------------------- 1 | { 2 | "foo": "foo" 3 | } 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/process-import2/bar.js: -------------------------------------------------------------------------------- 1 | export const bar = process.env; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/process-import2/foo.js: -------------------------------------------------------------------------------- 1 | export const foo = process.env; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/publicpath/public/constants.js: -------------------------------------------------------------------------------- 1 | export const minimum = 10; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/script-type/public/foo.js: -------------------------------------------------------------------------------- 1 | export const foo = 'it works'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/virtual-id-at/public/index.js: -------------------------------------------------------------------------------- 1 | import 'virtual:windi.css'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/worker-esm/entry-1.js: -------------------------------------------------------------------------------- 1 | export { value } from './dep-a'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/alias-parent/foo/style.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | color: peachpuff; 3 | } 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/alias-src-public/src/foo.js: -------------------------------------------------------------------------------- 1 | export const value = 'it works'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/commonjs/named.js: -------------------------------------------------------------------------------- 1 | export const a = 1; 2 | export const b = 2; 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/config-reload-package-json/index.html: -------------------------------------------------------------------------------- 1 |

Hello world

2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-import-hash/public/index.js: -------------------------------------------------------------------------------- 1 | import './style.less'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-nested-alias/public/style.less: -------------------------------------------------------------------------------- 1 | @import 'src/foo'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-sass-import-hash/public/index.js: -------------------------------------------------------------------------------- 1 | import './style.scss'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-sass-nested-alias/public/style.scss: -------------------------------------------------------------------------------- 1 | @import 'src/foo'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/define-config-fn-return/public/index.html: -------------------------------------------------------------------------------- 1 |

it works

2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/define-config-typescript/public/index.html: -------------------------------------------------------------------------------- 1 |

it works

2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/import-assertions-dynamic/foo.json: -------------------------------------------------------------------------------- 1 | { 2 | "foo": "bar" 3 | } 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/json/data2.json: -------------------------------------------------------------------------------- 1 | { 2 | "second": "file", 3 | "a": 42 4 | } 5 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/plugin-config/public/index.html: -------------------------------------------------------------------------------- 1 |

Nothing to see here!

2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/plugin-hooks/public/index.html: -------------------------------------------------------------------------------- 1 |

Nothing to see here!

2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/prerender-missing-export/index.js: -------------------------------------------------------------------------------- 1 | export function foo() {} 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/publicpath/public/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: red; 3 | } 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/publicpath/public/math.css: -------------------------------------------------------------------------------- 1 | .sum { 2 | color: green; 3 | } 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/this-undefined/-node_modules/foo/index.js: -------------------------------------------------------------------------------- 1 | export default this; 2 | -------------------------------------------------------------------------------- /examples/demo/public/pages/about/style.module.css: -------------------------------------------------------------------------------- 1 | .about { 2 | background: #dbcfe7; 3 | } 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/alias/index.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/config/index.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-duplicates/c.css: -------------------------------------------------------------------------------- 1 | a { color: #00f; text-decoration: underline; } 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-imports/index.js: -------------------------------------------------------------------------------- 1 | import './styles/a.css'; 2 | import './a.css'; 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-file-error/public/style.less: -------------------------------------------------------------------------------- 1 | @import 'non-existing.less'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-import-hash/public/2.less: -------------------------------------------------------------------------------- 1 | body { 2 | color: green; 3 | } 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-nested-alias-relative-2/src/style/bar.less: -------------------------------------------------------------------------------- 1 | @color: red; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-nested-alias-relative/public/style.less: -------------------------------------------------------------------------------- 1 | @import 'src/foo'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-resolve-error/public/foo.less: -------------------------------------------------------------------------------- 1 | h1 { 2 | color: red; 3 | } 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-module/foo.module.css: -------------------------------------------------------------------------------- 1 | .foo { 2 | background: peachpuff; 3 | } 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-sass-file-error/public/style.scss: -------------------------------------------------------------------------------- 1 | @import 'non-existing.scss'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-sass-import-hash/public/2.scss: -------------------------------------------------------------------------------- 1 | body { 2 | color: green; 3 | } 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-sass-resolve-error/public/foo.scss: -------------------------------------------------------------------------------- 1 | h1 { 2 | color: red; 3 | } 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css/style.module.css: -------------------------------------------------------------------------------- 1 | .app > section { 2 | padding: 20px; 3 | } 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/define-config-fn-conditional/public/index.html: -------------------------------------------------------------------------------- 1 |

it works

2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/define-config-typescript-cjs/public/index.html: -------------------------------------------------------------------------------- 1 |

it works

2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/define-config-typescript/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/env-precedence/.env: -------------------------------------------------------------------------------- 1 | WMR_BAR="it works" 2 | WMR_FOO="it doesn't work" -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/middleware-custom/foo.js: -------------------------------------------------------------------------------- 1 | export const value = "it doesn't work"; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/package-exports/node_modules/main/index.js: -------------------------------------------------------------------------------- 1 | export default 'main'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/plugin-middlewares/public/index.html: -------------------------------------------------------------------------------- 1 |

Nothing to see here!

2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/process-present/foo.js: -------------------------------------------------------------------------------- 1 | export const env = { value: 'it works' }; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/publicpath-typescript/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/script-type/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-alias-relative/public/style.less: -------------------------------------------------------------------------------- 1 | @import '../src/foo.less'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-import-hash-html/public/2.less: -------------------------------------------------------------------------------- 1 | body { 2 | color: green; 3 | } 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-nested-alias-relative-2/src/index.js: -------------------------------------------------------------------------------- 1 | import './style/foo.less'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-nested-alias-relative/public/index.js: -------------------------------------------------------------------------------- 1 | import './style.less'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-sass-alias-relative/public/style.scss: -------------------------------------------------------------------------------- 1 | @import '../src/foo.scss'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-sass-import-hash-html/public/2.scss: -------------------------------------------------------------------------------- 1 | body { 2 | color: green; 3 | } 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/json/index.js: -------------------------------------------------------------------------------- 1 | import data from './data.json'; 2 | export default data; 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/node-builtins/http.js: -------------------------------------------------------------------------------- 1 | import http from 'http'; 2 | export default http; 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/plugin-config-multiple/public/index.html: -------------------------------------------------------------------------------- 1 |

Nothing to see here!

2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/prod-prerender-json/foo.json: -------------------------------------------------------------------------------- 1 | { 2 | "foo": 42, 3 | "bar": "bar" 4 | } 5 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/publicpath-typescript/public/constants.js: -------------------------------------------------------------------------------- 1 | export const minimum = 10; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/publicpath-typescript/public/math.css: -------------------------------------------------------------------------------- 1 | .sum { 2 | color: green; 3 | } 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/this-undefined/index.js: -------------------------------------------------------------------------------- 1 | import foo from 'foo'; 2 | console.log(foo); 3 | -------------------------------------------------------------------------------- /packages/create-wmr/tpl/public/pages/about/style.module.css: -------------------------------------------------------------------------------- 1 | .about { 2 | background: #dbcfe7; 3 | } 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/_unit-transform-imports/dynamic-import.js: -------------------------------------------------------------------------------- 1 | // @ts-ignore 2 | import('foo'); 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/alias-outside/forbidden/forbidden.js: -------------------------------------------------------------------------------- 1 | export const value = "it doesn't work"; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/alias-src-public/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | export default { 2 | public: 'src' 3 | }; 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-duplicates/index.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-entry/c.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | color: #00f; 3 | text-decoration: underline; 4 | } 5 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-nested-alias-relative-2/public/index.js: -------------------------------------------------------------------------------- 1 | import '../src/index.js'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-nested-alias-relative-2/public/style.less: -------------------------------------------------------------------------------- 1 | @import 'src/style/foo'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-module-clash/public/bar/styles.module.css: -------------------------------------------------------------------------------- 1 | .bar { 2 | color: red; 3 | } 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-module-clash/public/foo/styles.module.css: -------------------------------------------------------------------------------- 1 | .foo { 2 | color: blue; 3 | } 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/dynamic-import/index.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/hmr-index/index.js: -------------------------------------------------------------------------------- 1 | document.getElementById('root').textContent = 'success'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/hmr/style.module.css: -------------------------------------------------------------------------------- 1 | .app { 2 | background: #f6f6f6; 3 | color: #333; 4 | } 5 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/package-exports/index.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/publicpath-typescript/public/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: red; 3 | } 4 | -------------------------------------------------------------------------------- /examples/demo/public/pages/home/style.module.css: -------------------------------------------------------------------------------- 1 | .home { 2 | background: #f6f6f6; 3 | color: #333; 4 | } 5 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/_unit-transform-imports/import-meta.js: -------------------------------------------------------------------------------- 1 | // @ts-ignore 2 | import(import.meta.foo); 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-entry/index.js: -------------------------------------------------------------------------------- 1 | import './a.css'; 2 | import './b.css'; 3 | import './c.css'; 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less/public/style.less: -------------------------------------------------------------------------------- 1 | @color: red; 2 | 3 | h1 { 4 | color: @color; 5 | } 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-module-clash/public/index.js: -------------------------------------------------------------------------------- 1 | import './foo/foo.js'; 2 | import './bar/bar.js'; 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-sass/public/style.scss: -------------------------------------------------------------------------------- 1 | $color: red; 2 | 3 | h1 { 4 | color: $color; 5 | } 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css/home/style.module.css: -------------------------------------------------------------------------------- 1 | .home { 2 | background: #eee; 3 | color: #00f; 4 | } 5 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/exports/node_modules/test/browser.mjs: -------------------------------------------------------------------------------- 1 | export default "Browser implementation"; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/hmr-scss/index.scss: -------------------------------------------------------------------------------- 1 | @import 'home.scss'; 2 | 3 | body { 4 | color: #333; 5 | } 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/preact-jsx/app.js: -------------------------------------------------------------------------------- 1 | export function App() { 2 | return

it works

; 3 | } 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/simple/public/index.js: -------------------------------------------------------------------------------- 1 | document.getElementById('root').textContent = 'success'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/_unit-transform-imports/import-meta.expected.js: -------------------------------------------------------------------------------- 1 | // @ts-ignore 2 | import(it_works); 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/alias-deprecated/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-absolute/foo.less: -------------------------------------------------------------------------------- 1 | @import '/bar.less'; 2 | 3 | h1 { 4 | color: @color; 5 | } 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-html/public/style.less: -------------------------------------------------------------------------------- 1 | @color: red; 2 | 3 | div { 4 | color: @color; 5 | } 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-sass-absolute/foo.scss: -------------------------------------------------------------------------------- 1 | @import '/bar.scss'; 2 | 3 | h1 { 4 | color: $color; 5 | } 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-sass-html/public/style.scss: -------------------------------------------------------------------------------- 1 | $color: red; 2 | 3 | div { 4 | color: $color; 5 | } 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/json/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/json/using-prefix.js: -------------------------------------------------------------------------------- 1 | import data from 'json:./data2.json'; 2 | export default data; 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/package-exports/node_modules/main/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "no-mainfield-module" 3 | } -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/package-exports/node_modules/no-mainfield/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 'no-mainfield'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/package-exports/node_modules/no-mainfield/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "no-mainfield" 3 | } -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/prerender-additional-links/index.js: -------------------------------------------------------------------------------- 1 | export function prerender() { 2 | return {}; 3 | } 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/process/index.js: -------------------------------------------------------------------------------- 1 | document.getElementById('out').textContent = process.env.NODE_ENV; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/prod-routes/about.js: -------------------------------------------------------------------------------- 1 | export default function About() { 2 | return

About

; 3 | } 4 | -------------------------------------------------------------------------------- /packages/create-wmr/tpl/public/pages/home/style.module.css: -------------------------------------------------------------------------------- 1 | .home { 2 | background: #f6f6f6; 3 | color: #333; 4 | } 5 | -------------------------------------------------------------------------------- /packages/wmr/src/lib/~readable-stream-duplex.js: -------------------------------------------------------------------------------- 1 | const Stream = require('stream'); 2 | module.exports = Stream.Duplex; 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/_unit-transform-imports/dynamic-import.expected.js: -------------------------------------------------------------------------------- 1 | // @ts-ignore 2 | import('it_works'); 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/alias-css/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | export default { 2 | alias: { 3 | 'foo/*': 'foo' 4 | } 5 | }; 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/cli-minify/index.html: -------------------------------------------------------------------------------- 1 |

check js

2 | 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-imports/index.html: -------------------------------------------------------------------------------- 1 |

foobar

2 | 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-nested-alias/src/foo.less: -------------------------------------------------------------------------------- 1 | @import 'bar'; 2 | 3 | h1 { 4 | color: @color; 5 | } 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-nested-relative/style.less: -------------------------------------------------------------------------------- 1 | @import 'foo'; 2 | 3 | h1 { 4 | color: @color; 5 | } 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-sass-nested-alias/src/foo.scss: -------------------------------------------------------------------------------- 1 | @import 'bar'; 2 | 3 | h1 { 4 | color: $color; 5 | } 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/json-alias/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | export default { 2 | alias: { 3 | 'src/*': 'src' 4 | } 5 | }; 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/package-exports/node_modules/exports-multi/exports-multi.js: -------------------------------------------------------------------------------- 1 | export default 'exports-multi'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/prerender-crash/index.js: -------------------------------------------------------------------------------- 1 | export function prerender() { 2 | throw new Error('fail'); 3 | } 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/prerender-error/index.js: -------------------------------------------------------------------------------- 1 | export function prerender() { 2 | return window.foo.bar; 3 | } 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/process/index.html: -------------------------------------------------------------------------------- 1 | 2 |

3 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/transformations/jsx-escaped.js:
--------------------------------------------------------------------------------
1 | export function Foo() {
2 | 	return <;
3 | }
4 | 


--------------------------------------------------------------------------------
/examples/demo/public/pages/files/img.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/preactjs/wmr/HEAD/examples/demo/public/pages/files/img.jpg


--------------------------------------------------------------------------------
/packages/sw-plugin/example/public/index.js:
--------------------------------------------------------------------------------
1 | import swURL from 'sw:./sw.js';
2 | 
3 | navigator.serviceWorker.register(swURL);
4 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/200/index.js:
--------------------------------------------------------------------------------
1 | document.getElementById('root').textContent = location.pathname + location.search;
2 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/_unit-transform-imports/import-meta-long.expected.js:
--------------------------------------------------------------------------------
1 | // @ts-ignore
2 | import(it_works.NODE_ENV);
3 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/_unit-transform-imports/import-meta-long.js:
--------------------------------------------------------------------------------
1 | // @ts-ignore
2 | import(import.meta.env.NODE_ENV);
3 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/alias-asset/wmr.config.mjs:
--------------------------------------------------------------------------------
1 | export default {
2 | 	alias: {
3 | 		'foo/': './foo'
4 | 	}
5 | };
6 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/alias-outside/wmr.config.mjs:
--------------------------------------------------------------------------------
1 | export default {
2 | 	alias: {
3 | 		'foo/*': './foo'
4 | 	}
5 | };
6 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/alias-parent/wmr.config.mjs:
--------------------------------------------------------------------------------
1 | export default {
2 | 	alias: {
3 | 		'parent/*': '../'
4 | 	}
5 | };
6 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/class-fields/index.html:
--------------------------------------------------------------------------------
1 | 
2 | 

3 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/css-less-alias/public/style.less:
--------------------------------------------------------------------------------
1 | @import '~/foo.less';
2 | 
3 | h1 {
4 | 	color: @color;
5 | }
6 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/css-less-alias/wmr.config.mjs:
--------------------------------------------------------------------------------
1 | export default {
2 | 	alias: {
3 | 		'~/*': 'foo'
4 | 	}
5 | };
6 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/css-less-module/public/index.html:
--------------------------------------------------------------------------------
1 | 

Sass

2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-module/public/style.module.less: -------------------------------------------------------------------------------- 1 | @color: red; 2 | 3 | .foo { 4 | color: @color; 5 | } 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-sass-alias/public/style.scss: -------------------------------------------------------------------------------- 1 | @import '~/foo.scss'; 2 | 3 | h1 { 4 | color: $color; 5 | } 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-sass-alias/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | export default { 2 | alias: { 3 | '~/*': 'foo' 4 | } 5 | }; 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-sass-module/public/index.html: -------------------------------------------------------------------------------- 1 |

Sass

2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-sass-module/public/style.module.scss: -------------------------------------------------------------------------------- 1 | $color: red; 2 | 3 | .foo { 4 | color: $color; 5 | } 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/directory-import/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/dynamic-import/pages/one.js: -------------------------------------------------------------------------------- 1 | console.log('hello from page one'); 2 | export default 'page one'; 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/dynamic-import/pages/two.js: -------------------------------------------------------------------------------- 1 | console.log('hello from page two'); 2 | export default 'page two'; 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/env-vars/index.html: -------------------------------------------------------------------------------- 1 |

2 | 
3 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/env/public/index.html:
--------------------------------------------------------------------------------
1 | 
2 | 

3 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/exports/node_modules/test/node.mjs:
--------------------------------------------------------------------------------
1 | import "node:url";export default "Node.js implementation";
2 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/file-import/index.html:
--------------------------------------------------------------------------------
1 | 
2 | 

3 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/import-meta-env/index.js:
--------------------------------------------------------------------------------
1 | document.getElementById('out').textContent = import.meta.env.NODE_ENV;
2 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/package-exports/node_modules/exports-fallbacks-defaultfallback/other.js:
--------------------------------------------------------------------------------
1 | export default 'default';
2 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/package-exports/node_modules/exports-fallbacks-defaultfirst/default.js:
--------------------------------------------------------------------------------
1 | export default 'default';
2 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/package-exports/node_modules/exports-fallbacks-defaultfirst/import.js:
--------------------------------------------------------------------------------
1 | export default 'import';
2 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/package-exports/node_modules/exports-fallbacks-defaultfirst/module.js:
--------------------------------------------------------------------------------
1 | export default 'module';
2 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/package-exports/node_modules/exports-fallbacks-defaultfirst/require.js:
--------------------------------------------------------------------------------
1 | export default 'require';
2 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/package-exports/node_modules/exports-fallbacks-importfirst/default.js:
--------------------------------------------------------------------------------
1 | export default 'default';
2 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/package-exports/node_modules/exports-fallbacks-importfirst/import.js:
--------------------------------------------------------------------------------
1 | export default 'import';
2 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/package-exports/node_modules/exports-fallbacks-importfirst/module.js:
--------------------------------------------------------------------------------
1 | export default 'module';
2 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/package-exports/node_modules/exports-fallbacks-importfirst/require.js:
--------------------------------------------------------------------------------
1 | export default 'require';
2 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/package-exports/node_modules/exports-fallbacks-requirefallback/other.js:
--------------------------------------------------------------------------------
1 | export default 'default';
2 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/package-exports/node_modules/exports-fallbacks-requirefirst/default.js:
--------------------------------------------------------------------------------
1 | export default 'default';
2 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/package-exports/node_modules/exports-fallbacks-requirefirst/import.js:
--------------------------------------------------------------------------------
1 | export default 'import';
2 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/package-exports/node_modules/exports-fallbacks-requirefirst/module.js:
--------------------------------------------------------------------------------
1 | export default 'module';
2 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/package-exports/node_modules/exports-fallbacks-requirefirst/require.js:
--------------------------------------------------------------------------------
1 | export default 'require';
2 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/package-exports/node_modules/exports-single/exports-single.js:
--------------------------------------------------------------------------------
1 | export default 'exports-single';
2 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/package-exports/node_modules/no-mainfield-module/index.js:
--------------------------------------------------------------------------------
1 | export default 'no-mainfield-module';
2 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/preact-jsx/index.html:
--------------------------------------------------------------------------------
1 | 
2 | 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/serve-fallback/public/index.html: -------------------------------------------------------------------------------- 1 |

it doesn't work

2 | 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/serve-fallback/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | export default { 2 | alias: { 3 | 'foo/*': './foo' 4 | } 5 | }; 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/url-prefix/index.html: -------------------------------------------------------------------------------- 1 | 2 |

3 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/virtual-id-at/public/index.html:
--------------------------------------------------------------------------------
1 | 

foo

2 | 3 | -------------------------------------------------------------------------------- /.changeset/moody-shirts-smash.md: -------------------------------------------------------------------------------- 1 | --- 2 | 'wmr': patch 3 | --- 4 | 5 | Corrects worker regex pattern to avoid false positives 6 | -------------------------------------------------------------------------------- /examples/demo/wmr.config.ts: -------------------------------------------------------------------------------- 1 | export default function () { 2 | return { 3 | alias: { 4 | 'src/*': 'src' 5 | } 6 | }; 7 | } 8 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/_unit-transform-imports/import-assertion.js: -------------------------------------------------------------------------------- 1 | import json from './foo.json' assert { type: 'json' }; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/commonjs/mixed.js: -------------------------------------------------------------------------------- 1 | export default 'default export'; 2 | export const a = 1; 3 | export const b = 2; 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/commonjs/node_modules/fake-lib/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fake-lib", 3 | "main": "./fake-lib.js" 4 | } -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-imports/styles/a.css: -------------------------------------------------------------------------------- 1 | @import 'b.css'; 2 | 3 | body { 4 | background: url('./img.jpg'); 5 | } 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-alias-relative/src/foo.less: -------------------------------------------------------------------------------- 1 | @import './bar.less'; 2 | 3 | h1 { 4 | color: @color; 5 | } 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-nested-alias-relative/src/foo.less: -------------------------------------------------------------------------------- 1 | @import './bar'; 2 | 3 | h1 { 4 | color: @color; 5 | } 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-nested-alias/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | export default { 2 | alias: { 3 | 'src/*': 'src' 4 | } 5 | }; 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-module-compose-warn/index.html: -------------------------------------------------------------------------------- 1 |

foo

2 | 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-module/index.html: -------------------------------------------------------------------------------- 1 |

foo

2 | 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-sass-alias-relative/src/foo.scss: -------------------------------------------------------------------------------- 1 | @import './bar.scss'; 2 | 3 | h1 { 4 | color: $color; 5 | } 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-sass-nested-alias/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | export default { 2 | alias: { 3 | 'src/*': 'src' 4 | } 5 | }; 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/directory-import/public/invalid.js: -------------------------------------------------------------------------------- 1 | import files from 'dir:./foo/a.js'; 2 | 3 | console.log(files); 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/import-meta-env/index.html: -------------------------------------------------------------------------------- 1 |

2 | 
3 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/import-priority/index.html:
--------------------------------------------------------------------------------
1 | 
2 | 

3 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/import-relative/index.html:
--------------------------------------------------------------------------------
1 | 
2 | 

3 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/package-exports/node_modules/exports-fallbacks-defaultfallback/default.js:
--------------------------------------------------------------------------------
1 | export default 'default';
2 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/package-exports/node_modules/exports-fallbacks-defaultfallback/require.js:
--------------------------------------------------------------------------------
1 | export default 'require';
2 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/package-exports/node_modules/exports-fallbacks-requirefallback/default.js:
--------------------------------------------------------------------------------
1 | export default 'default';
2 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/package-exports/node_modules/exports-fallbacks-requirefallback/require.js:
--------------------------------------------------------------------------------
1 | export default 'require';
2 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/plugin-emit/public/worker.js:
--------------------------------------------------------------------------------
1 | addEventListener('message', () => {
2 | 	postMessage('it works');
3 | });
4 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/preact-no-jsx/index.html:
--------------------------------------------------------------------------------
1 | 
2 | 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/process-complex/index.html: -------------------------------------------------------------------------------- 1 |

2 | 
3 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/process-import/index.html:
--------------------------------------------------------------------------------
1 | 
2 | 

3 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/process-import2/index.html:
--------------------------------------------------------------------------------
1 | 
2 | 

3 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/process-object/index.html:
--------------------------------------------------------------------------------
1 | 

2 | 
3 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/process-present/index.html:
--------------------------------------------------------------------------------
1 | 
2 | 

3 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/this-undefined/-node_modules/foo/package.json:
--------------------------------------------------------------------------------
1 | {
2 | 	"name": "foo",
3 | 	"main": "./index.js"
4 | }
5 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/this-undefined/index.html:
--------------------------------------------------------------------------------
1 | 
2 | 

3 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/worker-multi/bar.worker.js:
--------------------------------------------------------------------------------
1 | addEventListener('message', () => {
2 | 	postMessage('it works');
3 | });
4 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/worker-multi/foo.worker.js:
--------------------------------------------------------------------------------
1 | addEventListener('message', () => {
2 | 	postMessage('it works');
3 | });
4 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/_unit-transform-imports/import-assertion.expected.js:
--------------------------------------------------------------------------------
1 | import json from 'it_works' assert { type: 'json' };
2 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/_unit-transform-imports/static-import-relative.js:
--------------------------------------------------------------------------------
1 | // @ts-ignore
2 | import { foo } from './foo.js?module';
3 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/alias-asset/public/index.html:
--------------------------------------------------------------------------------
1 | 

it doesn't work

2 | 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/alias-css/public/index.html: -------------------------------------------------------------------------------- 1 |

it doesn't work

2 | 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/alias-src-public/src/index.html: -------------------------------------------------------------------------------- 1 |

it doesn't work

2 | 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/alias-src/public/index.html: -------------------------------------------------------------------------------- 1 |

it doesn't work

2 | 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/class-fields-private/index.html: -------------------------------------------------------------------------------- 1 | 2 |

3 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/class-fields-static/index.html:
--------------------------------------------------------------------------------
1 | 
2 | 

3 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/config-reload-client/index.html:
--------------------------------------------------------------------------------
1 | 

Hello world

2 | 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-alias-relative/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | export default { 2 | alias: { 3 | 'src/*': 'src' 4 | } 5 | }; 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-module-hmr/index.html: -------------------------------------------------------------------------------- 1 |

foo

2 | 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-sass-alias-relative/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | export default { 2 | alias: { 3 | 'src/*': 'src' 4 | } 5 | }; 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/import-absolute/public/index.html: -------------------------------------------------------------------------------- 1 | 2 |

3 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/import-assertions/index.html:
--------------------------------------------------------------------------------
1 | 

2 | 
3 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/index-fallback/index.js:
--------------------------------------------------------------------------------
1 | document.getElementById('root').textContent = location.pathname + location.search;
2 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/json-alias/public/index.html:
--------------------------------------------------------------------------------
1 | 

it doesn't work

2 | 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/logical-assignment/index.html: -------------------------------------------------------------------------------- 1 | 2 |

3 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/markdown/index.js:
--------------------------------------------------------------------------------
1 | import foo from './foo.md';
2 | 
3 | document.getElementById('out').textContent = foo;
4 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/middleware-custom/index.html:
--------------------------------------------------------------------------------
1 | 

it doesn't work

2 | 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/overwrite-loader-json/index.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/overwrite-loader-url/index.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/package-exports/node_modules/exports-multi/exports-multi-other.js: -------------------------------------------------------------------------------- 1 | export default 'exports-multi-other'; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/plugin-emit/public/index.html: -------------------------------------------------------------------------------- 1 |

it doesn't work

2 | 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/plugin-enforce/public/scripts.js: -------------------------------------------------------------------------------- 1 | const app = document.getElementById('app'); 2 | app.textContent = 'file'; 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/plugin-error/public/index.html: -------------------------------------------------------------------------------- 1 |

check console

2 | 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/prerender-additional-links/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | export default { 2 | customRoutes: ['/non-existent-link'] 3 | }; 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/virtual-id/public/index.html: -------------------------------------------------------------------------------- 1 |

it doesn't work 2 | 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/worker-relative/foo/foo.worker.js: -------------------------------------------------------------------------------- 1 | addEventListener('message', () => { 2 | postMessage('it works'); 3 | }); 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/worker-relative/index.html: -------------------------------------------------------------------------------- 1 |

it doesn't work

2 | 3 | -------------------------------------------------------------------------------- /.changeset/thick-apes-relax.md: -------------------------------------------------------------------------------- 1 | --- 2 | 'create-wmr': patch 3 | --- 4 | 5 | Install eslint and eslint-config-preact as dev dependencies 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/_unit-transform-imports/static-import-relative.expected.js: -------------------------------------------------------------------------------- 1 | // @ts-ignore 2 | import { foo } from 'it_works'; 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/alias-outside/public/index.html: -------------------------------------------------------------------------------- 1 |

it doesn't work

2 | 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/alias-parent/public/index.html: -------------------------------------------------------------------------------- 1 |

it doesn't work

2 | 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/config-node-builtins/wmr/a.mjs: -------------------------------------------------------------------------------- 1 | export function pluginA() { 2 | return { 3 | name: 'plugin-A' 4 | }; 5 | } 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-duplicates/index.js: -------------------------------------------------------------------------------- 1 | import './a.css'; 2 | import './b.css'; 3 | import './c.css'; 4 | import('./lazy.js'); 5 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-nested-alias-relative-2/src/style/foo.less: -------------------------------------------------------------------------------- 1 | @import './bar'; 2 | 3 | h1 { 4 | color: @color; 5 | } 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-nested-alias-relative/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | export default { 2 | alias: { 3 | 'src/*': 'src' 4 | } 5 | }; 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/file-import/img.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/preactjs/wmr/HEAD/packages/wmr/test/fixtures/file-import/img.jpg -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/hmr-css-no-public/index.css: -------------------------------------------------------------------------------- 1 | @import 'home.css'; 2 | 3 | body { 4 | color: #333; 5 | background: white; 6 | } 7 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/hmr-css/public/index.css: -------------------------------------------------------------------------------- 1 | @import 'home.css'; 2 | 3 | body { 4 | color: #333; 5 | background: white; 6 | } 7 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/markdown/index.html: -------------------------------------------------------------------------------- 1 |
it doesn't work
2 | 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/plugin-resolve/public/index.html: -------------------------------------------------------------------------------- 1 |

it doesn't work

2 | 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/sourcemap-ts/index.html: -------------------------------------------------------------------------------- 1 |
it doesn't work
2 | 3 | -------------------------------------------------------------------------------- /examples/demo/public/pages/files/unreferenced.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/preactjs/wmr/HEAD/examples/demo/public/pages/files/unreferenced.jpg -------------------------------------------------------------------------------- /packages/wmr/src/global.d.ts: -------------------------------------------------------------------------------- 1 | type empty = null | undefined; 2 | 3 | type Mode = import('wmr').Mode; 4 | type Options = import('wmr').Options; 5 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/_unit-transform-imports/import-assertion-dynamic.js: -------------------------------------------------------------------------------- 1 | // @ts-ignore 2 | import('foo', { assert: { type: 'json' } }); 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/alias-asset/foo/img.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/preactjs/wmr/HEAD/packages/wmr/test/fixtures/alias-asset/foo/img.jpg -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/alias-css/public/index.js: -------------------------------------------------------------------------------- 1 | import 'foo/style.css'; 2 | 3 | document.querySelector('h1').textContent = `check color`; 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/alias/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "alias": { 3 | "react": "preact/compat", 4 | "react-dom": "preact/compat" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-nested-alias-relative-2/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | export default { 2 | alias: { 3 | 'src/*': 'src' 4 | } 5 | }; 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-module-compose-warn/foo.css: -------------------------------------------------------------------------------- 1 | .className { 2 | color: red; 3 | } 4 | 5 | h1 { 6 | composes: className; 7 | } 8 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/exports/node_modules/test/package.json: -------------------------------------------------------------------------------- 1 | {"name":"test", "exports":{".":{"node":"./node.mjs", "default":"./browser.mjs"}}} -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/import-assertions-dynamic/index.html: -------------------------------------------------------------------------------- 1 |

2 | 
3 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/import-relative/index.js:
--------------------------------------------------------------------------------
1 | import { foo } from './foo.js';
2 | 
3 | document.getElementById('out').textContent = foo;
4 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/json-alias/src/foo.js:
--------------------------------------------------------------------------------
1 | import json from './bar.json';
2 | 
3 | document.querySelector('h1').textContent = json.value;
4 | 


--------------------------------------------------------------------------------
/packages/wmr/test/fixtures/plugin-config-falsy/public/index.html:
--------------------------------------------------------------------------------
1 | 

Nothing to see here!

2 | 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/plugin-output-options/public/index.html: -------------------------------------------------------------------------------- 1 |

check console

2 | 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/plugin-resolve-prefix/public/index.html: -------------------------------------------------------------------------------- 1 |

it doesn't work

2 | 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/process-present-import-id/index.html: -------------------------------------------------------------------------------- 1 |

it doesn't work

2 | 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/process-present-import-ns/index.html: -------------------------------------------------------------------------------- 1 |

it doesn't work

2 | 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/sourcemap-jsx/index.html: -------------------------------------------------------------------------------- 1 |
it doesn't work
2 | 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/watch/public/index.js: -------------------------------------------------------------------------------- 1 | import { value } from './foo.js'; 2 | 3 | document.getElementById('root').textContent = value; 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/_unit-transform-imports/dynamic-import-inline.expected.js: -------------------------------------------------------------------------------- 1 | // @ts-ignore 2 | const About = lazy(() => import('it_works')); 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/alias-src-public/src/index.js: -------------------------------------------------------------------------------- 1 | import { value } from './foo.js'; 2 | 3 | document.querySelector('h1').textContent = value; 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/config-reload/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | export default function () { 2 | return [ 3 | { 4 | name: 'foo' 5 | } 6 | ]; 7 | } 8 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/config/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "devDependencies": { 4 | "@babel/standalone": "7.11.6" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/file-import/index.js: -------------------------------------------------------------------------------- 1 | import image from './img.jpg'; 2 | 3 | document.getElementById('out').textContent = String(image); 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/import-absolute/public/index.js: -------------------------------------------------------------------------------- 1 | import { foo } from '~/foo.js'; 2 | 3 | document.getElementById('out').textContent = foo; 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/package-exports/node_modules/no-mainfield-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "no-mainfield-module", 3 | "type": "module" 4 | } -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/process-import/index.js: -------------------------------------------------------------------------------- 1 | import './foo.js'; 2 | 3 | document.getElementById('out').textContent = process.env.NODE_ENV; 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/process-present-import-default/index.html: -------------------------------------------------------------------------------- 1 |

it doesn't work

2 | 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/publicpath/wmr.config.js: -------------------------------------------------------------------------------- 1 | module.exports = function (config) { 2 | config.publicPath = 'https://cdn.example.com/'; 3 | }; 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/script-type/public/index.js: -------------------------------------------------------------------------------- 1 | import { foo } from './foo.js'; 2 | 3 | document.getElementById('root').textContent = foo; 4 | -------------------------------------------------------------------------------- /packages/sw-plugin/example/public/sw.js: -------------------------------------------------------------------------------- 1 | import { pageCache, staticResourceCache } from 'workbox-recipes'; 2 | 3 | pageCache(); 4 | staticResourceCache(); 5 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/_unit-transform-imports/dynamic-import-inline.js: -------------------------------------------------------------------------------- 1 | // @ts-ignore 2 | const About = lazy(() => import('./pages/about/index.js')); 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/config-multiple/wmr.config.js: -------------------------------------------------------------------------------- 1 | module.exports = () => { 2 | return { 3 | plugins: [{ name: 'plugin-cjs' }] 4 | }; 5 | }; 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/config-multiple/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | export default function () { 2 | return { 3 | plugins: [{ name: 'plugin-mjs' }] 4 | }; 5 | } 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/config-multiple/wmr.config.ts: -------------------------------------------------------------------------------- 1 | export default function () { 2 | return { 3 | plugins: [{ name: 'plugin-ts' }] 4 | }; 5 | } 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/config-reload-client/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | export default function () { 2 | return [ 3 | { 4 | name: 'foo' 5 | } 6 | ]; 7 | } 8 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/config-typescript-cjs/wmr.config.ts: -------------------------------------------------------------------------------- 1 | export default function () { 2 | return { 3 | plugins: [{ name: 'foo' }], 4 | }; 5 | } 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-imports/styles/img.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/preactjs/wmr/HEAD/packages/wmr/test/fixtures/css-imports/styles/img.jpg -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-module/index.js: -------------------------------------------------------------------------------- 1 | import styles from './foo.module.css'; 2 | 3 | document.querySelector('.foo')?.classList.add(styles.foo); 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/htmlonly-nopublic/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

Hello wmr

5 | 6 | 7 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/htmlonly/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

Hello wmr

5 | 6 | 7 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/process-present-import-default/process.js: -------------------------------------------------------------------------------- 1 | export default { env: { value: 'it works' }, platform: 'win32', cwd: () => null }; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/process-present-import-id/process.js: -------------------------------------------------------------------------------- 1 | export const process = { env: { value: 'it works' }, platform: 'win32', cwd: () => null }; 2 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/worker/index.html: -------------------------------------------------------------------------------- 1 |

it doesn't work

2 |

it doesn't work

3 | 4 | -------------------------------------------------------------------------------- /packages/sw-plugin/example/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | import swPlugin from '../src/index.js'; 2 | 3 | export default function (options) { 4 | swPlugin(options); 5 | } 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/config-reload-client/index.js: -------------------------------------------------------------------------------- 1 | import { foo } from './foo.js'; 2 | document.querySelector('h1').textContent = 'Hello world ' + foo; 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/package-exports/node_modules/exports-single/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "exports-single", 3 | "exports": "./exports-single.js" 4 | } -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/publicpath-typescript/wmr.config.ts: -------------------------------------------------------------------------------- 1 | export default function (config) { 2 | config.publicPath = 'https://cdn.example.com/'; 3 | }; 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/worker-esm/index.html: -------------------------------------------------------------------------------- 1 |

it doesn't work

2 |

it doesn't work

3 | 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/worker-multi/index.html: -------------------------------------------------------------------------------- 1 |

it doesn't work

2 |

it doesn't work

3 | 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/_unit-transform-imports/dynamic-import-comment.js: -------------------------------------------------------------------------------- 1 | // @ts-ignore 2 | const About = lazy(() => import(/* webpackChunkName: foo */ 'foo')); 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/_unit-transform-imports/import-assertion-dynamic.expected.js: -------------------------------------------------------------------------------- 1 | // @ts-ignore 2 | import('it_works_dynamic', { assert: { type: 'json' } }); 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/cli-minify/index.js: -------------------------------------------------------------------------------- 1 | const foo = {}; 2 | 3 | Object.defineProperty(foo, 'bar', { 4 | value: 42 5 | }); 6 | 7 | console.log(foo.bar); 8 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-module-clash/public/index.html: -------------------------------------------------------------------------------- 1 |

foo

2 |

bar

3 | 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/process-present/index.js: -------------------------------------------------------------------------------- 1 | import * as process from './foo.js'; 2 | 3 | document.getElementById('out').textContent = process.env.value; 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/rmwc/index.html: -------------------------------------------------------------------------------- 1 | 7 | 8 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/worker-esm/foo.worker.js: -------------------------------------------------------------------------------- 1 | import { value } from './dep-b'; 2 | 3 | addEventListener('message', () => { 4 | postMessage(value); 5 | }); 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/200/200.html: -------------------------------------------------------------------------------- 1 | 2 | 200.html 3 |

4 | 5 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/alias-parent/public/index.js: -------------------------------------------------------------------------------- 1 | import 'parent/alias-parent/foo/style.css'; 2 | 3 | document.querySelector('h1').textContent = `check color`; 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-module/public/index.js: -------------------------------------------------------------------------------- 1 | import styles from './style.module.less'; 2 | 3 | document.querySelector('h1')?.classList.add(styles.foo); 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-sass-module/public/index.js: -------------------------------------------------------------------------------- 1 | import styles from './style.module.scss'; 2 | 3 | document.querySelector('h1')?.classList.add(styles.foo); 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/plugin-resolve/public/index.js: -------------------------------------------------------------------------------- 1 | import { value } from './foo.js'; 2 | 3 | document.querySelector('h1').textContent = `Resolved: ${value}`; 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/prerender-data/index.js: -------------------------------------------------------------------------------- 1 | export function prerender() { 2 | return { html: '

it works

', links: ['/'], data: { hello: 'world' } }; 3 | } 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/200/index.html: -------------------------------------------------------------------------------- 1 | 2 | index.html 3 |

4 | 5 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/_unit-transform-imports/static-import-empty.js: -------------------------------------------------------------------------------- 1 | // @ts-ignore 2 | import { foo } from ''; 3 | // @ts-ignore 4 | import bar from ''; 5 | import ''; 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/alias-deprecated/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | export default { 2 | aliases: { 3 | react: 'preact/compat', 4 | 'react-dom': 'preact/compat' 5 | } 6 | }; 7 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/alias-outside/public/forbidden.js: -------------------------------------------------------------------------------- 1 | import { value } from '../forbidden/forbidden.js'; 2 | 3 | document.querySelector('h1').textContent = value; 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-module-clash/public/bar/bar.js: -------------------------------------------------------------------------------- 1 | import styles from './styles.module.css'; 2 | 3 | document.querySelector('#bar')?.classList.add(styles.bar); 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-module-clash/public/foo/foo.js: -------------------------------------------------------------------------------- 1 | import styles from './styles.module.css'; 2 | 3 | document.querySelector('#foo')?.classList.add(styles.foo); 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/define-config/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'wmr'; 2 | 3 | export default defineConfig({ 4 | plugins: [{ name: 'foo' }] 5 | }); 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/env-precedence/index.html: -------------------------------------------------------------------------------- 1 |

it doesn't work

2 |

it doesn't work

3 | 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/preact-jsx/index.js: -------------------------------------------------------------------------------- 1 | import { render } from 'preact'; 2 | import { App } from './app.js'; 3 | 4 | render(, document.getElementById('app')); 5 | -------------------------------------------------------------------------------- /packages/directory-plugin/example/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | import directoryPlugin from '../src/index.js'; 2 | 3 | export default function (config) { 4 | directoryPlugin(config); 5 | } 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/_unit-transform-imports/dynamic-import-comment.expected.js: -------------------------------------------------------------------------------- 1 | // @ts-ignore 2 | const About = lazy(() => import(/* webpackChunkName: foo */ 'it_works')); 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/_unit-transform-imports/static-import.expected.js: -------------------------------------------------------------------------------- 1 | // @ts-ignore 2 | import { foo } from 'a'; 3 | // @ts-ignore 4 | import bar from 'b'; 5 | import 'c'; 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/_unit-transform-imports/static-import.js: -------------------------------------------------------------------------------- 1 | // @ts-ignore 2 | import { foo } from 'foo'; 3 | // @ts-ignore 4 | import bar from 'bar'; 5 | import 'baz'; 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/class-fields-static/index.js: -------------------------------------------------------------------------------- 1 | class Foo { 2 | static state = 'class fields work'; 3 | } 4 | 5 | document.getElementById('out').textContent = Foo.state; 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/plugin-resolve-prefix/public/index.js: -------------------------------------------------------------------------------- 1 | import { value } from 'url:./foo.js'; 2 | 3 | document.querySelector('h1').textContent = `Resolved: ${value}`; 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/process-present-import-ns/process.js: -------------------------------------------------------------------------------- 1 | export const env = { value: 'it works' }; 2 | export const platform = 'win32'; 3 | export const cwd = () => null; 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/publicpath/public/index.js: -------------------------------------------------------------------------------- 1 | document.getElementById('root').textContent = 'success'; 2 | 3 | import('./math.js').then(m => { 4 | m.add(1, 2); 5 | }); 6 | -------------------------------------------------------------------------------- /packages/wmr/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Wrapper for improved intellisense completion 3 | * @type {typeof import("wmr").defineConfig} 4 | */ 5 | export const defineConfig = config => config; 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/define-config-typescript-cjs/wmr.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'wmr'; 2 | 3 | export default defineConfig({ 4 | plugins: [{ name: 'foo' }] 5 | }); 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/define-config-typescript/wmr.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'wmr'; 2 | 3 | export default defineConfig({ 4 | plugins: [{ name: 'foo' }] 5 | }); 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/index-fallback/index.html: -------------------------------------------------------------------------------- 1 | 2 | index.html 3 |

4 | 5 | -------------------------------------------------------------------------------- /examples/demo/public/pages/_404.js: -------------------------------------------------------------------------------- 1 | const NotFound = () => ( 2 |
3 |

404: Not Found

4 |

It's gone :(

5 |
6 | ); 7 | 8 | export default NotFound; 9 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/hmr-scss/index.js: -------------------------------------------------------------------------------- 1 | import { render } from 'preact'; 2 | 3 | export function App() { 4 | return
Test
; 5 | } 6 | 7 | render(, document.body); 8 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/import-assertions/index.js: -------------------------------------------------------------------------------- 1 | import json from './foo.json' assert { type: 'json' }; 2 | 3 | document.getElementById('json-1').textContent = JSON.stringify(json); 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/import-priority/index.js: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line import/extensions 2 | import { foo } from './foo'; 3 | 4 | document.getElementById('out').textContent = foo; 5 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/process-object/index.js: -------------------------------------------------------------------------------- 1 | const result = typeof process === 'object' && 'development' === 'production'; 2 | document.getElementById('out').textContent = result; 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/process-present-import-id/index.js: -------------------------------------------------------------------------------- 1 | import { win32 } from './bar.js'; 2 | 3 | document.querySelector('h1').textContent = win32 ? 'it works' : "it doesn't work"; 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/process-present-import-ns/index.js: -------------------------------------------------------------------------------- 1 | import { win32 } from './bar.js'; 2 | 3 | document.querySelector('h1').textContent = win32 ? 'it works' : "it doesn't work"; 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/publicpath-typescript/public/index.js: -------------------------------------------------------------------------------- 1 | document.getElementById('root').textContent = 'success'; 2 | 3 | import('./math.js').then(m => { 4 | m.add(1, 2); 5 | }); 6 | -------------------------------------------------------------------------------- /docs/public/assets/arrow.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/_unit-transform-imports/static-import-empty.expected.js: -------------------------------------------------------------------------------- 1 | // @ts-ignore 2 | import { foo } from 'foo'; 3 | // @ts-ignore 4 | import bar from 'foo'; 5 | import 'foo'; 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/directory-import/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | import directoryPlugin from '@wmrjs/directory-import'; 2 | 3 | export default function (config) { 4 | directoryPlugin(config); 5 | } 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/env-precedence/index.js: -------------------------------------------------------------------------------- 1 | document.getElementById('foo').textContent = import.meta.env.WMR_FOO; 2 | document.getElementById('bar').textContent = import.meta.env.WMR_BAR; 3 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/middleware-custom/index.js: -------------------------------------------------------------------------------- 1 | import { value } from './foo.js'; 2 | import { works } from './bar.js'; 3 | 4 | document.querySelector('h1').textContent = value + works; 5 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/prerender-external/index.js: -------------------------------------------------------------------------------- 1 | export function prerender() { 2 | return { html: '

it works

', links: ['/'], head: { title: `Page: ${location.pathname}` } }; 3 | } 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/process-present-import-default/index.js: -------------------------------------------------------------------------------- 1 | import { win32 } from './bar.js'; 2 | 3 | document.querySelector('h1').textContent = win32 ? 'it works' : "it doesn't work"; 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/serve-fallback/public/10-seconds-of-silence.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/preactjs/wmr/HEAD/packages/wmr/test/fixtures/serve-fallback/public/10-seconds-of-silence.mp3 -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/transformations/jsx-escaped.expected.js: -------------------------------------------------------------------------------- 1 | import { html as $$html } from '/@npm/htm/preact'; 2 | export function Foo() { 3 | return $$html`${`<`}`; 4 | } 5 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/worker/foo.worker.js: -------------------------------------------------------------------------------- 1 | import { value } from './dep-b'; 2 | 3 | addEventListener('message', () => { 4 | postMessage(value); 5 | }); 6 | 7 | export const foo = 42; 8 | -------------------------------------------------------------------------------- /docs/public/assets/wmr-shadow.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/create-wmr/tpl/public/pages/_404.js: -------------------------------------------------------------------------------- 1 | const NotFound = () => ( 2 |
3 |

404: Not Found

4 |

It's gone :(

5 |
6 | ); 7 | 8 | export default NotFound; 9 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/alias-src/public/index.js: -------------------------------------------------------------------------------- 1 | import { it } from '../src/it.js'; 2 | import { works } from 'src/works.js'; 3 | 4 | document.querySelector('h1').textContent = `${it} ${works}`; 5 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css/profile/style.module.css: -------------------------------------------------------------------------------- 1 | .profile { 2 | background: #f6f6f6; 3 | color: red; 4 | } 5 | 6 | .profile h1 { 7 | font: inherit; 8 | font-size: 200%; 9 | } 10 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/prod-routes/_404.js: -------------------------------------------------------------------------------- 1 | const NotFound = () => ( 2 |
3 |

404: Not Found

4 |

It's gone :(

5 |
6 | ); 7 | 8 | export default NotFound; 9 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/url-prefix/index.js: -------------------------------------------------------------------------------- 1 | import selfUrl from 'url:./index.js'; 2 | import htmlUrl from 'url:./index.html'; 3 | 4 | self.out.textContent = JSON.stringify({ selfUrl, htmlUrl }); 5 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/virtual-id/public/index.js: -------------------------------------------------------------------------------- 1 | import { it } from 'virtual-id'; 2 | import { works } from '@virtual-id'; 3 | 4 | document.querySelector('h1').textContent = it + ' ' + works; 5 | -------------------------------------------------------------------------------- /examples/demo/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": "./public", 4 | "paths": { 5 | "lib/*": ["foo/lib/*"] 6 | } 7 | }, 8 | "include": ["**/*.ts", "**/*.tsx"] 9 | } 10 | -------------------------------------------------------------------------------- /packages/preact-iso/hydrate.d.ts: -------------------------------------------------------------------------------- 1 | import { ComponentChild } from 'preact'; 2 | 3 | export default function hydrate(jsx: ComponentChild, parent?: Element | Document | ShadowRoot | DocumentFragment): void; 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/alias-outside/public/index.js: -------------------------------------------------------------------------------- 1 | import { it } from '../foo/it.js'; 2 | import { works } from 'foo/works.js'; 3 | 4 | document.querySelector('h1').textContent = `${it} ${works}`; 5 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/env-vars/index.js: -------------------------------------------------------------------------------- 1 | document.getElementById('out').textContent = [import.meta.env.FOO, import.meta.env.WMR_FOO, import.meta.env.WMR_BAR] 2 | .filter(Boolean) 3 | .join(' '); 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/define-config-fn-return/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'wmr'; 2 | 3 | export default defineConfig(async options => { 4 | options.plugins.push({ name: 'foo' }); 5 | }); 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/prerender-missing-entry/index.tsx: -------------------------------------------------------------------------------- 1 | export function prerender() { 2 | document.title = `Page: ${location.pathname}`; 3 | return { html: '

it works

', links: ['/'] }; 4 | } 5 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/transformations/jsx-self-closed.js: -------------------------------------------------------------------------------- 1 | const Bar = () => null; 2 | const Bob = () => null; 3 | 4 | export function Foo() { 5 | // prettier-ignore 6 | return ; 7 | } 8 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-module-reserved/foo.module.css: -------------------------------------------------------------------------------- 1 | .foo { 2 | background: peachpuff; 3 | } 4 | 5 | .new { 6 | background: yellow; 7 | } 8 | 9 | .debugger { 10 | background: red; 11 | } 12 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/define-config-fn/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'wmr'; 2 | 3 | export default defineConfig(async options => { 4 | return { 5 | plugins: [{ name: 'foo' }] 6 | }; 7 | }); 8 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/prerender-resource-fetch/index.js: -------------------------------------------------------------------------------- 1 | export async function prerender() { 2 | const md = await fetch('/content.md').then(res => res.text()); 3 | return { html: md, links: ['/'] }; 4 | } 5 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | *.cjs 2 | package-lock.json 3 | yarn.lock 4 | packages/wmr/test/fixtures/**/*.expected.* 5 | packages/wmr/test/fixtures/*/dist 6 | packages/wmr/test/fixtures/*/.cache 7 | packages/wmr/test/fixtures/_unit 8 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/env/public/index.js: -------------------------------------------------------------------------------- 1 | // @ts-ignore 2 | document.getElementById('out').textContent = Object.keys(process.env) 3 | .map(key => `${key}=${JSON.stringify(process.env[key])}`) 4 | .join(', '); 5 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/package-exports/node_modules/exports-multi/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "exports-multi", 3 | "exports": { 4 | ".": "./exports-multi.js", 5 | "./other": "./exports-multi-other.js" 6 | } 7 | } -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/_unit-transform-imports/import-meta-inline.expected.js: -------------------------------------------------------------------------------- 1 | // @ts-ignore 2 | let m = import(foo); 3 | // @ts-ignore 4 | bar.accept(async ({ module }) => { 5 | // @ts-ignore 6 | m = await m; 7 | }); 8 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/preact-no-jsx/index.js: -------------------------------------------------------------------------------- 1 | function Preact() { 2 | return 'it works'; 3 | } 4 | 5 | function render() { 6 | document.getElementById('app').textContent = Preact(); 7 | } 8 | 9 | render(); 10 | -------------------------------------------------------------------------------- /packages/preact-iso/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default as prerender } from './prerender'; 2 | export * from './router'; 3 | export { default as lazy, ErrorBoundary } from './lazy'; 4 | export { default as hydrate } from './hydrate'; 5 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/_unit/jsx-nesting.js: -------------------------------------------------------------------------------- 1 | export function x(y) { 2 | return ( 3 | <> 4 | {Object.entries(y).map(([k, v]) => ( 5 |
  • 6 | {k}: {v} 7 |
  • 8 | ))} 9 | 10 | ); 11 | } 12 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/prerender-external-resource-fetch/index.js: -------------------------------------------------------------------------------- 1 | export async function prerender() { 2 | const html = await fetch('https://preactjs.com').then(res => res.text()); 3 | return { html, links: ['/'] }; 4 | } 5 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/process-complex/other.js: -------------------------------------------------------------------------------- 1 | const type = typeof process; 2 | const typeofEnv = typeof process.env; 3 | const typeofWMR_A = typeof process.env.WMR_A; 4 | export default { type, typeofEnv, typeofWMR_A }; 5 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/watch/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | export default { 2 | plugins: [ 3 | { 4 | name: 'foo', 5 | watchChange(id, event) { 6 | console.log('WATCH', event.event, id); 7 | } 8 | } 9 | ] 10 | }; 11 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/_unit/jsx-nesting.expected.js: -------------------------------------------------------------------------------- 1 | export function x(y) { 2 | return ( 3 | $$html` 4 | ${Object.entries(y).map(([k, v]) => $$html`
  • 5 | ${k}: ${v} 6 |
  • `)} 7 | ` 8 | ); 9 | } 10 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/exports/public/index.js: -------------------------------------------------------------------------------- 1 | import value from 'test'; 2 | 3 | const div = document.createElement('div'); 4 | div.setAttribute('class', 'test'); 5 | div.innerText = value; 6 | document.body.appendChild(div); 7 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/hmr/useCounter.js: -------------------------------------------------------------------------------- 1 | import { useState } from 'preact/hooks'; 2 | 3 | export default function useCounter() { 4 | const [count, setCount] = useState(0); 5 | return [count, () => setCount(count + 1)]; 6 | } 7 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/overwrite-loader-url/foo.svg: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/_unit-transform-imports/import-meta-inline.js: -------------------------------------------------------------------------------- 1 | // @ts-ignore 2 | let m = import(import.meta.url); 3 | // @ts-ignore 4 | import.meta.hot.accept(async ({ module }) => { 5 | // @ts-ignore 6 | m = await m; 7 | }); 8 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/import-assertions-dynamic/index.js: -------------------------------------------------------------------------------- 1 | (async () => { 2 | const json = await import('./foo.json', { assert: { type: 'json' } }); 3 | document.getElementById('json-1').textContent = JSON.stringify(json); 4 | })(); 5 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-module-reserved/index.html: -------------------------------------------------------------------------------- 1 |

    foo

    2 |

    new

    3 |

    debugger

    4 |

    const export

    5 | 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/commonjs/index.js: -------------------------------------------------------------------------------- 1 | import fooDefault, * as foo from './foo.cjs'; 2 | 3 | document.querySelector('#cjsdefault').textContent = JSON.stringify(fooDefault); 4 | document.querySelector('#cjs').textContent = JSON.stringify(foo); 5 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/commonjs/node_modules/fake-lib/fake-lib.js: -------------------------------------------------------------------------------- 1 | var PropTypes = require('prop-types'); 2 | 3 | const propTypes = { 4 | foo: PropTypes.string 5 | }; 6 | 7 | PropTypes.checkPropTypes(propTypes, { foo: 'bar' }, 'foo', 'Demo'); 8 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/prod-routes/header.js: -------------------------------------------------------------------------------- 1 | export default function Header() { 2 | return ( 3 |
    4 | 8 |
    9 | ); 10 | } 11 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/sourcemap-ts/index.ts: -------------------------------------------------------------------------------- 1 | export interface Foo { 2 | foo: string; 3 | } 4 | 5 | function getFoo(foo: Foo) { 6 | return foo.foo; 7 | } 8 | 9 | document.getElementById('out').textContent = getFoo({ foo: 'it works' }); 10 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/typescript-override/index.ts: -------------------------------------------------------------------------------- 1 | class A { 2 | hi() {} 3 | } 4 | 5 | class B extends A { 6 | override hi() { 7 | return 'it works'; 8 | } 9 | } 10 | 11 | document.querySelector('h1').textContent = new B().hi(); 12 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/plugin-output-options/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | export default { 2 | plugins: [ 3 | { 4 | name: 'plugin-a', 5 | outputOptions(opts) { 6 | console.log(`OPTIONS format: ${opts.format}`); 7 | } 8 | } 9 | ] 10 | }; 11 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/sourcemap-jsx/index.jsx: -------------------------------------------------------------------------------- 1 | import { render } from 'preact'; 2 | 3 | function App() { 4 | return

    it works

    ; 5 | } 6 | 7 | document.getElementById('out').textContent = ''; 8 | render(, document.getElementById('out')); 9 | -------------------------------------------------------------------------------- /docs/public/components/meta.js: -------------------------------------------------------------------------------- 1 | import { useTitle, useMeta } from 'hoofd/preact'; 2 | 3 | export default function Meta({ title, description }) { 4 | useTitle('WMR: ' + title); 5 | useMeta({ name: 'description', content: description }); 6 | return null; 7 | } 8 | -------------------------------------------------------------------------------- /packages/wmr/jest-puppeteer.config.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | launch: { 3 | // Slows down browser actions by ms. 0 disables it 4 | slowMo: process.env.SLOWMO ? process.env.SLOWMO : 0, 5 | // Enable to open browser window 6 | devtools: false 7 | } 8 | }; 9 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-resolve-error/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | export default { 2 | plugins: [ 3 | { 4 | name: 'foo', 5 | resolveId(id) { 6 | if (id === 'bar') { 7 | throw new Error('fail'); 8 | } 9 | } 10 | } 11 | ] 12 | }; 13 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-sass-resolve-error/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | export default { 2 | plugins: [ 3 | { 4 | name: 'foo', 5 | resolveId(id) { 6 | if (id === 'bar') { 7 | throw new Error('fail'); 8 | } 9 | } 10 | } 11 | ] 12 | }; 13 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/process-import2/index.js: -------------------------------------------------------------------------------- 1 | import { foo } from './foo.js'; 2 | import { bar } from './bar.js'; 3 | 4 | const result = foo === bar ? 'it works' : 'process.env objs are not equal'; 5 | document.getElementById('out').textContent = result; 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/process-present-import-default/bar.js: -------------------------------------------------------------------------------- 1 | import process from './process.js'; 2 | 3 | export const win32 = { 4 | resolve() { 5 | const resolvedDevice = 'foo'; 6 | return process.env[`=${resolvedDevice}`] || process.cwd(); 7 | } 8 | }; 9 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/process-present-import-id/bar.js: -------------------------------------------------------------------------------- 1 | import { process } from './process.js'; 2 | 3 | export const win32 = { 4 | resolve() { 5 | const resolvedDevice = 'foo'; 6 | return process.env[`=${resolvedDevice}`] || process.cwd(); 7 | } 8 | }; 9 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/process-present-import-ns/bar.js: -------------------------------------------------------------------------------- 1 | import * as process from './process.js'; 2 | 3 | export const win32 = { 4 | resolve() { 5 | const resolvedDevice = 'foo'; 6 | return process.env[`=${resolvedDevice}`] || process.cwd(); 7 | } 8 | }; 9 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/publicpath/public/math.js: -------------------------------------------------------------------------------- 1 | import styles from './math.css'; 2 | 3 | export function add(x, y) { 4 | console.log('math styles', styles); 5 | return import('./constants.js').then(mod => { 6 | return x + y + mod.minimum; 7 | }); 8 | } 9 | -------------------------------------------------------------------------------- /packages/sw-plugin/types.d.ts: -------------------------------------------------------------------------------- 1 | import { Plugin } from 'rollup'; 2 | import { Options } from 'wmr'; 3 | 4 | export default function swPlugin(options?: Options): Plugin; 5 | 6 | declare module 'sw:*' { 7 | const url: string; 8 | export default url; 9 | } 10 | -------------------------------------------------------------------------------- /packages/wmr/src/plugins/wmr/styles/sass.js: -------------------------------------------------------------------------------- 1 | import { transformCss } from '../../../lib/transform-css.js'; 2 | 3 | /** 4 | * @param {string} sass 5 | * @returns {string} css 6 | */ 7 | export function processSass(sass) { 8 | return transformCss(sass); 9 | } 10 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/external-scripts/index.js: -------------------------------------------------------------------------------- 1 | // @ts-ignore-next 2 | // eslint-disable-next-line import/extensions 3 | import { h, render } from '//unpkg.com/preact?module'; 4 | 5 | render(h('pre', null, 'rendered from unpkg'), document.getElementById('external')); 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/package-exports/node_modules/exports-fallbacks-defaultfallback/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "exports-fallbacks-requirefirst", 3 | "exports": { 4 | "other": "./other.js", 5 | "default": "./default.js", 6 | "require": "./require.js" 7 | } 8 | } -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/package-exports/node_modules/exports-fallbacks-requirefallback/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "exports-fallbacks-requirefirst", 3 | "exports": { 4 | "other": "./other.js", 5 | "require": "./require.js", 6 | "default": "./default.js" 7 | } 8 | } -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/publicpath-typescript/public/math.js: -------------------------------------------------------------------------------- 1 | import styles from './math.css'; 2 | 3 | export function add(x, y) { 4 | console.log('math styles', styles); 5 | return import('./constants.js').then(mod => { 6 | return x + y + mod.minimum; 7 | }); 8 | } 9 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/rmwc/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "alias": { 3 | "react": "preact/compat", 4 | "react-dom": "preact/compat", 5 | "@material/dom/dist/mdc.dom.js": "@material/dom" 6 | }, 7 | "resolutions": { 8 | "@material/**": "^5.0.0" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/directory-plugin/example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "scripts": { 3 | "dev": "cross-env node --experimental-modules ../../wmr/src/cli.js 2>&1" 4 | }, 5 | "type": "module", 6 | "devDependencies": { 7 | "cross-env": "7.0.3", 8 | "wmr": "latest" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/commonjs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
    5 |
    6 |
    7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/env-precedence/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | const settings = { 2 | env: { 3 | FOO: 'asdf' 4 | } 5 | }; 6 | // API_URL from `.env` gets overwritten with `undefined` 7 | export default options => { 8 | Object.assign(options.env, settings.env); 9 | }; 10 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/prod-head/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | default title 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/prod-routes/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | default title 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Less 6 | 7 | 8 | 9 |

    Less

    10 | 11 | 12 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-sass/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | sass 6 | 7 | 8 | 9 |

    Sass

    10 | 11 | 12 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/define-config-fn-conditional/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'wmr'; 2 | 3 | export default defineConfig(async options => { 4 | if (options.mode === 'start') { 5 | return { 6 | plugins: [{ name: 'start' }] 7 | }; 8 | } 9 | }); 10 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/logical-assignment/index.js: -------------------------------------------------------------------------------- 1 | function example(opts) { 2 | opts.foo ??= 'bar'; 3 | opts.baz ??= 'qux'; 4 | 5 | return opts; 6 | } 7 | 8 | const out = document.getElementById('out'); 9 | out.textContent = JSON.stringify(example({ foo: 'foo' })); 10 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/prerender-crash/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | default title 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/prerender-data/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | default title 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/prerender-error/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | default title 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/transformations/jsx-self-closed.expected.js: -------------------------------------------------------------------------------- 1 | import { html as $$html } from '/@npm/htm/preact'; 2 | const Bar = () => null; 3 | const Bob = () => null; 4 | 5 | export function Foo() { 6 | // prettier-ignore 7 | return $$html`<${Bar}><${Bob} />`; 8 | } 9 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/worker-relative/foo/index.js: -------------------------------------------------------------------------------- 1 | const worker = new Worker(new URL('./foo.worker.js', import.meta.url)); 2 | 3 | worker.addEventListener('message', e => { 4 | document.querySelector('h1').textContent = e.data; 5 | }); 6 | 7 | worker.postMessage('hello'); 8 | -------------------------------------------------------------------------------- /packages/directory-plugin/types.d.ts: -------------------------------------------------------------------------------- 1 | import { Plugin } from 'rollup'; 2 | import { Options } from 'wmr'; 3 | 4 | export default function directoryPlugin(options?: Options): Plugin; 5 | 6 | declare module 'dir:*' { 7 | const files: string[]; 8 | export default files; 9 | } 10 | -------------------------------------------------------------------------------- /packages/preact-iso/lazy.d.ts: -------------------------------------------------------------------------------- 1 | import { ComponentChildren, VNode } from 'preact'; 2 | 3 | export default function lazy(load: () => Promise<{ default: T } | T>): T; 4 | 5 | export function ErrorBoundary(props: { children?: ComponentChildren; onError?: (error: Error) => void }): VNode; 6 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-alias/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Less 6 | 7 | 8 | 9 |

    Less

    10 | 11 | 12 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-sass-alias/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | sass 6 | 7 | 8 | 9 |

    Sass

    10 | 11 | 12 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/prod-prerender-json/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | default title 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/transformations/jsx-member.js: -------------------------------------------------------------------------------- 1 | const Ctx = { 2 | Foo: function Foo() { 3 | return
    ; 4 | } 5 | }; 6 | 7 | export default function Demo() { 8 | return ( 9 | 10 |
    11 | 12 | ); 13 | } 14 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-file-error/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Less 6 | 7 | 8 | 9 |

    Less

    10 | 11 | 12 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-nested-alias/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Less 6 | 7 | 8 | 9 |

    Less

    10 | 11 | 12 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-sass-file-error/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | sass 6 | 7 | 8 | 9 |

    Sass

    10 | 11 | 12 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-sass-nested-alias/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | sass 6 | 7 | 8 | 9 |

    Sass

    10 | 11 | 12 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/directory-import/public/index.js: -------------------------------------------------------------------------------- 1 | import files from 'dir:./foo'; 2 | 3 | const list = document.querySelector('ul'); 4 | 5 | files.forEach(file => { 6 | const el = document.createElement('li'); 7 | el.textContent = file; 8 | list.appendChild(el); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/hmr-css/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Simple 6 | 7 | 8 | 9 |

    Test

    10 | 11 | 12 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/prerender-additional-links/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | default title 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/prerender-missing-entry/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | default title 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/prerender-missing-export/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | default title 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/prerender-resource-fetch/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | default title 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-alias-relative/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Less 6 | 7 | 8 | 9 |

    Less

    10 | 11 | 12 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-resolve-error/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Less 6 | 7 | 8 | 9 |

    Less

    10 | 11 | 12 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-sass-alias-relative/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | sass 6 | 7 | 8 | 9 |

    Sass

    10 | 11 | 12 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-sass-resolve-error/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | sass 6 | 7 | 8 | 9 |

    Sass

    10 | 11 | 12 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/hmr-css-no-public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Simple 6 | 7 | 8 | 9 |

    Test

    10 | 11 | 12 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/package-exports/node_modules/exports-fallbacks-importfirst/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "exports-fallbacks-importfirst", 3 | "exports": { 4 | "import": "./import.js", 5 | "module": "./module.js", 6 | "require": "./require.js", 7 | "default": "./default.js" 8 | } 9 | } -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-import-hash/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Less 6 | 7 | 8 | 9 |
    Less
    10 | 11 | 12 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/hmr-index/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | hmr-index 6 | 7 | 8 |
    9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/overwrite-loader-json/index.js: -------------------------------------------------------------------------------- 1 | import json from 'my-json:./foo.json'; 2 | import json2 from 'json:./bar.json'; 3 | import json3 from './baz.json'; 4 | 5 | const app = document.querySelector('#app'); 6 | if (app) { 7 | app.textContent = json.foo + json2.bar + json3.baz; 8 | } 9 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/package-exports/node_modules/exports-fallbacks-defaultfirst/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "exports-fallbacks-defaultfirst", 3 | "exports": { 4 | "default": "./default.js", 5 | "import": "./import.js", 6 | "module": "./module.js", 7 | "require": "./require.js" 8 | } 9 | } -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/package-exports/node_modules/exports-fallbacks-requirefirst/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "exports-fallbacks-requirefirst", 3 | "exports": { 4 | "require": "./require.js", 5 | "import": "./import.js", 6 | "module": "./module.js", 7 | "default": "./default.js" 8 | } 9 | } -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/prerender-external-resource-fetch/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | default title 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/simple/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Simple 6 | 7 | 8 |
    9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/watch/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Watch 6 | 7 | 8 |
    9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .dist 2 | .cache 3 | dist 4 | node_modules 5 | wmr.cjs 6 | package-lock.json 7 | !packages/wmr/test/fixtures/commonjs/node_modules 8 | !packages/wmr/test/fixtures/package-exports/node_modules 9 | !packages/wmr/test/fixtures/exports/node_modules 10 | .DS_Store 11 | .vscode 12 | .lighthouseci -------------------------------------------------------------------------------- /packages/sw-plugin/example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "scripts": { 3 | "dev": "cross-env node --experimental-modules ../../wmr/src/cli.js 2>&1" 4 | }, 5 | "type": "module", 6 | "devDependencies": { 7 | "cross-env": "7.0.3", 8 | "wmr": "latest", 9 | "workbox-recipes": "^6.1.0" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-nested-alias-relative-2/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Less 6 | 7 | 8 |

    Less

    9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-nested-alias-relative/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Less 6 | 7 | 8 |

    Less

    9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/exports/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Exports 6 | 7 | 8 |
    9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/typescript-override/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | TS 6 | 7 | 8 |

    it doesn't work

    9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/plugin-enforce/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | enforce plugins 6 | 7 | 8 |
    9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /packages/create-wmr/tpl/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'wmr'; 2 | 3 | // Full list of options: https://wmr.dev/docs/configuration 4 | export default defineConfig({ 5 | /* Your configuration here */ 6 | alias: { 7 | react: 'preact/compat', 8 | 'react-dom': 'preact/compat' 9 | } 10 | }); 11 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-sass-import-hash/public/index.html: -------------------------------------------------------------------------------- 1 |

    Sass

    2 | 3 | 4 | 5 | 6 | sass 7 | 8 | 9 | 10 |
    Sass
    11 | 12 | 13 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css/profile/index.js: -------------------------------------------------------------------------------- 1 | import styles from './style.module.css'; 2 | 3 | export default function Profile({ username }) { 4 | return ( 5 |
    6 |

    Profile

    7 |

    This is the profile page for {username}.

    8 |
    9 | ); 10 | } 11 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /examples/demo/public/pages/alias-outside.js: -------------------------------------------------------------------------------- 1 | import { value } from '../../src/outside.js'; 2 | import { value as inside } from '../foo/alias-inside.js'; 3 | 4 | export default function AliasOutside() { 5 | return ( 6 |
    7 |

    Inside: {inside}

    8 |

    Outside: {value}

    9 |
    10 | ); 11 | } 12 | -------------------------------------------------------------------------------- /examples/demo/public/pages/files/index.js: -------------------------------------------------------------------------------- 1 | import jpg from './img.jpg'; 2 | 3 | export default function Files() { 4 | return ( 5 |
    6 |

    Files

    7 |

    8 | jpg: {jpg} 9 |
    10 | 11 |

    12 |
    13 | ); 14 | } 15 | -------------------------------------------------------------------------------- /examples/demo/public/pages/environment/style.css: -------------------------------------------------------------------------------- 1 | table { 2 | margin: 4rem; 3 | border-collapse: collapse; 4 | border-spacing: 0; 5 | } 6 | 7 | td, 8 | th { 9 | padding: 0.5rem 0.75rem; 10 | border: 0.0625rem solid #d0d0d0; 11 | text-align: left; 12 | } 13 | 14 | tbody tr:nth-child(even) { 15 | background: #eee; 16 | } 17 | -------------------------------------------------------------------------------- /packages/create-wmr/tpl/public/pages/about/index.js: -------------------------------------------------------------------------------- 1 | import styles from './style.module.css'; 2 | 3 | const About = ({ query }) => ( 4 |
    5 |

    About

    6 |

    A page all about this website.

    7 |
    {JSON.stringify(query)}
    8 |
    9 | ); 10 | 11 | export default About; 12 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/commonjs/cjs-imports.cjs: -------------------------------------------------------------------------------- 1 | exports.namedCjs = require('./named.cjs'); 2 | exports.namedEsm = require('./named.js'); 3 | 4 | exports.defaultCjs = require('./default.cjs'); 5 | exports.defaultEsm = require('./default.js'); 6 | 7 | exports.mixedEsm = require('./mixed.js'); 8 | exports.mixedCjs = require('./mixed.cjs'); 9 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-html/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Less 6 | 7 | 8 | 9 | 10 |
    Less
    11 | 12 | 13 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-nested-relative/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Less 6 | 7 | 8 | 9 |

    Less

    10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/hmr/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Simple 6 | 7 | 8 | 9 |
    10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/plugin-error/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | export default { 2 | plugins: [ 3 | { 4 | name: 'plugin-a', 5 | resolveId() { 6 | this.error(`oh no #1`); 7 | }, 8 | load() { 9 | this.error(`oh no #2`); 10 | }, 11 | transform() { 12 | this.error(`oh no #3`); 13 | } 14 | } 15 | ] 16 | }; 17 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/publicpath/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Simple + publicPath 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-entry/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | css entry 5 | 6 | 7 | 8 | 9 |

    hello there

    10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/prod-prerender-json/index.js: -------------------------------------------------------------------------------- 1 | import foo from './foo.json'; 2 | 3 | export function prerender() { 4 | const html = `
    5 |

    page = ${location.pathname}

    6 |

    JSON: ${JSON.stringify(foo)}

    7 |
    `; 8 | return { html, links: ['/'], head: { title: `Page: ${location.pathname}` } }; 9 | } 10 | -------------------------------------------------------------------------------- /examples/demo/public/pages/compat.js: -------------------------------------------------------------------------------- 1 | import { useState } from 'preact/hooks'; 2 | import Calendar from 'react-calendar'; 3 | import 'react-calendar/dist/Calendar.css'; 4 | 5 | export default function CompatDemo() { 6 | const [value, onChange] = useState(new Date()); 7 | return ; 8 | } 9 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/hmr-scss/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Simple 6 | 7 | 8 | 9 |
    10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/middleware-custom/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | export default { 2 | middleware: [ 3 | (req, res, next) => { 4 | if (req.path === '/foo.js') { 5 | res.setHeader('Content-Type', 'application/javascript'); 6 | res.end(`export const value = "it ";`); 7 | return; 8 | } 9 | 10 | next(); 11 | } 12 | ] 13 | }; 14 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/publicpath-typescript/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Simple + publicPath 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /packages/wmr/src/plugins/external-urls-plugin.js: -------------------------------------------------------------------------------- 1 | /** @returns {import('rollup').Plugin} */ 2 | export default function externalUrlsPlugin() { 3 | return { 4 | name: 'external-urls', 5 | resolveId(id) { 6 | if (/^(https?:)?\/\//.test(id)) { 7 | return { 8 | id, 9 | external: true 10 | }; 11 | } 12 | } 13 | }; 14 | } 15 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/commonjs/mixed.cjs: -------------------------------------------------------------------------------- 1 | // this is Babel's transpiled output of `mixed.js` 2 | 3 | exports.__esModule = true; 4 | exports.b = exports.a = exports.default = void 0; 5 | 6 | let _default = 'default export'; 7 | exports.default = _default; 8 | 9 | const a = 1; 10 | exports.a = a; 11 | 12 | const b = 2; 13 | exports.b = b; 14 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-import-hash-html/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Less 6 | 7 | 8 | 9 | 10 |
    Less
    11 | 12 | 13 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/import-absolute/wmr.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | 3 | module.exports = function (config) { 4 | config.plugins.push({ 5 | name: 'root-resolve', 6 | resolveId(spec, importer) { 7 | if (!spec.startsWith('~/')) return; 8 | return path.resolve(config.cwd, spec.substring(2)); 9 | } 10 | }); 11 | }; 12 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/prerender-external/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | default title 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-sass-html/public/index.html: -------------------------------------------------------------------------------- 1 |

    Sass

    2 | 3 | 4 | 5 | 6 | sass 7 | 8 | 9 | 10 | 11 |
    Sass
    12 | 13 | 14 | -------------------------------------------------------------------------------- /docs/public/components/footer.js: -------------------------------------------------------------------------------- 1 | export function Footer() { 2 | return ( 3 |
    4 |
    5 | 10 |
    11 |
    12 | ); 13 | } 14 | -------------------------------------------------------------------------------- /packages/preact-iso/index.js: -------------------------------------------------------------------------------- 1 | export { Router, LocationProvider, useLocation, Route, useRoute } from './router.js'; 2 | export { default as lazy, ErrorBoundary } from './lazy.js'; 3 | export { default as hydrate } from './hydrate.js'; 4 | 5 | export function prerender(vnode, options) { 6 | return import('./prerender.js').then(m => m.default(vnode, options)); 7 | } 8 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-module-reserved/index.js: -------------------------------------------------------------------------------- 1 | import styles, { foo } from './foo.module.css'; 2 | 3 | document.querySelector('.foo')?.classList.add(styles.foo); 4 | document.querySelector('.new')?.classList.add(styles.new); 5 | document.querySelector('.debugger')?.classList.add(styles.debugger); 6 | document.querySelector('.const')?.classList.add(foo); 7 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/transformations/jsx-member.expected.js: -------------------------------------------------------------------------------- 1 | import { html as $$html } from '/@npm/htm/preact'; 2 | const Ctx = { 3 | Foo: function Foo() { 4 | return $$html`
    `; 5 | } 6 | }; 7 | 8 | export default function Demo() { 9 | return ( 10 | $$html`<${Ctx.Foo} value=${{ foo: 123 }}> 11 |
    12 | ` 13 | ); 14 | } 15 | -------------------------------------------------------------------------------- /packages/nomodule-plugin/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # @wmrjs/nomodule 2 | 3 | ## 0.2.0 4 | ### Minor Changes 5 | 6 | 7 | 8 | - [`5f54c76`](https://github.com/preactjs/wmr/commit/5f54c76d4bb558ba335aeaf61208263f2e0b2d7c) [#495](https://github.com/preactjs/wmr/pull/495) Thanks [@marvinhagemeister](https://github.com/marvinhagemeister)! - Move plugins from @wmr-plugins org to @wmrjs 9 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/markdown/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | export default { 2 | plugins: [ 3 | { 4 | name: 'markdown-plugin', 5 | resolveId(id) { 6 | if (/\.md$/.test(id)) { 7 | return id; 8 | } 9 | }, 10 | load(id) { 11 | if (/\.md$/.test(id)) { 12 | return `export default "it works"`; 13 | } 14 | } 15 | } 16 | ] 17 | }; 18 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/plugin-config-falsy/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | export default { 2 | middleware: [false, undefined, null, 0], 3 | plugins: [ 4 | false, 5 | undefined, 6 | null, 7 | 0, 8 | { 9 | name: 'foo', 10 | configResolved() { 11 | return { 12 | middleware: [false, undefined, null, 0] 13 | }; 14 | } 15 | } 16 | ] 17 | }; 18 | -------------------------------------------------------------------------------- /docs/public/content/_config.yml: -------------------------------------------------------------------------------- 1 | # https://jekyllrb.com/docs/collections/#manually-ordering-documents 2 | collections: 3 | docs: 4 | order: 5 | - { heading: 'Prologue' } 6 | - index 7 | - cli 8 | - configuration 9 | - plugins 10 | - prerendering 11 | - web-workers 12 | - { heading: 'API' } 13 | - plugin-api 14 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/commonjs/foo.cjs: -------------------------------------------------------------------------------- 1 | const other = require('./mixed.js'); 2 | 3 | console.log(other); 4 | 5 | let collected = {}; 6 | for (let i in other) collected[i] = other[i]; 7 | collected.default = other.default; 8 | 9 | document.querySelector('#cjsimport').textContent = JSON.stringify(collected); 10 | 11 | exports.a = 'one'; 12 | exports.b = 'two'; 13 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-sass-import-hash-html/public/index.html: -------------------------------------------------------------------------------- 1 |

    Sass

    2 | 3 | 4 | 5 | 6 | sass 7 | 8 | 9 | 10 | 11 |
    Sass
    12 | 13 | 14 | -------------------------------------------------------------------------------- /packages/directory-plugin/example/public/pages/about.js: -------------------------------------------------------------------------------- 1 | export default function About() { 2 | return ( 3 |
    4 |

    About Page

    5 |

    6 | This is the about page (pages/about.js). 7 |

    8 | 11 |
    12 | ); 13 | } 14 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/config-node-builtins/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | import path from 'path'; 2 | import { pluginA } from './wmr/a.mjs'; 3 | 4 | export default function wmr() { 5 | // Random path usage to check if it works 6 | const random = path.join('foo', 'bar').split(path.sep).join(path.posix.sep); 7 | return { 8 | plugins: [{ name: random }, pluginA()] 9 | }; 10 | } 11 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/plugin-middlewares/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | export default function foo() { 2 | return { 3 | async config() { 4 | return { 5 | middleware: [ 6 | (req, res, next) => { 7 | if (req.url === '/test') { 8 | res.end('it works'); 9 | } else { 10 | next(); 11 | } 12 | } 13 | ] 14 | }; 15 | } 16 | }; 17 | } 18 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/worker/index.js: -------------------------------------------------------------------------------- 1 | import { value as value2 } from './entry-1'; 2 | 3 | document.querySelector('h2').textContent = value2; 4 | 5 | const worker = new Worker(new URL('./foo.worker.js', import.meta.url)); 6 | 7 | worker.addEventListener('message', e => { 8 | document.querySelector('h1').textContent = e.data; 9 | }); 10 | 11 | worker.postMessage('hello'); 12 | -------------------------------------------------------------------------------- /packages/create-wmr/tpl/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "start": "wmr", 5 | "build": "wmr build --prerender", 6 | "serve": "wmr serve" 7 | }, 8 | "eslintConfig": { 9 | "extends": "preact" 10 | }, 11 | "dependencies": { 12 | "preact": "latest", 13 | "preact-iso": "latest" 14 | }, 15 | "devDependencies": { 16 | "wmr": "latest" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/class-fields/index.js: -------------------------------------------------------------------------------- 1 | class Foo { 2 | state = { value: 'class fields work' }; 3 | onLoad = () => { 4 | return this.state; 5 | }; 6 | } 7 | 8 | const out = document.getElementById('out'); 9 | if (!out) { 10 | throw new Error("Element with id 'out' is missing in DOM"); 11 | } 12 | 13 | const foo = new Foo(); 14 | out.textContent = foo.onLoad().value; 15 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-module-hmr/index.js: -------------------------------------------------------------------------------- 1 | import styles from './styles/foo.module.css'; 2 | 3 | document.querySelector('.foo')?.classList.add(styles.foo); 4 | 5 | if (import.meta.hot) { 6 | let m = import(import.meta.url); 7 | import.meta.hot?.accept(async ({ module }) => { 8 | m = await m; 9 | document.querySelector('.foo')?.classList.add(styles.foo); 10 | }); 11 | } 12 | -------------------------------------------------------------------------------- /docs/public/assets/auto.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/wmr/src/lib/~fsevents.js: -------------------------------------------------------------------------------- 1 | // require("fsevents") gets hoisted and breaks under Windows & Linux as it is Mac-only. 2 | // This shim module forces it to be required dynamically. 3 | // Doing this disables Chokidar's automatic fsevents usage, so the useFSEvents option is required. 4 | 5 | // // eslint-disable-next-line 6 | try { 7 | module.exports = eval('require')('fsevents'); 8 | } catch (e) {} 9 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/config/style.module.css: -------------------------------------------------------------------------------- 1 | .fetcher { 2 | padding: 10px; 3 | background: #eee; 4 | } 5 | .fetcher h3 { 6 | margin: 0 0 0.5em; 7 | color: #4152be; 8 | } 9 | .header { 10 | display: flex; 11 | margin: 0; 12 | color: #121f75; 13 | } 14 | .header dt { 15 | font-weight: bold; 16 | text-align: right; 17 | min-width: 10em; 18 | } 19 | .header dd { 20 | margin: 0; 21 | } 22 | -------------------------------------------------------------------------------- /packages/preact-iso/prerender.d.ts: -------------------------------------------------------------------------------- 1 | import { VNode } from 'preact'; 2 | 3 | export interface PrerenderOptions { 4 | maxDepth?: number; 5 | props?: Record; 6 | } 7 | 8 | export interface PrerenderResult { 9 | html: string; 10 | links?: Set 11 | } 12 | 13 | export default function prerender( 14 | vnode: VNode, 15 | options?: PrerenderOptions 16 | ): Promise; 17 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/worker-esm/index.js: -------------------------------------------------------------------------------- 1 | import { value as value2 } from './entry-1'; 2 | 3 | document.querySelector('h2').textContent = value2; 4 | 5 | const worker = new Worker(new URL('./foo.worker.js', import.meta.url), { type: 'module' }); 6 | 7 | worker.addEventListener('message', e => { 8 | document.querySelector('h1').textContent = e.data; 9 | }); 10 | 11 | worker.postMessage('hello'); 12 | -------------------------------------------------------------------------------- /.changeset/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://unpkg.com/@changesets/config@1.1.0/schema.json", 3 | "changelog": [ 4 | "@changesets/changelog-github", 5 | { "repo": "preactjs/wmr" } 6 | ], 7 | "commit": false, 8 | "access": "public", 9 | "baseBranch": "main", 10 | "___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": { 11 | "onlyUpdatePeerDependentsWhenOutOfRange": true 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/plugin-hooks/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | export default function foo() { 2 | return [ 3 | { 4 | name: 'plugin-a', 5 | async config(config) { 6 | console.log(`plugin-a: config() cwd: ${config.cwd}, root: ${config.root} }`); 7 | }, 8 | configResolved(config) { 9 | console.log(`plugin-a: configResolved() { cwd: ${config.cwd}, root: ${config.root} }`); 10 | } 11 | } 12 | ]; 13 | } 14 | -------------------------------------------------------------------------------- /packages/wmr/src/lib/mimetypes.js: -------------------------------------------------------------------------------- 1 | import mime from 'mime/lite.js'; 2 | 3 | /** @param {string} file */ 4 | export function getMimeType(file, charset = true) { 5 | let type = mime.getType(file); 6 | if (/\.wasm$/.test(file)) { 7 | type = 'application/wasm'; 8 | } 9 | if (charset !== false && type && /(text|xml)/.test(type)) { 10 | type += `;charset=${charset === true ? 'utf-8' : charset}`; 11 | } 12 | return type; 13 | } 14 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/pwa/public/sw.js: -------------------------------------------------------------------------------- 1 | addEventListener('install', e => self.skipWaiting()); 2 | 3 | addEventListener('fetch', e => e.respondWith(fromCache(e.request))); 4 | 5 | async function fromCache(req) { 6 | let res = await caches.match(req); 7 | if (res) return res; 8 | res = await fetch((req = req.url.replace(/\?t=\d+/g, ''))); 9 | caches.open('v1').then(c => c.put(req, res)); 10 | return res.clone(); 11 | } 12 | -------------------------------------------------------------------------------- /packages/wmr/src/lib/http2.js: -------------------------------------------------------------------------------- 1 | import { createSecureServer } from 'http2'; 2 | import devcert from 'devcert'; 3 | 4 | export async function createHttp2Server(options = {}) { 5 | const host = process.env.HOST || 'localhost'; 6 | const { key, cert } = await devcert.certificateFor(host); 7 | 8 | const server = createSecureServer({ 9 | key, 10 | cert, 11 | allowHTTP1: true, 12 | ...options 13 | }); 14 | 15 | return server; 16 | } 17 | -------------------------------------------------------------------------------- /packages/wmr/src/lib/~readable-stream.js: -------------------------------------------------------------------------------- 1 | const Stream = require('stream'); 2 | 3 | module.exports = Stream.Readable; 4 | module.exports.Stream = Stream; 5 | module.exports.Writable = Stream.Writable; 6 | module.exports.Duplex = Stream.Duplex; 7 | module.exports.Transform = Stream.Transform; 8 | module.exports.PassThrough = Stream.PassThrough; 9 | module.exports.finished = Stream.finished; 10 | module.exports.pipeline = Stream.pipeline; 11 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/serve-fallback/public/index.js: -------------------------------------------------------------------------------- 1 | // Try to load 2 | async function run() { 3 | const extensionless = await fetch('/extensionless').then(r => r.text()); 4 | const mp3Header = await fetch('/10-seconds-of-silence.mp3').then(r => r.headers.get('Content-Type')); 5 | 6 | if (extensionless === 'asdf' && mp3Header === 'audio/mpeg') { 7 | document.querySelector('h1').textContent = 'it works'; 8 | } 9 | } 10 | 11 | run(); 12 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/class-fields-private/index.js: -------------------------------------------------------------------------------- 1 | class Foo { 2 | state = { value: 'class fields work' }; 3 | #getState() { 4 | return this.state; 5 | } 6 | onLoad = () => { 7 | return this.#getState(); 8 | }; 9 | } 10 | 11 | const out = document.getElementById('out'); 12 | if (!out) { 13 | throw new Error("Element with id 'out' is missing in DOM"); 14 | } 15 | 16 | const foo = new Foo(); 17 | out.textContent = foo.onLoad().value; 18 | -------------------------------------------------------------------------------- /docs/public/assets/dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/external-scripts/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

    Hello

    5 |
    6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /packages/sw-plugin/example/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | WMR Demo 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css/home/index.js: -------------------------------------------------------------------------------- 1 | import { useState } from 'preact/hooks'; 2 | import styles from './style.module.css'; 3 | 4 | export default function Home() { 5 | const [count, setCount] = useState(0); 6 | return ( 7 |
    8 |

    Home

    9 |

    This is the home page.

    10 | Count: {count} 11 | 12 |
    13 | ); 14 | } 15 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css/style.css: -------------------------------------------------------------------------------- 1 | body, 2 | html { 3 | margin: 0; 4 | min-height: 100%; 5 | font-family: system-ui, sans-serif; 6 | } 7 | 8 | header { 9 | display: flex; 10 | background: #ddd; 11 | } 12 | 13 | header > nav { 14 | flex: 1; 15 | display: flex; 16 | } 17 | 18 | header > nav a { 19 | padding: 10px; 20 | color: #673ab8; 21 | text-decoration: none; 22 | } 23 | 24 | header > nav a:hover { 25 | background-color: #f1e9ff; 26 | } 27 | -------------------------------------------------------------------------------- /packages/directory-plugin/example/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | WMR Demo 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/pwa/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "WMR PWA Demo", 3 | "short_name": "WMR PWA Demo", 4 | "display": "standalone", 5 | "start_url": "/", 6 | "background_color": "#fff", 7 | "theme_color": "#ccc", 8 | "icons": [ 9 | { 10 | "sizes": "512x512", 11 | "type": "image/png", 12 | "src": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==" 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = tab 5 | end_of_line = lf 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | 10 | [{.*rc,*.yml}] 11 | indent_style = space 12 | indent_size = 2 13 | 14 | [package.json] 15 | insert_final_newline = false 16 | 17 | [*.md] 18 | trim_trailing_whitespace = false 19 | 20 | [test/fixtures/**/*.expected.*] 21 | trim_trailing_whitespace = false 22 | insert_final_newline = false 23 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/hmr/home.js: -------------------------------------------------------------------------------- 1 | import { FOO } from './store/index.js'; 2 | import useCounter from './useCounter.js'; 3 | 4 | function Home() { 5 | const [count, increment] = useCounter(); 6 | return ( 7 |
    8 |

    {FOO}

    9 |

    Home

    10 |

    {count}

    11 |

    12 | Increment 13 |

    14 |
    15 | ); 16 | } 17 | 18 | export default Home; 19 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/overwrite-loader-url/index.js: -------------------------------------------------------------------------------- 1 | import svg from 'my-url:./foo.svg'; 2 | import svg2 from 'url:./foo.svg'; 3 | import svg3 from './foo.svg'; 4 | 5 | const app = document.querySelector('#app'); 6 | if (app) { 7 | const addText = s => { 8 | const txt = document.createElement('p'); 9 | txt.append(s); 10 | app.append(txt); 11 | }; 12 | 13 | addText('my-url: ' + svg); 14 | addText('url: ' + svg2); 15 | addText('fallback: ' + svg3); 16 | } 17 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/worker-multi/index.js: -------------------------------------------------------------------------------- 1 | const foo = new Worker(new URL('./foo.worker.js', import.meta.url)); 2 | const bar = new Worker(new URL('./foo.worker.js', import.meta.url)); 3 | 4 | foo.addEventListener('message', e => { 5 | document.querySelector('h1').textContent = e.data; 6 | }); 7 | bar.addEventListener('message', e => { 8 | document.querySelector('h2').textContent = e.data; 9 | }); 10 | 11 | foo.postMessage('hello'); 12 | bar.postMessage('hello'); 13 | -------------------------------------------------------------------------------- /packages/create-wmr/tpl/public/header.js: -------------------------------------------------------------------------------- 1 | import { useLocation } from 'preact-iso'; 2 | 3 | export default function Header() { 4 | const { url } = useLocation(); 5 | return ( 6 |
    7 | 12 | 16 |
    17 | ); 18 | } 19 | -------------------------------------------------------------------------------- /packages/wmr/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "jsx": "preserve", 5 | "allowJs": true, 6 | "checkJs": true, 7 | "noEmit": true, 8 | "moduleResolution": "node", 9 | "module": "esnext", 10 | "resolveJsonModule": true, 11 | "allowSyntheticDefaultImports": true, 12 | "downlevelIteration": true, 13 | "target": "ESNext", 14 | "strictNullChecks": true 15 | }, 16 | "typeAcquisition": { 17 | "enable": true 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /docs/public/components/markup.js: -------------------------------------------------------------------------------- 1 | import MarkupRenderer from 'preact-markup'; 2 | 3 | const COMPONENTS = { 4 | a(props) { 5 | if (/^(https?:)?\/\//.test(props.href)) { 6 | props.target = props.target || '_blank'; 7 | props.rel = 'noopener noreferrer'; 8 | } 9 | return ; 10 | } 11 | }; 12 | 13 | export default function Markup({ html }) { 14 | return ; 15 | } 16 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/alias-asset/public/index.js: -------------------------------------------------------------------------------- 1 | import img1 from '../foo/img.jpg'; 2 | import img2 from 'foo/img.jpg'; 3 | 4 | let loaded = 0; 5 | function loadImg(src) { 6 | const img = document.createElement('img'); 7 | img.addEventListener('load', () => { 8 | if (++loaded === 2) { 9 | document.querySelector('h1').textContent = `it works`; 10 | } 11 | }); 12 | img.src = src; 13 | document.body.appendChild(img); 14 | } 15 | 16 | loadImg(img1); 17 | loadImg(img2); 18 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-less-absolute/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 | 11 |

    hello

    12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/css-sass-absolute/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 | 11 |

    hello

    12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /docs/public/assets/teatime.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /examples/demo/public/pages/class-fields.js: -------------------------------------------------------------------------------- 1 | import { Component } from 'preact'; 2 | 3 | export default class ClassFields extends Component { 4 | state = { 5 | value: 1 6 | }; 7 | 8 | onClick = () => { 9 | this.setState(prev => ({ value: prev.value + 1 })); 10 | }; 11 | 12 | render() { 13 | return ( 14 |
    15 |

    16 | State: {this.state.value} 17 |

    18 | 19 |
    20 | ); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/plugin-resolve/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | export default function foo() { 2 | let resolved = ''; 3 | return { 4 | plugins: [ 5 | { 6 | name: 'resolve-id', 7 | resolveId(id) { 8 | if (/foo/.test(id)) { 9 | resolved = id; 10 | return id; 11 | } 12 | }, 13 | load(id) { 14 | if (/foo/.test(id)) { 15 | return `export const value = ${JSON.stringify(resolved.replace('\0', ''))}`; 16 | } 17 | } 18 | } 19 | ] 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /examples/demo/public/pages/json.js: -------------------------------------------------------------------------------- 1 | import { useEffect, useState } from 'preact/hooks'; 2 | import json from './foo.json'; 3 | 4 | export function JSONView() { 5 | const [fetched, setFetched] = useState(null); 6 | 7 | useEffect(() => { 8 | fetch('./pages/foo.json') 9 | .then(r => r.json()) 10 | .then(r => setFetched(r)); 11 | }, []); 12 | 13 | return ( 14 |
    15 |

    import: {JSON.stringify(json)}

    16 |

    fetch: {JSON.stringify(fetched)}

    17 |
    18 | ); 19 | } 20 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/virtual-id-at/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | export default function () { 2 | const ID = 'virtual:windi.css'; 3 | const VIRTUAL_ID = '/@windicss/windi.css'; 4 | 5 | return { 6 | plugins: [ 7 | { 8 | name: 'virtual-id-plugin', 9 | resolveId(id) { 10 | if (id === ID) { 11 | return VIRTUAL_ID; 12 | } 13 | }, 14 | load(id) { 15 | if (id === VIRTUAL_ID) { 16 | return `h1 { color: red; }`; 17 | } 18 | } 19 | } 20 | ] 21 | }; 22 | } 23 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/plugin-resolve-prefix/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | export default function foo() { 2 | let resolved = ''; 3 | return { 4 | plugins: [ 5 | { 6 | name: 'resolve-id', 7 | resolveId(id) { 8 | if (/foo/.test(id)) { 9 | resolved = id; 10 | return id; 11 | } 12 | }, 13 | load(id) { 14 | if (/foo/.test(id)) { 15 | return `export const value = ${JSON.stringify(resolved.replace('\0', ''))}`; 16 | } 17 | } 18 | } 19 | ] 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/transformations/jsx-comment.expected.js: -------------------------------------------------------------------------------- 1 | import { html as $$html } from '/@npm/htm/preact'; 2 | // prettier-ignore 3 | export const a = $$html`
    ` 10 | 11 | // prettier-ignore 12 | export const b = $$html`
    ` 19 | 20 | const Foo = () => null; 21 | // prettier-ignore 22 | export const c = $$html`
    28 | <${Foo} foo=${2} /> 29 |
    ` 30 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/pwa/public/style.css: -------------------------------------------------------------------------------- 1 | html, 2 | body { 3 | margin: 0; 4 | min-height: 100%; 5 | font-family: system-ui, sans-serif; 6 | } 7 | 8 | header { 9 | display: flex; 10 | background: #ddd; 11 | } 12 | 13 | header > nav { 14 | flex: 1; 15 | display: flex; 16 | } 17 | 18 | header > nav a { 19 | padding: 10px; 20 | color: #673ab8; 21 | text-decoration: none; 22 | } 23 | 24 | header > nav a:hover { 25 | background-color: #f1e9ff; 26 | } 27 | 28 | .app > section { 29 | padding: 20px; 30 | } 31 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/alias/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import compat from 'preact/compat'; 4 | import { options } from 'preact'; 5 | 6 | window.React = React; 7 | window.ReactDOM = ReactDOM; 8 | window.preactCompat = compat; 9 | 10 | options.vnode = vnode => { 11 | if (vnode.type === 'div') { 12 | vnode.props.children = 'preact was used to render'; 13 | } 14 | }; 15 | 16 | ReactDOM.render(React.createElement('div', null, 'react was used to render'), document.body); 17 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/pwa/public/index.js: -------------------------------------------------------------------------------- 1 | import { render } from 'preact'; 2 | import Home from './home.js'; 3 | 4 | export function App() { 5 | return ( 6 |
    7 |
    8 | 11 |
    12 | 13 |
    14 | ); 15 | } 16 | 17 | render(, document.body); 18 | 19 | navigator.serviceWorker.register('/sw.js'); 20 | 21 | // @ts-ignore 22 | if (module.hot) module.hot.accept(u => render(, document.body)); 23 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/plugin-config-multiple/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | export default function foo() { 2 | return [ 3 | { 4 | name: 'A', 5 | config() { 6 | console.log('config() A'); 7 | }, 8 | configResolved() { 9 | console.log('configResolved() A'); 10 | } 11 | }, 12 | { 13 | name: 'B' 14 | }, 15 | { 16 | name: 'C', 17 | async config() { 18 | console.log('config() C'); 19 | }, 20 | async configResolved() { 21 | console.log('configResolved() C'); 22 | } 23 | } 24 | ]; 25 | } 26 | -------------------------------------------------------------------------------- /docs/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | WMR 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /examples/demo/public/pages/about/index.js: -------------------------------------------------------------------------------- 1 | import { useEffect } from 'preact/hooks'; 2 | import styles from './style.module.css'; 3 | 4 | export default function About({ query, title }) { 5 | useEffect(() => { 6 | console.log('Mounted About: ', title); 7 | return () => { 8 | console.log('Unmounting About: ', title); 9 | }; 10 | }, []); 11 | return ( 12 |
    13 |

    {title || 'About'}

    14 |

    My name is Jason.

    15 |
    {JSON.stringify(query)}
    16 |
    17 | ); 18 | } 19 | -------------------------------------------------------------------------------- /packages/create-wmr/tpl/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | %%TITLE%% 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/prod-head/index.js: -------------------------------------------------------------------------------- 1 | const PAGES = ['/', '/other.html']; 2 | 3 | export function prerender() { 4 | const html = `

    page = ${location.pathname}

    `; 5 | return { 6 | html, 7 | links: PAGES, 8 | head: { 9 | lang: 'de', 10 | elements: [ 11 | { type: 'link', props: { rel: 'icon', href: `data:,favicon-for-${location.pathname}` } }, 12 | { type: 'meta', props: { property: 'og:title', content: 'Become an SEO Expert' } } 13 | ], 14 | title: `Page: ${location.pathname}` 15 | } 16 | }; 17 | } 18 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/alias-deprecated/public/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import compat from 'preact/compat'; 4 | import { options } from 'preact'; 5 | 6 | window.React = React; 7 | window.ReactDOM = ReactDOM; 8 | window.preactCompat = compat; 9 | 10 | options.vnode = vnode => { 11 | if (vnode.type === 'div') { 12 | vnode.props.children = 'preact was used to render'; 13 | } 14 | }; 15 | 16 | ReactDOM.render(React.createElement('div', null, 'react was used to render'), document.body); 17 | -------------------------------------------------------------------------------- /docs/global.d.ts: -------------------------------------------------------------------------------- 1 | interface ContentHeading { 2 | heading: string; 3 | } 4 | interface ContentItem { 5 | name: string; 6 | nav?: string; 7 | title?: string; 8 | description?: string; 9 | image?: string; 10 | slug?: string; 11 | [key: string]: string; 12 | } 13 | 14 | declare module 'content:*' { 15 | const Data: Array; 16 | export = Data; 17 | } 18 | 19 | declare module 'markdown:*' { 20 | const Url: string; 21 | export = Url; 22 | } 23 | 24 | interface Window { 25 | page: HTMLDivElement 26 | } 27 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/transformations/jsx-comment.js: -------------------------------------------------------------------------------- 1 | // prettier-ignore 2 | export const a =
    9 | 10 | // prettier-ignore 11 | export const b =
    18 | 19 | const Foo = () => null; 20 | // prettier-ignore 21 | export const c =
    27 | 28 |
    29 | -------------------------------------------------------------------------------- /packages/nomodule-plugin/README.md: -------------------------------------------------------------------------------- 1 | # `@wmrjs/nomodule` 2 | 3 | WMR outputs modern JavaScript bundles by default. 4 | This plugin creates legacy versions of your bundles using [@babel/preset-env](https://babeljs.io/docs/en/babel-preset-env) and serves those versions to older browsers. 5 | 6 | New browsers get the new stuff, old browsers get the old stuff. 7 | 8 | ## Usage 9 | 10 | Add this to your `wmr.config.js`: 11 | 12 | ```js 13 | import nomodule from '@wmrjs/nomodule'; 14 | 15 | export function build(config) { 16 | nomodule(config); 17 | } 18 | ``` 19 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/virtual-id/wmr.config.mjs: -------------------------------------------------------------------------------- 1 | export default function () { 2 | const ID = 'virtual-id'; 3 | const ID2 = '@virtual-id'; 4 | 5 | return { 6 | plugins: [ 7 | { 8 | name: 'virtual-id-plugin', 9 | resolveId(id) { 10 | if (id === ID || id === ID2) { 11 | return id; 12 | } 13 | }, 14 | load(id) { 15 | if (id === ID) { 16 | return `export const it = "it"`; 17 | } else if (id === ID2) { 18 | return `export const works = "works"`; 19 | } 20 | } 21 | } 22 | ] 23 | }; 24 | } 25 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/pwa/public/home.js: -------------------------------------------------------------------------------- 1 | import { useState } from 'preact/hooks'; 2 | 3 | export default function Home() { 4 | const [count, setCount] = useState(0); 5 | 6 | return ( 7 |
    8 |

    Home

    9 |

    This is the home page.

    10 | 13 | Count: {count} 14 | 17 |
    18 | ); 19 | } 20 | -------------------------------------------------------------------------------- /packages/preact-iso/hydrate.js: -------------------------------------------------------------------------------- 1 | import { render, hydrate as hydrativeRender } from 'preact'; 2 | 3 | let initialized; 4 | 5 | /** @type {typeof render} */ 6 | export default function hydrate(jsx, parent) { 7 | if (typeof window === 'undefined') return; 8 | let isodata = document.querySelector('script[type=isodata]'); 9 | // @ts-ignore-next 10 | parent = parent || (isodata && isodata.parentNode) || document.body; 11 | if (!initialized && isodata) { 12 | hydrativeRender(jsx, parent); 13 | } else { 14 | render(jsx, parent); 15 | } 16 | initialized = true; 17 | } 18 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/external-scripts/external.umd.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | // @ts-nocheck 3 | 4 | window.capitalize = function capitalize(str) { 5 | return str.toUpperCase(); 6 | }; 7 | 8 | !(function (e, n) { 9 | 'object' == typeof exports && 'undefined' != typeof module 10 | ? (module.exports = n(require('capitalize'))) 11 | : 'function' == typeof define && define.amd 12 | ? define(['capitalize'], n) 13 | : (e.foo = n(e.capitalize)); 14 | })(this, function (capitalize) { 15 | document.querySelector('h1').textContent = capitalize('external script loaded'); 16 | }); 17 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/process-complex/index.js: -------------------------------------------------------------------------------- 1 | import withoutFullAccess from './other.js'; 2 | 3 | const { WMR_A, WMR_B } = process.env; 4 | const NODE_ENV = process.env.NODE_ENV; 5 | const keys = Object.keys(process.env); 6 | const type = typeof process; 7 | const typeofEnv = typeof process.env; 8 | const typeofWMR_A = typeof process.env.WMR_A; 9 | 10 | document.getElementById('out').textContent = JSON.stringify({ 11 | WMR_A, 12 | WMR_B, 13 | NODE_ENV, 14 | keys, 15 | withFullAccess: { 16 | type, 17 | typeofEnv, 18 | typeofWMR_A 19 | }, 20 | withoutFullAccess 21 | }); 22 | -------------------------------------------------------------------------------- /docs/wmr.config.js: -------------------------------------------------------------------------------- 1 | import contentPlugin from './plugins/content.js'; 2 | import markdownPlugin from './plugins/markdown.js'; 3 | import prism from './plugins/prism.min.js'; 4 | 5 | export default function (config) { 6 | contentPlugin(config); 7 | markdownPlugin(config, { 8 | highlight(code, lang) { 9 | try { 10 | return prism.highlight(code, prism.languages[lang], lang); 11 | } catch (e) { 12 | console.log('Error highlighting ' + lang + ': ', e); 13 | return code.replace(/[<>&]/g, s => (s == '<' ? '<' : s == '>' ? '>' : '&')); 14 | } 15 | } 16 | }); 17 | } 18 | -------------------------------------------------------------------------------- /examples/demo/public/pages/environment/index.js: -------------------------------------------------------------------------------- 1 | import './style.css'; 2 | import { foo } from './foo.js'; 3 | 4 | export function Environment() { 5 | return ( 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | {Object.keys(process.env) 15 | .sort() 16 | .map(key => { 17 | return ( 18 | 19 | 20 | 21 | 22 | ); 23 | })} 24 | 25 |
    Name {foo}Value
    {key}{String(process.env[key])}
    26 | ); 27 | } 28 | -------------------------------------------------------------------------------- /docs/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "jsx": "preserve", 5 | "jsxFactory": "preact.h", 6 | "jsxFragmentFactory": "preact.Fragment", 7 | "allowJs": true, 8 | "checkJs": true, 9 | // "strict": true, 10 | "noEmit": true, 11 | "moduleResolution": "node", 12 | "target": "ESNext", 13 | "module": "esnext", 14 | "resolveJsonModule": true, 15 | "allowSyntheticDefaultImports": true, 16 | "downlevelIteration": true 17 | }, 18 | "include": ["node_modules/wmr/types.d.ts", "**/*"], 19 | "typeAcquisition": { 20 | "enable": true 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/wmr/src/lib/fs-watcher.js: -------------------------------------------------------------------------------- 1 | import chokidar from 'chokidar'; 2 | 3 | // We disable Chokidar's automatic fsevents usage, so the useFSEvents option is required. 4 | let useFsEvents; 5 | function initFsEvents() { 6 | if (useFsEvents === undefined) { 7 | try { 8 | eval('require')('fsevents'); 9 | useFsEvents = true; 10 | } catch (e) { 11 | useFsEvents = false; 12 | } 13 | } 14 | } 15 | 16 | /** @type {typeof chokidar.watch} */ 17 | export function watch(files, opts) { 18 | initFsEvents(); 19 | return chokidar.watch(files, { 20 | useFsEvents, 21 | ...opts 22 | }); 23 | } 24 | -------------------------------------------------------------------------------- /packages/wmr/src/plugins/wmr/client-prod.js: -------------------------------------------------------------------------------- 1 | export function createHotContext() {} 2 | 3 | export function style(filename) { 4 | if (typeof document === 'undefined') { 5 | // eslint-disable-next-line no-undef 6 | wmr.ssr.head.elements.add({ type: 'link', props: { rel: 'stylesheet', href: filename } }); 7 | } else { 8 | const prev = document.querySelector('link[rel=stylesheet][href="' + filename + '"]'); 9 | if (prev) return; 10 | const node = document.createElement('link'); 11 | node.rel = 'stylesheet'; 12 | node.href = filename; 13 | document.head.appendChild(node); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/hmr/index.js: -------------------------------------------------------------------------------- 1 | import { render } from 'preact'; 2 | import styles from './style.module.css'; 3 | import Home from './home.js'; 4 | import { FOO } from './store/index.js'; 5 | 6 | export function App() { 7 | return ( 8 |
    9 |
    10 |

    {FOO}

    11 | 14 |
    15 | 16 |
    17 | ); 18 | } 19 | 20 | render(, document.body); 21 | 22 | // @ts-ignore 23 | if (module.hot) module.hot.accept(u => render(, document.body)); 24 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/base64-html/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 |

    it doesn't work

    11 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /packages/create-wmr/tpl/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "jsx": "preserve", 5 | "jsxFactory": "preact.h", 6 | "jsxFragmentFactory": "preact.Fragment", 7 | "allowJs": true, 8 | "checkJs": true, 9 | // "strict": true, 10 | "noEmit": true, 11 | "moduleResolution": "node", 12 | "target": "ESNext", 13 | "module": "esnext", 14 | "resolveJsonModule": true, 15 | "allowSyntheticDefaultImports": true, 16 | "downlevelIteration": true 17 | }, 18 | "include": ["node_modules/wmr/types.d.ts", "**/*"], 19 | "typeAcquisition": { 20 | "enable": true 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/wmr/test/fixtures/dynamic-import/index.js: -------------------------------------------------------------------------------- 1 | console.log('hello from index.js'); 2 | 3 | // eslint-disable-next-line no-async-promise-executor 4 | const mods = new Promise(async resolve => { 5 | let out = []; 6 | 7 | // Use a for loop to ensure a consistent loading order 8 | for (const page of ['one', 'two']) { 9 | const m = await import(`./pages/${page}.js`); 10 | out.push(m); 11 | } 12 | 13 | console.log('loaded pages'); 14 | console.log(out.map(m => m.default).join()); 15 | resolve(out); 16 | }); 17 | 18 | export async function prerender() { 19 | await mods; 20 | return { html: 'nothing here' }; 21 | } 22 | -------------------------------------------------------------------------------- /examples/demo/public/prerender.tsx: -------------------------------------------------------------------------------- 1 | import { prerender as ssr } from 'preact-iso'; 2 | import { toStatic } from 'hoofd/preact'; 3 | 4 | export async function prerender(vnode: any) { 5 | const res = await ssr(vnode); 6 | 7 | const head = toStatic(); 8 | const elements = new Set([ 9 | ...head.links.map(props => ({ type: 'link', props })), 10 | ...head.metas.map(props => ({ type: 'meta', props })), 11 | ...head.scripts.map(props => ({ type: 'script', props })) 12 | ]); 13 | 14 | return { 15 | ...res, 16 | data: { 17 | hello: 'world' 18 | }, 19 | head: { 20 | title: head.title, 21 | lang: head.lang, 22 | elements 23 | } 24 | }; 25 | } 26 | -------------------------------------------------------------------------------- /docs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "docs", 3 | "version": "0.0.0", 4 | "private": true, 5 | "type": "module", 6 | "scripts": { 7 | "start": "node ../packages/wmr/src/cli.js", 8 | "build": "if-env NETLIFY=true && node --experimental-modules ../packages/wmr/src/cli.js build --prerender || wmr build --prerender", 9 | "serve": "wmr serve" 10 | }, 11 | "dependencies": { 12 | "preact": "^10.5.13", 13 | "preact-iso": "*", 14 | "preact-markup": "^2.1.1", 15 | "hoofd": "^1.2.2" 16 | }, 17 | "devDependencies": { 18 | "@wmrjs/directory-import": "*", 19 | "if-env": "^1.0.4", 20 | "marked": "^2.0.1", 21 | "wmr": "*", 22 | "yaml": "^1.10.2" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/wmr/test/global.d.ts: -------------------------------------------------------------------------------- 1 | declare const jestPuppeteer: { 2 | debug(): Promise; 3 | resetPage(): Promise; 4 | resetBrowser(): Promise; 5 | }; 6 | declare const browser: import('puppeteer').Browser; 7 | declare const page: import('puppeteer').Page; 8 | 9 | declare interface TestEnv { 10 | tmp: import('tmp-promise').DirectoryResult; 11 | browser: typeof browser; 12 | page: typeof page; 13 | } 14 | 15 | declare interface WmrInstance { 16 | output: string[]; 17 | code: number; 18 | address: Promise; 19 | close: () => void; 20 | done: Promise; 21 | } 22 | 23 | declare module 'json:*' {} 24 | declare module '*.jpg' {} 25 | -------------------------------------------------------------------------------- /packages/wmr/src/plugins/absolute-path-plugin.js: -------------------------------------------------------------------------------- 1 | import path from 'path'; 2 | import { isFile } from '../lib/fs-utils.js'; 3 | 4 | /** 5 | * Resolve all import specifiers starting with a `/` against 6 | * the defined root. 7 | * @param {object} options 8 | * @param {string} options.root 9 | * @returns {import('rollup').Plugin} 10 | */ 11 | export function absolutePathPlugin({ root }) { 12 | return { 13 | name: 'absolute-path', 14 | async resolveId(id) { 15 | if (id.startsWith('/')) { 16 | const file = path.join(root, id.split(path.posix.sep).join(path.sep)); 17 | if (await isFile(file)) { 18 | return file; 19 | } 20 | } 21 | } 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | 8 | jobs: 9 | release: 10 | name: Release 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: Checkout Repo 14 | uses: actions/checkout@master 15 | with: 16 | fetch-depth: 0 17 | - name: Setup Node.js 16.x 18 | uses: actions/setup-node@master 19 | with: 20 | node-version: 16.x 21 | - name: Install 22 | run: yarn --frozen-lockfile 23 | - name: Create Release Pull Request 24 | uses: changesets/action@master 25 | env: 26 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 27 | --------------------------------------------------------------------------------