@revealui/core 0.0.1-pre.1 → 0.0.1-pre.3
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/dist/exports/bin-entry.js +15 -1
- package/dist/node/cli/index.js +18 -0
- package/package.json +2 -2
- package/dist/core/__internal/index.ts +0 -63
- package/dist/core/__tests__/assertNoInfiniteHttpRedirect.spec.ts +0 -76
- package/dist/core/__tests__/deduceRouteStringFromFilesystemPath.spec.ts +0 -88
- package/dist/core/__tests__/freezePartial.spec.ts +0 -40
- package/dist/core/__tests__/getValuePrintable.spec.ts +0 -15
- package/dist/core/__tests__/injectHtmlTags.spec.ts +0 -101
- package/dist/core/__tests__/isHtml.spec.ts +0 -23
- package/dist/core/__tests__/isNpmPackage.spec.ts +0 -93
- package/dist/core/__tests__/normalizeHeaders.spec.ts +0 -142
- package/dist/core/__tests__/parseUrl-extras.spec.ts +0 -60
- package/dist/core/__tests__/parseUrl.spec.ts +0 -1339
- package/dist/core/__tests__/resolvePrecedence/resolvePrecedence_overall.spec.ts +0 -106
- package/dist/core/__tests__/resolvePrecedence/resolvePrecedence_route-strings.spec.ts +0 -99
- package/dist/core/__tests__/resolveRedirects.spec.ts +0 -132
- package/dist/core/__tests__/resolveRouteString.spec.ts +0 -211
- package/dist/core/__tests__/resolveUrlPathname.spec.ts +0 -22
- package/dist/core/__tests__/trimWithAnsi.spec.ts +0 -40
- package/dist/core/api/ssr.ts +0 -63
- package/dist/core/assets/extractAssetsQuery.ts +0 -29
- package/dist/core/assets/index.ts +0 -173
- package/dist/core/assets/inferHtmlTags.ts +0 -61
- package/dist/core/assets/injectHtmlTags.ts +0 -236
- package/dist/core/assets/mergeScriptTags.ts +0 -77
- package/dist/core/assets/sanitizeJson.ts +0 -8
- package/dist/core/cli/bin.ts +0 -161
- package/dist/core/cli/commands/add.ts +0 -158
- package/dist/core/cli/commands/check.ts +0 -47
- package/dist/core/cli/commands/doctor/checks/build.ts +0 -83
- package/dist/core/cli/commands/doctor/checks/config.ts +0 -130
- package/dist/core/cli/commands/doctor/checks/dependencies.ts +0 -144
- package/dist/core/cli/commands/doctor/checks/practices.ts +0 -156
- package/dist/core/cli/commands/doctor/checks/structure.ts +0 -127
- package/dist/core/cli/commands/doctor/fixes/index.ts +0 -136
- package/dist/core/cli/commands/doctor/index.ts +0 -47
- package/dist/core/cli/commands/doctor/print.ts +0 -44
- package/dist/core/cli/commands/doctor/types.ts +0 -16
- package/dist/core/cli/commands/fix.ts +0 -161
- package/dist/core/cli/commands/init.ts +0 -145
- package/dist/core/cli/commands/upgrade.ts +0 -115
- package/dist/core/cli/onLoad.ts +0 -7
- package/dist/core/cli/utils.ts +0 -6
- package/dist/core/components/Config/Config-client.ts +0 -14
- package/dist/core/components/Config/Config-server.ts +0 -16
- package/dist/core/components/Head/Head-client.ts +0 -4
- package/dist/core/components/Head/Head-server.ts +0 -16
- package/dist/core/components/Loading.tsx +0 -23
- package/dist/core/config/findPageConfig.ts +0 -14
- package/dist/core/config/loadConfigValues.ts +0 -28
- package/dist/core/constants/UnifiedConstants.ts +0 -348
- package/dist/core/dom/applyHeadSettings.tsx +0 -13
- package/dist/core/dom/onPageVisibilityChange.ts +0 -17
- package/dist/core/dom/updateDocumentHead.ts +0 -15
- package/dist/core/errors/ErrorHandler.ts +0 -480
- package/dist/core/files/file-system/filesystemPath.ts +0 -27
- package/dist/core/files/file-system/findFile.ts +0 -35
- package/dist/core/files/file-system/findPackageJson.ts +0 -19
- package/dist/core/files/file-system/findPageFiles.ts +0 -40
- package/dist/core/files/file-system/pathShim.ts +0 -16
- package/dist/core/files/file-system/prependEntriesDir.ts +0 -13
- package/dist/core/files/file-system/removeFileExtention.ts +0 -3
- package/dist/core/files/file-system/requireResolve.ts +0 -59
- package/dist/core/files/file-system/scanCodebase.ts +0 -64
- package/dist/core/files/virtual-files/index.ts +0 -31
- package/dist/core/files/virtual-files/virtualFileImportUserCode.ts +0 -34
- package/dist/core/files/virtual-files/virtualFilePageConfigValuesAll.ts +0 -49
- package/dist/core/gaurds/assertions/assert/base.ts +0 -6
- package/dist/core/gaurds/assertions/assert/index.ts +0 -2
- package/dist/core/gaurds/assertions/assert/log.ts +0 -42
- package/dist/core/gaurds/assertions/assertArguments.ts +0 -83
- package/dist/core/gaurds/assertions/assertCast.ts +0 -9
- package/dist/core/gaurds/assertions/assertCommonJS/base.ts +0 -9
- package/dist/core/gaurds/assertions/assertCommonJS/common.ts +0 -30
- package/dist/core/gaurds/assertions/assertCommonJS/index.ts +0 -2
- package/dist/core/gaurds/assertions/assertExtensions/base.ts +0 -187
- package/dist/core/gaurds/assertions/assertExtensions/index.ts +0 -1
- package/dist/core/gaurds/assertions/assertHookReturnedObject.ts +0 -30
- package/dist/core/gaurds/assertions/assertInfo/base.ts +0 -14
- package/dist/core/gaurds/assertions/assertInfo/index.ts +0 -2
- package/dist/core/gaurds/assertions/assertInfo/log.ts +0 -28
- package/dist/core/gaurds/assertions/assertIs404.ts +0 -12
- package/dist/core/gaurds/assertions/assertIsBrowser/base.ts +0 -8
- package/dist/core/gaurds/assertions/assertIsBrowser/index.ts +0 -1
- package/dist/core/gaurds/assertions/assertIsNotBrowser/base.ts +0 -9
- package/dist/core/gaurds/assertions/assertIsNotBrowser/index.ts +0 -1
- package/dist/core/gaurds/assertions/assertIsNotProductionRuntime/base.ts +0 -71
- package/dist/core/gaurds/assertions/assertIsNotProductionRuntime/index.ts +0 -1
- package/dist/core/gaurds/assertions/assertKeys/base.ts +0 -31
- package/dist/core/gaurds/assertions/assertKeys/index.ts +0 -1
- package/dist/core/gaurds/assertions/assertNoInfiniteHttpRedirect.ts +0 -55
- package/dist/core/gaurds/assertions/assertNodeEnv/base.ts +0 -120
- package/dist/core/gaurds/assertions/assertNodeEnv/index.ts +0 -1
- package/dist/core/gaurds/assertions/assertNodeVersion/base.ts +0 -11
- package/dist/core/gaurds/assertions/assertNodeVersion/index.ts +0 -1
- package/dist/core/gaurds/assertions/assertOnBeforeRenderHookReturn.ts +0 -37
- package/dist/core/gaurds/assertions/assertPageContextProvidedByUser.ts +0 -60
- package/dist/core/gaurds/assertions/assertPluginManifest.ts +0 -41
- package/dist/core/gaurds/assertions/assertPlusFileExport.ts +0 -66
- package/dist/core/gaurds/assertions/assertRoutingType/base.ts +0 -41
- package/dist/core/gaurds/assertions/assertRoutingType/index.ts +0 -1
- package/dist/core/gaurds/assertions/assertRuntimeManifest.ts +0 -34
- package/dist/core/gaurds/assertions/assertSingleInstance/index.ts +0 -142
- package/dist/core/gaurds/assertions/assertSingleInstance/onAssertModuleLoad.ts +0 -0
- package/dist/core/gaurds/assertions/assertSingleInstance/onClientEntryClientRouting.ts +0 -0
- package/dist/core/gaurds/assertions/assertSingleInstance/onClientEntryServerRouting.ts +0 -0
- package/dist/core/gaurds/assertions/assertType.ts +0 -12
- package/dist/core/gaurds/assertions/assertUsage/base.ts +0 -43
- package/dist/core/gaurds/assertions/assertUsage/index.ts +0 -3
- package/dist/core/gaurds/assertions/assertUsage/log.ts +0 -29
- package/dist/core/gaurds/assertions/assertUsage/node.ts +0 -16
- package/dist/core/gaurds/assertions/assertV1Design.ts +0 -29
- package/dist/core/gaurds/assertions/assertVersion/base.ts +0 -55
- package/dist/core/gaurds/assertions/assertVersion/index.ts +0 -1
- package/dist/core/gaurds/assertions/assertWarning/base.ts +0 -43
- package/dist/core/gaurds/assertions/assertWarning/index.ts +0 -2
- package/dist/core/gaurds/assertions/assertWarning/log.ts +0 -43
- package/dist/core/gaurds/assertions/checkType.ts +0 -2
- package/dist/core/gaurds/debugger/createDebugger.ts +0 -196
- package/dist/core/gaurds/debugger/debugPageFiles.ts +0 -121
- package/dist/core/gaurds/debugger/index.ts +0 -2
- package/dist/core/gaurds/errors/createErrorWithCleanStackTrace.ts +0 -56
- package/dist/core/gaurds/errors/removeErrMsg.ts +0 -8
- package/dist/core/gaurds/logger/addOnBeforeLogHook/index.ts +0 -7
- package/dist/core/gaurds/logger/formatHintLog.ts +0 -17
- package/dist/core/gaurds/logger/log404/index.spec.ts +0 -78
- package/dist/core/gaurds/logger/log404/index.ts +0 -208
- package/dist/core/gaurds/logger/logErrorHint/errors.ts +0 -17
- package/dist/core/gaurds/logger/logErrorHint/getErrorHint.spec.ts +0 -1057
- package/dist/core/gaurds/logger/logErrorHint.ts +0 -196
- package/dist/core/gaurds/logger/loggerNotProd/errorWithCodeSnippet/fixture-errors/errBabelReact.ts +0 -16
- package/dist/core/gaurds/logger/loggerNotProd/errorWithCodeSnippet/fixture-errors/errBabelSolid.ts +0 -16
- package/dist/core/gaurds/logger/loggerNotProd/errorWithCodeSnippet/fixture-errors/errEsbuild.ts +0 -39
- package/dist/core/gaurds/logger/loggerNotProd/errorWithCodeSnippet/fixture-errors/errMdx1.ts +0 -24
- package/dist/core/gaurds/logger/loggerNotProd/errorWithCodeSnippet/fixture-errors/errMdx2.ts +0 -83
- package/dist/core/gaurds/logger/loggerNotProd/errorWithCodeSnippet/fixture-errors/errPostcss.ts +0 -33
- package/dist/core/gaurds/logger/loggerNotProd/errorWithCodeSnippet/fixture-errors/errSwc.ts +0 -20
- package/dist/core/gaurds/logger/loggerNotProd/errorWithCodeSnippet/fixture-errors/errSwcBig.ts +0 -19
- package/dist/core/gaurds/logger/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueCss.ts +0 -36
- package/dist/core/gaurds/logger/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueHtml.ts +0 -17
- package/dist/core/gaurds/logger/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueJavascript.ts +0 -16
- package/dist/core/gaurds/logger/loggerNotProd/errorWithCodeSnippet/getPrettyErrMessage.spec.ts +0 -101
- package/dist/core/gaurds/logger/loggerNotProd/errorWithCodeSnippet/getPrettyErrorWithCodeSnippet.spec.ts +0 -232
- package/dist/core/gaurds/logger/loggerNotProd/errorWithCodeSnippet.ts +0 -212
- package/dist/core/gaurds/logger/loggerNotProd/log.ts +0 -124
- package/dist/core/gaurds/logger/loggerNotProd.ts +0 -271
- package/dist/core/gaurds/logger/loggerProd.ts +0 -37
- package/dist/core/gaurds/logger/loggerRuntime.ts +0 -46
- package/dist/core/gaurds/logger/loggerVite/removeSuperfluousViteLog.ts +0 -30
- package/dist/core/gaurds/logger/loggerVite.ts +0 -65
- package/dist/core/gaurds/logger/overwriteAssertProductionLogger/index.ts +0 -9
- package/dist/core/gaurds/logger/trackLogs.ts +0 -35
- package/dist/core/gaurds/logger/warnIfErrorIsNotObject.ts +0 -31
- package/dist/core/gaurds/normalization/freezePartial.ts +0 -39
- package/dist/core/gaurds/normalization/normalizeHeaders.ts +0 -20
- package/dist/core/gaurds/normalization/normalizeLink.tsx +0 -14
- package/dist/core/gaurds/normalization/normalizeUrlArgument.ts +0 -22
- package/dist/core/gaurds/validators/hasProp.ts +0 -116
- package/dist/core/gaurds/validators/isArray.ts +0 -4
- package/dist/core/gaurds/validators/isArrayOfStrings.ts +0 -7
- package/dist/core/gaurds/validators/isAsset.ts +0 -43
- package/dist/core/gaurds/validators/isBrowser.ts +0 -5
- package/dist/core/gaurds/validators/isBug.ts +0 -5
- package/dist/core/gaurds/validators/isCallable.ts +0 -11
- package/dist/core/gaurds/validators/isClientSideRoutable.ts +0 -19
- package/dist/core/gaurds/validators/isConfigInvalid.ts +0 -10
- package/dist/core/gaurds/validators/isDev.ts +0 -56
- package/dist/core/gaurds/validators/isErrorDebug.ts +0 -7
- package/dist/core/gaurds/validators/isErrorPage.ts +0 -16
- package/dist/core/gaurds/validators/isFilePathAbsoluteFilesystem.ts +0 -55
- package/dist/core/gaurds/validators/isHtml.ts +0 -9
- package/dist/core/gaurds/validators/isNewError.ts +0 -29
- package/dist/core/gaurds/validators/isNodeJS.ts +0 -10
- package/dist/core/gaurds/validators/isNotFalse.ts +0 -3
- package/dist/core/gaurds/validators/isNotNullish.ts +0 -2
- package/dist/core/gaurds/validators/isNpmPackage.ts +0 -127
- package/dist/core/gaurds/validators/isObject.ts +0 -3
- package/dist/core/gaurds/validators/isObjectOfStrings.ts +0 -9
- package/dist/core/gaurds/validators/isObjectWithKeys.ts +0 -18
- package/dist/core/gaurds/validators/isPlainObject.ts +0 -21
- package/dist/core/gaurds/validators/isPromise.ts +0 -9
- package/dist/core/gaurds/validators/isPropertyGetter.ts +0 -4
- package/dist/core/gaurds/validators/isReact.ts +0 -24
- package/dist/core/gaurds/validators/isReactElement.ts +0 -21
- package/dist/core/gaurds/validators/isRevealApp.ts +0 -4
- package/dist/core/gaurds/validators/isSameErrorMessage.ts +0 -8
- package/dist/core/gaurds/validators/isScriptFile.ts +0 -75
- package/dist/core/gaurds/validators/isServerSideError.ts +0 -1
- package/dist/core/gaurds/validators/isViteCliCall.ts +0 -93
- package/dist/core/gaurds/validators/isVitest.ts +0 -7
- package/dist/core/gaurds/validators/rollupIsEsm.ts +0 -14
- package/dist/core/gaurds/validators/viteIsSSR.ts +0 -23
- package/dist/core/globals/contexts/globalContext/getPageFilesExports.ts +0 -28
- package/dist/core/globals/contexts/globalContext/index.ts +0 -374
- package/dist/core/globals/contexts/globalContext/loadImportBuild.ts +0 -44
- package/dist/core/globals/contexts/globalContext/setup.ts +0 -4
- package/dist/core/globals/contexts/index.ts +0 -1
- package/dist/core/globals/logger/index.ts +0 -1
- package/dist/core/globals/logger/numberOfStackTraceLinesToRemove.ts +0 -3
- package/dist/core/globals/objects/index.ts +0 -1
- package/dist/core/globals/objects/log.ts +0 -24
- package/dist/core/globals/patterns/styleFileRE.ts +0 -3
- package/dist/core/globals/tags/addPrefixAssertType.ts +0 -11
- package/dist/core/globals/tags/addPrefixProjectName.ts +0 -9
- package/dist/core/globals/tags/projectTag.ts +0 -3
- package/dist/core/globals/tags/projectTagWithVersion.ts +0 -5
- package/dist/core/globals/versions/PROJECT_VERSION.ts +0 -2
- package/dist/core/globals/versions/projectInfo.ts +0 -5
- package/dist/core/handlers/handleErrorWithoutErrorPage.ts +0 -70
- package/dist/core/handlers/handlePageContext.ts +0 -15
- package/dist/core/handlers/handlePageContextRequestUrl.ts +0 -56
- package/dist/core/handlers/openFacebook.ts +0 -20
- package/dist/core/hocs/clientOnly.tsx +0 -130
- package/dist/core/hooks/callCumulativeHooks.ts +0 -22
- package/dist/core/hooks/executeHook.ts +0 -118
- package/dist/core/hooks/useConfig/configsCumulative.ts +0 -6
- package/dist/core/hooks/useConfig/useConfig-client.ts +0 -82
- package/dist/core/hooks/useConfig/useConfig-server.ts +0 -152
- package/dist/core/hydration/progressive.ts +0 -252
- package/dist/core/index.ts +0 -60
- package/dist/core/islands/index.tsx +0 -198
- package/dist/core/logging/UnifiedLoggerV2.ts +0 -555
- package/dist/core/logging/index.ts +0 -80
- package/dist/core/logging/plugins/FilePlugin.ts +0 -132
- package/dist/core/logging/plugins/PayloadCMSPlugin.ts +0 -71
- package/dist/core/logging/plugins/RemotePlugin.ts +0 -110
- package/dist/core/logging/plugins/index.ts +0 -11
- package/dist/core/naming/UnifiedNaming.ts +0 -424
- package/dist/core/observability/logger.ts +0 -195
- package/dist/core/observability/metrics.ts +0 -156
- package/dist/core/processing/getters/getAssertErrMsg.ts +0 -49
- package/dist/core/processing/getters/getAssetsDir.ts +0 -11
- package/dist/core/processing/getters/getBaseServer.ts +0 -16
- package/dist/core/processing/getters/getCacheControl.ts +0 -26
- package/dist/core/processing/getters/getConfigDefinedAt.ts +0 -73
- package/dist/core/processing/getters/getConfigReveal.ts +0 -14
- package/dist/core/processing/getters/getConfigValue.ts +0 -68
- package/dist/core/processing/getters/getConfigValueBuildTime.ts +0 -92
- package/dist/core/processing/getters/getConfigValueFilePathToShowToUser.ts +0 -17
- package/dist/core/processing/getters/getCurrentUrl.ts +0 -42
- package/dist/core/processing/getters/getEarlyHints.ts +0 -58
- package/dist/core/processing/getters/getEnv.ts +0 -33
- package/dist/core/processing/getters/getErrorPageId.ts +0 -23
- package/dist/core/processing/getters/getExportPath.spec.ts +0 -34
- package/dist/core/processing/getters/getExportPath.ts +0 -33
- package/dist/core/processing/getters/getFileExtension.ts +0 -19
- package/dist/core/processing/getters/getFilePath.ts +0 -269
- package/dist/core/processing/getters/getGlobalObject.ts +0 -53
- package/dist/core/processing/getters/getHeadSetting.tsx +0 -36
- package/dist/core/processing/getters/getHook.ts +0 -222
- package/dist/core/processing/getters/getHookFilePathToShowToUser.ts +0 -12
- package/dist/core/processing/getters/getHtmlTags.ts +0 -341
- package/dist/core/processing/getters/getHttpRequestAsyncStore.ts +0 -122
- package/dist/core/processing/getters/getHttpResponseBody.ts +0 -177
- package/dist/core/processing/getters/getMostSimilar.ts +0 -72
- package/dist/core/processing/getters/getOutDirs.ts +0 -160
- package/dist/core/processing/getters/getPageAssets/getManifestEntry.ts +0 -164
- package/dist/core/processing/getters/getPageAssets/retrieveAssetsDev.ts +0 -96
- package/dist/core/processing/getters/getPageAssets/retrieveAssetsProd.ts +0 -86
- package/dist/core/processing/getters/getPageAssets/sortPageAssetsForEarlyHintsHeader.ts +0 -40
- package/dist/core/processing/getters/getPageAssets.ts +0 -140
- package/dist/core/processing/getters/getPageConfig.ts +0 -14
- package/dist/core/processing/getters/getPageContext.ts +0 -64
- package/dist/core/processing/getters/getPageContextCurrent.ts +0 -19
- package/dist/core/processing/getters/getPageContextFromHooks.ts +0 -335
- package/dist/core/processing/getters/getPageContextProxyForUser.ts +0 -97
- package/dist/core/processing/getters/getPageContextRequestUrl.ts +0 -22
- package/dist/core/processing/getters/getPageContextSerializedInHtml.ts +0 -32
- package/dist/core/processing/getters/getPageContextUrlComputed.ts +0 -410
- package/dist/core/processing/getters/getPageElement.tsx +0 -148
- package/dist/core/processing/getters/getPageFiles/analyzeClientSide.ts +0 -50
- package/dist/core/processing/getters/getPageFiles/analyzePageServerSide.ts +0 -32
- package/dist/core/processing/getters/getPageFiles/getExportNames.ts +0 -16
- package/dist/core/processing/getters/getPageFiles/getExports.ts +0 -193
- package/dist/core/processing/getters/getPageFiles/index.ts +0 -9
- package/dist/core/processing/getters/getPageFiles/parseGlobResults.ts +0 -167
- package/dist/core/processing/getters/getPageFiles/setPageFiles.ts +0 -76
- package/dist/core/processing/getters/getPrefetchSettingResolved.ts.ts +0 -87
- package/dist/core/processing/getters/getProjectError.ts +0 -18
- package/dist/core/processing/getters/getPropAccessNotation.ts +0 -10
- package/dist/core/processing/getters/getRandomId.ts +0 -15
- package/dist/core/processing/getters/getRevalidationKey.ts +0 -5
- package/dist/core/processing/getters/getRevealClientEntry.ts +0 -7
- package/dist/core/processing/getters/getRevealConfig/configDefinitionsBuiltIn.ts +0 -711
- package/dist/core/processing/getters/getRevealConfig/crawlPlusFiles.ts +0 -409
- package/dist/core/processing/getters/getRevealConfig/filesystemRouting.spec.ts +0 -40
- package/dist/core/processing/getters/getRevealConfig/filesystemRouting.ts +0 -286
- package/dist/core/processing/getters/getRevealConfig/index.ts +0 -1641
- package/dist/core/processing/getters/getRevealConfig/loadFileAtConfigTime.ts +0 -181
- package/dist/core/processing/getters/getRevealConfig/resolvePointerImport.ts +0 -240
- package/dist/core/processing/getters/getRevealConfig/transformPointerImports.spec.ts +0 -30
- package/dist/core/processing/getters/getRevealConfig/transformPointerImports.ts +0 -244
- package/dist/core/processing/getters/getRevealConfig/transpileAndExecuteFile.ts +0 -490
- package/dist/core/processing/getters/getTagAttributesString.ts +0 -27
- package/dist/core/processing/getters/getTerminWidth.ts +0 -9
- package/dist/core/processing/getters/getValuePrintable.ts +0 -6
- package/dist/core/processing/getters/getViteDevScript.ts +0 -47
- package/dist/core/processing/iterators/analyzePage.ts +0 -65
- package/dist/core/processing/iterators/includes.ts +0 -10
- package/dist/core/processing/iterators/index.ts +0 -2
- package/dist/core/processing/iterators/objectKeys.ts +0 -6
- package/dist/core/processing/parsers/parseEsModule.ts +0 -43
- package/dist/core/processing/parsers/parseTransform.ts +0 -36
- package/dist/core/processing/serializers/notSerializable.ts +0 -2
- package/dist/core/processing/serializers/replaceWithParserPath.ts +0 -30
- package/dist/core/processing/serializers/serializePage/PageConfigSerialized.ts +0 -45
- package/dist/core/processing/serializers/serializePage/parsePageConfigs.ts +0 -223
- package/dist/core/processing/serializers/serializePage/serializeConfigValues.ts +0 -336
- package/dist/core/processing/serializers/serializePageContextClientSide.ts +0 -179
- package/dist/core/processing/serializers/stringify.ts +0 -188
- package/dist/core/processing/serializers/stringifyTypes.ts +0 -103
- package/dist/core/processing/setters/addIs404ToPageProps.ts +0 -27
- package/dist/core/processing/setters/setAlwaysShowStackTrace.ts +0 -7
- package/dist/core/processing/transformers/augmentType.ts +0 -10
- package/dist/core/processing/transformers/rollupSourceMap.ts +0 -23
- package/dist/core/processing/transformers/slice.ts +0 -52
- package/dist/core/renderer/page/executeOnBeforeRenderAndDataHooks.ts +0 -53
- package/dist/core/renderer/page/executeOnRenderHtmlHook.ts +0 -261
- package/dist/core/renderer/page/index.ts +0 -804
- package/dist/core/renderer/page/inferMediaType.ts +0 -128
- package/dist/core/renderer/page/loadUserFilesServerSide.ts +0 -154
- package/dist/core/renderer/page/preparePageContextForUserConsumption.ts +0 -55
- package/dist/core/renderer/page/preparePageContextForUserConsumptionServerSide.ts +0 -38
- package/dist/core/renderer/page/renderPageAlreadyRouted.ts +0 -373
- package/dist/core/renderer/page/resolveRedirects.ts +0 -75
- package/dist/core/renderer/prerender/index.ts +0 -1
- package/dist/core/renderer/prerender/runPrerender.ts +0 -1141
- package/dist/core/renderer/prerender/utils.ts +0 -22
- package/dist/core/renderer/stream/html.ts +0 -408
- package/dist/core/renderer/stream/index.ts +0 -1001
- package/dist/core/renderer/stream/onLoad.ts +0 -14
- package/dist/core/renderer/stream/react-streaming.ts +0 -69
- package/dist/core/renderer/stream/utils.ts +0 -66
- package/dist/core/resilience/circuit-breaker.ts +0 -212
- package/dist/core/resilience/retry.ts +0 -172
- package/dist/core/result/adapters.ts +0 -254
- package/dist/core/result.ts +0 -332
- package/dist/core/router/abort.ts +0 -339
- package/dist/core/router/apiRoutes.ts +0 -94
- package/dist/core/router/debug.ts +0 -19
- package/dist/core/router/deduceRouteStringFromFilesystemPath.ts +0 -75
- package/dist/core/router/dynamicApiRoutes.ts +0 -18
- package/dist/core/router/dynamicPageRoutes.ts +0 -18
- package/dist/core/router/executeGuardHook.ts +0 -45
- package/dist/core/router/executeOnBeforeRouteHook.ts +0 -161
- package/dist/core/router/index.ts +0 -230
- package/dist/core/router/loadPageRoutes.ts +0 -155
- package/dist/core/router/noRouteMatch.ts +0 -1
- package/dist/core/router/pageRoutes.ts +0 -159
- package/dist/core/router/resolvePrecedence.ts +0 -128
- package/dist/core/router/resolveRoute.ts +0 -29
- package/dist/core/router/resolveRouteFunction.ts +0 -193
- package/dist/core/router/resolveRouteString.ts +0 -204
- package/dist/core/router/resolveRouteUtils.ts +0 -77
- package/dist/core/router/resolveUrlPathname.ts +0 -67
- package/dist/core/router/routeInternal.ts +0 -97
- package/dist/core/router/utils.ts +0 -30
- package/dist/core/services/BaseService.ts +0 -403
- package/dist/core/targets/client/abort.ts +0 -11
- package/dist/core/targets/client/createPageContext.ts +0 -48
- package/dist/core/targets/client/entry.ts +0 -15
- package/dist/core/targets/client/executeOnRenderClientHook.ts +0 -94
- package/dist/core/targets/client/history.ts +0 -142
- package/dist/core/targets/client/index.ts +0 -9
- package/dist/core/targets/client/initClientRouter.ts +0 -48
- package/dist/core/targets/client/initOnLinkClick.ts +0 -54
- package/dist/core/targets/client/loadUserFilesClientSide.ts +0 -92
- package/dist/core/targets/client/navigate.ts +0 -45
- package/dist/core/targets/client/onBrowserHistoryNavigation.ts +0 -85
- package/dist/core/targets/client/onLoad.ts +0 -10
- package/dist/core/targets/client/pageContextInitIsPassedToClient.ts +0 -2
- package/dist/core/targets/client/pageFiles.ts +0 -4
- package/dist/core/targets/client/prefetch.ts +0 -399
- package/dist/core/targets/client/preparePageContextForUserConsumptionClientSide.ts +0 -48
- package/dist/core/targets/client/removeBuiltInOverrides.ts +0 -37
- package/dist/core/targets/client/removeFoucBuster.ts +0 -70
- package/dist/core/targets/client/renderPageClientSide.ts +0 -1817
- package/dist/core/targets/client/router.ts +0 -15
- package/dist/core/targets/client/scrollRestoration.ts +0 -37
- package/dist/core/targets/client/setScrollPosition.ts +0 -87
- package/dist/core/targets/client/skipLink.ts +0 -63
- package/dist/core/targets/client/utils.ts +0 -34
- package/dist/core/targets/http/createHttpResponse.ts +0 -254
- package/dist/core/targets/http/fetchBanner.ts +0 -25
- package/dist/core/targets/http/fetchCard.ts +0 -25
- package/dist/core/targets/http/fetchEvents.ts +0 -25
- package/dist/core/targets/http/fetchHero.ts +0 -25
- package/dist/core/targets/http/fetchMainInfos.ts +0 -25
- package/dist/core/targets/http/fetchPage.ts +0 -78
- package/dist/core/targets/http/fetchPages.ts +0 -70
- package/dist/core/targets/http/fetchVideos.ts +0 -26
- package/dist/core/targets/http/fetchYouTube.ts +0 -90
- package/dist/core/targets/server/entry.ts +0 -43
- package/dist/core/targets/server/middleware/addSsrMiddleware.ts +0 -52
- package/dist/core/targets/server/onLoad.ts +0 -7
- package/dist/core/targets/server/pageFiles.ts +0 -4
- package/dist/core/targets/server/root.ts +0 -10
- package/dist/core/targets/server/utils.ts +0 -20
- package/dist/core/targets/url/index.ts +0 -439
- package/dist/core/targets/url/modifyUrl.ts +0 -45
- package/dist/core/targets/url/parseUrl.ts +0 -440
- package/dist/core/targets/url/parseUrlExtras.ts +0 -193
- package/dist/core/targets/url/redirectHard.ts +0 -3
- package/dist/core/targets/url/updateCurrentPath.ts +0 -52
- package/dist/core/targets/url/urlToFile.ts +0 -47
- package/dist/core/types/UnifiedTypes.ts +0 -493
- package/dist/core/types/contracts.ts +0 -61
- package/dist/core/types/generator.ts +0 -316
- package/dist/core/utils/array/includes.ts +0 -10
- package/dist/core/utils/array/slice.ts +0 -52
- package/dist/core/utils/array/sorter.ts +0 -130
- package/dist/core/utils/array/stringifyStringArray.ts +0 -7
- package/dist/core/utils/array/unique.ts +0 -5
- package/dist/core/utils/async/genPromise.ts +0 -8
- package/dist/core/utils/async/pLimit.ts +0 -157
- package/dist/core/utils/async/sleep.ts +0 -3
- package/dist/core/utils/async/throttle.ts +0 -14
- package/dist/core/utils/index.ts +0 -31
- package/dist/core/utils/object/changeEnumerable.ts +0 -9
- package/dist/core/utils/object/deepEqual.ts +0 -10
- package/dist/core/utils/object/objectAssign.ts +0 -16
- package/dist/core/utils/object/objectDefineProperty.ts +0 -15
- package/dist/core/utils/object/objectEntries.ts +0 -7
- package/dist/core/utils/object/objectEntriesForEach.ts +0 -7
- package/dist/core/utils/object/objectFromEntries.ts +0 -6
- package/dist/core/utils/string/addWhitespace.ts +0 -9
- package/dist/core/utils/string/capitalizeFirstLetter.ts +0 -8
- package/dist/core/utils/string/compareString.ts +0 -7
- package/dist/core/utils/string/escapeHtml.ts +0 -10
- package/dist/core/utils/string/escapeRegex.ts +0 -4
- package/dist/core/utils/string/joinEnglish.ts +0 -18
- package/dist/core/utils/string/removeEmptyLines.ts +0 -6
- package/dist/core/utils/string/stripAnsi.ts +0 -24
- package/dist/core/utils/string/trimWithAnsi.ts +0 -40
- package/dist/core/utils/string/truncateString.ts +0 -19
- package/dist/core/utils/time/humanizeTime.ts +0 -24
- package/dist/integration/hydration.ts +0 -52
- package/dist/integration/onRenderClient.tsx +0 -377
- package/dist/integration/onRenderHtml.tsx +0 -761
- package/dist/integration/ssrEffect.ts +0 -31
- package/dist/plugins/baseUrls.ts +0 -54
- package/dist/plugins/buildConfig/index.ts +0 -701
- package/dist/plugins/buildConfig/injectRollupInputs.ts +0 -36
- package/dist/plugins/commonConfig.ts +0 -112
- package/dist/plugins/config/assertResolveAlias.ts +0 -99
- package/dist/plugins/config/assertRevealConfig.ts +0 -116
- package/dist/plugins/config/fixServerAssets.ts +0 -213
- package/dist/plugins/config/index.ts +0 -227
- package/dist/plugins/config/pickFirst.ts +0 -3
- package/dist/plugins/config/resolveBase.ts +0 -78
- package/dist/plugins/devConfig/determineFsAllowList.ts +0 -34
- package/dist/plugins/devConfig/determineOptimizeDeps.ts +0 -129
- package/dist/plugins/devConfig/index.ts +0 -222
- package/dist/plugins/distFileNames.ts +0 -341
- package/dist/plugins/envVars.ts +0 -150
- package/dist/plugins/extractAssetsPlugin.ts +0 -318
- package/dist/plugins/extractExportNamesPlugin.ts +0 -154
- package/dist/plugins/fileEnv.ts +0 -374
- package/dist/plugins/importBuild/getRevealManifest.ts +0 -20
- package/dist/plugins/importBuild/index.ts +0 -120
- package/dist/plugins/importUserCode/addImportStatement.ts +0 -32
- package/dist/plugins/importUserCode/debug.ts +0 -2
- package/dist/plugins/importUserCode/getConfigFileExport.ts +0 -24
- package/dist/plugins/importUserCode/getVirtualFilePageConfigValuesAll.ts +0 -95
- package/dist/plugins/importUserCode/getVirtualFilePageConfigs.ts +0 -150
- package/dist/plugins/importUserCode/index.ts +0 -375
- package/dist/plugins/importUserCode/isRuntimeEnvMatch.ts +0 -31
- package/dist/plugins/index.ts +0 -233
- package/dist/plugins/onLoad.ts +0 -12
- package/dist/plugins/packageJsonFile.ts +0 -62
- package/dist/plugins/payload/index.ts +0 -62
- package/dist/plugins/previewConfig.ts +0 -95
- package/dist/plugins/react/index.ts +0 -72
- package/dist/plugins/removeRequireHookPlugin.ts +0 -27
- package/dist/plugins/resolveClientEntriesDev.ts +0 -87
- package/dist/plugins/reveal/index.ts +0 -39
- package/dist/plugins/reveal/remove-use-client-server.ts +0 -52
- package/dist/plugins/setGlobalContext.ts +0 -53
- package/dist/plugins/suppressRollupWarning.ts +0 -94
- package/dist/plugins/utils.ts +0 -33
- package/dist/plugins/vercel/+config.ts +0 -18
- package/dist/plugins/vercel/functions/assert.ts +0 -13
- package/dist/plugins/vercel/functions/build.ts +0 -484
- package/dist/plugins/vercel/functions/config.ts +0 -147
- package/dist/plugins/vercel/functions/helpers.ts +0 -134
- package/dist/plugins/vercel/functions/prerender.ts +0 -140
- package/dist/plugins/vercel/functions/route-regex.ts +0 -37
- package/dist/plugins/vercel/functions/utils.ts +0 -33
- package/dist/plugins/vercel/functions/vike.ts +0 -754
- package/dist/plugins/vercel/index.ts +0 -186
- package/dist/plugins/vercel/plugin.ts +0 -45
- package/dist/plugins/vercel/schemas/config/prerender-config.ts +0 -20
- package/dist/plugins/vercel/schemas/config/vc-config.ts +0 -45
- package/dist/plugins/vercel/schemas/config/vercel.ts +0 -130
- package/dist/plugins/vercel/schemas/exports.ts +0 -12
- package/dist/plugins/vercel/templates/edge-helpers.ts +0 -72
- package/dist/plugins/vercel/templates/node-helpers.ts +0 -60
- package/dist/plugins/vercel/templates/ssr_.template.ts +0 -25
- package/dist/plugins/vercel/templates/ssr_edge_.template.ts +0 -20
- package/dist/plugins/vercel/templates/utils.ts +0 -31
- package/dist/plugins/workaroundCssModuleHmr.ts +0 -23
- package/dist/types/index.ts +0 -50
- package/dist/types/interfaces/app.ts +0 -700
- package/dist/types/interfaces/client.ts +0 -10
- package/dist/types/interfaces/config.ts +0 -481
- package/dist/types/interfaces/context.ts +0 -677
- package/dist/types/interfaces/error.ts +0 -6
- package/dist/types/interfaces/file.ts +0 -98
- package/dist/types/interfaces/host.ts +0 -209
- package/dist/types/interfaces/log.ts +0 -3
- package/dist/types/interfaces/logic.ts +0 -46
- package/dist/types/interfaces/manifest.ts +0 -15
- package/dist/types/interfaces/node.ts +0 -8
- package/dist/types/interfaces/page.ts +0 -154
- package/dist/types/interfaces/reveal.ts +0 -118
- package/dist/types/interfaces/tag.ts +0 -3
- package/dist/types/modules/assets.d.ts +0 -57
- package/dist/types/modules/env.d.ts +0 -34
- package/dist/types/modules/global.d.ts +0 -10
- package/dist/types/modules/index.d.ts +0 -1
- package/dist/types/modules/node.d.ts +0 -2
- package/dist/types/modules/payload.d.ts +0 -2
- package/dist/types/modules/reveal-vercel.d.ts +0 -19
- package/dist/types/modules/reveal.d.ts +0 -1
- package/dist/types/modules/stripe.d.ts +0 -41
- package/dist/types/modules/supabase.d.ts +0 -19
- package/dist/types/modules/tailwindcss.d.ts +0 -49
- package/dist/types/modules/vite.d.ts +0 -7
- package/dist/types/namespaces/Config.ts +0 -291
- package/dist/types/namespaces/PageContext.ts +0 -23
- package/dist/types/namespaces/RevealNamespace.ts +0 -51
- package/dist/types/namespaces/index.ts +0 -3
- package/dist/ui/accents/DiagonalGrid.tsx +0 -36
- package/dist/ui/accents/Glass.tsx +0 -33
- package/dist/ui/accents/Parallax.tsx +0 -78
- package/dist/ui/accents/Shadow.tsx +0 -28
- package/dist/ui/accents/index.tsx +0 -4
- package/dist/ui/accessibility/index.ts +0 -168
- package/dist/ui/ai/ChatGPTAssistant.tsx +0 -113
- package/dist/ui/ai/index.ts +0 -3
- package/dist/ui/animations/container.ts +0 -7
- package/dist/ui/animations/content.ts +0 -16
- package/dist/ui/animations/fade.ts +0 -16
- package/dist/ui/animations/index.ts +0 -6
- package/dist/ui/animations/slide.ts +0 -23
- package/dist/ui/animations/text.ts +0 -14
- package/dist/ui/animations/transition.ts +0 -1
- package/dist/ui/audio/AudioTrack.tsx +0 -26
- package/dist/ui/audio/index.tsx +0 -1
- package/dist/ui/backgrounds/Diagonal.tsx +0 -46
- package/dist/ui/backgrounds/GradientConic.tsx +0 -21
- package/dist/ui/backgrounds/GradientConicRev.tsx +0 -50
- package/dist/ui/backgrounds/GradientGlass.tsx +0 -28
- package/dist/ui/backgrounds/GradientRadial.tsx +0 -37
- package/dist/ui/backgrounds/GradientRadialLeft.tsx +0 -33
- package/dist/ui/backgrounds/GradientToBottom.tsx +0 -59
- package/dist/ui/backgrounds/GradientToTop.tsx +0 -60
- package/dist/ui/backgrounds/Solid.tsx +0 -50
- package/dist/ui/backgrounds/Straight.tsx +0 -55
- package/dist/ui/backgrounds/TopRight.tsx +0 -15
- package/dist/ui/backgrounds/Wrapper.tsx +0 -33
- package/dist/ui/backgrounds/index.tsx +0 -12
- package/dist/ui/buttons/Button.tsx +0 -54
- package/dist/ui/buttons/DisclosureButton.tsx +0 -35
- package/dist/ui/buttons/GradientButton.tsx +0 -51
- package/dist/ui/buttons/IconButton.tsx +0 -24
- package/dist/ui/buttons/LikeButton.tsx +0 -221
- package/dist/ui/buttons/MobileMenuButton.tsx +0 -63
- package/dist/ui/buttons/MusicButton.tsx +0 -53
- package/dist/ui/buttons/SignUpButton.tsx +0 -18
- package/dist/ui/buttons/index.tsx +0 -8
- package/dist/ui/cards/Card.tsx +0 -255
- package/dist/ui/cards/ProductCard.tsx +0 -291
- package/dist/ui/cards/VideoCard.tsx +0 -201
- package/dist/ui/cards/index.tsx +0 -3
- package/dist/ui/contexts/DisclosureContext.tsx +0 -44
- package/dist/ui/contexts/GlobalContext.tsx +0 -67
- package/dist/ui/contexts/MenuContext.tsx +0 -8
- package/dist/ui/contexts/PageContext.tsx +0 -28
- package/dist/ui/contexts/ThemeContext.tsx +0 -195
- package/dist/ui/controls/MusicHeader.tsx +0 -484
- package/dist/ui/controls/MusicPlayer.tsx +0 -76
- package/dist/ui/controls/MusicSidebar.tsx +0 -118
- package/dist/ui/controls/MusicSlider.tsx +0 -25
- package/dist/ui/controls/MusicUpload.tsx +0 -296
- package/dist/ui/controls/PlayPause.tsx +0 -64
- package/dist/ui/controls/PlayerContent.tsx +0 -205
- package/dist/ui/controls/SearchContent.tsx +0 -58
- package/dist/ui/controls/SearchInput.tsx +0 -118
- package/dist/ui/controls/Searchbar.tsx +0 -53
- package/dist/ui/controls/SidebarItem.tsx +0 -57
- package/dist/ui/controls/SongItem.tsx +0 -45
- package/dist/ui/controls/VideoPlayer.tsx +0 -36
- package/dist/ui/controls/index.tsx +0 -13
- package/dist/ui/dividers/Horizontal.tsx +0 -18
- package/dist/ui/dividers/Transparent.tsx +0 -7
- package/dist/ui/dividers/index.tsx +0 -2
- package/dist/ui/error/ErrorBoundary.tsx +0 -150
- package/dist/ui/error/index.tsx +0 -1
- package/dist/ui/forms/Input.tsx +0 -38
- package/dist/ui/forms/MediaItem.tsx +0 -105
- package/dist/ui/forms/index.tsx +0 -2
- package/dist/ui/game/Enemy.tsx +0 -52
- package/dist/ui/game/Fighters.tsx +0 -38
- package/dist/ui/game/GameControls.tsx +0 -37
- package/dist/ui/game/HealthBar.tsx +0 -18
- package/dist/ui/game/Player.tsx +0 -70
- package/dist/ui/game/index.tsx +0 -5
- package/dist/ui/hooks/useApiData.ts +0 -57
- package/dist/ui/hooks/useAuthModal.ts +0 -18
- package/dist/ui/hooks/useCart.ts +0 -21
- package/dist/ui/hooks/useChatGPT.ts +0 -94
- package/dist/ui/hooks/useCustomProps.ts +0 -31
- package/dist/ui/hooks/useData.ts +0 -10
- package/dist/ui/hooks/useDebounce.ts +0 -52
- package/dist/ui/hooks/useDisclosure.ts +0 -8
- package/dist/ui/hooks/useGame.ts +0 -1147
- package/dist/ui/hooks/useLayoutClasses.ts +0 -70
- package/dist/ui/hooks/useLazyLoad.ts +0 -78
- package/dist/ui/hooks/useLikeSong.ts +0 -22
- package/dist/ui/hooks/useLivePreview.ts +0 -60
- package/dist/ui/hooks/useMenu.ts +0 -6
- package/dist/ui/hooks/useOnPlay.ts +0 -23
- package/dist/ui/hooks/usePageContext.ts +0 -174
- package/dist/ui/hooks/useParallax.ts +0 -161
- package/dist/ui/hooks/usePreviewModal.ts +0 -25
- package/dist/ui/hooks/useScreenSize.ts +0 -56
- package/dist/ui/hooks/useTheme.ts +0 -6
- package/dist/ui/images/Carousel.tsx +0 -326
- package/dist/ui/images/Circle.tsx +0 -9
- package/dist/ui/images/Defs.tsx +0 -7
- package/dist/ui/images/Image.tsx +0 -127
- package/dist/ui/images/ImageGrid.tsx +0 -73
- package/dist/ui/images/Logo.tsx +0 -22
- package/dist/ui/images/Path.tsx +0 -27
- package/dist/ui/images/Pattern.tsx +0 -70
- package/dist/ui/images/PromoBanner.tsx +0 -25
- package/dist/ui/images/Rect.tsx +0 -10
- package/dist/ui/images/SVG.tsx +0 -58
- package/dist/ui/images/Stop.tsx +0 -15
- package/dist/ui/images/index.tsx +0 -12
- package/dist/ui/layouts/classNames.ts +0 -8
- package/dist/ui/layouts/container.ts +0 -20
- package/dist/ui/layouts/flex.ts +0 -13
- package/dist/ui/layouts/grid.ts +0 -11
- package/dist/ui/layouts/main.ts +0 -31
- package/dist/ui/layouts/responsive.ts +0 -28
- package/dist/ui/layouts/stack.ts +0 -24
- package/dist/ui/lists/DescriptionList.tsx +0 -41
- package/dist/ui/lists/DisclosurePanel.tsx +0 -20
- package/dist/ui/lists/JobOpeningsList.tsx +0 -54
- package/dist/ui/lists/List.tsx +0 -18
- package/dist/ui/lists/ListElements.tsx +0 -43
- package/dist/ui/lists/ListItem.tsx +0 -63
- package/dist/ui/lists/ProductList.tsx +0 -37
- package/dist/ui/lists/StatsList.tsx +0 -64
- package/dist/ui/lists/UList.tsx +0 -54
- package/dist/ui/lists/index.ts +0 -9
- package/dist/ui/navigation/DesktopMenu.tsx +0 -14
- package/dist/ui/navigation/Footer.tsx +0 -128
- package/dist/ui/navigation/Link.tsx +0 -225
- package/dist/ui/navigation/MobileMenu.tsx +0 -26
- package/dist/ui/navigation/NavigationLinks.tsx +0 -244
- package/dist/ui/navigation/NotFound.tsx +0 -12
- package/dist/ui/navigation/Route.tsx +0 -120
- package/dist/ui/navigation/Transition.tsx +0 -40
- package/dist/ui/navigation/index.tsx +0 -8
- package/dist/ui/notifications/Banner.tsx +0 -69
- package/dist/ui/notifications/Error.tsx +0 -12
- package/dist/ui/notifications/Loader.tsx +0 -14
- package/dist/ui/notifications/NoResults.tsx +0 -11
- package/dist/ui/notifications/index.tsx +0 -4
- package/dist/ui/providers/AppProvider.tsx +0 -115
- package/dist/ui/providers/DisclosureProvider.tsx +0 -21
- package/dist/ui/providers/MenuProvider.tsx +0 -40
- package/dist/ui/providers/PageContextProvider.tsx +0 -176
- package/dist/ui/providers/ThemeProvider.tsx +0 -196
- package/dist/ui/shells/App.tsx +0 -57
- package/dist/ui/shells/Container.tsx +0 -74
- package/dist/ui/shells/Disclosure.tsx +0 -72
- package/dist/ui/shells/Field.tsx +0 -21
- package/dist/ui/shells/Flex.tsx +0 -193
- package/dist/ui/shells/Grid.tsx +0 -118
- package/dist/ui/shells/Header.tsx +0 -123
- package/dist/ui/shells/Main.tsx +0 -96
- package/dist/ui/shells/Nav.tsx +0 -138
- package/dist/ui/shells/Section.tsx +0 -94
- package/dist/ui/shells/Skeleton.tsx +0 -24
- package/dist/ui/shells/index.ts +0 -11
- package/dist/ui/text/Article.tsx +0 -141
- package/dist/ui/text/Currency.tsx +0 -29
- package/dist/ui/text/Heading.tsx +0 -29
- package/dist/ui/text/Label.tsx +0 -24
- package/dist/ui/text/Motto.tsx +0 -40
- package/dist/ui/text/Paragraph.tsx +0 -20
- package/dist/ui/text/Span.tsx +0 -20
- package/dist/ui/text/TagLine.tsx +0 -20
- package/dist/ui/text/Time.tsx +0 -36
- package/dist/ui/text/WelcomeHeading.tsx +0 -40
- package/dist/ui/text/index.ts +0 -10
- package/dist/ui/video/VideoComponent.tsx +0 -23
- package/dist/ui/video/VideoDetail.tsx +0 -33
- package/dist/ui/video/VideoItem.tsx +0 -51
- package/dist/ui/video/VideoList.tsx +0 -155
- package/dist/ui/video/index.ts +0 -4
|
@@ -1,1001 +0,0 @@
|
|
|
1
|
-
export {
|
|
2
|
-
getStreamName,
|
|
3
|
-
getStreamReadableNode,
|
|
4
|
-
getStreamReadableWeb,
|
|
5
|
-
inferStreamName,
|
|
6
|
-
isStream,
|
|
7
|
-
isStreamPipeNode,
|
|
8
|
-
isStreamPipeWeb,
|
|
9
|
-
isStreamReadableNode,
|
|
10
|
-
isStreamReadableWeb,
|
|
11
|
-
isStreamWritableNode,
|
|
12
|
-
isStreamWritableWeb,
|
|
13
|
-
pipeStream,
|
|
14
|
-
pipeToStreamWritableNode,
|
|
15
|
-
pipeToStreamWritableWeb,
|
|
16
|
-
processStream,
|
|
17
|
-
stampPipe,
|
|
18
|
-
streamPipeNodeToString,
|
|
19
|
-
streamReadableWebToString,
|
|
20
|
-
streamToString,
|
|
21
|
-
}
|
|
22
|
-
export type {
|
|
23
|
-
StreamPipeNode,
|
|
24
|
-
StreamPipeWeb,
|
|
25
|
-
StreamProviderAny,
|
|
26
|
-
StreamProviderNormalized,
|
|
27
|
-
StreamReadableNode,
|
|
28
|
-
StreamReadableWeb,
|
|
29
|
-
StreamTypePatch,
|
|
30
|
-
StreamWritableNode,
|
|
31
|
-
StreamWritableWeb,
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
import { import_ } from "@brillout/import"
|
|
35
|
-
import pc from "@brillout/picocolors"
|
|
36
|
-
import type { Readable as Readable_, Writable as Writable_ } from "node:stream"
|
|
37
|
-
import { HtmlRender } from "./html.js"
|
|
38
|
-
import {
|
|
39
|
-
getStreamOfReactStreamingPackage,
|
|
40
|
-
isStreamFromReactStreamingPackage,
|
|
41
|
-
StreamFromReactStreamingPackagePublic,
|
|
42
|
-
streamFromReactStreamingPackageToString,
|
|
43
|
-
} from "./react-streaming.js"
|
|
44
|
-
import {
|
|
45
|
-
assert,
|
|
46
|
-
assertUsage,
|
|
47
|
-
assertWarning,
|
|
48
|
-
capitalizeFirstLetter,
|
|
49
|
-
checkType,
|
|
50
|
-
createDebugger,
|
|
51
|
-
hasProp,
|
|
52
|
-
isBug,
|
|
53
|
-
isCallable,
|
|
54
|
-
isObject,
|
|
55
|
-
objectAssign,
|
|
56
|
-
} from "./utils.js"
|
|
57
|
-
|
|
58
|
-
const debug = createDebugger("reveal:stream")
|
|
59
|
-
|
|
60
|
-
type StreamReadableWeb = ReadableStream
|
|
61
|
-
type StreamReadableNode = Readable_
|
|
62
|
-
type StreamWritableWeb = WritableStream
|
|
63
|
-
type StreamWritableNode = Writable_
|
|
64
|
-
type StreamPipeWeb = (writable: StreamWritableWeb) => void
|
|
65
|
-
type StreamPipeNode = (writable: StreamWritableNode) => void
|
|
66
|
-
|
|
67
|
-
type StreamProviderNormalized =
|
|
68
|
-
| StreamReadableWeb
|
|
69
|
-
| StreamReadableNode
|
|
70
|
-
// stampPipe()
|
|
71
|
-
| StreamPipeWeb
|
|
72
|
-
// stampPipe()
|
|
73
|
-
| StreamPipeNode
|
|
74
|
-
type StreamProviderAny =
|
|
75
|
-
| StreamProviderNormalized
|
|
76
|
-
| StreamFromReactStreamingPackagePublic
|
|
77
|
-
|
|
78
|
-
// Not needed but just to clarify StreamProvider vs StreamConsumer
|
|
79
|
-
type StreamConsumer = StreamWritableWeb | StreamWritableNode
|
|
80
|
-
|
|
81
|
-
// ReactDOMServer.renderToNodeStream() returns a NodeJS.ReadableStream which differs from Stream.Readable
|
|
82
|
-
type StreamTypePatch = NodeJS.ReadableStream
|
|
83
|
-
|
|
84
|
-
function isStreamReadableWeb(thing: unknown): thing is StreamReadableWeb {
|
|
85
|
-
return (
|
|
86
|
-
typeof ReadableStream !== "undefined" && thing instanceof ReadableStream
|
|
87
|
-
)
|
|
88
|
-
}
|
|
89
|
-
function isStreamWritableWeb(thing: unknown): thing is StreamWritableWeb {
|
|
90
|
-
return (
|
|
91
|
-
typeof WritableStream !== "undefined" && thing instanceof WritableStream
|
|
92
|
-
)
|
|
93
|
-
}
|
|
94
|
-
function isStreamReadableNode(thing: unknown): thing is StreamReadableNode {
|
|
95
|
-
if (isStreamReadableWeb(thing)) {
|
|
96
|
-
return false
|
|
97
|
-
}
|
|
98
|
-
// https://stackoverflow.com/questions/17009975/how-to-test-if-an-object-is-a-stream-in-nodejs/37022523#37022523
|
|
99
|
-
return hasProp(thing, "read", "function")
|
|
100
|
-
}
|
|
101
|
-
function isStreamWritableNode(thing: unknown): thing is StreamWritableNode {
|
|
102
|
-
if (isStreamWritableWeb(thing)) {
|
|
103
|
-
return false
|
|
104
|
-
}
|
|
105
|
-
// https://stackoverflow.com/questions/17009975/how-to-test-if-an-object-is-a-stream-in-nodejs/37022523#37022523
|
|
106
|
-
return hasProp(thing, "write", "function")
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
async function streamReadableNodeToString(
|
|
110
|
-
readableNode: StreamReadableNode
|
|
111
|
-
): Promise<string> {
|
|
112
|
-
// Copied from: https://stackoverflow.com/questions/10623798/how-do-i-read-the-contents-of-a-node-js-stream-into-a-string-variable/49428486#49428486
|
|
113
|
-
const chunks: Buffer[] = []
|
|
114
|
-
return new Promise((resolve, reject) => {
|
|
115
|
-
readableNode.on("data", (chunk) => chunks.push(Buffer.from(chunk)))
|
|
116
|
-
readableNode.on("error", (err) => reject(err))
|
|
117
|
-
readableNode.on("end", () =>
|
|
118
|
-
resolve(Buffer.concat(chunks).toString("utf8"))
|
|
119
|
-
)
|
|
120
|
-
})
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
async function streamReadableWebToString(
|
|
124
|
-
readableWeb: ReadableStream
|
|
125
|
-
): Promise<string> {
|
|
126
|
-
const reader = readableWeb.getReader()
|
|
127
|
-
const { decode, getClosingChunk } = decodeChunks()
|
|
128
|
-
let str: string = ""
|
|
129
|
-
while (true) {
|
|
130
|
-
const { done, value } = await reader.read()
|
|
131
|
-
if (done) break
|
|
132
|
-
str += decode(value)
|
|
133
|
-
}
|
|
134
|
-
str += getClosingChunk()
|
|
135
|
-
return str
|
|
136
|
-
}
|
|
137
|
-
async function stringToStreamReadableNode(
|
|
138
|
-
str: string
|
|
139
|
-
): Promise<StreamReadableNode> {
|
|
140
|
-
const { Readable } = await loadStreamNodeModule()
|
|
141
|
-
return Readable.from(str)
|
|
142
|
-
}
|
|
143
|
-
function stringToStreamReadableWeb(str: string): StreamReadableWeb {
|
|
144
|
-
// ReadableStream.from() spec discussion: https://github.com/whatwg/streams/issues/1018
|
|
145
|
-
assertReadableStreamConstructor()
|
|
146
|
-
const readableStream = new ReadableStream({
|
|
147
|
-
start(controller) {
|
|
148
|
-
controller.enqueue(encodeForWebStream(str))
|
|
149
|
-
controller.close()
|
|
150
|
-
},
|
|
151
|
-
})
|
|
152
|
-
return readableStream
|
|
153
|
-
}
|
|
154
|
-
function stringToStreamPipeNode(str: string): StreamPipeNode {
|
|
155
|
-
return (writable: StreamWritableNode) => {
|
|
156
|
-
writable.write(str)
|
|
157
|
-
writable.end()
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
function stringToStreamPipeWeb(str: string): StreamPipeWeb {
|
|
161
|
-
return (writable: StreamWritableWeb) => {
|
|
162
|
-
const writer = writable.getWriter()
|
|
163
|
-
writer.write(encodeForWebStream(str))
|
|
164
|
-
writer.close()
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
async function streamPipeNodeToString(
|
|
169
|
-
streamPipeNode: StreamPipeNode
|
|
170
|
-
): Promise<string> {
|
|
171
|
-
let str: string = ""
|
|
172
|
-
let resolve: () => void
|
|
173
|
-
let reject: (err: unknown) => void
|
|
174
|
-
const promise = new Promise<string>((resolve_, reject_) => {
|
|
175
|
-
resolve = () => resolve_(str)
|
|
176
|
-
reject = reject_
|
|
177
|
-
})
|
|
178
|
-
const { Writable } = await loadStreamNodeModule()
|
|
179
|
-
const writable = new Writable({
|
|
180
|
-
write(chunk, _encoding, callback) {
|
|
181
|
-
const s = chunk.toString()
|
|
182
|
-
assert(typeof s === "string")
|
|
183
|
-
str += s
|
|
184
|
-
callback()
|
|
185
|
-
},
|
|
186
|
-
final(callback) {
|
|
187
|
-
resolve()
|
|
188
|
-
callback()
|
|
189
|
-
},
|
|
190
|
-
destroy(err) {
|
|
191
|
-
if (err) {
|
|
192
|
-
reject(err)
|
|
193
|
-
} else {
|
|
194
|
-
resolve()
|
|
195
|
-
}
|
|
196
|
-
},
|
|
197
|
-
})
|
|
198
|
-
streamPipeNode(writable)
|
|
199
|
-
return promise
|
|
200
|
-
}
|
|
201
|
-
function streamPipeWebToString(streamPipeWeb: StreamPipeWeb): Promise<string> {
|
|
202
|
-
const { decode, getClosingChunk } = decodeChunks()
|
|
203
|
-
let str: string = ""
|
|
204
|
-
let resolve: (s: string) => void
|
|
205
|
-
const promise = new Promise<string>((r) => (resolve = r))
|
|
206
|
-
const writable = new WritableStream({
|
|
207
|
-
write(chunk) {
|
|
208
|
-
str += decode(chunk)
|
|
209
|
-
},
|
|
210
|
-
close() {
|
|
211
|
-
str += getClosingChunk()
|
|
212
|
-
resolve(str)
|
|
213
|
-
},
|
|
214
|
-
})
|
|
215
|
-
streamPipeWeb(writable)
|
|
216
|
-
return promise
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
async function getStreamReadableNode(
|
|
220
|
-
htmlRender: HtmlRender
|
|
221
|
-
): Promise<null | StreamReadableNode> {
|
|
222
|
-
if (typeof htmlRender === "string") {
|
|
223
|
-
return stringToStreamReadableNode(htmlRender)
|
|
224
|
-
}
|
|
225
|
-
if (isStreamReadableNode(htmlRender)) {
|
|
226
|
-
return htmlRender
|
|
227
|
-
}
|
|
228
|
-
return null
|
|
229
|
-
}
|
|
230
|
-
function getStreamReadableWeb(
|
|
231
|
-
htmlRender: HtmlRender
|
|
232
|
-
): null | StreamReadableWeb {
|
|
233
|
-
if (typeof htmlRender === "string") {
|
|
234
|
-
return stringToStreamReadableWeb(htmlRender)
|
|
235
|
-
}
|
|
236
|
-
if (isStreamReadableWeb(htmlRender)) {
|
|
237
|
-
return htmlRender
|
|
238
|
-
}
|
|
239
|
-
return null
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
function pipeToStreamWritableWeb(
|
|
243
|
-
htmlRender: HtmlRender,
|
|
244
|
-
writable: StreamWritableWeb
|
|
245
|
-
): boolean {
|
|
246
|
-
if (typeof htmlRender === "string") {
|
|
247
|
-
const streamPipeWeb = stringToStreamPipeWeb(htmlRender)
|
|
248
|
-
streamPipeWeb(writable)
|
|
249
|
-
return true
|
|
250
|
-
}
|
|
251
|
-
if (isStreamReadableWeb(htmlRender)) {
|
|
252
|
-
htmlRender.pipeTo(writable)
|
|
253
|
-
return true
|
|
254
|
-
}
|
|
255
|
-
if (isStreamPipeWeb(htmlRender)) {
|
|
256
|
-
const streamPipeWeb = getStreamPipeWeb(htmlRender)
|
|
257
|
-
assert(streamPipeWeb)
|
|
258
|
-
streamPipeWeb(writable)
|
|
259
|
-
return true
|
|
260
|
-
}
|
|
261
|
-
if (isStreamReadableNode(htmlRender) || isStreamPipeNode(htmlRender)) {
|
|
262
|
-
return false
|
|
263
|
-
}
|
|
264
|
-
// checkType<never>(htmlRender)
|
|
265
|
-
assert(false)
|
|
266
|
-
}
|
|
267
|
-
function pipeToStreamWritableNode(
|
|
268
|
-
htmlRender: HtmlRender,
|
|
269
|
-
writable: StreamWritableNode
|
|
270
|
-
): boolean {
|
|
271
|
-
if (typeof htmlRender === "string") {
|
|
272
|
-
const streamPipeNode = stringToStreamPipeNode(htmlRender)
|
|
273
|
-
streamPipeNode(writable)
|
|
274
|
-
return true
|
|
275
|
-
}
|
|
276
|
-
if (isStreamReadableNode(htmlRender)) {
|
|
277
|
-
htmlRender.pipe(writable)
|
|
278
|
-
return true
|
|
279
|
-
}
|
|
280
|
-
if (isStreamPipeNode(htmlRender)) {
|
|
281
|
-
const streamPipeNode = getStreamPipeNode(htmlRender)
|
|
282
|
-
assert(streamPipeNode)
|
|
283
|
-
streamPipeNode(writable)
|
|
284
|
-
return true
|
|
285
|
-
}
|
|
286
|
-
if (isStreamReadableWeb(htmlRender) || isStreamPipeWeb(htmlRender)) {
|
|
287
|
-
return false
|
|
288
|
-
}
|
|
289
|
-
// checkType<never>(htmlRender)
|
|
290
|
-
assert(false)
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
async function processStream(
|
|
294
|
-
streamOriginal: StreamProviderAny,
|
|
295
|
-
{
|
|
296
|
-
injectStringAtBegin,
|
|
297
|
-
injectStringAfterFirstChunk,
|
|
298
|
-
injectStringAtEnd,
|
|
299
|
-
onErrorWhileStreaming,
|
|
300
|
-
enableEagerStreaming,
|
|
301
|
-
}: {
|
|
302
|
-
injectStringAtBegin?: () => Promise<string>
|
|
303
|
-
injectStringAfterFirstChunk?: () => string | null
|
|
304
|
-
injectStringAtEnd?: () => Promise<string>
|
|
305
|
-
onErrorWhileStreaming: (err: unknown) => void
|
|
306
|
-
enableEagerStreaming?: boolean
|
|
307
|
-
}
|
|
308
|
-
): Promise<StreamProviderNormalized> {
|
|
309
|
-
const buffer: unknown[] = []
|
|
310
|
-
let streamOriginalHasStartedEmitting = false
|
|
311
|
-
let streamOriginalEnded = false
|
|
312
|
-
let streamClosed = false
|
|
313
|
-
let onEndWasCalled = false
|
|
314
|
-
let isReadyToWrite = false
|
|
315
|
-
let wrapperCreated = false
|
|
316
|
-
let shouldFlushStream = false
|
|
317
|
-
let resolve: (result: StreamProviderNormalized) => void
|
|
318
|
-
let reject: (err: unknown) => void
|
|
319
|
-
let promiseHasResolved = false
|
|
320
|
-
let injectStringAfterFirstChunk_done = false
|
|
321
|
-
const streamWrapperPromise = new Promise<StreamProviderNormalized>(
|
|
322
|
-
(resolve_, reject_) => {
|
|
323
|
-
resolve = (streamWrapper) => {
|
|
324
|
-
promiseHasResolved = true
|
|
325
|
-
resolve_(streamWrapper)
|
|
326
|
-
}
|
|
327
|
-
reject = (err) => {
|
|
328
|
-
promiseHasResolved = true
|
|
329
|
-
reject_(err)
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
)
|
|
333
|
-
let resolveReadyToWrite: () => void
|
|
334
|
-
const promiseReadyToWrite = new Promise<void>(
|
|
335
|
-
(r) => (resolveReadyToWrite = r)
|
|
336
|
-
)
|
|
337
|
-
|
|
338
|
-
if (injectStringAtBegin) {
|
|
339
|
-
const injectedChunk: string = await injectStringAtBegin()
|
|
340
|
-
writeStream(injectedChunk) // Adds injectedChunk to buffer
|
|
341
|
-
flushStream() // Sets shouldFlushStream to true
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
// We call onStreamEvent() also when the stream ends in order to properly handle the situation when the stream didn't emit any data
|
|
345
|
-
const onStreamDataOrEnd = (cb: () => void) => {
|
|
346
|
-
assert(streamOriginalEnded === false)
|
|
347
|
-
streamOriginalHasStartedEmitting = true
|
|
348
|
-
cb()
|
|
349
|
-
if (wrapperCreated) resolvePromise()
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
const { streamWrapper, streamWrapperOperations } = await createStreamWrapper({
|
|
353
|
-
streamOriginal,
|
|
354
|
-
onReadyToWrite() {
|
|
355
|
-
debug("stream begin")
|
|
356
|
-
isReadyToWrite = true
|
|
357
|
-
flushBuffer()
|
|
358
|
-
resolveReadyToWrite()
|
|
359
|
-
},
|
|
360
|
-
onError(err) {
|
|
361
|
-
if (!promiseHasResolved) {
|
|
362
|
-
reject(err)
|
|
363
|
-
} else {
|
|
364
|
-
onErrorWhileStreaming(err)
|
|
365
|
-
}
|
|
366
|
-
},
|
|
367
|
-
onData(chunk: unknown) {
|
|
368
|
-
onStreamDataOrEnd(() => {
|
|
369
|
-
writeStream(chunk)
|
|
370
|
-
if (injectStringAfterFirstChunk && !injectStringAfterFirstChunk_done) {
|
|
371
|
-
const injectedChunk = injectStringAfterFirstChunk()
|
|
372
|
-
if (injectedChunk !== null) writeStream(injectedChunk)
|
|
373
|
-
injectStringAfterFirstChunk_done = true
|
|
374
|
-
}
|
|
375
|
-
})
|
|
376
|
-
},
|
|
377
|
-
async onEnd(
|
|
378
|
-
// Should we use this `isCancel`? Maybe we can skip `injectStringAtEnd()`?
|
|
379
|
-
isCancel
|
|
380
|
-
) {
|
|
381
|
-
try {
|
|
382
|
-
assert(!onEndWasCalled)
|
|
383
|
-
onEndWasCalled = true
|
|
384
|
-
debug("stream end")
|
|
385
|
-
// We call onStreamEvent() also here in case the stream didn't emit any data
|
|
386
|
-
onStreamDataOrEnd(() => {
|
|
387
|
-
streamOriginalEnded = true
|
|
388
|
-
})
|
|
389
|
-
if (injectStringAtEnd) {
|
|
390
|
-
const injectedChunk = await injectStringAtEnd()
|
|
391
|
-
writeStream(injectedChunk)
|
|
392
|
-
}
|
|
393
|
-
await promiseReadyToWrite // E.g. if the user calls the pipe wrapper after the original writable has ended
|
|
394
|
-
assert(isReady())
|
|
395
|
-
flushBuffer()
|
|
396
|
-
streamClosed = true
|
|
397
|
-
debug("stream ended")
|
|
398
|
-
} catch (err) {
|
|
399
|
-
// Ideally, we should catch and gracefully handle user land errors, as any error thrown here kills the server. (I assume that the fact it kills the server is a Node.js bug?)
|
|
400
|
-
|
|
401
|
-
// Show "[reveal][Bug] You stumbled upon a bug in Reveal's source code" to user while printing original error
|
|
402
|
-
if (!isBug(err)) {
|
|
403
|
-
console.error(err)
|
|
404
|
-
assert(false)
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
throw err
|
|
408
|
-
}
|
|
409
|
-
},
|
|
410
|
-
onFlush() {
|
|
411
|
-
flushStream()
|
|
412
|
-
},
|
|
413
|
-
})
|
|
414
|
-
wrapperCreated = true
|
|
415
|
-
|
|
416
|
-
flushBuffer() // In case onReadyToWrite() was already called (the flushBuffer() of onReadyToWrite() wasn't called because `wrapperCreated === false`)
|
|
417
|
-
|
|
418
|
-
if (!delayStreamStart()) resolvePromise()
|
|
419
|
-
|
|
420
|
-
return streamWrapperPromise
|
|
421
|
-
|
|
422
|
-
function writeStream(chunk: unknown) {
|
|
423
|
-
buffer.push(chunk)
|
|
424
|
-
flushBuffer()
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
function flushBuffer() {
|
|
428
|
-
if (!isReady()) return
|
|
429
|
-
assert(!streamClosed)
|
|
430
|
-
buffer.forEach((chunk) => {
|
|
431
|
-
streamWrapperOperations.writeChunk(chunk)
|
|
432
|
-
})
|
|
433
|
-
buffer.length = 0
|
|
434
|
-
if (shouldFlushStream) flushStream()
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
function resolvePromise() {
|
|
438
|
-
assert(!delayStreamStart()) // The stream promise shouldn't resolve before delayStreamStart()
|
|
439
|
-
assert(wrapperCreated) // Doesn't make sense to resolve streamWrapper if it isn't defined yet
|
|
440
|
-
debug("stream promise resolved")
|
|
441
|
-
resolve(streamWrapper)
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
function flushStream() {
|
|
445
|
-
if (!isReady()) {
|
|
446
|
-
shouldFlushStream = true
|
|
447
|
-
return
|
|
448
|
-
}
|
|
449
|
-
if (streamWrapperOperations.flushStream === null) return
|
|
450
|
-
streamWrapperOperations.flushStream()
|
|
451
|
-
shouldFlushStream = false
|
|
452
|
-
debug("stream flushed")
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
function isReady() {
|
|
456
|
-
/*
|
|
457
|
-
console.log('isReadyToWrite', isReadyToWrite)
|
|
458
|
-
console.log('wrapperCreated', wrapperCreated)
|
|
459
|
-
console.log('!delayStreamStart()', !delayStreamStart())
|
|
460
|
-
*/
|
|
461
|
-
return (
|
|
462
|
-
isReadyToWrite &&
|
|
463
|
-
// We can't use streamWrapperOperations.writeChunk() if it isn't defined yet
|
|
464
|
-
wrapperCreated &&
|
|
465
|
-
// See comment below
|
|
466
|
-
!delayStreamStart()
|
|
467
|
-
)
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
// Delay streaming, so that if the page shell fails then Reveal is able to render the error page.
|
|
471
|
-
// - We can't erase the previously written stream data => we need to delay streaming if we want to be able to restart rendering anew for the error page
|
|
472
|
-
// - This is what React expects.
|
|
473
|
-
// - Does this make sense for UI frameworks other than React?
|
|
474
|
-
// - We don't need this anymore if we implement a client-side recover mechanism.
|
|
475
|
-
// - I.e. rendering the error page on the client-side if there is an error during the stream.
|
|
476
|
-
// - We cannot do this with Server Routing
|
|
477
|
-
// - Emitting the wrong status code doesn't matter with libraries like react-streaming which automatically disable streaming for bots. (Emitting the right status code only matters for bots.)
|
|
478
|
-
function delayStreamStart() {
|
|
479
|
-
return !enableEagerStreaming && !streamOriginalHasStartedEmitting
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
async function createStreamWrapper({
|
|
484
|
-
streamOriginal,
|
|
485
|
-
onError,
|
|
486
|
-
onData,
|
|
487
|
-
onEnd,
|
|
488
|
-
onFlush,
|
|
489
|
-
onReadyToWrite,
|
|
490
|
-
}: {
|
|
491
|
-
streamOriginal: StreamProviderAny
|
|
492
|
-
onError: (err: unknown) => void
|
|
493
|
-
onData: (chunk: unknown) => void
|
|
494
|
-
onEnd: (isCancel?: boolean) => Promise<void>
|
|
495
|
-
onFlush: () => void
|
|
496
|
-
onReadyToWrite: () => void
|
|
497
|
-
}): Promise<{
|
|
498
|
-
streamWrapper: StreamProviderNormalized
|
|
499
|
-
streamWrapperOperations: {
|
|
500
|
-
writeChunk: (chunk: unknown) => void
|
|
501
|
-
flushStream: null | (() => void)
|
|
502
|
-
}
|
|
503
|
-
}> {
|
|
504
|
-
// Normalize react-streaming package streams
|
|
505
|
-
let streamToProcess: StreamProviderAny = streamOriginal
|
|
506
|
-
if (isStreamFromReactStreamingPackage(streamOriginal)) {
|
|
507
|
-
debug(`onRenderHtml() hook returned ${pc.cyan("react-streaming")} result`)
|
|
508
|
-
streamToProcess = getStreamOfReactStreamingPackage(streamOriginal) as StreamProviderAny
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
if (isStreamPipeNode(streamToProcess)) {
|
|
512
|
-
debug("onRenderHtml() hook returned Node.js Stream Pipe")
|
|
513
|
-
|
|
514
|
-
let writableOriginal: null | (StreamWritableNode & { flush?: () => void }) =
|
|
515
|
-
null
|
|
516
|
-
const pipeProxy: StreamPipeNode = (writable_: StreamWritableNode) => {
|
|
517
|
-
writableOriginal = writable_
|
|
518
|
-
debug("original Node.js Writable received")
|
|
519
|
-
onReadyToWrite()
|
|
520
|
-
if (hasEnded) {
|
|
521
|
-
// onReadyToWrite() already wrote everything; we can close the stream right away
|
|
522
|
-
writableOriginal.end()
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
stampPipe(pipeProxy, "node-stream")
|
|
526
|
-
const writeChunk = (chunk: unknown) => {
|
|
527
|
-
assert(writableOriginal)
|
|
528
|
-
writableOriginal.write(chunk)
|
|
529
|
-
debugWithChunk("data written (Node.js Writable)", chunk)
|
|
530
|
-
}
|
|
531
|
-
// For libraries such as https://www.npmjs.com/package/compression
|
|
532
|
-
// - React calls writable.flush() when available
|
|
533
|
-
// - https://github.com/revealjs/reveal/issues/466#issuecomment-1269601710
|
|
534
|
-
const flushStream = () => {
|
|
535
|
-
assert(writableOriginal)
|
|
536
|
-
if (typeof writableOriginal.flush === "function") {
|
|
537
|
-
writableOriginal.flush()
|
|
538
|
-
debug("stream flush() performed (Node.js Writable)")
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
let hasEnded = false
|
|
543
|
-
const endStream = () => {
|
|
544
|
-
hasEnded = true
|
|
545
|
-
if (writableOriginal) {
|
|
546
|
-
writableOriginal.end()
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
const { Writable } = await loadStreamNodeModule()
|
|
551
|
-
const writableProxy = new Writable({
|
|
552
|
-
async write(chunk, _encoding, callback) {
|
|
553
|
-
onData(chunk)
|
|
554
|
-
callback()
|
|
555
|
-
},
|
|
556
|
-
async destroy(err, callback) {
|
|
557
|
-
if (err) {
|
|
558
|
-
onError(err)
|
|
559
|
-
} else {
|
|
560
|
-
await onEnd()
|
|
561
|
-
}
|
|
562
|
-
callback(err)
|
|
563
|
-
endStream()
|
|
564
|
-
},
|
|
565
|
-
})
|
|
566
|
-
|
|
567
|
-
// Forward the flush() call
|
|
568
|
-
objectAssign(writableProxy, {
|
|
569
|
-
flush: () => {
|
|
570
|
-
onFlush()
|
|
571
|
-
},
|
|
572
|
-
})
|
|
573
|
-
assert(typeof writableProxy.flush === "function")
|
|
574
|
-
|
|
575
|
-
const pipeOriginal = getStreamPipeNode(streamToProcess)
|
|
576
|
-
assert(pipeOriginal)
|
|
577
|
-
pipeOriginal(writableProxy)
|
|
578
|
-
|
|
579
|
-
return {
|
|
580
|
-
streamWrapper: pipeProxy,
|
|
581
|
-
streamWrapperOperations: { writeChunk, flushStream },
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
if (isStreamPipeWeb(streamToProcess)) {
|
|
586
|
-
debug("onRenderHtml() hook returned Web Stream Pipe")
|
|
587
|
-
|
|
588
|
-
let writerOriginal: null | WritableStreamDefaultWriter<unknown> = null
|
|
589
|
-
const pipeProxy: StreamPipeWeb = (writableOriginal: StreamWritableWeb) => {
|
|
590
|
-
writerOriginal = writableOriginal.getWriter()
|
|
591
|
-
debug("original Web Writable received")
|
|
592
|
-
;(async () => {
|
|
593
|
-
// CloudFlare Workers does not implement `ready` property
|
|
594
|
-
// - https://github.com/vuejs/vue-next/issues/4287
|
|
595
|
-
try {
|
|
596
|
-
await writerOriginal.ready
|
|
597
|
-
} catch (e: unknown) {
|
|
598
|
-
// Ignore stream errors during ready check
|
|
599
|
-
}
|
|
600
|
-
onReadyToWrite()
|
|
601
|
-
if (hasEnded) {
|
|
602
|
-
// onReadyToWrite() already wrote everything; we can close the stream right away
|
|
603
|
-
writerOriginal.close()
|
|
604
|
-
}
|
|
605
|
-
})()
|
|
606
|
-
}
|
|
607
|
-
stampPipe(pipeProxy, "web-stream")
|
|
608
|
-
const writeChunk = (chunk: unknown) => {
|
|
609
|
-
assert(writerOriginal)
|
|
610
|
-
writerOriginal.write(encodeForWebStream(chunk))
|
|
611
|
-
debugWithChunk("data written (Web Writable)", chunk)
|
|
612
|
-
}
|
|
613
|
-
// Web Streams have compression built-in
|
|
614
|
-
// - https://developer.mozilla.org/en-US/docs/Web/API/Compression_Streams_API
|
|
615
|
-
// - It seems that there is no flush interface? Flushing just works automagically?
|
|
616
|
-
const flushStream = null
|
|
617
|
-
|
|
618
|
-
let hasEnded = false
|
|
619
|
-
const endStream = () => {
|
|
620
|
-
hasEnded = true
|
|
621
|
-
if (writerOriginal) {
|
|
622
|
-
writerOriginal.close()
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
let writableProxy: WritableStream<unknown>
|
|
627
|
-
if (typeof ReadableStream !== "function") {
|
|
628
|
-
writableProxy = new WritableStream({
|
|
629
|
-
write(chunk) {
|
|
630
|
-
onData(chunk)
|
|
631
|
-
},
|
|
632
|
-
async close() {
|
|
633
|
-
await onEnd()
|
|
634
|
-
endStream()
|
|
635
|
-
},
|
|
636
|
-
abort(err) {
|
|
637
|
-
onError(err)
|
|
638
|
-
endStream()
|
|
639
|
-
},
|
|
640
|
-
})
|
|
641
|
-
} else {
|
|
642
|
-
const { readable, writable } = new TransformStream()
|
|
643
|
-
writableProxy = writable
|
|
644
|
-
handleReadableWeb(readable, {
|
|
645
|
-
onData,
|
|
646
|
-
onError(err) {
|
|
647
|
-
onError(err)
|
|
648
|
-
endStream()
|
|
649
|
-
},
|
|
650
|
-
async onEnd() {
|
|
651
|
-
await onEnd()
|
|
652
|
-
endStream()
|
|
653
|
-
},
|
|
654
|
-
})
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
const pipeOriginal = getStreamPipeWeb(streamToProcess)
|
|
658
|
-
assert(pipeOriginal)
|
|
659
|
-
pipeOriginal(writableProxy)
|
|
660
|
-
|
|
661
|
-
return {
|
|
662
|
-
streamWrapper: pipeProxy,
|
|
663
|
-
streamWrapperOperations: { writeChunk, flushStream },
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
if (isStreamReadableWeb(streamToProcess)) {
|
|
668
|
-
debug("onRenderHtml() hook returned Web Readable")
|
|
669
|
-
|
|
670
|
-
const readableOriginal: StreamReadableWeb = streamToProcess as StreamReadableWeb
|
|
671
|
-
|
|
672
|
-
let controllerProxyIsClosed = false
|
|
673
|
-
let isClosed = false
|
|
674
|
-
let isCancel = false
|
|
675
|
-
const closeStream = async () => {
|
|
676
|
-
if (isClosed) return
|
|
677
|
-
isClosed = true
|
|
678
|
-
await onEnd(isCancel)
|
|
679
|
-
controllerProxy.close()
|
|
680
|
-
controllerProxyIsClosed = true
|
|
681
|
-
}
|
|
682
|
-
let controllerProxy: ReadableStreamController<unknown>
|
|
683
|
-
assertReadableStreamConstructor()
|
|
684
|
-
const readableProxy = new ReadableStream<unknown>({
|
|
685
|
-
start(controller) {
|
|
686
|
-
controllerProxy = controller
|
|
687
|
-
onReadyToWrite()
|
|
688
|
-
handleReadableWeb(readableOriginal, {
|
|
689
|
-
onData,
|
|
690
|
-
onError(err) {
|
|
691
|
-
onError(err)
|
|
692
|
-
controllerProxy.close()
|
|
693
|
-
},
|
|
694
|
-
async onEnd() {
|
|
695
|
-
await closeStream()
|
|
696
|
-
},
|
|
697
|
-
})
|
|
698
|
-
},
|
|
699
|
-
async cancel(...args) {
|
|
700
|
-
isCancel = true
|
|
701
|
-
await readableOriginal.cancel(...args)
|
|
702
|
-
// If readableOriginal has implemented readableOriginal.cancel() then the onEnd() callback and therfore closeStream() may already have been called at this point
|
|
703
|
-
await closeStream()
|
|
704
|
-
},
|
|
705
|
-
})
|
|
706
|
-
|
|
707
|
-
const writeChunk = (chunk: unknown) => {
|
|
708
|
-
if (
|
|
709
|
-
// If readableOriginal doesn't implement readableOriginal.cancel() then it may still emit data after we close the stream. We therefore need to check whether we closed `controllerProxy`.
|
|
710
|
-
!controllerProxyIsClosed
|
|
711
|
-
) {
|
|
712
|
-
controllerProxy.enqueue(encodeForWebStream(chunk) as any)
|
|
713
|
-
debugWithChunk("data written (Web Readable)", chunk)
|
|
714
|
-
} else {
|
|
715
|
-
debugWithChunk("data emitted but not written (Web Readable)", chunk)
|
|
716
|
-
}
|
|
717
|
-
}
|
|
718
|
-
// Readables don't have the notion of flushing
|
|
719
|
-
const flushStream = null
|
|
720
|
-
|
|
721
|
-
return {
|
|
722
|
-
streamWrapper: readableProxy as StreamProviderNormalized,
|
|
723
|
-
streamWrapperOperations: { writeChunk, flushStream },
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
|
|
727
|
-
if (isStreamReadableNode(streamToProcess)) {
|
|
728
|
-
debug("onRenderHtml() hook returned Node.js Readable")
|
|
729
|
-
|
|
730
|
-
const readableOriginal: StreamReadableNode = streamToProcess as StreamReadableNode
|
|
731
|
-
|
|
732
|
-
const { Readable } = await loadStreamNodeModule()
|
|
733
|
-
// Vue doesn't always set the read() handler: https://github.com/revealjs/reveal/issues/138#issuecomment-934743375
|
|
734
|
-
if (readableOriginal._read === Readable.prototype._read) {
|
|
735
|
-
readableOriginal._read = function () {}
|
|
736
|
-
}
|
|
737
|
-
|
|
738
|
-
const writeChunk = (chunk: unknown) => {
|
|
739
|
-
readableProxy.push(chunk)
|
|
740
|
-
debugWithChunk("data written (Node.js Readable)", chunk)
|
|
741
|
-
}
|
|
742
|
-
// Readables don't have the notion of flushing
|
|
743
|
-
const flushStream = null
|
|
744
|
-
const closeProxy = () => {
|
|
745
|
-
readableProxy.push(null)
|
|
746
|
-
}
|
|
747
|
-
const readableProxy: StreamReadableNode = new Readable({ read() {} })
|
|
748
|
-
|
|
749
|
-
onReadyToWrite()
|
|
750
|
-
|
|
751
|
-
readableOriginal.on("data", (chunk) => {
|
|
752
|
-
onData(chunk)
|
|
753
|
-
})
|
|
754
|
-
readableOriginal.on("error", (err) => {
|
|
755
|
-
onError(err)
|
|
756
|
-
closeProxy()
|
|
757
|
-
})
|
|
758
|
-
readableOriginal.on("end", async () => {
|
|
759
|
-
await onEnd()
|
|
760
|
-
closeProxy()
|
|
761
|
-
})
|
|
762
|
-
|
|
763
|
-
return {
|
|
764
|
-
streamWrapper: readableProxy as StreamProviderNormalized,
|
|
765
|
-
streamWrapperOperations: { writeChunk, flushStream },
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
|
|
769
|
-
assert(false)
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
async function handleReadableWeb(
|
|
773
|
-
readable: ReadableStream,
|
|
774
|
-
{
|
|
775
|
-
onData,
|
|
776
|
-
onError,
|
|
777
|
-
onEnd,
|
|
778
|
-
}: {
|
|
779
|
-
onData: (chunk: unknown) => void
|
|
780
|
-
onError: (err: unknown) => void
|
|
781
|
-
onEnd: () => Promise<void>
|
|
782
|
-
}
|
|
783
|
-
) {
|
|
784
|
-
const reader = readable.getReader()
|
|
785
|
-
while (true) {
|
|
786
|
-
let result: ReadableStreamReadResult<unknown>
|
|
787
|
-
try {
|
|
788
|
-
result = await reader.read()
|
|
789
|
-
} catch (err) {
|
|
790
|
-
onError(err)
|
|
791
|
-
return
|
|
792
|
-
}
|
|
793
|
-
const { value, done } = result
|
|
794
|
-
if (done) {
|
|
795
|
-
break
|
|
796
|
-
}
|
|
797
|
-
onData(value)
|
|
798
|
-
}
|
|
799
|
-
await onEnd()
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
function isStream(something: unknown): something is StreamProviderAny {
|
|
803
|
-
if (
|
|
804
|
-
isStreamReadableWeb(something) ||
|
|
805
|
-
isStreamReadableNode(something) ||
|
|
806
|
-
isStreamPipeNode(something) ||
|
|
807
|
-
isStreamPipeWeb(something) ||
|
|
808
|
-
isStreamFromReactStreamingPackage(something)
|
|
809
|
-
) {
|
|
810
|
-
checkType<StreamProviderAny>(something)
|
|
811
|
-
return true
|
|
812
|
-
}
|
|
813
|
-
return false
|
|
814
|
-
}
|
|
815
|
-
|
|
816
|
-
function getStreamPipeWeb(thing: unknown): null | StreamPipeWeb {
|
|
817
|
-
if (!isStreamPipeWeb(thing)) {
|
|
818
|
-
return null
|
|
819
|
-
}
|
|
820
|
-
assert(isCallable(thing) && "isWebStreamPipe" in thing)
|
|
821
|
-
return thing
|
|
822
|
-
}
|
|
823
|
-
function isStreamPipeWeb(thing: unknown): thing is StreamPipeWeb {
|
|
824
|
-
if (isCallable(thing) && "isWebStreamPipe" in thing) {
|
|
825
|
-
return true
|
|
826
|
-
}
|
|
827
|
-
return false
|
|
828
|
-
}
|
|
829
|
-
|
|
830
|
-
function getStreamPipeNode(thing: unknown): null | StreamPipeNode {
|
|
831
|
-
if (!isStreamPipeNode(thing)) {
|
|
832
|
-
return null
|
|
833
|
-
}
|
|
834
|
-
assert(isCallable(thing) && "isNodeStreamPipe" in thing)
|
|
835
|
-
return thing
|
|
836
|
-
}
|
|
837
|
-
function isStreamPipeNode(thing: unknown): thing is StreamPipeNode {
|
|
838
|
-
if (isCallable(thing) && "isNodeStreamPipe" in thing) {
|
|
839
|
-
return true
|
|
840
|
-
}
|
|
841
|
-
return false
|
|
842
|
-
}
|
|
843
|
-
|
|
844
|
-
function stampPipe(
|
|
845
|
-
pipe: StreamPipeNode | StreamPipeWeb,
|
|
846
|
-
pipeType: "web-stream" | "node-stream"
|
|
847
|
-
) {
|
|
848
|
-
assertUsage(
|
|
849
|
-
pipeType,
|
|
850
|
-
`stampPipe(pipe, pipeType): argument ${pc.cyan("pipeType")} is missing.)`,
|
|
851
|
-
{
|
|
852
|
-
showStackTrace: true,
|
|
853
|
-
}
|
|
854
|
-
)
|
|
855
|
-
assertUsage(
|
|
856
|
-
["web-stream", "node-stream"].includes(pipeType),
|
|
857
|
-
`stampPipe(pipe, pipeType): argument ${pc.cyan("pipeType")} should be either ${pc.cyan(
|
|
858
|
-
"'web-stream'"
|
|
859
|
-
)} or ${pc.cyan("'node-stream'")}.`,
|
|
860
|
-
{ showStackTrace: true }
|
|
861
|
-
)
|
|
862
|
-
if (pipeType === "node-stream") {
|
|
863
|
-
Object.assign(pipe, { isNodeStreamPipe: true })
|
|
864
|
-
} else {
|
|
865
|
-
Object.assign(pipe, { isWebStreamPipe: true })
|
|
866
|
-
}
|
|
867
|
-
}
|
|
868
|
-
|
|
869
|
-
type StreamPipe = (writable: StreamWritableNode | StreamWritableWeb) => void
|
|
870
|
-
const __streamPipe = "__streamPipe"
|
|
871
|
-
type StreamPipeWrapped = { [__streamPipe]: StreamPipe }
|
|
872
|
-
function pipeStream(pipe: StreamPipe): StreamPipeWrapped {
|
|
873
|
-
return { [__streamPipe]: pipe }
|
|
874
|
-
}
|
|
875
|
-
|
|
876
|
-
async function streamToString(stream: StreamProviderAny): Promise<string> {
|
|
877
|
-
if (isStreamReadableWeb(stream)) {
|
|
878
|
-
return await streamReadableWebToString(stream)
|
|
879
|
-
}
|
|
880
|
-
if (isStreamReadableNode(stream)) {
|
|
881
|
-
return await streamReadableNodeToString(stream)
|
|
882
|
-
}
|
|
883
|
-
if (isStreamPipeNode(stream)) {
|
|
884
|
-
const pipeNode = getStreamPipeNode(stream)
|
|
885
|
-
assert(pipeNode)
|
|
886
|
-
return await streamPipeNodeToString(pipeNode)
|
|
887
|
-
}
|
|
888
|
-
if (isStreamPipeWeb(stream)) {
|
|
889
|
-
const pipeWeb = getStreamPipeWeb(stream)
|
|
890
|
-
assert(pipeWeb)
|
|
891
|
-
return await streamPipeWebToString(pipeWeb)
|
|
892
|
-
}
|
|
893
|
-
if (isStreamFromReactStreamingPackage(stream)) {
|
|
894
|
-
const result = await streamFromReactStreamingPackageToString(stream)
|
|
895
|
-
if (result === undefined) {
|
|
896
|
-
throw new Error(
|
|
897
|
-
"streamFromReactStreamingPackageToString returned undefined"
|
|
898
|
-
)
|
|
899
|
-
}
|
|
900
|
-
return result
|
|
901
|
-
}
|
|
902
|
-
assert(false)
|
|
903
|
-
}
|
|
904
|
-
|
|
905
|
-
function assertReadableStreamConstructor() {
|
|
906
|
-
assertUsage(
|
|
907
|
-
typeof ReadableStream === "function",
|
|
908
|
-
// Error message copied from vue's renderToWebStream() implementation
|
|
909
|
-
"ReadableStream constructor isn't available in the global scope. " +
|
|
910
|
-
"If the target environment does support web streams, consider using " +
|
|
911
|
-
"pipeToWebWritable() with an existing WritableStream instance instead."
|
|
912
|
-
)
|
|
913
|
-
}
|
|
914
|
-
|
|
915
|
-
let encoder: TextEncoder
|
|
916
|
-
function encodeForWebStream(thing: unknown) {
|
|
917
|
-
if (!encoder) {
|
|
918
|
-
encoder = new TextEncoder()
|
|
919
|
-
}
|
|
920
|
-
if (typeof thing === "string") {
|
|
921
|
-
return encoder.encode(thing)
|
|
922
|
-
}
|
|
923
|
-
return thing
|
|
924
|
-
}
|
|
925
|
-
|
|
926
|
-
// Because of Cloudflare Workers, we cannot statically import the `stream` module, instead we dynamically import it.
|
|
927
|
-
async function loadStreamNodeModule(): Promise<{
|
|
928
|
-
Readable: typeof Readable_
|
|
929
|
-
Writable: typeof Writable_
|
|
930
|
-
}> {
|
|
931
|
-
const streamModule = (await import_("stream")).default as Awaited<
|
|
932
|
-
typeof import("stream")
|
|
933
|
-
>
|
|
934
|
-
const { Readable, Writable } = streamModule
|
|
935
|
-
return { Readable, Writable }
|
|
936
|
-
}
|
|
937
|
-
|
|
938
|
-
function getStreamName(
|
|
939
|
-
kind: "pipe" | "readable" | "writable",
|
|
940
|
-
type: "web" | "node"
|
|
941
|
-
): `a ${string} Stream` | `a ${string} Stream Pipe` {
|
|
942
|
-
let typeName = capitalizeFirstLetter(type)
|
|
943
|
-
if (typeName === "Node") {
|
|
944
|
-
typeName = "Node.js"
|
|
945
|
-
}
|
|
946
|
-
const kindName = capitalizeFirstLetter(kind)
|
|
947
|
-
if (kind !== "pipe") {
|
|
948
|
-
return `a ${kindName} ${typeName} Stream`
|
|
949
|
-
}
|
|
950
|
-
if (kind === "pipe") {
|
|
951
|
-
return `a ${typeName} Stream Pipe`
|
|
952
|
-
}
|
|
953
|
-
assert(false)
|
|
954
|
-
}
|
|
955
|
-
|
|
956
|
-
function inferStreamName(stream: StreamProviderNormalized) {
|
|
957
|
-
if (isStreamReadableWeb(stream)) {
|
|
958
|
-
return getStreamName("readable", "web")
|
|
959
|
-
}
|
|
960
|
-
if (isStreamReadableNode(stream)) {
|
|
961
|
-
return getStreamName("readable", "node")
|
|
962
|
-
}
|
|
963
|
-
if (isStreamPipeNode(stream)) {
|
|
964
|
-
return getStreamName("pipe", "node")
|
|
965
|
-
}
|
|
966
|
-
if (isStreamPipeWeb(stream)) {
|
|
967
|
-
return getStreamName("pipe", "web")
|
|
968
|
-
}
|
|
969
|
-
assert(false)
|
|
970
|
-
}
|
|
971
|
-
|
|
972
|
-
function decodeChunks() {
|
|
973
|
-
const decoder = new TextDecoder()
|
|
974
|
-
const decode = (chunk: unknown): string => {
|
|
975
|
-
if (typeof chunk === "string") {
|
|
976
|
-
return chunk
|
|
977
|
-
} else if (chunk instanceof Uint8Array) {
|
|
978
|
-
return decoder.decode(chunk, { stream: true })
|
|
979
|
-
} else {
|
|
980
|
-
assert(false)
|
|
981
|
-
}
|
|
982
|
-
}
|
|
983
|
-
// https://github.com/revealjs/reveal/pull/1799#discussion_r1713554096
|
|
984
|
-
const getClosingChunk = (): string => {
|
|
985
|
-
return decoder.decode()
|
|
986
|
-
}
|
|
987
|
-
return { decode, getClosingChunk }
|
|
988
|
-
}
|
|
989
|
-
|
|
990
|
-
function debugWithChunk(msg: string, chunk: unknown): void {
|
|
991
|
-
if (!debug.isActivated) return
|
|
992
|
-
|
|
993
|
-
let chunkStr: string
|
|
994
|
-
try {
|
|
995
|
-
chunkStr = new TextDecoder().decode(chunk as any)
|
|
996
|
-
} catch (err) {
|
|
997
|
-
chunkStr = String(chunk)
|
|
998
|
-
}
|
|
999
|
-
|
|
1000
|
-
debug(msg, chunkStr)
|
|
1001
|
-
}
|