create-jen-app 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +674 -0
- package/README.md +89 -0
- package/dist/index.js +72 -0
- package/package.json +50 -0
- package/templates/static/.esbuild/jen.config.js +1 -0
- package/templates/static/README.md +67 -0
- package/templates/static/build.js +106 -0
- package/templates/static/jen.config.ts +128 -0
- package/templates/static/jenjs.d.ts +33 -0
- package/templates/static/lib/api/(hello).d.ts +7 -0
- package/templates/static/lib/api/(hello).js +26 -0
- package/templates/static/lib/auth/cookie-utils.d.ts +24 -0
- package/templates/static/lib/auth/cookie-utils.js +99 -0
- package/templates/static/lib/auth/index.d.ts +2 -0
- package/templates/static/lib/auth/index.js +19 -0
- package/templates/static/lib/auth/jwt.d.ts +2 -0
- package/templates/static/lib/auth/jwt.js +30 -0
- package/templates/static/lib/auth/session.d.ts +44 -0
- package/templates/static/lib/auth/session.js +111 -0
- package/templates/static/lib/build/asset-hashing.d.ts +10 -0
- package/templates/static/lib/build/asset-hashing.js +42 -0
- package/templates/static/lib/build/asset-manifest.d.ts +11 -0
- package/templates/static/lib/build/asset-manifest.js +38 -0
- package/templates/static/lib/build/build.d.ts +4 -0
- package/templates/static/lib/build/build.js +113 -0
- package/templates/static/lib/build/island-hydration.d.ts +25 -0
- package/templates/static/lib/build/island-hydration.js +62 -0
- package/templates/static/lib/build/minifier.d.ts +20 -0
- package/templates/static/lib/build/minifier.js +65 -0
- package/templates/static/lib/build/page-renderer.d.ts +17 -0
- package/templates/static/lib/build/page-renderer.js +45 -0
- package/templates/static/lib/build/production-build.d.ts +10 -0
- package/templates/static/lib/build/production-build.js +30 -0
- package/templates/static/lib/build/ssg-pipeline.d.ts +15 -0
- package/templates/static/lib/build/ssg-pipeline.js +119 -0
- package/templates/static/lib/build-tools/build-site.d.ts +6 -0
- package/templates/static/lib/build-tools/build-site.js +56 -0
- package/templates/static/lib/cache/index.d.ts +2 -0
- package/templates/static/lib/cache/index.js +19 -0
- package/templates/static/lib/cache/memory.d.ts +6 -0
- package/templates/static/lib/cache/memory.js +31 -0
- package/templates/static/lib/cache/redis.d.ts +6 -0
- package/templates/static/lib/cache/redis.js +33 -0
- package/templates/static/lib/cli/banner.d.ts +1 -0
- package/templates/static/lib/cli/banner.js +41 -0
- package/templates/static/lib/cli/templates/ssg/jen.config.d.ts +3 -0
- package/templates/static/lib/cli/templates/ssg/jen.config.js +49 -0
- package/templates/static/lib/cli/templates/ssg/site/index.d.ts +2 -0
- package/templates/static/lib/cli/templates/ssg/site/index.js +4 -0
- package/templates/static/lib/cli/templates/ssr/jen.config.d.ts +3 -0
- package/templates/static/lib/cli/templates/ssr/jen.config.js +49 -0
- package/templates/static/lib/cli/templates/ssr/site/index.d.ts +2 -0
- package/templates/static/lib/cli/templates/ssr/site/index.js +4 -0
- package/templates/static/lib/compilers/esbuild-plugins.d.ts +6 -0
- package/templates/static/lib/compilers/esbuild-plugins.js +130 -0
- package/templates/static/lib/compilers/svelte.d.ts +18 -0
- package/templates/static/lib/compilers/svelte.js +61 -0
- package/templates/static/lib/compilers/vue.d.ts +15 -0
- package/templates/static/lib/compilers/vue.js +99 -0
- package/templates/static/lib/core/config.d.ts +53 -0
- package/templates/static/lib/core/config.js +18 -0
- package/templates/static/lib/core/http.d.ts +3 -0
- package/templates/static/lib/core/http.js +42 -0
- package/templates/static/lib/core/middleware-hooks.d.ts +46 -0
- package/templates/static/lib/core/middleware-hooks.js +69 -0
- package/templates/static/lib/core/paths.d.ts +6 -0
- package/templates/static/lib/core/paths.js +24 -0
- package/templates/static/lib/core/routes/match.d.ts +6 -0
- package/templates/static/lib/core/routes/match.js +31 -0
- package/templates/static/lib/core/routes/scan.d.ts +9 -0
- package/templates/static/lib/core/routes/scan.js +148 -0
- package/templates/static/lib/core/types.d.ts +18 -0
- package/templates/static/lib/core/types.js +18 -0
- package/templates/static/lib/css/compiler.d.ts +20 -0
- package/templates/static/lib/css/compiler.js +87 -0
- package/templates/static/lib/db/connector.d.ts +4 -0
- package/templates/static/lib/db/connector.js +33 -0
- package/templates/static/lib/db/drivers/jdb.d.ts +13 -0
- package/templates/static/lib/db/drivers/jdb.js +59 -0
- package/templates/static/lib/db/drivers/sql.d.ts +18 -0
- package/templates/static/lib/db/drivers/sql.js +182 -0
- package/templates/static/lib/db/index.d.ts +19 -0
- package/templates/static/lib/db/index.js +65 -0
- package/templates/static/lib/db/types.d.ts +29 -0
- package/templates/static/lib/db/types.js +18 -0
- package/templates/static/lib/graphql/index.d.ts +1 -0
- package/templates/static/lib/graphql/index.js +22 -0
- package/templates/static/lib/graphql/resolvers.d.ts +17 -0
- package/templates/static/lib/graphql/resolvers.js +26 -0
- package/templates/static/lib/graphql/schema.d.ts +1 -0
- package/templates/static/lib/graphql/schema.js +20 -0
- package/templates/static/lib/i18n/en.json +4 -0
- package/templates/static/lib/i18n/es.json +4 -0
- package/templates/static/lib/i18n/index.d.ts +8 -0
- package/templates/static/lib/i18n/index.js +32 -0
- package/templates/static/lib/import/jen-import.d.ts +27 -0
- package/templates/static/lib/import/jen-import.js +128 -0
- package/templates/static/lib/index.d.ts +81 -0
- package/templates/static/lib/index.js +120 -0
- package/templates/static/lib/jdb/engine.d.ts +9 -0
- package/templates/static/lib/jdb/engine.js +176 -0
- package/templates/static/lib/jdb/index.d.ts +2 -0
- package/templates/static/lib/jdb/index.js +19 -0
- package/templates/static/lib/jdb/types.d.ts +46 -0
- package/templates/static/lib/jdb/types.js +18 -0
- package/templates/static/lib/jdb/utils.d.ts +6 -0
- package/templates/static/lib/jdb/utils.js +141 -0
- package/templates/static/lib/middleware/builtins/body-parser.d.ts +1 -0
- package/templates/static/lib/middleware/builtins/body-parser.js +55 -0
- package/templates/static/lib/middleware/builtins/cors.d.ts +13 -0
- package/templates/static/lib/middleware/builtins/cors.js +67 -0
- package/templates/static/lib/middleware/builtins/logger.d.ts +1 -0
- package/templates/static/lib/middleware/builtins/logger.js +33 -0
- package/templates/static/lib/middleware/builtins/rate-limit.d.ts +5 -0
- package/templates/static/lib/middleware/builtins/rate-limit.js +76 -0
- package/templates/static/lib/middleware/builtins/request-id.d.ts +1 -0
- package/templates/static/lib/middleware/builtins/request-id.js +25 -0
- package/templates/static/lib/middleware/builtins/security-headers.d.ts +1 -0
- package/templates/static/lib/middleware/builtins/security-headers.js +39 -0
- package/templates/static/lib/middleware/context.d.ts +18 -0
- package/templates/static/lib/middleware/context.js +50 -0
- package/templates/static/lib/middleware/decorators.d.ts +2 -0
- package/templates/static/lib/middleware/decorators.js +61 -0
- package/templates/static/lib/middleware/errors/handler.d.ts +1 -0
- package/templates/static/lib/middleware/errors/handler.js +65 -0
- package/templates/static/lib/middleware/errors/http-error.d.ts +5 -0
- package/templates/static/lib/middleware/errors/http-error.js +27 -0
- package/templates/static/lib/middleware/kernel.d.ts +6 -0
- package/templates/static/lib/middleware/kernel.js +39 -0
- package/templates/static/lib/middleware/pipeline.d.ts +4 -0
- package/templates/static/lib/middleware/pipeline.js +67 -0
- package/templates/static/lib/middleware/registry.d.ts +10 -0
- package/templates/static/lib/middleware/registry.js +41 -0
- package/templates/static/lib/middleware/response.d.ts +13 -0
- package/templates/static/lib/middleware/response.js +60 -0
- package/templates/static/lib/middleware/types.d.ts +1 -0
- package/templates/static/lib/middleware/types.js +18 -0
- package/templates/static/lib/middleware/utils/matcher.d.ts +1 -0
- package/templates/static/lib/middleware/utils/matcher.js +31 -0
- package/templates/static/lib/native/bundle.d.ts +19 -0
- package/templates/static/lib/native/bundle.js +39 -0
- package/templates/static/lib/native/dev-server.d.ts +6 -0
- package/templates/static/lib/native/dev-server.js +38 -0
- package/templates/static/lib/native/index.d.ts +30 -0
- package/templates/static/lib/native/index.js +48 -0
- package/templates/static/lib/native/optimizer.d.ts +17 -0
- package/templates/static/lib/native/optimizer.js +37 -0
- package/templates/static/lib/native/style-compiler.d.ts +10 -0
- package/templates/static/lib/native/style-compiler.js +36 -0
- package/templates/static/lib/plugin/loader.d.ts +8 -0
- package/templates/static/lib/plugin/loader.js +59 -0
- package/templates/static/lib/runtime/client-runtime.d.ts +1 -0
- package/templates/static/lib/runtime/client-runtime.js +28 -0
- package/templates/static/lib/runtime/hmr.d.ts +1 -0
- package/templates/static/lib/runtime/hmr.js +54 -0
- package/templates/static/lib/runtime/hydrate.d.ts +1 -0
- package/templates/static/lib/runtime/hydrate.js +45 -0
- package/templates/static/lib/runtime/island-hydration-client.d.ts +5 -0
- package/templates/static/lib/runtime/island-hydration-client.js +132 -0
- package/templates/static/lib/runtime/islands.d.ts +46 -0
- package/templates/static/lib/runtime/islands.js +89 -0
- package/templates/static/lib/runtime/render.d.ts +13 -0
- package/templates/static/lib/runtime/render.js +183 -0
- package/templates/static/lib/server/api-routes.d.ts +44 -0
- package/templates/static/lib/server/api-routes.js +196 -0
- package/templates/static/lib/server/api.d.ts +6 -0
- package/templates/static/lib/server/api.js +124 -0
- package/templates/static/lib/server/app.d.ts +10 -0
- package/templates/static/lib/server/app.js +381 -0
- package/templates/static/lib/server/runtimeServe.d.ts +4 -0
- package/templates/static/lib/server/runtimeServe.js +125 -0
- package/templates/static/lib/shared/log.d.ts +5 -0
- package/templates/static/lib/shared/log.js +31 -0
- package/templates/static/node_modules/.bin/esbuild +16 -0
- package/templates/static/node_modules/.bin/esbuild.cmd +17 -0
- package/templates/static/node_modules/.bin/esbuild.ps1 +28 -0
- package/templates/static/node_modules/.bin/tsc +16 -0
- package/templates/static/node_modules/.bin/tsc.cmd +17 -0
- package/templates/static/node_modules/.bin/tsc.ps1 +28 -0
- package/templates/static/node_modules/.bin/tsserver +16 -0
- package/templates/static/node_modules/.bin/tsserver.cmd +17 -0
- package/templates/static/node_modules/.bin/tsserver.ps1 +28 -0
- package/templates/static/node_modules/.jen/cache/B__Jen.js_packages_create-jen-app_templates_static_site_(home).tsx.mjs +14 -0
- package/templates/static/node_modules/.jen/cache/B__Jen.js_packages_create-jen-app_yo_site_(home).tsx.mjs +11 -0
- package/templates/static/node_modules/.package-lock.json +585 -0
- package/templates/static/node_modules/@esbuild/win32-x64/README.md +3 -0
- package/templates/static/node_modules/@esbuild/win32-x64/esbuild.exe +0 -0
- package/templates/static/node_modules/@esbuild/win32-x64/package.json +20 -0
- package/templates/static/node_modules/@jenjs/master/README.md +24 -0
- package/templates/static/node_modules/@jenjs/master/index.js +3655 -0
- package/templates/static/node_modules/@jenjs/master/package.json +36 -0
- package/templates/static/node_modules/@polka/url/build.js +49 -0
- package/templates/static/node_modules/@polka/url/build.mjs +47 -0
- package/templates/static/node_modules/@polka/url/index.d.ts +11 -0
- package/templates/static/node_modules/@polka/url/package.json +30 -0
- package/templates/static/node_modules/@polka/url/readme.md +68 -0
- package/templates/static/node_modules/@types/node/LICENSE +21 -0
- package/templates/static/node_modules/@types/node/README.md +15 -0
- package/templates/static/node_modules/@types/node/assert/strict.d.ts +111 -0
- package/templates/static/node_modules/@types/node/assert.d.ts +1078 -0
- package/templates/static/node_modules/@types/node/async_hooks.d.ts +603 -0
- package/templates/static/node_modules/@types/node/buffer.buffer.d.ts +472 -0
- package/templates/static/node_modules/@types/node/buffer.d.ts +1934 -0
- package/templates/static/node_modules/@types/node/child_process.d.ts +1476 -0
- package/templates/static/node_modules/@types/node/cluster.d.ts +578 -0
- package/templates/static/node_modules/@types/node/compatibility/disposable.d.ts +14 -0
- package/templates/static/node_modules/@types/node/compatibility/index.d.ts +9 -0
- package/templates/static/node_modules/@types/node/compatibility/indexable.d.ts +20 -0
- package/templates/static/node_modules/@types/node/compatibility/iterators.d.ts +20 -0
- package/templates/static/node_modules/@types/node/console.d.ts +452 -0
- package/templates/static/node_modules/@types/node/constants.d.ts +21 -0
- package/templates/static/node_modules/@types/node/crypto.d.ts +4545 -0
- package/templates/static/node_modules/@types/node/dgram.d.ts +600 -0
- package/templates/static/node_modules/@types/node/diagnostics_channel.d.ts +578 -0
- package/templates/static/node_modules/@types/node/dns/promises.d.ts +503 -0
- package/templates/static/node_modules/@types/node/dns.d.ts +923 -0
- package/templates/static/node_modules/@types/node/domain.d.ts +170 -0
- package/templates/static/node_modules/@types/node/events.d.ts +976 -0
- package/templates/static/node_modules/@types/node/fs/promises.d.ts +1295 -0
- package/templates/static/node_modules/@types/node/fs.d.ts +4461 -0
- package/templates/static/node_modules/@types/node/globals.d.ts +172 -0
- package/templates/static/node_modules/@types/node/globals.typedarray.d.ts +38 -0
- package/templates/static/node_modules/@types/node/http.d.ts +2089 -0
- package/templates/static/node_modules/@types/node/http2.d.ts +2644 -0
- package/templates/static/node_modules/@types/node/https.d.ts +579 -0
- package/templates/static/node_modules/@types/node/index.d.ts +97 -0
- package/templates/static/node_modules/@types/node/inspector.d.ts +253 -0
- package/templates/static/node_modules/@types/node/inspector.generated.d.ts +4052 -0
- package/templates/static/node_modules/@types/node/module.d.ts +891 -0
- package/templates/static/node_modules/@types/node/net.d.ts +1057 -0
- package/templates/static/node_modules/@types/node/os.d.ts +506 -0
- package/templates/static/node_modules/@types/node/package.json +145 -0
- package/templates/static/node_modules/@types/node/path.d.ts +200 -0
- package/templates/static/node_modules/@types/node/perf_hooks.d.ts +968 -0
- package/templates/static/node_modules/@types/node/process.d.ts +2089 -0
- package/templates/static/node_modules/@types/node/punycode.d.ts +117 -0
- package/templates/static/node_modules/@types/node/querystring.d.ts +152 -0
- package/templates/static/node_modules/@types/node/readline/promises.d.ts +161 -0
- package/templates/static/node_modules/@types/node/readline.d.ts +594 -0
- package/templates/static/node_modules/@types/node/repl.d.ts +428 -0
- package/templates/static/node_modules/@types/node/sea.d.ts +153 -0
- package/templates/static/node_modules/@types/node/sqlite.d.ts +721 -0
- package/templates/static/node_modules/@types/node/stream/consumers.d.ts +38 -0
- package/templates/static/node_modules/@types/node/stream/promises.d.ts +90 -0
- package/templates/static/node_modules/@types/node/stream/web.d.ts +622 -0
- package/templates/static/node_modules/@types/node/stream.d.ts +1664 -0
- package/templates/static/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/templates/static/node_modules/@types/node/test.d.ts +2163 -0
- package/templates/static/node_modules/@types/node/timers/promises.d.ts +108 -0
- package/templates/static/node_modules/@types/node/timers.d.ts +287 -0
- package/templates/static/node_modules/@types/node/tls.d.ts +1319 -0
- package/templates/static/node_modules/@types/node/trace_events.d.ts +197 -0
- package/templates/static/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +468 -0
- package/templates/static/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +34 -0
- package/templates/static/node_modules/@types/node/ts5.6/index.d.ts +97 -0
- package/templates/static/node_modules/@types/node/tty.d.ts +208 -0
- package/templates/static/node_modules/@types/node/url.d.ts +984 -0
- package/templates/static/node_modules/@types/node/util.d.ts +2606 -0
- package/templates/static/node_modules/@types/node/v8.d.ts +920 -0
- package/templates/static/node_modules/@types/node/vm.d.ts +1000 -0
- package/templates/static/node_modules/@types/node/wasi.d.ts +181 -0
- package/templates/static/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
- package/templates/static/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
- package/templates/static/node_modules/@types/node/web-globals/events.d.ts +97 -0
- package/templates/static/node_modules/@types/node/web-globals/fetch.d.ts +55 -0
- package/templates/static/node_modules/@types/node/web-globals/navigator.d.ts +22 -0
- package/templates/static/node_modules/@types/node/web-globals/storage.d.ts +24 -0
- package/templates/static/node_modules/@types/node/worker_threads.d.ts +784 -0
- package/templates/static/node_modules/@types/node/zlib.d.ts +683 -0
- package/templates/static/node_modules/esbuild/LICENSE.md +21 -0
- package/templates/static/node_modules/esbuild/README.md +3 -0
- package/templates/static/node_modules/esbuild/bin/esbuild +223 -0
- package/templates/static/node_modules/esbuild/install.js +289 -0
- package/templates/static/node_modules/esbuild/lib/main.d.ts +716 -0
- package/templates/static/node_modules/esbuild/lib/main.js +2242 -0
- package/templates/static/node_modules/esbuild/package.json +49 -0
- package/templates/static/node_modules/mrmime/index.d.ts +2 -0
- package/templates/static/node_modules/mrmime/index.js +449 -0
- package/templates/static/node_modules/mrmime/index.mjs +448 -0
- package/templates/static/node_modules/mrmime/license +21 -0
- package/templates/static/node_modules/mrmime/package.json +44 -0
- package/templates/static/node_modules/mrmime/readme.md +130 -0
- package/templates/static/node_modules/preact/LICENSE +21 -0
- package/templates/static/node_modules/preact/README.md +185 -0
- package/templates/static/node_modules/preact/compat/client.d.ts +13 -0
- package/templates/static/node_modules/preact/compat/client.js +21 -0
- package/templates/static/node_modules/preact/compat/client.mjs +24 -0
- package/templates/static/node_modules/preact/compat/dist/compat.js +2 -0
- package/templates/static/node_modules/preact/compat/dist/compat.js.map +1 -0
- package/templates/static/node_modules/preact/compat/dist/compat.mjs +2 -0
- package/templates/static/node_modules/preact/compat/dist/compat.module.js +2 -0
- package/templates/static/node_modules/preact/compat/dist/compat.module.js.map +1 -0
- package/templates/static/node_modules/preact/compat/dist/compat.umd.js +2 -0
- package/templates/static/node_modules/preact/compat/dist/compat.umd.js.map +1 -0
- package/templates/static/node_modules/preact/compat/jsx-dev-runtime.js +3 -0
- package/templates/static/node_modules/preact/compat/jsx-dev-runtime.mjs +3 -0
- package/templates/static/node_modules/preact/compat/jsx-runtime.js +3 -0
- package/templates/static/node_modules/preact/compat/jsx-runtime.mjs +3 -0
- package/templates/static/node_modules/preact/compat/package.json +55 -0
- package/templates/static/node_modules/preact/compat/scheduler.js +15 -0
- package/templates/static/node_modules/preact/compat/scheduler.mjs +23 -0
- package/templates/static/node_modules/preact/compat/server.browser.js +11 -0
- package/templates/static/node_modules/preact/compat/server.js +36 -0
- package/templates/static/node_modules/preact/compat/server.mjs +17 -0
- package/templates/static/node_modules/preact/compat/src/Children.js +21 -0
- package/templates/static/node_modules/preact/compat/src/PureComponent.js +16 -0
- package/templates/static/node_modules/preact/compat/src/forwardRef.js +44 -0
- package/templates/static/node_modules/preact/compat/src/hooks.js +70 -0
- package/templates/static/node_modules/preact/compat/src/index.d.ts +351 -0
- package/templates/static/node_modules/preact/compat/src/index.js +238 -0
- package/templates/static/node_modules/preact/compat/src/internal.d.ts +48 -0
- package/templates/static/node_modules/preact/compat/src/memo.js +35 -0
- package/templates/static/node_modules/preact/compat/src/portals.js +78 -0
- package/templates/static/node_modules/preact/compat/src/render.js +313 -0
- package/templates/static/node_modules/preact/compat/src/suspense-list.d.ts +16 -0
- package/templates/static/node_modules/preact/compat/src/suspense-list.js +127 -0
- package/templates/static/node_modules/preact/compat/src/suspense.d.ts +19 -0
- package/templates/static/node_modules/preact/compat/src/suspense.js +291 -0
- package/templates/static/node_modules/preact/compat/src/util.js +33 -0
- package/templates/static/node_modules/preact/compat/test-utils.js +1 -0
- package/templates/static/node_modules/preact/compat/test-utils.mjs +1 -0
- package/templates/static/node_modules/preact/debug/dist/debug.js +2 -0
- package/templates/static/node_modules/preact/debug/dist/debug.js.map +1 -0
- package/templates/static/node_modules/preact/debug/dist/debug.mjs +2 -0
- package/templates/static/node_modules/preact/debug/dist/debug.module.js +2 -0
- package/templates/static/node_modules/preact/debug/dist/debug.module.js.map +1 -0
- package/templates/static/node_modules/preact/debug/dist/debug.umd.js +2 -0
- package/templates/static/node_modules/preact/debug/dist/debug.umd.js.map +1 -0
- package/templates/static/node_modules/preact/debug/package.json +27 -0
- package/templates/static/node_modules/preact/debug/src/check-props.js +54 -0
- package/templates/static/node_modules/preact/debug/src/component-stack.js +146 -0
- package/templates/static/node_modules/preact/debug/src/constants.js +3 -0
- package/templates/static/node_modules/preact/debug/src/debug.js +593 -0
- package/templates/static/node_modules/preact/debug/src/index.d.ts +23 -0
- package/templates/static/node_modules/preact/debug/src/index.js +12 -0
- package/templates/static/node_modules/preact/debug/src/internal.d.ts +82 -0
- package/templates/static/node_modules/preact/debug/src/util.js +15 -0
- package/templates/static/node_modules/preact/devtools/dist/devtools.js +2 -0
- package/templates/static/node_modules/preact/devtools/dist/devtools.js.map +1 -0
- package/templates/static/node_modules/preact/devtools/dist/devtools.mjs +2 -0
- package/templates/static/node_modules/preact/devtools/dist/devtools.module.js +2 -0
- package/templates/static/node_modules/preact/devtools/dist/devtools.module.js.map +1 -0
- package/templates/static/node_modules/preact/devtools/dist/devtools.umd.js +2 -0
- package/templates/static/node_modules/preact/devtools/dist/devtools.umd.js.map +1 -0
- package/templates/static/node_modules/preact/devtools/package.json +25 -0
- package/templates/static/node_modules/preact/devtools/src/devtools.js +21 -0
- package/templates/static/node_modules/preact/devtools/src/index.d.ts +8 -0
- package/templates/static/node_modules/preact/devtools/src/index.js +15 -0
- package/templates/static/node_modules/preact/dist/preact.js +2 -0
- package/templates/static/node_modules/preact/dist/preact.js.map +1 -0
- package/templates/static/node_modules/preact/dist/preact.min.js +2 -0
- package/templates/static/node_modules/preact/dist/preact.min.js.map +1 -0
- package/templates/static/node_modules/preact/dist/preact.min.module.js +2 -0
- package/templates/static/node_modules/preact/dist/preact.min.module.js.map +1 -0
- package/templates/static/node_modules/preact/dist/preact.min.umd.js +2 -0
- package/templates/static/node_modules/preact/dist/preact.min.umd.js.map +1 -0
- package/templates/static/node_modules/preact/dist/preact.mjs +2 -0
- package/templates/static/node_modules/preact/dist/preact.module.js +2 -0
- package/templates/static/node_modules/preact/dist/preact.module.js.map +1 -0
- package/templates/static/node_modules/preact/dist/preact.umd.js +2 -0
- package/templates/static/node_modules/preact/dist/preact.umd.js.map +1 -0
- package/templates/static/node_modules/preact/hooks/dist/hooks.js +2 -0
- package/templates/static/node_modules/preact/hooks/dist/hooks.js.map +1 -0
- package/templates/static/node_modules/preact/hooks/dist/hooks.mjs +2 -0
- package/templates/static/node_modules/preact/hooks/dist/hooks.module.js +2 -0
- package/templates/static/node_modules/preact/hooks/dist/hooks.module.js.map +1 -0
- package/templates/static/node_modules/preact/hooks/dist/hooks.umd.js +2 -0
- package/templates/static/node_modules/preact/hooks/dist/hooks.umd.js.map +1 -0
- package/templates/static/node_modules/preact/hooks/package.json +35 -0
- package/templates/static/node_modules/preact/hooks/src/index.d.ts +145 -0
- package/templates/static/node_modules/preact/hooks/src/index.js +555 -0
- package/templates/static/node_modules/preact/hooks/src/internal.d.ts +103 -0
- package/templates/static/node_modules/preact/jsx-runtime/dist/jsxRuntime.js +2 -0
- package/templates/static/node_modules/preact/jsx-runtime/dist/jsxRuntime.js.map +1 -0
- package/templates/static/node_modules/preact/jsx-runtime/dist/jsxRuntime.mjs +2 -0
- package/templates/static/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js +2 -0
- package/templates/static/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js.map +1 -0
- package/templates/static/node_modules/preact/jsx-runtime/dist/jsxRuntime.umd.js +2 -0
- package/templates/static/node_modules/preact/jsx-runtime/dist/jsxRuntime.umd.js.map +1 -0
- package/templates/static/node_modules/preact/jsx-runtime/package.json +28 -0
- package/templates/static/node_modules/preact/jsx-runtime/src/index.d.ts +62 -0
- package/templates/static/node_modules/preact/jsx-runtime/src/index.js +206 -0
- package/templates/static/node_modules/preact/jsx-runtime/src/utils.js +36 -0
- package/templates/static/node_modules/preact/package.json +258 -0
- package/templates/static/node_modules/preact/src/cjs.js +3 -0
- package/templates/static/node_modules/preact/src/clone-element.js +48 -0
- package/templates/static/node_modules/preact/src/component.js +249 -0
- package/templates/static/node_modules/preact/src/constants.js +22 -0
- package/templates/static/node_modules/preact/src/create-context.js +60 -0
- package/templates/static/node_modules/preact/src/create-element.js +97 -0
- package/templates/static/node_modules/preact/src/diff/catch-error.js +46 -0
- package/templates/static/node_modules/preact/src/diff/children.js +451 -0
- package/templates/static/node_modules/preact/src/diff/index.js +684 -0
- package/templates/static/node_modules/preact/src/diff/props.js +173 -0
- package/templates/static/node_modules/preact/src/dom.d.ts +2476 -0
- package/templates/static/node_modules/preact/src/index-5.d.ts +399 -0
- package/templates/static/node_modules/preact/src/index.d.ts +402 -0
- package/templates/static/node_modules/preact/src/index.js +13 -0
- package/templates/static/node_modules/preact/src/internal.d.ts +190 -0
- package/templates/static/node_modules/preact/src/jsx.d.ts +2878 -0
- package/templates/static/node_modules/preact/src/options.js +16 -0
- package/templates/static/node_modules/preact/src/render.js +78 -0
- package/templates/static/node_modules/preact/src/util.js +28 -0
- package/templates/static/node_modules/preact/test-utils/dist/testUtils.js +2 -0
- package/templates/static/node_modules/preact/test-utils/dist/testUtils.js.map +1 -0
- package/templates/static/node_modules/preact/test-utils/dist/testUtils.mjs +2 -0
- package/templates/static/node_modules/preact/test-utils/dist/testUtils.module.js +2 -0
- package/templates/static/node_modules/preact/test-utils/dist/testUtils.module.js.map +1 -0
- package/templates/static/node_modules/preact/test-utils/dist/testUtils.umd.js +2 -0
- package/templates/static/node_modules/preact/test-utils/dist/testUtils.umd.js.map +1 -0
- package/templates/static/node_modules/preact/test-utils/package.json +28 -0
- package/templates/static/node_modules/preact/test-utils/src/index.d.ts +3 -0
- package/templates/static/node_modules/preact/test-utils/src/index.js +129 -0
- package/templates/static/node_modules/preact-render-to-string/LICENSE +21 -0
- package/templates/static/node_modules/preact-render-to-string/README.md +149 -0
- package/templates/static/node_modules/preact-render-to-string/dist/commonjs.js +2 -0
- package/templates/static/node_modules/preact-render-to-string/dist/index.d.ts +17 -0
- package/templates/static/node_modules/preact-render-to-string/dist/index.js +6 -0
- package/templates/static/node_modules/preact-render-to-string/dist/index.js.map +1 -0
- package/templates/static/node_modules/preact-render-to-string/dist/index.mjs +2 -0
- package/templates/static/node_modules/preact-render-to-string/dist/index.module.js +2 -0
- package/templates/static/node_modules/preact-render-to-string/dist/index.module.js.map +1 -0
- package/templates/static/node_modules/preact-render-to-string/dist/index.umd.js +2 -0
- package/templates/static/node_modules/preact-render-to-string/dist/index.umd.js.map +1 -0
- package/templates/static/node_modules/preact-render-to-string/dist/internal.d.ts +35 -0
- package/templates/static/node_modules/preact-render-to-string/dist/jsx/commonjs.js +2 -0
- package/templates/static/node_modules/preact-render-to-string/dist/jsx/index.js +4 -0
- package/templates/static/node_modules/preact-render-to-string/dist/jsx/index.js.map +1 -0
- package/templates/static/node_modules/preact-render-to-string/dist/jsx/index.mjs +2 -0
- package/templates/static/node_modules/preact-render-to-string/dist/jsx/index.module.js +2 -0
- package/templates/static/node_modules/preact-render-to-string/dist/jsx/index.module.js.map +1 -0
- package/templates/static/node_modules/preact-render-to-string/dist/jsx/index.umd.js +2 -0
- package/templates/static/node_modules/preact-render-to-string/dist/jsx/index.umd.js.map +1 -0
- package/templates/static/node_modules/preact-render-to-string/dist/jsx.d.ts +24 -0
- package/templates/static/node_modules/preact-render-to-string/dist/stream/index.js +2 -0
- package/templates/static/node_modules/preact-render-to-string/dist/stream/index.js.map +1 -0
- package/templates/static/node_modules/preact-render-to-string/dist/stream/index.mjs +2 -0
- package/templates/static/node_modules/preact-render-to-string/dist/stream/index.module.js +2 -0
- package/templates/static/node_modules/preact-render-to-string/dist/stream/index.module.js.map +1 -0
- package/templates/static/node_modules/preact-render-to-string/dist/stream/index.umd.js +2 -0
- package/templates/static/node_modules/preact-render-to-string/dist/stream/index.umd.js.map +1 -0
- package/templates/static/node_modules/preact-render-to-string/dist/stream/node/index.js +884 -0
- package/templates/static/node_modules/preact-render-to-string/dist/stream/node/index.js.map +1 -0
- package/templates/static/node_modules/preact-render-to-string/dist/stream/node/index.mjs +884 -0
- package/templates/static/node_modules/preact-render-to-string/dist/stream/node/index.module.js +884 -0
- package/templates/static/node_modules/preact-render-to-string/dist/stream/node/index.module.js.map +1 -0
- package/templates/static/node_modules/preact-render-to-string/dist/stream/node/index.umd.js +888 -0
- package/templates/static/node_modules/preact-render-to-string/dist/stream/node/index.umd.js.map +1 -0
- package/templates/static/node_modules/preact-render-to-string/dist/stream-node.d.ts +19 -0
- package/templates/static/node_modules/preact-render-to-string/dist/stream.d.ts +10 -0
- package/templates/static/node_modules/preact-render-to-string/jsx.d.ts +24 -0
- package/templates/static/node_modules/preact-render-to-string/jsx.js +1 -0
- package/templates/static/node_modules/preact-render-to-string/package.json +152 -0
- package/templates/static/node_modules/preact-render-to-string/src/index.d.ts +17 -0
- package/templates/static/node_modules/preact-render-to-string/src/index.js +764 -0
- package/templates/static/node_modules/preact-render-to-string/src/internal.d.ts +35 -0
- package/templates/static/node_modules/preact-render-to-string/src/jsx.d.ts +24 -0
- package/templates/static/node_modules/preact-render-to-string/src/jsx.js +102 -0
- package/templates/static/node_modules/preact-render-to-string/src/lib/chunked.js +97 -0
- package/templates/static/node_modules/preact-render-to-string/src/lib/client.js +62 -0
- package/templates/static/node_modules/preact-render-to-string/src/lib/constants.js +20 -0
- package/templates/static/node_modules/preact-render-to-string/src/lib/polyfills.js +8 -0
- package/templates/static/node_modules/preact-render-to-string/src/lib/util.js +208 -0
- package/templates/static/node_modules/preact-render-to-string/src/pretty.js +491 -0
- package/templates/static/node_modules/preact-render-to-string/src/stream-node.d.ts +19 -0
- package/templates/static/node_modules/preact-render-to-string/src/stream-node.js +84 -0
- package/templates/static/node_modules/preact-render-to-string/src/stream.d.ts +10 -0
- package/templates/static/node_modules/preact-render-to-string/src/stream.js +43 -0
- package/templates/static/node_modules/preact-render-to-string/typings.json +5 -0
- package/templates/static/node_modules/sirv/build.js +197 -0
- package/templates/static/node_modules/sirv/build.mjs +197 -0
- package/templates/static/node_modules/sirv/index.d.mts +29 -0
- package/templates/static/node_modules/sirv/index.d.ts +33 -0
- package/templates/static/node_modules/sirv/package.json +40 -0
- package/templates/static/node_modules/sirv/readme.md +238 -0
- package/templates/static/node_modules/totalist/dist/index.js +24 -0
- package/templates/static/node_modules/totalist/dist/index.mjs +22 -0
- package/templates/static/node_modules/totalist/index.d.ts +3 -0
- package/templates/static/node_modules/totalist/license +21 -0
- package/templates/static/node_modules/totalist/package.json +55 -0
- package/templates/static/node_modules/totalist/readme.md +109 -0
- package/templates/static/node_modules/totalist/sync/index.d.ts +3 -0
- package/templates/static/node_modules/totalist/sync/index.js +17 -0
- package/templates/static/node_modules/totalist/sync/index.mjs +15 -0
- package/templates/static/node_modules/typescript/bin/tsc +2 -0
- package/templates/static/node_modules/typescript/bin/tsserver +2 -0
- package/templates/static/node_modules/typescript/lib/cs/diagnosticMessages.generated.json +2122 -0
- package/templates/static/node_modules/typescript/lib/de/diagnosticMessages.generated.json +2122 -0
- package/templates/static/node_modules/typescript/lib/es/diagnosticMessages.generated.json +2122 -0
- package/templates/static/node_modules/typescript/lib/fr/diagnosticMessages.generated.json +2122 -0
- package/templates/static/node_modules/typescript/lib/it/diagnosticMessages.generated.json +2122 -0
- package/templates/static/node_modules/typescript/lib/ja/diagnosticMessages.generated.json +2122 -0
- package/templates/static/node_modules/typescript/lib/ko/diagnosticMessages.generated.json +2122 -0
- package/templates/static/node_modules/typescript/lib/lib.d.ts +22 -0
- package/templates/static/node_modules/typescript/lib/lib.decorators.d.ts +384 -0
- package/templates/static/node_modules/typescript/lib/lib.decorators.legacy.d.ts +22 -0
- package/templates/static/node_modules/typescript/lib/lib.dom.asynciterable.d.ts +41 -0
- package/templates/static/node_modules/typescript/lib/lib.dom.d.ts +39429 -0
- package/templates/static/node_modules/typescript/lib/lib.dom.iterable.d.ts +571 -0
- package/templates/static/node_modules/typescript/lib/lib.es2015.collection.d.ts +147 -0
- package/templates/static/node_modules/typescript/lib/lib.es2015.core.d.ts +597 -0
- package/templates/static/node_modules/typescript/lib/lib.es2015.d.ts +28 -0
- package/templates/static/node_modules/typescript/lib/lib.es2015.generator.d.ts +77 -0
- package/templates/static/node_modules/typescript/lib/lib.es2015.iterable.d.ts +605 -0
- package/templates/static/node_modules/typescript/lib/lib.es2015.promise.d.ts +81 -0
- package/templates/static/node_modules/typescript/lib/lib.es2015.proxy.d.ts +128 -0
- package/templates/static/node_modules/typescript/lib/lib.es2015.reflect.d.ts +144 -0
- package/templates/static/node_modules/typescript/lib/lib.es2015.symbol.d.ts +46 -0
- package/templates/static/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts +326 -0
- package/templates/static/node_modules/typescript/lib/lib.es2016.array.include.d.ts +116 -0
- package/templates/static/node_modules/typescript/lib/lib.es2016.d.ts +21 -0
- package/templates/static/node_modules/typescript/lib/lib.es2016.full.d.ts +23 -0
- package/templates/static/node_modules/typescript/lib/lib.es2016.intl.d.ts +31 -0
- package/templates/static/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts +21 -0
- package/templates/static/node_modules/typescript/lib/lib.es2017.d.ts +26 -0
- package/templates/static/node_modules/typescript/lib/lib.es2017.date.d.ts +31 -0
- package/templates/static/node_modules/typescript/lib/lib.es2017.full.d.ts +23 -0
- package/templates/static/node_modules/typescript/lib/lib.es2017.intl.d.ts +44 -0
- package/templates/static/node_modules/typescript/lib/lib.es2017.object.d.ts +49 -0
- package/templates/static/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts +135 -0
- package/templates/static/node_modules/typescript/lib/lib.es2017.string.d.ts +45 -0
- package/templates/static/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts +53 -0
- package/templates/static/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts +77 -0
- package/templates/static/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts +53 -0
- package/templates/static/node_modules/typescript/lib/lib.es2018.d.ts +24 -0
- package/templates/static/node_modules/typescript/lib/lib.es2018.full.d.ts +24 -0
- package/templates/static/node_modules/typescript/lib/lib.es2018.intl.d.ts +83 -0
- package/templates/static/node_modules/typescript/lib/lib.es2018.promise.d.ts +30 -0
- package/templates/static/node_modules/typescript/lib/lib.es2018.regexp.d.ts +37 -0
- package/templates/static/node_modules/typescript/lib/lib.es2019.array.d.ts +79 -0
- package/templates/static/node_modules/typescript/lib/lib.es2019.d.ts +24 -0
- package/templates/static/node_modules/typescript/lib/lib.es2019.full.d.ts +24 -0
- package/templates/static/node_modules/typescript/lib/lib.es2019.intl.d.ts +23 -0
- package/templates/static/node_modules/typescript/lib/lib.es2019.object.d.ts +33 -0
- package/templates/static/node_modules/typescript/lib/lib.es2019.string.d.ts +37 -0
- package/templates/static/node_modules/typescript/lib/lib.es2019.symbol.d.ts +24 -0
- package/templates/static/node_modules/typescript/lib/lib.es2020.bigint.d.ts +765 -0
- package/templates/static/node_modules/typescript/lib/lib.es2020.d.ts +27 -0
- package/templates/static/node_modules/typescript/lib/lib.es2020.date.d.ts +42 -0
- package/templates/static/node_modules/typescript/lib/lib.es2020.full.d.ts +24 -0
- package/templates/static/node_modules/typescript/lib/lib.es2020.intl.d.ts +474 -0
- package/templates/static/node_modules/typescript/lib/lib.es2020.number.d.ts +28 -0
- package/templates/static/node_modules/typescript/lib/lib.es2020.promise.d.ts +47 -0
- package/templates/static/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts +99 -0
- package/templates/static/node_modules/typescript/lib/lib.es2020.string.d.ts +44 -0
- package/templates/static/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts +41 -0
- package/templates/static/node_modules/typescript/lib/lib.es2021.d.ts +23 -0
- package/templates/static/node_modules/typescript/lib/lib.es2021.full.d.ts +24 -0
- package/templates/static/node_modules/typescript/lib/lib.es2021.intl.d.ts +166 -0
- package/templates/static/node_modules/typescript/lib/lib.es2021.promise.d.ts +48 -0
- package/templates/static/node_modules/typescript/lib/lib.es2021.string.d.ts +33 -0
- package/templates/static/node_modules/typescript/lib/lib.es2021.weakref.d.ts +78 -0
- package/templates/static/node_modules/typescript/lib/lib.es2022.array.d.ts +121 -0
- package/templates/static/node_modules/typescript/lib/lib.es2022.d.ts +25 -0
- package/templates/static/node_modules/typescript/lib/lib.es2022.error.d.ts +75 -0
- package/templates/static/node_modules/typescript/lib/lib.es2022.full.d.ts +24 -0
- package/templates/static/node_modules/typescript/lib/lib.es2022.intl.d.ts +145 -0
- package/templates/static/node_modules/typescript/lib/lib.es2022.object.d.ts +26 -0
- package/templates/static/node_modules/typescript/lib/lib.es2022.regexp.d.ts +39 -0
- package/templates/static/node_modules/typescript/lib/lib.es2022.string.d.ts +25 -0
- package/templates/static/node_modules/typescript/lib/lib.es2023.array.d.ts +924 -0
- package/templates/static/node_modules/typescript/lib/lib.es2023.collection.d.ts +21 -0
- package/templates/static/node_modules/typescript/lib/lib.es2023.d.ts +22 -0
- package/templates/static/node_modules/typescript/lib/lib.es2023.full.d.ts +24 -0
- package/templates/static/node_modules/typescript/lib/lib.es2023.intl.d.ts +56 -0
- package/templates/static/node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts +65 -0
- package/templates/static/node_modules/typescript/lib/lib.es2024.collection.d.ts +29 -0
- package/templates/static/node_modules/typescript/lib/lib.es2024.d.ts +26 -0
- package/templates/static/node_modules/typescript/lib/lib.es2024.full.d.ts +24 -0
- package/templates/static/node_modules/typescript/lib/lib.es2024.object.d.ts +29 -0
- package/templates/static/node_modules/typescript/lib/lib.es2024.promise.d.ts +35 -0
- package/templates/static/node_modules/typescript/lib/lib.es2024.regexp.d.ts +25 -0
- package/templates/static/node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts +68 -0
- package/templates/static/node_modules/typescript/lib/lib.es2024.string.d.ts +29 -0
- package/templates/static/node_modules/typescript/lib/lib.es5.d.ts +4601 -0
- package/templates/static/node_modules/typescript/lib/lib.es6.d.ts +23 -0
- package/templates/static/node_modules/typescript/lib/lib.esnext.array.d.ts +35 -0
- package/templates/static/node_modules/typescript/lib/lib.esnext.collection.d.ts +96 -0
- package/templates/static/node_modules/typescript/lib/lib.esnext.d.ts +29 -0
- package/templates/static/node_modules/typescript/lib/lib.esnext.decorators.d.ts +28 -0
- package/templates/static/node_modules/typescript/lib/lib.esnext.disposable.d.ts +193 -0
- package/templates/static/node_modules/typescript/lib/lib.esnext.error.d.ts +24 -0
- package/templates/static/node_modules/typescript/lib/lib.esnext.float16.d.ts +445 -0
- package/templates/static/node_modules/typescript/lib/lib.esnext.full.d.ts +24 -0
- package/templates/static/node_modules/typescript/lib/lib.esnext.intl.d.ts +21 -0
- package/templates/static/node_modules/typescript/lib/lib.esnext.iterator.d.ts +148 -0
- package/templates/static/node_modules/typescript/lib/lib.esnext.promise.d.ts +34 -0
- package/templates/static/node_modules/typescript/lib/lib.esnext.sharedmemory.d.ts +25 -0
- package/templates/static/node_modules/typescript/lib/lib.scripthost.d.ts +322 -0
- package/templates/static/node_modules/typescript/lib/lib.webworker.asynciterable.d.ts +41 -0
- package/templates/static/node_modules/typescript/lib/lib.webworker.d.ts +13150 -0
- package/templates/static/node_modules/typescript/lib/lib.webworker.importscripts.d.ts +23 -0
- package/templates/static/node_modules/typescript/lib/lib.webworker.iterable.d.ts +340 -0
- package/templates/static/node_modules/typescript/lib/pl/diagnosticMessages.generated.json +2122 -0
- package/templates/static/node_modules/typescript/lib/pt-br/diagnosticMessages.generated.json +2122 -0
- package/templates/static/node_modules/typescript/lib/ru/diagnosticMessages.generated.json +2122 -0
- package/templates/static/node_modules/typescript/lib/tr/diagnosticMessages.generated.json +2122 -0
- package/templates/static/node_modules/typescript/lib/tsc.js +8 -0
- package/templates/static/node_modules/typescript/lib/tsserver.js +8 -0
- package/templates/static/node_modules/typescript/lib/tsserverlibrary.d.ts +17 -0
- package/templates/static/node_modules/typescript/lib/tsserverlibrary.js +21 -0
- package/templates/static/node_modules/typescript/lib/typescript.d.ts +11437 -0
- package/templates/static/package.json +20 -0
- package/templates/static/server.js +130 -0
- package/templates/static/site/(home).tsx +12 -0
- package/templates/static/site/styles/global.scss +78 -0
- package/templates/static/tsconfig.json +39 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { _catchError } from './diff/catch-error';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The `option` object can potentially contain callback functions
|
|
5
|
+
* that are called during various stages of our renderer. This is the
|
|
6
|
+
* foundation on which all our addons like `preact/debug`, `preact/compat`,
|
|
7
|
+
* and `preact/hooks` are based on. See the `Options` type in `internal.d.ts`
|
|
8
|
+
* for a full list of available option hooks (most editors/IDEs allow you to
|
|
9
|
+
* ctrl+click or cmd+click on mac the type definition below).
|
|
10
|
+
* @type {import('./internal').Options}
|
|
11
|
+
*/
|
|
12
|
+
const options = {
|
|
13
|
+
_catchError
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default options;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { EMPTY_OBJ, NULL } from './constants';
|
|
2
|
+
import { commitRoot, diff } from './diff/index';
|
|
3
|
+
import { createElement, Fragment } from './create-element';
|
|
4
|
+
import options from './options';
|
|
5
|
+
import { slice } from './util';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Render a Preact virtual node into a DOM element
|
|
9
|
+
* @param {import('./internal').ComponentChild} vnode The virtual node to render
|
|
10
|
+
* @param {import('./internal').PreactElement} parentDom The DOM element to render into
|
|
11
|
+
* @param {import('./internal').PreactElement | object} [replaceNode] Optional: Attempt to re-use an
|
|
12
|
+
* existing DOM tree rooted at `replaceNode`
|
|
13
|
+
*/
|
|
14
|
+
export function render(vnode, parentDom, replaceNode) {
|
|
15
|
+
// https://github.com/preactjs/preact/issues/3794
|
|
16
|
+
if (parentDom == document) {
|
|
17
|
+
parentDom = document.documentElement;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (options._root) options._root(vnode, parentDom);
|
|
21
|
+
|
|
22
|
+
// We abuse the `replaceNode` parameter in `hydrate()` to signal if we are in
|
|
23
|
+
// hydration mode or not by passing the `hydrate` function instead of a DOM
|
|
24
|
+
// element..
|
|
25
|
+
let isHydrating = typeof replaceNode == 'function';
|
|
26
|
+
|
|
27
|
+
// To be able to support calling `render()` multiple times on the same
|
|
28
|
+
// DOM node, we need to obtain a reference to the previous tree. We do
|
|
29
|
+
// this by assigning a new `_children` property to DOM nodes which points
|
|
30
|
+
// to the last rendered tree. By default this property is not present, which
|
|
31
|
+
// means that we are mounting a new tree for the first time.
|
|
32
|
+
let oldVNode = isHydrating
|
|
33
|
+
? NULL
|
|
34
|
+
: (replaceNode && replaceNode._children) || parentDom._children;
|
|
35
|
+
|
|
36
|
+
vnode = ((!isHydrating && replaceNode) || parentDom)._children =
|
|
37
|
+
createElement(Fragment, NULL, [vnode]);
|
|
38
|
+
|
|
39
|
+
// List of effects that need to be called after diffing.
|
|
40
|
+
let commitQueue = [],
|
|
41
|
+
refQueue = [];
|
|
42
|
+
diff(
|
|
43
|
+
parentDom,
|
|
44
|
+
// Determine the new vnode tree and store it on the DOM element on
|
|
45
|
+
// our custom `_children` property.
|
|
46
|
+
vnode,
|
|
47
|
+
oldVNode || EMPTY_OBJ,
|
|
48
|
+
EMPTY_OBJ,
|
|
49
|
+
parentDom.namespaceURI,
|
|
50
|
+
!isHydrating && replaceNode
|
|
51
|
+
? [replaceNode]
|
|
52
|
+
: oldVNode
|
|
53
|
+
? NULL
|
|
54
|
+
: parentDom.firstChild
|
|
55
|
+
? slice.call(parentDom.childNodes)
|
|
56
|
+
: NULL,
|
|
57
|
+
commitQueue,
|
|
58
|
+
!isHydrating && replaceNode
|
|
59
|
+
? replaceNode
|
|
60
|
+
: oldVNode
|
|
61
|
+
? oldVNode._dom
|
|
62
|
+
: parentDom.firstChild,
|
|
63
|
+
isHydrating,
|
|
64
|
+
refQueue
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
// Flush all queued effects
|
|
68
|
+
commitRoot(commitQueue, vnode, refQueue);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Update an existing DOM element with data from a Preact virtual node
|
|
73
|
+
* @param {import('./internal').ComponentChild} vnode The virtual node to render
|
|
74
|
+
* @param {import('./internal').PreactElement} parentDom The DOM element to update
|
|
75
|
+
*/
|
|
76
|
+
export function hydrate(vnode, parentDom) {
|
|
77
|
+
render(vnode, parentDom, hydrate);
|
|
78
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { EMPTY_ARR } from './constants';
|
|
2
|
+
|
|
3
|
+
export const isArray = Array.isArray;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Assign properties from `props` to `obj`
|
|
7
|
+
* @template O, P The obj and props types
|
|
8
|
+
* @param {O} obj The object to copy properties to
|
|
9
|
+
* @param {P} props The object to copy properties from
|
|
10
|
+
* @returns {O & P}
|
|
11
|
+
*/
|
|
12
|
+
export function assign(obj, props) {
|
|
13
|
+
// @ts-expect-error We change the type of `obj` to be `O & P`
|
|
14
|
+
for (let i in props) obj[i] = props[i];
|
|
15
|
+
return /** @type {O & P} */ (obj);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Remove a child node from its parent if attached. This is a workaround for
|
|
20
|
+
* IE11 which doesn't support `Element.prototype.remove()`. Using this function
|
|
21
|
+
* is smaller than including a dedicated polyfill.
|
|
22
|
+
* @param {import('./index').ContainerNode} node The node to remove
|
|
23
|
+
*/
|
|
24
|
+
export function removeNode(node) {
|
|
25
|
+
if (node && node.parentNode) node.parentNode.removeChild(node);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const slice = EMPTY_ARR.slice;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var r=require("preact");function t(){return r.options.t=r.options.debounceRendering,r.options.debounceRendering=function(t){return r.options.o=t},function(){return r.options.o&&r.options.o()}}var n=function(r){return null!=r&&"function"==typeof r.then},o=0;function e(){r.options.o&&(r.options.o(),delete r.options.o),void 0!==r.options.t?(r.options.debounceRendering=r.options.t,delete r.options.t):r.options.debounceRendering=void 0}exports.act=function(u){if(++o>1){try{var i=u();if(n(i))return i.then(function(){--o},function(r){throw--o,r})}catch(r){throw--o,r}return--o,Promise.resolve()}var c,f=r.options.requestAnimationFrame,a=t(),h=[];r.options.requestAnimationFrame=function(r){return h.push(r)};var v,l,p=function(){try{for(a();h.length;)c=h,h=[],c.forEach(function(r){return r()}),a()}catch(r){v||(v=r)}finally{e()}r.options.requestAnimationFrame=f,--o};try{l=u()}catch(r){v=r}if(n(l))return l.then(p,function(r){throw p(),r});if(p(),v)throw v;return Promise.resolve()},exports.setupRerender=t,exports.teardown=e;
|
|
2
|
+
//# sourceMappingURL=testUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testUtils.js","sources":["../src/index.js"],"sourcesContent":["import { options } from 'preact';\n\n/**\n * Setup a rerender function that will drain the queue of pending renders\n * @returns {() => void}\n */\nexport function setupRerender() {\n\toptions.__test__previousDebounce = options.debounceRendering;\n\toptions.debounceRendering = cb => (options.__test__drainQueue = cb);\n\treturn () => options.__test__drainQueue && options.__test__drainQueue();\n}\n\nconst isThenable = value => value != null && typeof value.then == 'function';\n\n/** Depth of nested calls to `act`. */\nlet actDepth = 0;\n\n/**\n * Run a test function, and flush all effects and rerenders after invoking it.\n *\n * Returns a Promise which resolves \"immediately\" if the callback is\n * synchronous or when the callback's result resolves if it is asynchronous.\n *\n * @param {() => void|Promise<void>} cb The function under test. This may be sync or async.\n * @return {Promise<void>}\n */\nexport function act(cb) {\n\tif (++actDepth > 1) {\n\t\t// If calls to `act` are nested, a flush happens only when the\n\t\t// outermost call returns. In the inner call, we just execute the\n\t\t// callback and return since the infrastructure for flushing has already\n\t\t// been set up.\n\t\t//\n\t\t// If an exception occurs, the outermost `act` will handle cleanup.\n\t\ttry {\n\t\t\tconst result = cb();\n\t\t\tif (isThenable(result)) {\n\t\t\t\treturn result.then(\n\t\t\t\t\t() => {\n\t\t\t\t\t\t--actDepth;\n\t\t\t\t\t},\n\t\t\t\t\te => {\n\t\t\t\t\t\t--actDepth;\n\t\t\t\t\t\tthrow e;\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t} catch (e) {\n\t\t\t--actDepth;\n\t\t\tthrow e;\n\t\t}\n\t\t--actDepth;\n\t\treturn Promise.resolve();\n\t}\n\n\tconst previousRequestAnimationFrame = options.requestAnimationFrame;\n\tconst rerender = setupRerender();\n\n\t/** @type {() => void} */\n\tlet flushes = [], toFlush;\n\n\t// Override requestAnimationFrame so we can flush pending hooks.\n\toptions.requestAnimationFrame = fc => flushes.push(fc);\n\n\tconst finish = () => {\n\t\ttry {\n\t\t\trerender();\n\t\t\twhile (flushes.length) {\n\t\t\t\ttoFlush = flushes;\n\t\t\t\tflushes = [];\n\n\t\t\t\ttoFlush.forEach(x => x());\n\t\t\t\trerender();\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tif (!err) {\n\t\t\t\terr = e;\n\t\t\t}\n\t\t} finally {\n\t\t\tteardown();\n\t\t}\n\n\t\toptions.requestAnimationFrame = previousRequestAnimationFrame;\n\t\t--actDepth;\n\t};\n\n\tlet err;\n\tlet result;\n\n\ttry {\n\t\tresult = cb();\n\t} catch (e) {\n\t\terr = e;\n\t}\n\n\tif (isThenable(result)) {\n\t\treturn result.then(finish, err => {\n\t\t\tfinish();\n\t\t\tthrow err;\n\t\t});\n\t}\n\n\t// nb. If the callback is synchronous, effects must be flushed before\n\t// `act` returns, so that the caller does not have to await the result,\n\t// even though React recommends this.\n\tfinish();\n\tif (err) {\n\t\tthrow err;\n\t}\n\treturn Promise.resolve();\n}\n\n/**\n * Teardown test environment and reset preact's internal state\n */\nexport function teardown() {\n\tif (options.__test__drainQueue) {\n\t\t// Flush any pending updates leftover by test\n\t\toptions.__test__drainQueue();\n\t\tdelete options.__test__drainQueue;\n\t}\n\n\tif (typeof options.__test__previousDebounce != 'undefined') {\n\t\toptions.debounceRendering = options.__test__previousDebounce;\n\t\tdelete options.__test__previousDebounce;\n\t} else {\n\t\toptions.debounceRendering = undefined;\n\t}\n}\n"],"names":["setupRerender","options","__test__previousDebounce","debounceRendering","cb","__test__drainQueue","isThenable","value","then","actDepth","teardown","undefined","result","e","Promise","resolve","toFlush","previousRequestAnimationFrame","requestAnimationFrame","rerender","flushes","fc","push","err","finish","length","forEach","x"],"mappings":"wBAMgB,SAAAA,IAGf,OAFAC,UAAQC,EAA2BD,EAAOA,QAACE,kBAC3CF,UAAQE,kBAAoB,SAAAC,GAAE,OAAKH,EAAOA,QAACI,EAAqBD,CAAE,oBACrDH,UAAQI,GAAsBJ,EAAOA,QAACI,GAAoB,CACxE,CAEA,IAAMC,EAAa,SAAAC,UAAkB,MAATA,GAAsC,mBAAdA,EAAMC,IAAkB,EAGxEC,EAAW,EAoGC,SAAAC,IACXT,EAAOA,QAACI,IAEXJ,UAAQI,WACDJ,UAAQI,QAG+B,IAApCJ,UAAQC,GAClBD,EAAAA,QAAQE,kBAAoBF,UAAQC,SAC7BD,EAAAA,QAAQC,GAEfD,EAAAA,QAAQE,uBAAoBQ,CAE9B,aAtGO,SAAaP,GACnB,KAAMK,EAAW,EAAG,CAOnB,IACC,IAAMG,EAASR,IACf,GAAIE,EAAWM,GACd,OAAOA,EAAOJ,KACb,aACGC,CACH,EACA,SAAAI,GAEC,OADEJ,EACII,CACP,EAMH,CAHE,MAAOA,GAER,OADEJ,EACII,CACP,CAEA,QADEJ,EACKK,QAAQC,SAChB,CAEA,IAIkBC,EAJZC,EAAgChB,UAAQiB,sBACxCC,EAAWnB,IAGboB,EAAU,GAGdnB,UAAQiB,sBAAwB,SAAAG,GAAE,OAAID,EAAQE,KAAKD,EAAG,EAEtD,IAsBIE,EACAX,EAvBEY,EAAS,WACd,IAEC,IADAL,IACOC,EAAQK,QACdT,EAAUI,EACVA,EAAU,GAEVJ,EAAQU,QAAQ,SAAAC,UAAKA,GAAG,GACxBR,GAQF,CANE,MAAON,GACHU,IACJA,EAAMV,EAER,CAAC,QACAH,GACD,CAEAT,UAAQiB,sBAAwBD,IAC9BR,CACH,EAKA,IACCG,EAASR,GAGV,CAFE,MAAOS,GACRU,EAAMV,CACP,CAEA,GAAIP,EAAWM,GACd,OAAOA,EAAOJ,KAAKgB,EAAQ,SAAAD,GAE1B,MADAC,IACMD,CACP,GAOD,GADAC,IACID,EACH,MAAMA,EAEP,OAAOT,QAAQC,SAChB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{options as t}from"preact";function n(){return t.t=t.debounceRendering,t.debounceRendering=function(n){return t.o=n},function(){return t.o&&t.o()}}var r=function(t){return null!=t&&"function"==typeof t.then},o=0;function u(u){if(++o>1){try{var e=u();if(r(e))return e.then(function(){--o},function(t){throw--o,t})}catch(t){throw--o,t}return--o,Promise.resolve()}var f,c=t.requestAnimationFrame,a=n(),h=[];t.requestAnimationFrame=function(t){return h.push(t)};var l,v,y=function(){try{for(a();h.length;)f=h,h=[],f.forEach(function(t){return t()}),a()}catch(t){l||(l=t)}finally{i()}t.requestAnimationFrame=c,--o};try{v=u()}catch(t){l=t}if(r(v))return v.then(y,function(t){throw y(),t});if(y(),l)throw l;return Promise.resolve()}function i(){t.o&&(t.o(),delete t.o),void 0!==t.t?(t.debounceRendering=t.t,delete t.t):t.debounceRendering=void 0}export{u as act,n as setupRerender,i as teardown};
|
|
2
|
+
//# sourceMappingURL=testUtils.module.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{options as t}from"preact";function n(){return t.t=t.debounceRendering,t.debounceRendering=function(n){return t.o=n},function(){return t.o&&t.o()}}var r=function(t){return null!=t&&"function"==typeof t.then},o=0;function u(u){if(++o>1){try{var e=u();if(r(e))return e.then(function(){--o},function(t){throw--o,t})}catch(t){throw--o,t}return--o,Promise.resolve()}var f,c=t.requestAnimationFrame,a=n(),h=[];t.requestAnimationFrame=function(t){return h.push(t)};var l,v,y=function(){try{for(a();h.length;)f=h,h=[],f.forEach(function(t){return t()}),a()}catch(t){l||(l=t)}finally{i()}t.requestAnimationFrame=c,--o};try{v=u()}catch(t){l=t}if(r(v))return v.then(y,function(t){throw y(),t});if(y(),l)throw l;return Promise.resolve()}function i(){t.o&&(t.o(),delete t.o),void 0!==t.t?(t.debounceRendering=t.t,delete t.t):t.debounceRendering=void 0}export{u as act,n as setupRerender,i as teardown};
|
|
2
|
+
//# sourceMappingURL=testUtils.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testUtils.module.js","sources":["../src/index.js"],"sourcesContent":["import { options } from 'preact';\n\n/**\n * Setup a rerender function that will drain the queue of pending renders\n * @returns {() => void}\n */\nexport function setupRerender() {\n\toptions.__test__previousDebounce = options.debounceRendering;\n\toptions.debounceRendering = cb => (options.__test__drainQueue = cb);\n\treturn () => options.__test__drainQueue && options.__test__drainQueue();\n}\n\nconst isThenable = value => value != null && typeof value.then == 'function';\n\n/** Depth of nested calls to `act`. */\nlet actDepth = 0;\n\n/**\n * Run a test function, and flush all effects and rerenders after invoking it.\n *\n * Returns a Promise which resolves \"immediately\" if the callback is\n * synchronous or when the callback's result resolves if it is asynchronous.\n *\n * @param {() => void|Promise<void>} cb The function under test. This may be sync or async.\n * @return {Promise<void>}\n */\nexport function act(cb) {\n\tif (++actDepth > 1) {\n\t\t// If calls to `act` are nested, a flush happens only when the\n\t\t// outermost call returns. In the inner call, we just execute the\n\t\t// callback and return since the infrastructure for flushing has already\n\t\t// been set up.\n\t\t//\n\t\t// If an exception occurs, the outermost `act` will handle cleanup.\n\t\ttry {\n\t\t\tconst result = cb();\n\t\t\tif (isThenable(result)) {\n\t\t\t\treturn result.then(\n\t\t\t\t\t() => {\n\t\t\t\t\t\t--actDepth;\n\t\t\t\t\t},\n\t\t\t\t\te => {\n\t\t\t\t\t\t--actDepth;\n\t\t\t\t\t\tthrow e;\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t} catch (e) {\n\t\t\t--actDepth;\n\t\t\tthrow e;\n\t\t}\n\t\t--actDepth;\n\t\treturn Promise.resolve();\n\t}\n\n\tconst previousRequestAnimationFrame = options.requestAnimationFrame;\n\tconst rerender = setupRerender();\n\n\t/** @type {() => void} */\n\tlet flushes = [], toFlush;\n\n\t// Override requestAnimationFrame so we can flush pending hooks.\n\toptions.requestAnimationFrame = fc => flushes.push(fc);\n\n\tconst finish = () => {\n\t\ttry {\n\t\t\trerender();\n\t\t\twhile (flushes.length) {\n\t\t\t\ttoFlush = flushes;\n\t\t\t\tflushes = [];\n\n\t\t\t\ttoFlush.forEach(x => x());\n\t\t\t\trerender();\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tif (!err) {\n\t\t\t\terr = e;\n\t\t\t}\n\t\t} finally {\n\t\t\tteardown();\n\t\t}\n\n\t\toptions.requestAnimationFrame = previousRequestAnimationFrame;\n\t\t--actDepth;\n\t};\n\n\tlet err;\n\tlet result;\n\n\ttry {\n\t\tresult = cb();\n\t} catch (e) {\n\t\terr = e;\n\t}\n\n\tif (isThenable(result)) {\n\t\treturn result.then(finish, err => {\n\t\t\tfinish();\n\t\t\tthrow err;\n\t\t});\n\t}\n\n\t// nb. If the callback is synchronous, effects must be flushed before\n\t// `act` returns, so that the caller does not have to await the result,\n\t// even though React recommends this.\n\tfinish();\n\tif (err) {\n\t\tthrow err;\n\t}\n\treturn Promise.resolve();\n}\n\n/**\n * Teardown test environment and reset preact's internal state\n */\nexport function teardown() {\n\tif (options.__test__drainQueue) {\n\t\t// Flush any pending updates leftover by test\n\t\toptions.__test__drainQueue();\n\t\tdelete options.__test__drainQueue;\n\t}\n\n\tif (typeof options.__test__previousDebounce != 'undefined') {\n\t\toptions.debounceRendering = options.__test__previousDebounce;\n\t\tdelete options.__test__previousDebounce;\n\t} else {\n\t\toptions.debounceRendering = undefined;\n\t}\n}\n"],"names":["setupRerender","options","__test__previousDebounce","debounceRendering","cb","__test__drainQueue","isThenable","value","then","actDepth","act","result","e","Promise","resolve","toFlush","previousRequestAnimationFrame","requestAnimationFrame","rerender","flushes","fc","push","err","finish","length","forEach","x","teardown","undefined"],"mappings":"iCAMgB,SAAAA,IAGf,OAFAC,EAAQC,EAA2BD,EAAQE,kBAC3CF,EAAQE,kBAAoB,SAAAC,GAAE,OAAKH,EAAQI,EAAqBD,CAAE,oBACrDH,EAAQI,GAAsBJ,EAAQI,GAAoB,CACxE,CAEA,IAAMC,EAAa,SAAAC,UAAkB,MAATA,GAAsC,mBAAdA,EAAMC,IAAkB,EAGxEC,EAAW,EAWR,SAASC,EAAIN,GACnB,KAAMK,EAAW,EAAG,CAOnB,IACC,IAAME,EAASP,IACf,GAAIE,EAAWK,GACd,OAAOA,EAAOH,KACb,aACGC,CACH,EACA,SAAAG,GAEC,OADEH,EACIG,CACP,EAMH,CAHE,MAAOA,GAER,OADEH,EACIG,CACP,CAEA,QADEH,EACKI,QAAQC,SAChB,CAEA,IAIkBC,EAJZC,EAAgCf,EAAQgB,sBACxCC,EAAWlB,IAGbmB,EAAU,GAGdlB,EAAQgB,sBAAwB,SAAAG,GAAE,OAAID,EAAQE,KAAKD,EAAG,EAEtD,IAsBIE,EACAX,EAvBEY,EAAS,WACd,IAEC,IADAL,IACOC,EAAQK,QACdT,EAAUI,EACVA,EAAU,GAEVJ,EAAQU,QAAQ,SAAAC,UAAKA,GAAG,GACxBR,GAQF,CANE,MAAON,GACHU,IACJA,EAAMV,EAER,CAAC,QACAe,GACD,CAEA1B,EAAQgB,sBAAwBD,IAC9BP,CACH,EAKA,IACCE,EAASP,GAGV,CAFE,MAAOQ,GACRU,EAAMV,CACP,CAEA,GAAIN,EAAWK,GACd,OAAOA,EAAOH,KAAKe,EAAQ,SAAAD,GAE1B,MADAC,IACMD,CACP,GAOD,GADAC,IACID,EACH,MAAMA,EAEP,OAAOT,QAAQC,SAChB,CAKgB,SAAAa,IACX1B,EAAQI,IAEXJ,EAAQI,WACDJ,EAAQI,QAG+B,IAApCJ,EAAQC,GAClBD,EAAQE,kBAAoBF,EAAQC,SAC7BD,EAAQC,GAEfD,EAAQE,uBAAoByB,CAE9B"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("preact")):"function"==typeof define&&define.amd?define(["exports","preact"],t):t((n||self).preactTestUtils={},n.preact)}(this,function(n,t){function e(){return t.options.t=t.options.debounceRendering,t.options.debounceRendering=function(n){return t.options.o=n},function(){return t.options.o&&t.options.o()}}var r=function(n){return null!=n&&"function"==typeof n.then},o=0;function i(){t.options.o&&(t.options.o(),delete t.options.o),void 0!==t.options.t?(t.options.debounceRendering=t.options.t,delete t.options.t):t.options.debounceRendering=void 0}n.act=function(n){if(++o>1){try{var f=n();if(r(f))return f.then(function(){--o},function(n){throw--o,n})}catch(n){throw--o,n}return--o,Promise.resolve()}var u,c=t.options.requestAnimationFrame,a=e(),d=[];t.options.requestAnimationFrame=function(n){return d.push(n)};var l,h,p=function(){try{for(a();d.length;)u=d,d=[],u.forEach(function(n){return n()}),a()}catch(n){l||(l=n)}finally{i()}t.options.requestAnimationFrame=c,--o};try{h=n()}catch(n){l=n}if(r(h))return h.then(p,function(n){throw p(),n});if(p(),l)throw l;return Promise.resolve()},n.setupRerender=e,n.teardown=i});
|
|
2
|
+
//# sourceMappingURL=testUtils.umd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testUtils.umd.js","sources":["../src/index.js"],"sourcesContent":["import { options } from 'preact';\n\n/**\n * Setup a rerender function that will drain the queue of pending renders\n * @returns {() => void}\n */\nexport function setupRerender() {\n\toptions.__test__previousDebounce = options.debounceRendering;\n\toptions.debounceRendering = cb => (options.__test__drainQueue = cb);\n\treturn () => options.__test__drainQueue && options.__test__drainQueue();\n}\n\nconst isThenable = value => value != null && typeof value.then == 'function';\n\n/** Depth of nested calls to `act`. */\nlet actDepth = 0;\n\n/**\n * Run a test function, and flush all effects and rerenders after invoking it.\n *\n * Returns a Promise which resolves \"immediately\" if the callback is\n * synchronous or when the callback's result resolves if it is asynchronous.\n *\n * @param {() => void|Promise<void>} cb The function under test. This may be sync or async.\n * @return {Promise<void>}\n */\nexport function act(cb) {\n\tif (++actDepth > 1) {\n\t\t// If calls to `act` are nested, a flush happens only when the\n\t\t// outermost call returns. In the inner call, we just execute the\n\t\t// callback and return since the infrastructure for flushing has already\n\t\t// been set up.\n\t\t//\n\t\t// If an exception occurs, the outermost `act` will handle cleanup.\n\t\ttry {\n\t\t\tconst result = cb();\n\t\t\tif (isThenable(result)) {\n\t\t\t\treturn result.then(\n\t\t\t\t\t() => {\n\t\t\t\t\t\t--actDepth;\n\t\t\t\t\t},\n\t\t\t\t\te => {\n\t\t\t\t\t\t--actDepth;\n\t\t\t\t\t\tthrow e;\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t} catch (e) {\n\t\t\t--actDepth;\n\t\t\tthrow e;\n\t\t}\n\t\t--actDepth;\n\t\treturn Promise.resolve();\n\t}\n\n\tconst previousRequestAnimationFrame = options.requestAnimationFrame;\n\tconst rerender = setupRerender();\n\n\t/** @type {() => void} */\n\tlet flushes = [], toFlush;\n\n\t// Override requestAnimationFrame so we can flush pending hooks.\n\toptions.requestAnimationFrame = fc => flushes.push(fc);\n\n\tconst finish = () => {\n\t\ttry {\n\t\t\trerender();\n\t\t\twhile (flushes.length) {\n\t\t\t\ttoFlush = flushes;\n\t\t\t\tflushes = [];\n\n\t\t\t\ttoFlush.forEach(x => x());\n\t\t\t\trerender();\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tif (!err) {\n\t\t\t\terr = e;\n\t\t\t}\n\t\t} finally {\n\t\t\tteardown();\n\t\t}\n\n\t\toptions.requestAnimationFrame = previousRequestAnimationFrame;\n\t\t--actDepth;\n\t};\n\n\tlet err;\n\tlet result;\n\n\ttry {\n\t\tresult = cb();\n\t} catch (e) {\n\t\terr = e;\n\t}\n\n\tif (isThenable(result)) {\n\t\treturn result.then(finish, err => {\n\t\t\tfinish();\n\t\t\tthrow err;\n\t\t});\n\t}\n\n\t// nb. If the callback is synchronous, effects must be flushed before\n\t// `act` returns, so that the caller does not have to await the result,\n\t// even though React recommends this.\n\tfinish();\n\tif (err) {\n\t\tthrow err;\n\t}\n\treturn Promise.resolve();\n}\n\n/**\n * Teardown test environment and reset preact's internal state\n */\nexport function teardown() {\n\tif (options.__test__drainQueue) {\n\t\t// Flush any pending updates leftover by test\n\t\toptions.__test__drainQueue();\n\t\tdelete options.__test__drainQueue;\n\t}\n\n\tif (typeof options.__test__previousDebounce != 'undefined') {\n\t\toptions.debounceRendering = options.__test__previousDebounce;\n\t\tdelete options.__test__previousDebounce;\n\t} else {\n\t\toptions.debounceRendering = undefined;\n\t}\n}\n"],"names":["setupRerender","options","__test__previousDebounce","debounceRendering","cb","__test__drainQueue","isThenable","value","then","actDepth","teardown","undefined","result","e","Promise","resolve","toFlush","previousRequestAnimationFrame","requestAnimationFrame","rerender","flushes","fc","push","err","finish","length","forEach","x"],"mappings":"+QAMgB,SAAAA,IAGf,OAFAC,UAAQC,EAA2BD,EAAOA,QAACE,kBAC3CF,UAAQE,kBAAoB,SAAAC,GAAE,OAAKH,EAAOA,QAACI,EAAqBD,CAAE,oBACrDH,UAAQI,GAAsBJ,EAAOA,QAACI,GAAoB,CACxE,CAEA,IAAMC,EAAa,SAAAC,UAAkB,MAATA,GAAsC,mBAAdA,EAAMC,IAAkB,EAGxEC,EAAW,EAoGC,SAAAC,IACXT,EAAOA,QAACI,IAEXJ,UAAQI,WACDJ,UAAQI,QAG+B,IAApCJ,UAAQC,GAClBD,EAAAA,QAAQE,kBAAoBF,UAAQC,SAC7BD,EAAAA,QAAQC,GAEfD,EAAAA,QAAQE,uBAAoBQ,CAE9B,OAtGO,SAAaP,GACnB,KAAMK,EAAW,EAAG,CAOnB,IACC,IAAMG,EAASR,IACf,GAAIE,EAAWM,GACd,OAAOA,EAAOJ,KACb,aACGC,CACH,EACA,SAAAI,GAEC,OADEJ,EACII,CACP,EAMH,CAHE,MAAOA,GAER,OADEJ,EACII,CACP,CAEA,QADEJ,EACKK,QAAQC,SAChB,CAEA,IAIkBC,EAJZC,EAAgChB,UAAQiB,sBACxCC,EAAWnB,IAGboB,EAAU,GAGdnB,UAAQiB,sBAAwB,SAAAG,GAAE,OAAID,EAAQE,KAAKD,EAAG,EAEtD,IAsBIE,EACAX,EAvBEY,EAAS,WACd,IAEC,IADAL,IACOC,EAAQK,QACdT,EAAUI,EACVA,EAAU,GAEVJ,EAAQU,QAAQ,SAAAC,UAAKA,GAAG,GACxBR,GAQF,CANE,MAAON,GACHU,IACJA,EAAMV,EAER,CAAC,QACAH,GACD,CAEAT,UAAQiB,sBAAwBD,IAC9BR,CACH,EAKA,IACCG,EAASR,GAGV,CAFE,MAAOS,GACRU,EAAMV,CACP,CAEA,GAAIP,EAAWM,GACd,OAAOA,EAAOJ,KAAKgB,EAAQ,SAAAD,GAE1B,MADAC,IACMD,CACP,GAOD,GADAC,IACID,EACH,MAAMA,EAEP,OAAOT,QAAQC,SAChB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "test-utils",
|
|
3
|
+
"amdName": "preactTestUtils",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"private": true,
|
|
6
|
+
"description": "Test-utils for Preact",
|
|
7
|
+
"main": "dist/testUtils.js",
|
|
8
|
+
"module": "dist/testUtils.module.js",
|
|
9
|
+
"umd:main": "dist/testUtils.umd.js",
|
|
10
|
+
"source": "src/index.js",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"types": "src/index.d.ts",
|
|
13
|
+
"peerDependencies": {
|
|
14
|
+
"preact": "^10.0.0"
|
|
15
|
+
},
|
|
16
|
+
"mangle": {
|
|
17
|
+
"regex": "^_"
|
|
18
|
+
},
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./src/index.d.ts",
|
|
22
|
+
"browser": "./dist/testUtils.module.js",
|
|
23
|
+
"umd": "./dist/testUtils.umd.js",
|
|
24
|
+
"import": "./dist/testUtils.mjs",
|
|
25
|
+
"require": "./dist/testUtils.js"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { options } from 'preact';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Setup a rerender function that will drain the queue of pending renders
|
|
5
|
+
* @returns {() => void}
|
|
6
|
+
*/
|
|
7
|
+
export function setupRerender() {
|
|
8
|
+
options.__test__previousDebounce = options.debounceRendering;
|
|
9
|
+
options.debounceRendering = cb => (options.__test__drainQueue = cb);
|
|
10
|
+
return () => options.__test__drainQueue && options.__test__drainQueue();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const isThenable = value => value != null && typeof value.then == 'function';
|
|
14
|
+
|
|
15
|
+
/** Depth of nested calls to `act`. */
|
|
16
|
+
let actDepth = 0;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Run a test function, and flush all effects and rerenders after invoking it.
|
|
20
|
+
*
|
|
21
|
+
* Returns a Promise which resolves "immediately" if the callback is
|
|
22
|
+
* synchronous or when the callback's result resolves if it is asynchronous.
|
|
23
|
+
*
|
|
24
|
+
* @param {() => void|Promise<void>} cb The function under test. This may be sync or async.
|
|
25
|
+
* @return {Promise<void>}
|
|
26
|
+
*/
|
|
27
|
+
export function act(cb) {
|
|
28
|
+
if (++actDepth > 1) {
|
|
29
|
+
// If calls to `act` are nested, a flush happens only when the
|
|
30
|
+
// outermost call returns. In the inner call, we just execute the
|
|
31
|
+
// callback and return since the infrastructure for flushing has already
|
|
32
|
+
// been set up.
|
|
33
|
+
//
|
|
34
|
+
// If an exception occurs, the outermost `act` will handle cleanup.
|
|
35
|
+
try {
|
|
36
|
+
const result = cb();
|
|
37
|
+
if (isThenable(result)) {
|
|
38
|
+
return result.then(
|
|
39
|
+
() => {
|
|
40
|
+
--actDepth;
|
|
41
|
+
},
|
|
42
|
+
e => {
|
|
43
|
+
--actDepth;
|
|
44
|
+
throw e;
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
} catch (e) {
|
|
49
|
+
--actDepth;
|
|
50
|
+
throw e;
|
|
51
|
+
}
|
|
52
|
+
--actDepth;
|
|
53
|
+
return Promise.resolve();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const previousRequestAnimationFrame = options.requestAnimationFrame;
|
|
57
|
+
const rerender = setupRerender();
|
|
58
|
+
|
|
59
|
+
/** @type {() => void} */
|
|
60
|
+
let flushes = [], toFlush;
|
|
61
|
+
|
|
62
|
+
// Override requestAnimationFrame so we can flush pending hooks.
|
|
63
|
+
options.requestAnimationFrame = fc => flushes.push(fc);
|
|
64
|
+
|
|
65
|
+
const finish = () => {
|
|
66
|
+
try {
|
|
67
|
+
rerender();
|
|
68
|
+
while (flushes.length) {
|
|
69
|
+
toFlush = flushes;
|
|
70
|
+
flushes = [];
|
|
71
|
+
|
|
72
|
+
toFlush.forEach(x => x());
|
|
73
|
+
rerender();
|
|
74
|
+
}
|
|
75
|
+
} catch (e) {
|
|
76
|
+
if (!err) {
|
|
77
|
+
err = e;
|
|
78
|
+
}
|
|
79
|
+
} finally {
|
|
80
|
+
teardown();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
options.requestAnimationFrame = previousRequestAnimationFrame;
|
|
84
|
+
--actDepth;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
let err;
|
|
88
|
+
let result;
|
|
89
|
+
|
|
90
|
+
try {
|
|
91
|
+
result = cb();
|
|
92
|
+
} catch (e) {
|
|
93
|
+
err = e;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (isThenable(result)) {
|
|
97
|
+
return result.then(finish, err => {
|
|
98
|
+
finish();
|
|
99
|
+
throw err;
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// nb. If the callback is synchronous, effects must be flushed before
|
|
104
|
+
// `act` returns, so that the caller does not have to await the result,
|
|
105
|
+
// even though React recommends this.
|
|
106
|
+
finish();
|
|
107
|
+
if (err) {
|
|
108
|
+
throw err;
|
|
109
|
+
}
|
|
110
|
+
return Promise.resolve();
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Teardown test environment and reset preact's internal state
|
|
115
|
+
*/
|
|
116
|
+
export function teardown() {
|
|
117
|
+
if (options.__test__drainQueue) {
|
|
118
|
+
// Flush any pending updates leftover by test
|
|
119
|
+
options.__test__drainQueue();
|
|
120
|
+
delete options.__test__drainQueue;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (typeof options.__test__previousDebounce != 'undefined') {
|
|
124
|
+
options.debounceRendering = options.__test__previousDebounce;
|
|
125
|
+
delete options.__test__previousDebounce;
|
|
126
|
+
} else {
|
|
127
|
+
options.debounceRendering = undefined;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015 Jason Miller
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# preact-render-to-string
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/preact-render-to-string)
|
|
4
|
+
[](https://github.com/preactjs/preact-render-to-string/actions/workflows/ci.yml)
|
|
5
|
+
|
|
6
|
+
Render JSX and [Preact](https://github.com/preactjs/preact) components to an HTML string.
|
|
7
|
+
|
|
8
|
+
Works in Node & the browser, making it useful for universal/isomorphic rendering.
|
|
9
|
+
|
|
10
|
+
\>\> **[Cute Fox-Related Demo](http://codepen.io/developit/pen/dYZqjE?editors=001)** _(@ CodePen)_ <<
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
### Render JSX/VDOM to HTML
|
|
15
|
+
|
|
16
|
+
```js
|
|
17
|
+
import { render } from 'preact-render-to-string';
|
|
18
|
+
import { h } from 'preact';
|
|
19
|
+
/** @jsx h */
|
|
20
|
+
|
|
21
|
+
let vdom = <div class="foo">content</div>;
|
|
22
|
+
|
|
23
|
+
let html = render(vdom);
|
|
24
|
+
console.log(html);
|
|
25
|
+
// <div class="foo">content</div>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Render Preact Components to HTML
|
|
29
|
+
|
|
30
|
+
```js
|
|
31
|
+
import { render } from 'preact-render-to-string';
|
|
32
|
+
import { h, Component } from 'preact';
|
|
33
|
+
/** @jsx h */
|
|
34
|
+
|
|
35
|
+
// Classical components work
|
|
36
|
+
class Fox extends Component {
|
|
37
|
+
render({ name }) {
|
|
38
|
+
return <span class="fox">{name}</span>;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// ... and so do pure functional components:
|
|
43
|
+
const Box = ({ type, children }) => (
|
|
44
|
+
<div class={`box box-${type}`}>{children}</div>
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
let html = render(
|
|
48
|
+
<Box type="open">
|
|
49
|
+
<Fox name="Finn" />
|
|
50
|
+
</Box>
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
console.log(html);
|
|
54
|
+
// <div class="box box-open"><span class="fox">Finn</span></div>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
### Render JSX / Preact / Whatever via Express!
|
|
60
|
+
|
|
61
|
+
```js
|
|
62
|
+
import express from 'express';
|
|
63
|
+
import { h } from 'preact';
|
|
64
|
+
import { render } from 'preact-render-to-string';
|
|
65
|
+
/** @jsx h */
|
|
66
|
+
|
|
67
|
+
// silly example component:
|
|
68
|
+
const Fox = ({ name }) => (
|
|
69
|
+
<div class="fox">
|
|
70
|
+
<h5>{name}</h5>
|
|
71
|
+
<p>This page is all about {name}.</p>
|
|
72
|
+
</div>
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
// basic HTTP server via express:
|
|
76
|
+
const app = express();
|
|
77
|
+
app.listen(8080);
|
|
78
|
+
|
|
79
|
+
// on each request, render and return a component:
|
|
80
|
+
app.get('/:fox', (req, res) => {
|
|
81
|
+
let html = render(<Fox name={req.params.fox} />);
|
|
82
|
+
// send it back wrapped up as an HTML5 document:
|
|
83
|
+
res.send(`<!DOCTYPE html><html><body>${html}</body></html>`);
|
|
84
|
+
});
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Error Boundaries
|
|
88
|
+
|
|
89
|
+
Rendering errors can be caught by Preact via `getDerivedStateFromErrors` or `componentDidCatch`. To enable that feature in `preact-render-to-string` set `errorBoundaries = true`
|
|
90
|
+
|
|
91
|
+
```js
|
|
92
|
+
import { options } from 'preact';
|
|
93
|
+
|
|
94
|
+
// Enable error boundaries in `preact-render-to-string`
|
|
95
|
+
options.errorBoundaries = true;
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
### `Suspense` & `lazy` components with [`preact/compat`](https://www.npmjs.com/package/preact)
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
npm install preact preact-render-to-string
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
```jsx
|
|
107
|
+
export default () => {
|
|
108
|
+
return <h1>Home page</h1>;
|
|
109
|
+
};
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
```jsx
|
|
113
|
+
import { Suspense, lazy } from 'preact/compat';
|
|
114
|
+
|
|
115
|
+
// Creation of the lazy component
|
|
116
|
+
const HomePage = lazy(() => import('./pages/home'));
|
|
117
|
+
|
|
118
|
+
const Main = () => {
|
|
119
|
+
return (
|
|
120
|
+
<Suspense fallback={<p>Loading</p>}>
|
|
121
|
+
<HomePage />
|
|
122
|
+
</Suspense>
|
|
123
|
+
);
|
|
124
|
+
};
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
```jsx
|
|
128
|
+
import { renderToStringAsync } from 'preact-render-to-string';
|
|
129
|
+
import { Main } from './main';
|
|
130
|
+
|
|
131
|
+
const main = async () => {
|
|
132
|
+
// Rendering of lazy components
|
|
133
|
+
const html = await renderToStringAsync(<Main />);
|
|
134
|
+
|
|
135
|
+
console.log(html);
|
|
136
|
+
// <h1>Home page</h1>
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
// Execution & error handling
|
|
140
|
+
main().catch((error) => {
|
|
141
|
+
console.error(error);
|
|
142
|
+
});
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
### License
|
|
148
|
+
|
|
149
|
+
[MIT](http://choosealicense.com/licenses/mit/)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e=require("preact"),t="diffed",n="__c",r="__s",o="__c",i="__k",a="__d",s="__s",c=/[\s\n\\/='"\0<>]/,u=/^(xlink|xmlns|xml)([A-Z])/,l=/^(?:accessK|auto[A-Z]|cell|ch|col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|popoverT|readO|rowS|src[A-Z]|tabI|useM|item[A-Z])/,p=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,f=new Set(["draggable","spellcheck"]);function h(e){void 0!==e.__g?e.__g|=8:e[a]=!0}function d(e){void 0!==e.__g?e.__g&=-9:e[a]=!1}function v(e){return void 0!==e.__g?!!(8&e.__g):!0===e[a]}var g=/["&<]/;function m(e){if(0===e.length||!1===g.test(e))return e;for(var t=0,n=0,r="",o="";n<e.length;n++){switch(e.charCodeAt(n)){case 34:o=""";break;case 38:o="&";break;case 60:o="<";break;default:continue}n!==t&&(r+=e.slice(t,n)),r+=o,t=n+1}return n!==t&&(r+=e.slice(t,n)),r}var y={},_=new Set(["animation-iteration-count","border-image-outset","border-image-slice","border-image-width","box-flex","box-flex-group","box-ordinal-group","column-count","fill-opacity","flex","flex-grow","flex-negative","flex-order","flex-positive","flex-shrink","flood-opacity","font-weight","grid-column","grid-row","line-clamp","line-height","opacity","order","orphans","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","widows","z-index","zoom"]),b=/[A-Z]/g;function x(e){var t="";for(var n in e){var r=e[n];if(null!=r&&""!==r){var o="-"==n[0]?n:y[n]||(y[n]=n.replace(b,"-$&").toLowerCase()),i=";";"number"!=typeof r||o.startsWith("--")||_.has(o)||(i="px;"),t=t+o+":"+r+i}}return t||void 0}function k(){this.__d=!0}function w(e,t){return{__v:e,context:t,props:e.props,setState:k,forceUpdate:k,__d:!0,__h:new Array(0)}}function C(e,t,n){if(!e.s){if(n instanceof S){if(!n.s)return void(n.o=C.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(C.bind(null,e,t),C.bind(null,e,2));e.s=t,e.v=n;const r=e.o;r&&r(e)}}var S=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){var r=new e,o=this.s;if(o){var i=1&o?t:n;if(i){try{C(r,1,i(this.v))}catch(e){C(r,2,e)}return r}return this}return this.o=function(e){try{var o=e.v;1&e.s?C(r,1,t?t(o):o):n?C(r,1,n(o)):C(r,2,o)}catch(e){C(r,2,e)}},r},e}();function A(e){return e instanceof S&&1&e.s}function F(e,t,n){for(var r;;){var o=e();if(A(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!A(i)){r=1;break}i=i.s}if(t){var a=t();if(a&&a.then&&!A(a)){r=2;break}}}var s=new S,c=C.bind(null,s,2);return(0===r?o.then(l):1===r?i.then(u):a.then(p)).then(void 0,c),s;function u(r){i=r;do{if(t&&(a=t())&&a.then&&!A(a))return void a.then(p).then(void 0,c);if(!(o=e())||A(o)&&!o.v)return void C(s,1,i);if(o.then)return void o.then(l).then(void 0,c);A(i=n())&&(i=i.v)}while(!i||!i.then);i.then(u).then(void 0,c)}function l(e){e?(i=n())&&i.then?i.then(u).then(void 0,c):u(i):C(s,1,i)}function p(){(o=e())?o.then?o.then(l).then(void 0,c):l(o):C(s,1,i)}}function L(e,t){try{var n=e()}catch(e){return t(!0,e)}return n&&n.then?n.then(t.bind(null,!1),t.bind(null,!0)):t(!1,n)}var T,E,j,D,P={},$=[],M=Array.isArray,U=Object.assign,Z="",W="\x3c!--$s--\x3e",q="\x3c!--/$s--\x3e";function z(o,a,s){var c=e.options[r];e.options[r]=!0,T=e.options.__b,E=e.options[t],j=e.options.__r,D=e.options.unmount;var u=e.h(e.Fragment,null);u[i]=[o];try{var l=N(o,a||P,!1,void 0,u,!1,s);return M(l)?l.join(Z):l}catch(e){if(e.then)throw new Error('Use "renderToStringAsync" for suspenseful rendering.');throw e}finally{e.options[n]&&e.options[n](o,$),e.options[r]=c,$.length=0}}function H(e,t){var n,r=e.type,i=!0;return e[o]?(i=!1,(n=e[o]).state=n[s]):n=new r(e.props,t),e[o]=n,n.__v=e,n.props=e.props,n.context=t,h(n),null==n.state&&(n.state=P),null==n[s]&&(n[s]=n.state),r.getDerivedStateFromProps?n.state=U({},n.state,r.getDerivedStateFromProps(n.props,n.state)):i&&n.componentWillMount?(n.componentWillMount(),n.state=n[s]!==n.state?n[s]:n.state):!i&&n.componentWillUpdate&&n.componentWillUpdate(),j&&j(e),n.render(n.props,n.state,t)}function N(t,n,r,a,g,y,_){if(null==t||!0===t||!1===t||t===Z)return Z;var b=typeof t;if("object"!=b)return"function"==b?Z:"string"==b?m(t):t+Z;if(M(t)){var k,C=Z;g[i]=t;for(var S=t.length,A=0;A<S;A++){var F=t[A];if(null!=F&&"boolean"!=typeof F){var L,$=N(F,n,r,a,g,y,_);"string"==typeof $?C+=$:(k||(k=new Array(S)),C&&k.push(C),C=Z,M($)?(L=k).push.apply(L,$):k.push($))}}return k?(C&&k.push(C),k):C}if(void 0!==t.constructor)return Z;t.__=g,T&&T(t);var z=t.type,I=t.props;if("function"==typeof z){var O,V,K,G=n;if(z===e.Fragment){if("tpl"in I){for(var J=Z,Q=0;Q<I.tpl.length;Q++)if(J+=I.tpl[Q],I.exprs&&Q<I.exprs.length){var X=I.exprs[Q];if(null==X)continue;"object"!=typeof X||void 0!==X.constructor&&!M(X)?J+=X:J+=N(X,n,r,a,t,y,_)}return J}if("UNSTABLE_comment"in I)return"\x3c!--"+m(I.UNSTABLE_comment)+"--\x3e";V=I.children}else{if(null!=(O=z.contextType)){var Y=n[O.__c];G=Y?Y.props.value:O.__}var ee=z.prototype&&"function"==typeof z.prototype.render;if(ee)V=/**#__NOINLINE__**/H(t,G),K=t[o];else{t[o]=K=/**#__NOINLINE__**/w(t,G);for(var te=0;v(K)&&te++<25;){d(K),j&&j(t);try{V=z.call(K,I,G)}catch(e){throw y&&e&&"function"==typeof e.then&&(t._suspended=!0),e}}h(K)}if(null!=K.getChildContext&&(n=U({},n,K.getChildContext())),ee&&e.options.errorBoundaries&&(z.getDerivedStateFromError||K.componentDidCatch)){V=null!=V&&V.type===e.Fragment&&null==V.key&&null==V.props.tpl?V.props.children:V;try{return N(V,n,r,a,t,y,!1)}catch(i){return z.getDerivedStateFromError&&(K[s]=z.getDerivedStateFromError(i)),K.componentDidCatch&&K.componentDidCatch(i,P),v(K)?(V=H(t,n),null!=(K=t[o]).getChildContext&&(n=U({},n,K.getChildContext())),N(V=null!=V&&V.type===e.Fragment&&null==V.key&&null==V.props.tpl?V.props.children:V,n,r,a,t,y,_)):Z}finally{E&&E(t),D&&D(t)}}}V=null!=V&&V.type===e.Fragment&&null==V.key&&null==V.props.tpl?V.props.children:V;try{var ne=N(V,n,r,a,t,y,_);return E&&E(t),e.options.unmount&&e.options.unmount(t),t._suspended?"string"==typeof ne?W+ne+q:M(ne)?(ne.unshift(W),ne.push(q),ne):ne.then(function(e){return W+e+q}):ne}catch(o){if(!y&&_&&_.onError){var re=function e(o){return _.onError(o,t,function(t,o){try{return N(t,n,r,a,o,y,_)}catch(t){return e(t)}})}(o);if(void 0!==re)return re;var oe=e.options.__e;return oe&&oe(o,t),Z}if(!y)throw o;if(!o||"function"!=typeof o.then)throw o;return o.then(function e(){try{var o=N(V,n,r,a,t,y,_);return t._suspended?W+o+q:o}catch(t){if(!t||"function"!=typeof t.then)throw t;return t.then(e)}})}}var ie,ae="<"+z,se=Z;for(var ce in I){var ue=I[ce];if("function"!=typeof(ue=R(ue)?ue.value:ue)||"class"===ce||"className"===ce){switch(ce){case"children":ie=ue;continue;case"key":case"ref":case"__self":case"__source":continue;case"htmlFor":if("for"in I)continue;ce="for";break;case"className":if("class"in I)continue;ce="class";break;case"defaultChecked":ce="checked";break;case"defaultSelected":ce="selected";break;case"defaultValue":case"value":switch(ce="value",z){case"textarea":ie=ue;continue;case"select":a=ue;continue;case"option":a!=ue||"selected"in I||(ae+=" selected")}break;case"dangerouslySetInnerHTML":se=ue&&ue.__html;continue;case"style":"object"==typeof ue&&(ue=x(ue));break;case"acceptCharset":ce="accept-charset";break;case"httpEquiv":ce="http-equiv";break;default:if(u.test(ce))ce=ce.replace(u,"$1:$2").toLowerCase();else{if(c.test(ce))continue;"-"!==ce[4]&&!f.has(ce)||null==ue?r?p.test(ce)&&(ce="panose1"===ce?"panose-1":ce.replace(/([A-Z])/g,"-$1").toLowerCase()):l.test(ce)&&(ce=ce.toLowerCase()):ue+=Z}}null!=ue&&!1!==ue&&(ae=!0===ue||ue===Z?ae+" "+ce:ae+" "+ce+'="'+("string"==typeof ue?m(ue):ue+Z)+'"')}}if(c.test(z))throw new Error(z+" is not a valid HTML tag name in "+ae+">");if(se||("string"==typeof ie?se=m(ie):null!=ie&&!1!==ie&&!0!==ie&&(se=N(ie,n,"svg"===z||"foreignObject"!==z&&r,a,t,y,_))),E&&E(t),D&&D(t),!se&&B.has(z))return ae+"/>";var le="</"+z+">",pe=ae+">";return M(se)?[pe].concat(se,[le]):"string"!=typeof se?[pe,se,le]:pe+se+le}var B=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),I=z,O=z;function R(e){return null!==e&&"object"==typeof e&&"function"==typeof e.peek&&"value"in e}exports.default=z,exports.render=I,exports.renderToStaticMarkup=O,exports.renderToString=z,exports.renderToStringAsync=function(o,a){try{var s=e.options[r];e.options[r]=!0,T=e.options.__b,E=e.options[t],j=e.options.__r,D=e.options.unmount;var c=e.h(e.Fragment,null);return c[i]=[o],Promise.resolve(L(function(){return Promise.resolve(N(o,a||P,!1,void 0,c,!0,void 0)).then(function(e){var t,n=function(){if(M(e)){var n=function(){var e=o.join(Z);return t=1,e},r=0,o=e,i=F(function(){return!!o.some(function(e){return e&&"function"==typeof e.then})&&r++<25},void 0,function(){return Promise.resolve(Promise.all(o)).then(function(e){o=e.flat()})});return i&&i.then?i.then(n):n()}}();return n&&n.then?n.then(function(n){return t?n:e}):t?n:e})},function(t,i){if(e.options[n]&&e.options[n](o,$),e.options[r]=s,$.length=0,t)throw i;return i}))}catch(e){return Promise.reject(e)}};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { VNode } from 'preact';
|
|
2
|
+
|
|
3
|
+
export default function renderToString<P = {}>(
|
|
4
|
+
vnode: VNode<P>,
|
|
5
|
+
context?: any
|
|
6
|
+
): string;
|
|
7
|
+
|
|
8
|
+
export function render<P = {}>(vnode: VNode<P>, context?: any): string;
|
|
9
|
+
export function renderToString<P = {}>(vnode: VNode<P>, context?: any): string;
|
|
10
|
+
export function renderToStringAsync<P = {}>(
|
|
11
|
+
vnode: VNode<P>,
|
|
12
|
+
context?: any
|
|
13
|
+
): string | Promise<string>;
|
|
14
|
+
export function renderToStaticMarkup<P = {}>(
|
|
15
|
+
vnode: VNode<P>,
|
|
16
|
+
context?: any
|
|
17
|
+
): string;
|