vike 0.4.195-commit-486b49a → 0.4.195-commit-f7e91ba
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/cjs/__internal/index.js +3 -4
- package/dist/cjs/node/cli/onLoad.js +1 -2
- package/dist/cjs/node/createPageRenderer.js +1 -2
- package/dist/cjs/node/plugin/index.js +3 -3
- package/dist/cjs/node/plugin/onLoad.js +1 -2
- package/dist/cjs/node/plugin/plugins/autoFullBuild.js +1 -2
- package/dist/cjs/node/plugin/plugins/baseUrls.js +1 -2
- package/dist/cjs/node/plugin/plugins/buildConfig/fixServerAssets.js +2 -3
- package/dist/cjs/node/plugin/plugins/buildConfig.js +4 -4
- package/dist/cjs/node/plugin/plugins/commonConfig/assertResolveAlias.js +1 -2
- package/dist/cjs/node/plugin/plugins/commonConfig.js +1 -2
- package/dist/cjs/node/plugin/plugins/config/assertVikeConfig.js +1 -2
- package/dist/cjs/node/plugin/plugins/config/index.js +1 -2
- package/dist/cjs/node/plugin/plugins/config/pickFirst.js +1 -2
- package/dist/cjs/node/plugin/plugins/config/resolveBase.js +2 -3
- package/dist/cjs/node/plugin/plugins/devConfig/determineFsAllowList.js +1 -2
- package/dist/cjs/node/plugin/plugins/devConfig/determineOptimizeDeps.js +1 -2
- package/dist/cjs/node/plugin/plugins/devConfig/index.js +1 -2
- package/dist/cjs/node/plugin/plugins/distFileNames.js +1 -2
- package/dist/cjs/node/plugin/plugins/envVars.js +1 -2
- package/dist/cjs/node/plugin/plugins/extractAssetsPlugin.js +2 -2
- package/dist/cjs/node/plugin/plugins/extractExportNamesPlugin.js +3 -3
- package/dist/cjs/node/plugin/plugins/fileEnv.js +109 -88
- package/dist/cjs/node/plugin/plugins/importBuild/getVikeManifest.js +1 -2
- package/dist/cjs/node/plugin/plugins/importBuild/index.js +2 -3
- package/dist/cjs/node/plugin/plugins/importUserCode/addImportStatement.js +1 -2
- package/dist/cjs/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.js +1 -3
- package/dist/cjs/node/plugin/plugins/importUserCode/index.js +1 -2
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/assertExtensions.js +2 -3
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getConfigFileExport.js +1 -2
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +1 -2
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js +8 -9
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.js +3 -4
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolvePointerImport.js +3 -4
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transformFileImports.js +3 -4
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +4 -5
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +6 -6
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.js +1 -2
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigs.js +1 -2
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/isRuntimeEnvMatch.js +1 -2
- package/dist/cjs/node/plugin/plugins/packageJsonFile.js +1 -2
- package/dist/cjs/node/plugin/plugins/previewConfig.js +1 -2
- package/dist/cjs/node/plugin/plugins/removeRequireHookPlugin.js +1 -2
- package/dist/cjs/node/plugin/plugins/setGlobalContext.js +1 -2
- package/dist/cjs/node/plugin/plugins/suppressRollupWarning.js +1 -2
- package/dist/cjs/node/plugin/plugins/workaroundCssModuleHmr.js +1 -2
- package/dist/cjs/node/plugin/resolveClientEntriesDev.js +1 -2
- package/dist/cjs/node/plugin/shared/addSsrMiddleware.js +1 -2
- package/dist/cjs/node/plugin/shared/findPageFiles.js +1 -2
- package/dist/cjs/node/plugin/shared/getAssetsDir.js +1 -2
- package/dist/cjs/node/plugin/shared/getFilePath.js +8 -9
- package/dist/cjs/node/plugin/shared/getHttpRequestAsyncStore.js +2 -3
- package/dist/cjs/node/plugin/shared/isAsset.js +1 -2
- package/dist/cjs/node/plugin/shared/isViteCliCall.js +2 -3
- package/dist/cjs/node/plugin/shared/loggerNotProd/errorWithCodeSnippet.js +4 -5
- package/dist/cjs/node/plugin/shared/loggerNotProd/log.js +4 -5
- package/dist/cjs/node/plugin/shared/loggerNotProd.js +6 -7
- package/dist/cjs/node/plugin/shared/loggerVite/removeSuperfluousViteLog.js +3 -4
- package/dist/cjs/node/plugin/shared/loggerVite.js +1 -2
- package/dist/cjs/node/plugin/shared/parseEsModule.js +2 -3
- package/dist/cjs/node/plugin/shared/rollupIsEsm.js +1 -2
- package/dist/cjs/node/plugin/shared/rollupSourceMap.js +2 -3
- package/dist/cjs/node/prerender/runPrerender.js +4 -5
- package/dist/cjs/node/runtime/globalContext/loadImportBuild.js +2 -3
- package/dist/cjs/node/runtime/globalContext.js +13 -14
- package/dist/cjs/node/runtime/html/injectAssets/getHtmlTags.js +1 -2
- package/dist/cjs/node/runtime/html/injectAssets/getViteDevScript.js +1 -2
- package/dist/cjs/node/runtime/html/injectAssets/inferHtmlTags.js +4 -4
- package/dist/cjs/node/runtime/html/injectAssets/injectAssets__public.js +1 -2
- package/dist/cjs/node/runtime/html/injectAssets/injectHtmlTags.js +6 -7
- package/dist/cjs/node/runtime/html/injectAssets/mergeScriptTags.js +1 -2
- package/dist/cjs/node/runtime/html/injectAssets/sanitizeJson.js +1 -2
- package/dist/cjs/node/runtime/html/injectAssets.js +2 -3
- package/dist/cjs/node/runtime/html/renderHtml.js +5 -6
- package/dist/cjs/node/runtime/html/serializePageContextClientSide.js +2 -3
- package/dist/cjs/node/runtime/html/stream/react-streaming.js +3 -4
- package/dist/cjs/node/runtime/html/stream.js +21 -22
- package/dist/cjs/node/runtime/onLoad.js +1 -2
- package/dist/cjs/node/runtime/page-files/getPageFilesExports.js +1 -2
- package/dist/cjs/node/runtime/renderPage/analyzePage.js +1 -2
- package/dist/cjs/node/runtime/renderPage/assertArguments.js +1 -2
- package/dist/cjs/node/runtime/renderPage/createHttpResponse/assertNoInfiniteHttpRedirect.js +1 -2
- package/dist/cjs/node/runtime/renderPage/createHttpResponse/getCacheControl.js +1 -2
- package/dist/cjs/node/runtime/renderPage/createHttpResponse.js +5 -6
- package/dist/cjs/node/runtime/renderPage/debugPageFiles.js +1 -2
- package/dist/cjs/node/runtime/renderPage/executeOnBeforeRenderAndDataHooks.js +1 -2
- package/dist/cjs/node/runtime/renderPage/executeOnRenderHtmlHook.js +1 -2
- package/dist/cjs/node/runtime/renderPage/getEarlyHints.js +1 -2
- package/dist/cjs/node/runtime/renderPage/getHttpResponseBody.js +2 -3
- package/dist/cjs/node/runtime/renderPage/getPageAssets/getManifestEntry.js +1 -2
- package/dist/cjs/node/runtime/renderPage/getPageAssets/retrieveAssetsDev.js +1 -2
- package/dist/cjs/node/runtime/renderPage/getPageAssets/retrieveAssetsProd.js +1 -2
- package/dist/cjs/node/runtime/renderPage/getPageAssets/sortPageAssetsForEarlyHintsHeader.js +1 -2
- package/dist/cjs/node/runtime/renderPage/getPageAssets.js +2 -3
- package/dist/cjs/node/runtime/renderPage/handleErrorWithoutErrorPage.js +1 -2
- package/dist/cjs/node/runtime/renderPage/handlePageContextRequestUrl.js +1 -2
- package/dist/cjs/node/runtime/renderPage/inferMediaType.js +1 -2
- package/dist/cjs/node/runtime/renderPage/isNewError.js +2 -3
- package/dist/cjs/node/runtime/renderPage/loadUserFilesServerSide.js +1 -2
- package/dist/cjs/node/runtime/renderPage/log404/index.js +2 -3
- package/dist/cjs/node/runtime/renderPage/logErrorHint.js +2 -3
- package/dist/cjs/node/runtime/renderPage/loggerProd.js +2 -3
- package/dist/cjs/node/runtime/renderPage/loggerRuntime.js +2 -2
- package/dist/cjs/node/runtime/renderPage/preparePageContextForUserConsumptionServerSide.js +1 -2
- package/dist/cjs/node/runtime/renderPage/renderPageAlreadyRouted.js +5 -6
- package/dist/cjs/node/runtime/renderPage/resolveRedirects.js +2 -3
- package/dist/cjs/node/runtime/renderPage.js +2 -2
- package/dist/cjs/node/shared/assertPluginManifest.js +1 -2
- package/dist/cjs/node/shared/assertRuntimeManifest.js +1 -2
- package/dist/cjs/node/shared/assertV1Design.js +1 -2
- package/dist/cjs/node/shared/extractAssetsQuery.js +2 -3
- package/dist/cjs/node/shared/getConfigVike.js +1 -2
- package/dist/cjs/node/shared/isErrorDebug.js +1 -2
- package/dist/cjs/node/shared/prependEntriesDir.js +1 -2
- package/dist/cjs/node/shared/virtual-files/virtualFileImportUserCode.js +2 -2
- package/dist/cjs/node/shared/virtual-files/virtualFilePageConfigValuesAll.js +2 -3
- package/dist/cjs/shared/addIs404ToPageProps.js +1 -2
- package/dist/cjs/shared/assertHookReturnedObject.js +1 -2
- package/dist/cjs/shared/assertOnBeforeRenderHookReturn.js +1 -2
- package/dist/cjs/shared/assertPageContextProvidedByUser.js +1 -2
- package/dist/cjs/shared/assertPageFilePath.js +1 -2
- package/dist/cjs/shared/determinePageIdOld.js +1 -2
- package/dist/cjs/shared/error-page.js +3 -4
- package/dist/cjs/shared/getPageContextRequestUrl.js +2 -2
- package/dist/cjs/shared/getPageContextUrlComputed.js +2 -3
- package/dist/cjs/shared/getPageFiles/analyzeClientSide.js +1 -2
- package/dist/cjs/shared/getPageFiles/analyzePageClientSide/analyzeExports.js +1 -2
- package/dist/cjs/shared/getPageFiles/analyzePageClientSide/determineClientEntry.js +2 -3
- package/dist/cjs/shared/getPageFiles/analyzePageClientSide/getExportNames.js +1 -2
- package/dist/cjs/shared/getPageFiles/analyzePageClientSide.js +2 -3
- package/dist/cjs/shared/getPageFiles/analyzePageServerSide.js +1 -2
- package/dist/cjs/shared/getPageFiles/assert_exports_old_design.js +3 -3
- package/dist/cjs/shared/getPageFiles/fileTypes.js +3 -3
- package/dist/cjs/shared/getPageFiles/getAllPageIdFiles.js +2 -3
- package/dist/cjs/shared/getPageFiles/getExports.js +1 -2
- package/dist/cjs/shared/getPageFiles/getPageFileObject.js +1 -2
- package/dist/cjs/shared/getPageFiles/parseGlobResults.js +1 -2
- package/dist/cjs/shared/getPageFiles/setPageFiles.js +3 -4
- package/dist/cjs/shared/hooks/executeHook.js +4 -5
- package/dist/cjs/shared/hooks/getHook.js +6 -7
- package/dist/cjs/shared/modifyUrl.js +1 -2
- package/dist/cjs/shared/page-configs/assertPlusFileExport.js +1 -2
- package/dist/cjs/shared/page-configs/findPageConfig.js +1 -2
- package/dist/cjs/shared/page-configs/getConfigDefinedAt.js +3 -4
- package/dist/cjs/shared/page-configs/getConfigValue.js +2 -3
- package/dist/cjs/shared/page-configs/getConfigValueBuildTime.js +1 -2
- package/dist/cjs/shared/page-configs/getExportPath.js +1 -2
- package/dist/cjs/shared/page-configs/helpers.js +3 -4
- package/dist/cjs/shared/page-configs/loadConfigValues.js +1 -2
- package/dist/cjs/shared/page-configs/serialize/parsePageConfigs.js +2 -3
- package/dist/cjs/shared/page-configs/serialize/serializeConfigValues.js +1 -2
- package/dist/cjs/shared/route/abort.js +9 -10
- package/dist/cjs/shared/route/debug.js +1 -2
- package/dist/cjs/shared/route/deduceRouteStringFromFilesystemPath.js +1 -2
- package/dist/cjs/shared/route/executeGuardHook.js +1 -2
- package/dist/cjs/shared/route/executeOnBeforeRouteHook.js +1 -2
- package/dist/cjs/shared/route/index.js +1 -2
- package/dist/cjs/shared/route/loadPageRoutes.js +1 -2
- package/dist/cjs/shared/route/resolvePrecedence.js +1 -2
- package/dist/cjs/shared/route/resolveRoute.js +1 -2
- package/dist/cjs/shared/route/resolveRouteFunction.js +4 -5
- package/dist/cjs/shared/route/resolveRouteString.js +6 -7
- package/dist/cjs/shared/route/resolveUrlPathname.js +1 -2
- package/dist/cjs/shared/sortPageContext.js +1 -2
- package/dist/cjs/types/defineConfig.js +1 -2
- package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
- package/dist/cjs/utils/assert.js +10 -11
- package/dist/cjs/utils/assertIsBrowser.js +1 -2
- package/dist/cjs/utils/assertIsNotBrowser.js +1 -2
- package/dist/cjs/utils/assertIsNotProductionRuntime.js +6 -6
- package/dist/cjs/utils/assertKeys.js +1 -2
- package/dist/cjs/utils/assertNodeEnv.js +5 -6
- package/dist/cjs/utils/assertNodeVersion.js +1 -2
- package/dist/cjs/utils/assertRoutingType.js +3 -4
- package/dist/cjs/utils/assertSingleInstance.js +3 -4
- package/dist/cjs/utils/assertVersion.js +2 -3
- package/dist/cjs/utils/augmentType.js +1 -2
- package/dist/cjs/utils/capitalizeFirstLetter.js +1 -2
- package/dist/cjs/utils/cast.js +2 -3
- package/dist/cjs/utils/changeEnumerable.js +1 -2
- package/dist/cjs/utils/checkType.js +2 -3
- package/dist/cjs/utils/compareString.js +1 -2
- package/dist/cjs/utils/createErrorWithCleanStackTrace.js +1 -2
- package/dist/cjs/utils/debug.js +2 -3
- package/dist/cjs/utils/deepEqual.js +1 -2
- package/dist/cjs/utils/escapeHtml.js +1 -2
- package/dist/cjs/utils/escapeRegex.js +1 -2
- package/dist/cjs/utils/filesystemPathHandling.js +2 -3
- package/dist/cjs/utils/findFile.js +1 -2
- package/dist/cjs/utils/findPackageJson.js +1 -2
- package/dist/cjs/utils/formatHintLog.js +1 -2
- package/dist/cjs/utils/freezePartial.js +1 -2
- package/dist/cjs/utils/genPromise.js +1 -2
- package/dist/cjs/utils/getCurrentUrl.js +1 -2
- package/dist/cjs/utils/getFileExtension.js +1 -2
- package/dist/cjs/utils/getGlobalObject.js +2 -3
- package/dist/cjs/utils/getMostSimilar.js +1 -2
- package/dist/cjs/utils/getOutDirs.js +2 -3
- package/dist/cjs/utils/getPropAccessNotation.js +1 -2
- package/dist/cjs/utils/getRandomId.js +1 -2
- package/dist/cjs/utils/getTerminWidth.js +1 -2
- package/dist/cjs/utils/getValuePrintable.js +1 -2
- package/dist/cjs/utils/hasProp.js +1 -2
- package/dist/cjs/utils/humanizeTime.js +1 -2
- package/dist/cjs/utils/includes.js +1 -2
- package/dist/cjs/utils/injectRollupInputs.js +2 -3
- package/dist/cjs/utils/isArray.js +1 -2
- package/dist/cjs/utils/isArrayOfStrings.js +1 -2
- package/dist/cjs/utils/isBrowser.js +1 -2
- package/dist/cjs/utils/isCallable.js +1 -2
- package/dist/cjs/utils/isDev.js +2 -3
- package/dist/cjs/utils/isFilePathAbsoluteFilesystem.js +2 -3
- package/dist/cjs/utils/isHtml.js +1 -2
- package/dist/cjs/utils/isNodeJS.js +1 -2
- package/dist/cjs/utils/isNpmPackage.js +5 -6
- package/dist/cjs/utils/isObject.js +1 -2
- package/dist/cjs/utils/isObjectOfStrings.js +1 -2
- package/dist/cjs/utils/isObjectWithKeys.js +1 -2
- package/dist/cjs/utils/isPlainObject.js +1 -2
- package/dist/cjs/utils/isPromise.js +1 -2
- package/dist/cjs/utils/isPropertyGetter.js +1 -2
- package/dist/cjs/utils/isReact.js +1 -2
- package/dist/cjs/utils/isSameErrorMessage.js +1 -2
- package/dist/cjs/utils/isScriptFile.js +4 -4
- package/dist/cjs/utils/isVikeReactApp.js +1 -2
- package/dist/cjs/utils/isVitest.js +1 -2
- package/dist/cjs/utils/joinEnglish.js +1 -2
- package/dist/cjs/utils/normalizeHeaders.js +1 -2
- package/dist/cjs/utils/objectAssign.js +1 -2
- package/dist/cjs/utils/objectDefineProperty.js +1 -2
- package/dist/cjs/utils/objectEntries.js +1 -2
- package/dist/cjs/utils/objectEntriesForEach.js +1 -2
- package/dist/cjs/utils/objectFromEntries.js +1 -2
- package/dist/cjs/utils/objectKeys.js +1 -2
- package/dist/cjs/utils/onPageVisibilityChange.js +2 -3
- package/dist/cjs/utils/pLimit.js +1 -2
- package/dist/cjs/utils/parseUrl-extras.js +8 -9
- package/dist/cjs/utils/parseUrl.js +11 -12
- package/dist/cjs/utils/path-shim.js +1 -2
- package/dist/cjs/utils/redirectHard.js +1 -2
- package/dist/cjs/utils/removeEmptyLines.js +1 -2
- package/dist/cjs/utils/removeFileExtention.js +1 -2
- package/dist/cjs/utils/requireResolve.js +1 -2
- package/dist/cjs/utils/sleep.js +1 -2
- package/dist/cjs/utils/slice.js +1 -2
- package/dist/cjs/utils/sorter.js +5 -6
- package/dist/cjs/utils/stringifyStringArray.js +1 -2
- package/dist/cjs/utils/stripAnsi.js +1 -2
- package/dist/cjs/utils/throttle.js +1 -2
- package/dist/cjs/utils/trimWithAnsi.js +2 -3
- package/dist/cjs/utils/truncateString.js +1 -2
- package/dist/cjs/utils/unique.js +1 -2
- package/dist/cjs/utils/urlToFile.js +2 -2
- package/dist/cjs/utils/virtual-files.js +3 -4
- package/dist/cjs/utils/viteIsSSR.js +2 -3
- package/dist/cjs/utils/warnIfErrorIsNotObject.js +1 -2
- package/dist/esm/client/client-routing-runtime/installClientRouter.js +2 -4
- package/dist/esm/client/client-routing-runtime/navigate.js +3 -1
- package/dist/esm/client/client-routing-runtime/renderPageClientSide.d.ts +2 -0
- package/dist/esm/client/client-routing-runtime/renderPageClientSide.js +14 -2
- package/dist/esm/client/client-routing-runtime/skipLink.js +1 -1
- package/dist/esm/client/client-routing-runtime/utils.d.ts +1 -0
- package/dist/esm/client/client-routing-runtime/utils.js +1 -0
- package/dist/esm/node/plugin/plugins/fileEnv.js +109 -87
- package/dist/esm/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.js +0 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/debug.d.ts +2 -2
- package/dist/esm/node/runtime/html/stream.d.ts +0 -1
- package/dist/esm/node/runtime/index-deprecated.d.ts +1 -1
- package/dist/esm/node/runtime/renderPage/getHttpResponseBody.d.ts +0 -1
- package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.d.ts +6 -6
- package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/esm/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/utils/debugGlob.d.ts +2 -2
- package/dist/esm/utils/genPromise.d.ts +1 -1
- package/dist/esm/utils/projectInfo.d.ts +1 -1
- package/package.json +2 -2
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Unit tests at ./injectHtmlTags.spec.ts
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.injectHtmlTags = injectHtmlTags;
|
|
5
|
+
exports.injectHtmlTagsUsingStream = injectHtmlTagsUsingStream;
|
|
6
|
+
exports.createHtmlHeadIfMissing = createHtmlHeadIfMissing;
|
|
7
|
+
exports.joinHtmlTags = joinHtmlTags;
|
|
8
|
+
exports.injectAtOpeningTag = injectAtOpeningTag;
|
|
9
|
+
exports.injectAtClosingTag = injectAtClosingTag;
|
|
5
10
|
const utils_js_1 = require("../../utils.js");
|
|
6
11
|
function injectHtmlTags(htmlString, htmlTags, position) {
|
|
7
12
|
const htmlFragment = joinHtmlTags(htmlTags.filter((h) => h.position === position));
|
|
@@ -10,7 +15,6 @@ function injectHtmlTags(htmlString, htmlTags, position) {
|
|
|
10
15
|
}
|
|
11
16
|
return htmlString;
|
|
12
17
|
}
|
|
13
|
-
exports.injectHtmlTags = injectHtmlTags;
|
|
14
18
|
// Is it worth it? Should we remove this? https://github.com/vikejs/vike/pull/1740#issuecomment-2230540892
|
|
15
19
|
function injectHtmlTagsUsingStream(htmlTags, streamFromReactStreamingPackage) {
|
|
16
20
|
const htmlFragment = joinHtmlTags(htmlTags.filter((h) => h.position === 'HTML_STREAM'));
|
|
@@ -19,12 +23,10 @@ function injectHtmlTagsUsingStream(htmlTags, streamFromReactStreamingPackage) {
|
|
|
19
23
|
streamFromReactStreamingPackage.injectToStream(htmlFragment, { flush: true });
|
|
20
24
|
}
|
|
21
25
|
}
|
|
22
|
-
exports.injectHtmlTagsUsingStream = injectHtmlTagsUsingStream;
|
|
23
26
|
function joinHtmlTags(htmlTags) {
|
|
24
27
|
const htmlFragment = htmlTags.map((h) => resolveHtmlTag(h.htmlTag)).join('');
|
|
25
28
|
return htmlFragment;
|
|
26
29
|
}
|
|
27
|
-
exports.joinHtmlTags = joinHtmlTags;
|
|
28
30
|
function injectHtmlFragment(position, htmlFragment, htmlString) {
|
|
29
31
|
if (position === 'HTML_BEGIN') {
|
|
30
32
|
{
|
|
@@ -69,7 +71,6 @@ function injectAtOpeningTag(tag, htmlString, htmlFragment) {
|
|
|
69
71
|
htmlFragment = injectBreakLines(htmlFragment, before, after);
|
|
70
72
|
return before + htmlFragment + after;
|
|
71
73
|
}
|
|
72
|
-
exports.injectAtOpeningTag = injectAtOpeningTag;
|
|
73
74
|
function injectAtClosingTag(tag, htmlString, htmlFragment) {
|
|
74
75
|
const tagClosing = getTagClosing(tag);
|
|
75
76
|
const matches = htmlString.match(tagClosing);
|
|
@@ -84,7 +85,6 @@ function injectAtClosingTag(tag, htmlString, htmlFragment) {
|
|
|
84
85
|
htmlFragment = injectBreakLines(htmlFragment, before, after);
|
|
85
86
|
return before + htmlFragment + after;
|
|
86
87
|
}
|
|
87
|
-
exports.injectAtClosingTag = injectAtClosingTag;
|
|
88
88
|
function injectBreakLines(htmlFragment, before, after) {
|
|
89
89
|
(0, utils_js_1.assert)(htmlFragment.trim() === htmlFragment);
|
|
90
90
|
const currentLineBefore = before.split('\n').slice(-1)[0];
|
|
@@ -130,7 +130,6 @@ function createHtmlHeadIfMissing(htmlString) {
|
|
|
130
130
|
assertion();
|
|
131
131
|
return htmlString;
|
|
132
132
|
}
|
|
133
|
-
exports.createHtmlHeadIfMissing = createHtmlHeadIfMissing;
|
|
134
133
|
// Pay attention to performance when searching for tags
|
|
135
134
|
// Use the most effective way to test or match tag existence
|
|
136
135
|
// Use tag existence checking with caution as it is costly operation
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mergeScriptTags =
|
|
3
|
+
exports.mergeScriptTags = mergeScriptTags;
|
|
4
4
|
const utils_js_1 = require("../../utils.js");
|
|
5
5
|
const inferHtmlTags_js_1 = require("./inferHtmlTags.js");
|
|
6
6
|
const scriptRE = /(<script\b(?:\s[^>]*>|>))(.*?)<\/script>/gims;
|
|
@@ -42,7 +42,6 @@ function mergeScriptTags(scriptTagsHtml) {
|
|
|
42
42
|
}
|
|
43
43
|
return scriptTag;
|
|
44
44
|
}
|
|
45
|
-
exports.mergeScriptTags = mergeScriptTags;
|
|
46
45
|
function parseScripts(htmlString) {
|
|
47
46
|
const scripts = [];
|
|
48
47
|
let match;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Prevent XSS attacks, see https://github.com/vikejs/vike/pull/181#issuecomment-952846026
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.sanitizeJson =
|
|
4
|
+
exports.sanitizeJson = sanitizeJson;
|
|
5
5
|
function sanitizeJson(unsafe) {
|
|
6
6
|
const safe = unsafe.replace(/</g, '\\u003c');
|
|
7
7
|
return safe;
|
|
8
8
|
}
|
|
9
|
-
exports.sanitizeJson = sanitizeJson;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.injectHtmlTagsToString = injectHtmlTagsToString;
|
|
4
|
+
exports.injectHtmlTagsToStream = injectHtmlTagsToStream;
|
|
4
5
|
const utils_js_1 = require("../utils.js");
|
|
5
6
|
const assertPageContextProvidedByUser_js_1 = require("../../../shared/assertPageContextProvidedByUser.js");
|
|
6
7
|
const injectHtmlTags_js_1 = require("./injectAssets/injectHtmlTags.js");
|
|
@@ -16,7 +17,6 @@ async function injectHtmlTagsToString(htmlParts, pageContext, injectFilter) {
|
|
|
16
17
|
(0, utils_js_1.assert)(htmlTags.filter((snippet) => snippet.position === 'HTML_STREAM').length === 0);
|
|
17
18
|
return htmlString;
|
|
18
19
|
}
|
|
19
|
-
exports.injectHtmlTagsToString = injectHtmlTagsToString;
|
|
20
20
|
function injectHtmlTagsToStream(pageContext, streamFromReactStreamingPackage, injectFilter) {
|
|
21
21
|
let htmlTags;
|
|
22
22
|
return {
|
|
@@ -56,7 +56,6 @@ function injectHtmlTagsToStream(pageContext, streamFromReactStreamingPackage, in
|
|
|
56
56
|
return htmlEnd;
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
exports.injectHtmlTagsToStream = injectHtmlTagsToStream;
|
|
60
59
|
function injectToHtmlBegin(htmlBegin, htmlTags) {
|
|
61
60
|
// Ensure existence of `<head>`
|
|
62
61
|
htmlBegin = (0, injectHtmlTags_js_1.createHtmlHeadIfMissing)(htmlBegin);
|
|
@@ -3,7 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.escapeInject = escapeInject;
|
|
7
|
+
exports.dangerouslySkipEscape = dangerouslySkipEscape;
|
|
8
|
+
exports.renderDocumentHtml = renderDocumentHtml;
|
|
9
|
+
exports.isDocumentHtml = isDocumentHtml;
|
|
10
|
+
exports.getHtmlString = getHtmlString;
|
|
7
11
|
const utils_js_1 = require("../utils.js");
|
|
8
12
|
const injectAssets_js_1 = require("./injectAssets.js");
|
|
9
13
|
const stream_js_1 = require("./stream.js");
|
|
@@ -17,7 +21,6 @@ function isDocumentHtml(something) {
|
|
|
17
21
|
}
|
|
18
22
|
return false;
|
|
19
23
|
}
|
|
20
|
-
exports.isDocumentHtml = isDocumentHtml;
|
|
21
24
|
async function renderDocumentHtml(documentHtml, pageContext, onErrorWhileStreaming, injectFilter) {
|
|
22
25
|
if (isEscapedString(documentHtml)) {
|
|
23
26
|
(0, utils_js_1.objectAssign)(pageContext, { _isStream: false });
|
|
@@ -53,7 +56,6 @@ async function renderDocumentHtml(documentHtml, pageContext, onErrorWhileStreami
|
|
|
53
56
|
(0, utils_js_1.checkType)(documentHtml);
|
|
54
57
|
(0, utils_js_1.assert)(false);
|
|
55
58
|
}
|
|
56
|
-
exports.renderDocumentHtml = renderDocumentHtml;
|
|
57
59
|
async function renderHtmlStream(streamOriginal, injectString, pageContext, onErrorWhileStreaming, injectFilter) {
|
|
58
60
|
const processStreamOptions = {
|
|
59
61
|
onErrorWhileStreaming,
|
|
@@ -105,11 +107,9 @@ function escapeInject(templateStrings, ...templateVariables) {
|
|
|
105
107
|
}
|
|
106
108
|
};
|
|
107
109
|
}
|
|
108
|
-
exports.escapeInject = escapeInject;
|
|
109
110
|
function dangerouslySkipEscape(alreadyEscapedString) {
|
|
110
111
|
return _dangerouslySkipEscape(alreadyEscapedString);
|
|
111
112
|
}
|
|
112
|
-
exports.dangerouslySkipEscape = dangerouslySkipEscape;
|
|
113
113
|
function _dangerouslySkipEscape(arg) {
|
|
114
114
|
if ((0, utils_js_1.hasProp)(arg, '_escaped')) {
|
|
115
115
|
(0, utils_js_1.assert)(isEscapedString(arg));
|
|
@@ -234,4 +234,3 @@ async function getHtmlString(htmlRender) {
|
|
|
234
234
|
(0, utils_js_1.checkType)(htmlRender);
|
|
235
235
|
(0, utils_js_1.assert)(false);
|
|
236
236
|
}
|
|
237
|
-
exports.getHtmlString = getHtmlString;
|
|
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.serializePageContextClientSide = serializePageContextClientSide;
|
|
7
|
+
exports.serializePageContextAbort = serializePageContextAbort;
|
|
7
8
|
const stringify_1 = require("@brillout/json-serializer/stringify");
|
|
8
9
|
const utils_js_1 = require("../utils.js");
|
|
9
10
|
const error_page_js_1 = require("../../../shared/error-page.js");
|
|
@@ -94,7 +95,6 @@ function serializePageContextClientSide(pageContext) {
|
|
|
94
95
|
}
|
|
95
96
|
return pageContextSerialized;
|
|
96
97
|
}
|
|
97
|
-
exports.serializePageContextClientSide = serializePageContextClientSide;
|
|
98
98
|
function serialize(value, varName) {
|
|
99
99
|
return (0, stringify_1.stringify)(value, { forbidReactElements: true, valueName: varName });
|
|
100
100
|
}
|
|
@@ -143,4 +143,3 @@ function serializePageContextAbort(pageContext) {
|
|
|
143
143
|
}
|
|
144
144
|
return serialize(pageContext);
|
|
145
145
|
}
|
|
146
|
-
exports.serializePageContextAbort = serializePageContextAbort;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Zero-config support for https://www.npmjs.com/package/react-streaming
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.isStreamFromReactStreamingPackage = isStreamFromReactStreamingPackage;
|
|
5
|
+
exports.streamFromReactStreamingPackageToString = streamFromReactStreamingPackageToString;
|
|
6
|
+
exports.getStreamOfReactStreamingPackage = getStreamOfReactStreamingPackage;
|
|
5
7
|
const utils_js_1 = require("../../utils.js");
|
|
6
8
|
const stream_js_1 = require("../stream.js");
|
|
7
9
|
function streamFromReactStreamingPackageToString(stream) {
|
|
@@ -13,7 +15,6 @@ function streamFromReactStreamingPackageToString(stream) {
|
|
|
13
15
|
}
|
|
14
16
|
(0, utils_js_1.assert)(false);
|
|
15
17
|
}
|
|
16
|
-
exports.streamFromReactStreamingPackageToString = streamFromReactStreamingPackageToString;
|
|
17
18
|
function isStreamFromReactStreamingPackage(thing) {
|
|
18
19
|
if ((0, utils_js_1.hasProp)(thing, 'injectToStream', 'function')) {
|
|
19
20
|
(0, utils_js_1.assertUsage)((0, utils_js_1.hasProp)(thing, 'hasStreamEnded', 'function'), (0, utils_js_1.isVikeReactApp)()
|
|
@@ -24,7 +25,6 @@ function isStreamFromReactStreamingPackage(thing) {
|
|
|
24
25
|
}
|
|
25
26
|
return false;
|
|
26
27
|
}
|
|
27
|
-
exports.isStreamFromReactStreamingPackage = isStreamFromReactStreamingPackage;
|
|
28
28
|
function getStreamOfReactStreamingPackage(stream) {
|
|
29
29
|
if (stream.pipe) {
|
|
30
30
|
return { __streamPipeNode: stream.pipe };
|
|
@@ -34,4 +34,3 @@ function getStreamOfReactStreamingPackage(stream) {
|
|
|
34
34
|
}
|
|
35
35
|
(0, utils_js_1.assert)(false);
|
|
36
36
|
}
|
|
37
|
-
exports.getStreamOfReactStreamingPackage = getStreamOfReactStreamingPackage;
|
|
@@ -3,7 +3,27 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.processStream = processStream;
|
|
7
|
+
exports.streamToString = streamToString;
|
|
8
|
+
exports.stampPipe = stampPipe;
|
|
9
|
+
exports.pipeStream = pipeStream;
|
|
10
|
+
exports.pipeWebStream = pipeWebStream;
|
|
11
|
+
exports.pipeNodeStream = pipeNodeStream;
|
|
12
|
+
exports.getStreamReadableNode = getStreamReadableNode;
|
|
13
|
+
exports.getStreamReadableWeb = getStreamReadableWeb;
|
|
14
|
+
exports.pipeToStreamWritableNode = pipeToStreamWritableNode;
|
|
15
|
+
exports.pipeToStreamWritableWeb = pipeToStreamWritableWeb;
|
|
16
|
+
exports.isStream = isStream;
|
|
17
|
+
exports.isStreamPipeWeb = isStreamPipeWeb;
|
|
18
|
+
exports.isStreamPipeNode = isStreamPipeNode;
|
|
19
|
+
exports.isStreamReadableWeb = isStreamReadableWeb;
|
|
20
|
+
exports.isStreamReadableNode = isStreamReadableNode;
|
|
21
|
+
exports.getStreamName = getStreamName;
|
|
22
|
+
exports.inferStreamName = inferStreamName;
|
|
23
|
+
exports.streamReadableWebToString = streamReadableWebToString;
|
|
24
|
+
exports.streamPipeNodeToString = streamPipeNodeToString;
|
|
25
|
+
exports.isStreamWritableWeb = isStreamWritableWeb;
|
|
26
|
+
exports.isStreamWritableNode = isStreamWritableNode;
|
|
7
27
|
const utils_js_1 = require("../utils.js");
|
|
8
28
|
const react_streaming_js_1 = require("./stream/react-streaming.js");
|
|
9
29
|
const import_1 = require("@brillout/import");
|
|
@@ -12,11 +32,9 @@ const debug = (0, utils_js_1.createDebugger)('vike:stream');
|
|
|
12
32
|
function isStreamReadableWeb(thing) {
|
|
13
33
|
return typeof ReadableStream !== 'undefined' && thing instanceof ReadableStream;
|
|
14
34
|
}
|
|
15
|
-
exports.isStreamReadableWeb = isStreamReadableWeb;
|
|
16
35
|
function isStreamWritableWeb(thing) {
|
|
17
36
|
return typeof WritableStream !== 'undefined' && thing instanceof WritableStream;
|
|
18
37
|
}
|
|
19
|
-
exports.isStreamWritableWeb = isStreamWritableWeb;
|
|
20
38
|
function isStreamReadableNode(thing) {
|
|
21
39
|
if (isStreamReadableWeb(thing)) {
|
|
22
40
|
return false;
|
|
@@ -24,7 +42,6 @@ function isStreamReadableNode(thing) {
|
|
|
24
42
|
// https://stackoverflow.com/questions/17009975/how-to-test-if-an-object-is-a-stream-in-nodejs/37022523#37022523
|
|
25
43
|
return (0, utils_js_1.hasProp)(thing, 'read', 'function');
|
|
26
44
|
}
|
|
27
|
-
exports.isStreamReadableNode = isStreamReadableNode;
|
|
28
45
|
function isStreamWritableNode(thing) {
|
|
29
46
|
if (isStreamWritableWeb(thing)) {
|
|
30
47
|
return false;
|
|
@@ -32,7 +49,6 @@ function isStreamWritableNode(thing) {
|
|
|
32
49
|
// https://stackoverflow.com/questions/17009975/how-to-test-if-an-object-is-a-stream-in-nodejs/37022523#37022523
|
|
33
50
|
return (0, utils_js_1.hasProp)(thing, 'write', 'function');
|
|
34
51
|
}
|
|
35
|
-
exports.isStreamWritableNode = isStreamWritableNode;
|
|
36
52
|
async function streamReadableNodeToString(readableNode) {
|
|
37
53
|
// Copied from: https://stackoverflow.com/questions/10623798/how-do-i-read-the-contents-of-a-node-js-stream-into-a-string-variable/49428486#49428486
|
|
38
54
|
const chunks = [];
|
|
@@ -55,7 +71,6 @@ async function streamReadableWebToString(readableWeb) {
|
|
|
55
71
|
str += getClosingChunk();
|
|
56
72
|
return str;
|
|
57
73
|
}
|
|
58
|
-
exports.streamReadableWebToString = streamReadableWebToString;
|
|
59
74
|
async function stringToStreamReadableNode(str) {
|
|
60
75
|
const { Readable } = await loadStreamNodeModule();
|
|
61
76
|
return Readable.from(str);
|
|
@@ -116,7 +131,6 @@ async function streamPipeNodeToString(streamPipeNode) {
|
|
|
116
131
|
streamPipeNode(writable);
|
|
117
132
|
return promise;
|
|
118
133
|
}
|
|
119
|
-
exports.streamPipeNodeToString = streamPipeNodeToString;
|
|
120
134
|
function streamPipeWebToString(streamPipeWeb) {
|
|
121
135
|
const { decode, getClosingChunk } = decodeChunks();
|
|
122
136
|
let str = '';
|
|
@@ -143,7 +157,6 @@ async function getStreamReadableNode(htmlRender) {
|
|
|
143
157
|
}
|
|
144
158
|
return null;
|
|
145
159
|
}
|
|
146
|
-
exports.getStreamReadableNode = getStreamReadableNode;
|
|
147
160
|
function getStreamReadableWeb(htmlRender) {
|
|
148
161
|
if (typeof htmlRender === 'string') {
|
|
149
162
|
return stringToStreamReadableWeb(htmlRender);
|
|
@@ -153,7 +166,6 @@ function getStreamReadableWeb(htmlRender) {
|
|
|
153
166
|
}
|
|
154
167
|
return null;
|
|
155
168
|
}
|
|
156
|
-
exports.getStreamReadableWeb = getStreamReadableWeb;
|
|
157
169
|
function pipeToStreamWritableWeb(htmlRender, writable) {
|
|
158
170
|
if (typeof htmlRender === 'string') {
|
|
159
171
|
const streamPipeWeb = stringToStreamPipeWeb(htmlRender);
|
|
@@ -176,7 +188,6 @@ function pipeToStreamWritableWeb(htmlRender, writable) {
|
|
|
176
188
|
(0, utils_js_1.checkType)(htmlRender);
|
|
177
189
|
(0, utils_js_1.assert)(false);
|
|
178
190
|
}
|
|
179
|
-
exports.pipeToStreamWritableWeb = pipeToStreamWritableWeb;
|
|
180
191
|
function pipeToStreamWritableNode(htmlRender, writable) {
|
|
181
192
|
if (typeof htmlRender === 'string') {
|
|
182
193
|
const streamPipeNode = stringToStreamPipeNode(htmlRender);
|
|
@@ -199,7 +210,6 @@ function pipeToStreamWritableNode(htmlRender, writable) {
|
|
|
199
210
|
(0, utils_js_1.checkType)(htmlRender);
|
|
200
211
|
(0, utils_js_1.assert)(false);
|
|
201
212
|
}
|
|
202
|
-
exports.pipeToStreamWritableNode = pipeToStreamWritableNode;
|
|
203
213
|
async function processStream(streamOriginal, { injectStringAtBegin, injectStringAfterFirstChunk, injectStringAtEnd, onErrorWhileStreaming, enableEagerStreaming }) {
|
|
204
214
|
const buffer = [];
|
|
205
215
|
let streamOriginalHasStartedEmitting = false;
|
|
@@ -361,7 +371,6 @@ async function processStream(streamOriginal, { injectStringAtBegin, injectString
|
|
|
361
371
|
return !enableEagerStreaming && !streamOriginalHasStartedEmitting;
|
|
362
372
|
}
|
|
363
373
|
}
|
|
364
|
-
exports.processStream = processStream;
|
|
365
374
|
async function createStreamWrapper({ streamOriginal, onError, onData, onEnd, onFlush, onReadyToWrite }) {
|
|
366
375
|
if ((0, react_streaming_js_1.isStreamFromReactStreamingPackage)(streamOriginal)) {
|
|
367
376
|
debug(`onRenderHtml() hook returned ${picocolors_1.default.cyan('react-streaming')} result`);
|
|
@@ -626,7 +635,6 @@ function isStream(something) {
|
|
|
626
635
|
}
|
|
627
636
|
return false;
|
|
628
637
|
}
|
|
629
|
-
exports.isStream = isStream;
|
|
630
638
|
const __streamPipeWeb = '__streamPipeWeb';
|
|
631
639
|
/** @deprecated */
|
|
632
640
|
function pipeWebStream(pipe) {
|
|
@@ -636,7 +644,6 @@ function pipeWebStream(pipe) {
|
|
|
636
644
|
});
|
|
637
645
|
return { [__streamPipeWeb]: pipe };
|
|
638
646
|
}
|
|
639
|
-
exports.pipeWebStream = pipeWebStream;
|
|
640
647
|
function getStreamPipeWeb(thing) {
|
|
641
648
|
if (!isStreamPipeWeb(thing)) {
|
|
642
649
|
return null;
|
|
@@ -663,7 +670,6 @@ function isStreamPipeWeb(thing) {
|
|
|
663
670
|
}
|
|
664
671
|
return false;
|
|
665
672
|
}
|
|
666
|
-
exports.isStreamPipeWeb = isStreamPipeWeb;
|
|
667
673
|
const __streamPipeNode = '__streamPipeNode';
|
|
668
674
|
/** @deprecated */
|
|
669
675
|
function pipeNodeStream(pipe) {
|
|
@@ -673,7 +679,6 @@ function pipeNodeStream(pipe) {
|
|
|
673
679
|
});
|
|
674
680
|
return { [__streamPipeNode]: pipe };
|
|
675
681
|
}
|
|
676
|
-
exports.pipeNodeStream = pipeNodeStream;
|
|
677
682
|
function getStreamPipeNode(thing) {
|
|
678
683
|
if (!isStreamPipeNode(thing)) {
|
|
679
684
|
return null;
|
|
@@ -700,7 +705,6 @@ function isStreamPipeNode(thing) {
|
|
|
700
705
|
}
|
|
701
706
|
return false;
|
|
702
707
|
}
|
|
703
|
-
exports.isStreamPipeNode = isStreamPipeNode;
|
|
704
708
|
function stampPipe(pipe, pipeType) {
|
|
705
709
|
(0, utils_js_1.assertUsage)(pipeType, `stampPipe(pipe, pipeType): argument ${picocolors_1.default.cyan('pipeType')} is missing.)`, {
|
|
706
710
|
showStackTrace: true
|
|
@@ -713,12 +717,10 @@ function stampPipe(pipe, pipeType) {
|
|
|
713
717
|
Object.assign(pipe, { isWebStreamPipe: true });
|
|
714
718
|
}
|
|
715
719
|
}
|
|
716
|
-
exports.stampPipe = stampPipe;
|
|
717
720
|
const __streamPipe = '__streamPipe';
|
|
718
721
|
function pipeStream(pipe) {
|
|
719
722
|
return { [__streamPipe]: pipe };
|
|
720
723
|
}
|
|
721
|
-
exports.pipeStream = pipeStream;
|
|
722
724
|
async function streamToString(stream) {
|
|
723
725
|
if (isStreamReadableWeb(stream)) {
|
|
724
726
|
return await streamReadableWebToString(stream);
|
|
@@ -737,7 +739,6 @@ async function streamToString(stream) {
|
|
|
737
739
|
}
|
|
738
740
|
(0, utils_js_1.assert)(false);
|
|
739
741
|
}
|
|
740
|
-
exports.streamToString = streamToString;
|
|
741
742
|
function assertReadableStreamConstructor() {
|
|
742
743
|
(0, utils_js_1.assertUsage)(typeof ReadableStream === 'function',
|
|
743
744
|
// Error message copied from vue's renderToWebStream() implementation
|
|
@@ -775,7 +776,6 @@ function getStreamName(kind, type) {
|
|
|
775
776
|
}
|
|
776
777
|
(0, utils_js_1.assert)(false);
|
|
777
778
|
}
|
|
778
|
-
exports.getStreamName = getStreamName;
|
|
779
779
|
function inferStreamName(stream) {
|
|
780
780
|
if (isStreamReadableWeb(stream)) {
|
|
781
781
|
return getStreamName('readable', 'web');
|
|
@@ -791,7 +791,6 @@ function inferStreamName(stream) {
|
|
|
791
791
|
}
|
|
792
792
|
(0, utils_js_1.assert)(false);
|
|
793
793
|
}
|
|
794
|
-
exports.inferStreamName = inferStreamName;
|
|
795
794
|
function decodeChunks() {
|
|
796
795
|
const decoder = new TextDecoder();
|
|
797
796
|
const decode = (chunk) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.onLoad =
|
|
3
|
+
exports.onLoad = onLoad;
|
|
4
4
|
const assertIsNotBrowser_js_1 = require("../../utils/assertIsNotBrowser.js");
|
|
5
5
|
const assertNodeVersion_js_1 = require("../../utils/assertNodeVersion.js");
|
|
6
6
|
const require_shim_1 = require("@brillout/require-shim");
|
|
@@ -13,4 +13,3 @@ function onLoad() {
|
|
|
13
13
|
if ((0, isErrorDebug_js_1.isErrorDebug)())
|
|
14
14
|
(0, utils_js_1.setAlwaysShowStackTrace)();
|
|
15
15
|
}
|
|
16
|
-
exports.onLoad = onLoad;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getPageFilesExports =
|
|
3
|
+
exports.getPageFilesExports = getPageFilesExports;
|
|
4
4
|
const utils_js_1 = require("../utils.js");
|
|
5
5
|
const globalContext_js_1 = require("../globalContext.js");
|
|
6
6
|
const virtualFileImportUserCode_js_1 = require("../../shared/virtual-files/virtualFileImportUserCode.js");
|
|
@@ -20,4 +20,3 @@ async function getPageFilesExports() {
|
|
|
20
20
|
(0, utils_js_1.assert)((0, utils_js_1.isObject)(moduleExports));
|
|
21
21
|
return moduleExports;
|
|
22
22
|
}
|
|
23
|
-
exports.getPageFilesExports = getPageFilesExports;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.analyzePage =
|
|
3
|
+
exports.analyzePage = analyzePage;
|
|
4
4
|
const determineClientEntry_js_1 = require("../../../shared/getPageFiles/analyzePageClientSide/determineClientEntry.js");
|
|
5
5
|
const analyzePageClientSide_js_1 = require("../../../shared/getPageFiles/analyzePageClientSide.js");
|
|
6
6
|
const virtualFilePageConfigValuesAll_js_1 = require("../../shared/virtual-files/virtualFilePageConfigValuesAll.js");
|
|
@@ -68,4 +68,3 @@ function analyzePage(pageFilesAll, pageConfig, pageId) {
|
|
|
68
68
|
return (0, analyzePageClientSide_js_1.analyzePageClientSide)(pageFilesAll, pageId);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
exports.analyzePage = analyzePage;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.assertArguments =
|
|
6
|
+
exports.assertArguments = assertArguments;
|
|
7
7
|
const utils_js_1 = require("../utils.js");
|
|
8
8
|
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
9
9
|
function assertArguments(...args) {
|
|
@@ -40,4 +40,3 @@ function assertArguments(...args) {
|
|
|
40
40
|
` ${picocolors_1.default.cyan('pageContextInit.urlOriginal')} should be a URL but ${picocolors_1.default.cyan(`pageContextInit.urlOriginal === ${JSON.stringify(urlOriginal)}`)}`, { showStackTrace: true });
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
exports.assertArguments = assertArguments;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.assertNoInfiniteHttpRedirect =
|
|
6
|
+
exports.assertNoInfiniteHttpRedirect = assertNoInfiniteHttpRedirect;
|
|
7
7
|
const utils_js_1 = require("../../utils.js");
|
|
8
8
|
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
9
9
|
const globalObject = (0, utils_js_1.getGlobalObject)('assertNoInfiniteHttpRedirect.ts', {
|
|
@@ -26,7 +26,6 @@ function assertNoInfiniteHttpRedirect(urlRedirectTarget, urlLogical) {
|
|
|
26
26
|
validate(graph);
|
|
27
27
|
globalObject.redirectGraph = graph;
|
|
28
28
|
}
|
|
29
|
-
exports.assertNoInfiniteHttpRedirect = assertNoInfiniteHttpRedirect;
|
|
30
29
|
function copy(G) {
|
|
31
30
|
return Object.fromEntries(Object.entries(G).map(([key, val]) => [key, new Set(val)]));
|
|
32
31
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCacheControl =
|
|
3
|
+
exports.getCacheControl = getCacheControl;
|
|
4
4
|
const helpers_js_1 = require("../../../../shared/page-configs/helpers.js");
|
|
5
5
|
const getConfigValue_js_1 = require("../../../../shared/page-configs/getConfigValue.js");
|
|
6
6
|
const defaultValue = 'no-store, max-age=0';
|
|
@@ -18,4 +18,3 @@ function getCacheControl(pageId, pageConfigs) {
|
|
|
18
18
|
// - When there isn't any <script id="vike_pageContext" type="application/json"> then we can safely have caching. (We don't implement this exception because we're lazy and it's quite a rare situation.)
|
|
19
19
|
return defaultValue;
|
|
20
20
|
}
|
|
21
|
-
exports.getCacheControl = getCacheControl;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.createHttpResponsePage = createHttpResponsePage;
|
|
4
|
+
exports.createHttpResponsePageContextJson = createHttpResponsePageContextJson;
|
|
5
|
+
exports.createHttpResponseError = createHttpResponseError;
|
|
6
|
+
exports.createHttpResponseRedirect = createHttpResponseRedirect;
|
|
7
|
+
exports.createHttpResponseFavicon404 = createHttpResponseFavicon404;
|
|
4
8
|
const utils_js_1 = require("../utils.js");
|
|
5
9
|
const error_page_js_1 = require("../../../shared/error-page.js");
|
|
6
10
|
const getHttpResponseBody_js_1 = require("./getHttpResponseBody.js");
|
|
@@ -32,12 +36,10 @@ async function createHttpResponsePage(htmlRender, renderHook, pageContext) {
|
|
|
32
36
|
}
|
|
33
37
|
return createHttpResponse(statusCode, 'text/html;charset=utf-8', headers, htmlRender, earlyHints, renderHook);
|
|
34
38
|
}
|
|
35
|
-
exports.createHttpResponsePage = createHttpResponsePage;
|
|
36
39
|
function createHttpResponseFavicon404() {
|
|
37
40
|
const httpResponse = createHttpResponse(404, 'text/html;charset=utf-8', [], "<p>No favicon.ico found.</p><script>console.log('This HTTP response was generated by Vike.')</script>");
|
|
38
41
|
return httpResponse;
|
|
39
42
|
}
|
|
40
|
-
exports.createHttpResponseFavicon404 = createHttpResponseFavicon404;
|
|
41
43
|
function createHttpResponseError(pageContext) {
|
|
42
44
|
const reason = (() => {
|
|
43
45
|
if (!pageContext) {
|
|
@@ -54,12 +56,10 @@ function createHttpResponseError(pageContext) {
|
|
|
54
56
|
const httpResponse = createHttpResponse(500, 'text/html;charset=utf-8', [], `<p>An error occurred.</p><script>console.log(${JSON.stringify(`This HTTP response was generated by Vike. Vike returned this response because ${reason}.`)})</script>`);
|
|
55
57
|
return httpResponse;
|
|
56
58
|
}
|
|
57
|
-
exports.createHttpResponseError = createHttpResponseError;
|
|
58
59
|
async function createHttpResponsePageContextJson(pageContextSerialized) {
|
|
59
60
|
const httpResponse = createHttpResponse(200, 'application/json', [], pageContextSerialized, [], null);
|
|
60
61
|
return httpResponse;
|
|
61
62
|
}
|
|
62
|
-
exports.createHttpResponsePageContextJson = createHttpResponsePageContextJson;
|
|
63
63
|
function createHttpResponseRedirect({ url, statusCode },
|
|
64
64
|
// The URL we assume the redirect to be logically based on
|
|
65
65
|
urlLogical) {
|
|
@@ -73,7 +73,6 @@ urlLogical) {
|
|
|
73
73
|
// For users: showing a blank page is probably better than a flickering text.
|
|
74
74
|
`<p style="display: none">Redirecting to ${url}</p><script>console.log('This HTTP response was generated by Vike.')</script>`);
|
|
75
75
|
}
|
|
76
|
-
exports.createHttpResponseRedirect = createHttpResponseRedirect;
|
|
77
76
|
function createHttpResponse(statusCode, contentType, headers, htmlRender, earlyHints = [], renderHook = null) {
|
|
78
77
|
headers.push(['Content-Type', contentType]);
|
|
79
78
|
(0, utils_js_1.assert)(renderHook || typeof htmlRender === 'string');
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.debugPageFiles =
|
|
6
|
+
exports.debugPageFiles = debugPageFiles;
|
|
7
7
|
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
8
8
|
const utils_js_1 = require("../utils.js");
|
|
9
9
|
function debugPageFiles({ pageContext, isHtmlOnly, isClientRouting, pageFilesLoaded, pageFilesServerSide, pageFilesClientSide, clientEntries, clientDependencies }) {
|
|
@@ -46,7 +46,6 @@ function debugPageFiles({ pageContext, isHtmlOnly, isClientRouting, pageFilesLoa
|
|
|
46
46
|
.join('\n'));
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
exports.debugPageFiles = debugPageFiles;
|
|
50
49
|
function samePageFiles(pageFiles1, pageFiles2) {
|
|
51
50
|
return (pageFiles1.every((p1) => pageFiles2.some((p2) => p2.filePath === p1.filePath)) &&
|
|
52
51
|
pageFiles2.every((p2) => pageFiles1.some((p1) => p1.filePath === p2.filePath)));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.executeOnBeforeRenderAndDataHooks =
|
|
3
|
+
exports.executeOnBeforeRenderAndDataHooks = executeOnBeforeRenderAndDataHooks;
|
|
4
4
|
const getHook_js_1 = require("../../../shared/hooks/getHook.js");
|
|
5
5
|
const preparePageContextForUserConsumptionServerSide_js_1 = require("./preparePageContextForUserConsumptionServerSide.js");
|
|
6
6
|
const assertOnBeforeRenderHookReturn_js_1 = require("../../../shared/assertOnBeforeRenderHookReturn.js");
|
|
@@ -30,4 +30,3 @@ async function executeOnBeforeRenderAndDataHooks(pageContext) {
|
|
|
30
30
|
Object.assign(pageContext, pageContextFromHook);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
exports.executeOnBeforeRenderAndDataHooks = executeOnBeforeRenderAndDataHooks;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.executeOnRenderHtmlHook =
|
|
6
|
+
exports.executeOnRenderHtmlHook = executeOnRenderHtmlHook;
|
|
7
7
|
const renderHtml_js_1 = require("../html/renderHtml.js");
|
|
8
8
|
const getHook_js_1 = require("../../../shared/hooks/getHook.js");
|
|
9
9
|
const utils_js_1 = require("../utils.js");
|
|
@@ -36,7 +36,6 @@ async function executeOnRenderHtmlHook(pageContext) {
|
|
|
36
36
|
(0, utils_js_1.assert)(typeof htmlRender === 'string' || (0, stream_js_1.isStream)(htmlRender));
|
|
37
37
|
return { htmlRender, renderHook };
|
|
38
38
|
}
|
|
39
|
-
exports.executeOnRenderHtmlHook = executeOnRenderHtmlHook;
|
|
40
39
|
function getRenderHook(pageContext) {
|
|
41
40
|
let hookFound;
|
|
42
41
|
{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getEarlyHints =
|
|
3
|
+
exports.getEarlyHints = getEarlyHints;
|
|
4
4
|
const inferHtmlTags_js_1 = require("../html/injectAssets/inferHtmlTags.js");
|
|
5
5
|
const utils_js_1 = require("../utils.js");
|
|
6
6
|
function getEarlyHints(assets) {
|
|
@@ -18,7 +18,6 @@ function getEarlyHints(assets) {
|
|
|
18
18
|
}
|
|
19
19
|
return earlyHints;
|
|
20
20
|
}
|
|
21
|
-
exports.getEarlyHints = getEarlyHints;
|
|
22
21
|
function isFontFallback(asset, earlyHints) {
|
|
23
22
|
if (asset.assetType !== 'font') {
|
|
24
23
|
return false;
|
|
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.getHttpResponseBody = getHttpResponseBody;
|
|
7
|
+
exports.getHttpResponseBodyStreamHandlers = getHttpResponseBodyStreamHandlers;
|
|
7
8
|
const stream_js_1 = require("../html/stream.js");
|
|
8
9
|
const utils_js_1 = require("../utils.js");
|
|
9
10
|
const renderHtml_js_1 = require("../html/renderHtml.js");
|
|
@@ -16,7 +17,6 @@ function getHttpResponseBody(htmlRender, renderHook) {
|
|
|
16
17
|
const body = htmlRender;
|
|
17
18
|
return body;
|
|
18
19
|
}
|
|
19
|
-
exports.getHttpResponseBody = getHttpResponseBody;
|
|
20
20
|
function getHttpResponseBodyStreamHandlers(htmlRender, renderHook) {
|
|
21
21
|
return {
|
|
22
22
|
pipe(writable) {
|
|
@@ -108,7 +108,6 @@ function getHttpResponseBodyStreamHandlers(htmlRender, renderHook) {
|
|
|
108
108
|
return `Make sure the ${hookName}() defined by ${hookFilePath} hook provides ${streamName} instead`;
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
-
exports.getHttpResponseBodyStreamHandlers = getHttpResponseBodyStreamHandlers;
|
|
112
111
|
function getErrMsg(htmlRender, renderHook, method, msgAddendum) {
|
|
113
112
|
(0, utils_js_1.assert)(!msgAddendum || !msgAddendum.endsWith('.'));
|
|
114
113
|
const errMsgBody = getErrMsgBody(htmlRender, renderHook);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getManifestEntry =
|
|
3
|
+
exports.getManifestEntry = getManifestEntry;
|
|
4
4
|
const utils_js_1 = require("../../utils.js");
|
|
5
5
|
const virtualFilePageConfigValuesAll_js_1 = require("../../../shared/virtual-files/virtualFilePageConfigValuesAll.js");
|
|
6
6
|
const prependEntriesDir_js_1 = require("../../../shared/prependEntriesDir.js");
|
|
@@ -79,7 +79,6 @@ function getManifestEntry(id, assetsManifest) {
|
|
|
79
79
|
}
|
|
80
80
|
*/
|
|
81
81
|
}
|
|
82
|
-
exports.getManifestEntry = getManifestEntry;
|
|
83
82
|
function findEntryWithKeyEnd(manifestKeyEnd, assetsManifest, id) {
|
|
84
83
|
const debugInfo = getDebugInfo(id, assetsManifest, manifestKeyEnd);
|
|
85
84
|
(0, utils_js_1.assert)(manifestKeyEnd.startsWith('/'), debugInfo);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.retrieveAssetsDev =
|
|
3
|
+
exports.retrieveAssetsDev = retrieveAssetsDev;
|
|
4
4
|
const utils_js_1 = require("../../utils.js");
|
|
5
5
|
async function retrieveAssetsDev(clientDependencies, viteDevServer) {
|
|
6
6
|
const visitedModules = new Set();
|
|
@@ -26,7 +26,6 @@ async function retrieveAssetsDev(clientDependencies, viteDevServer) {
|
|
|
26
26
|
}));
|
|
27
27
|
return Array.from(assetUrls);
|
|
28
28
|
}
|
|
29
|
-
exports.retrieveAssetsDev = retrieveAssetsDev;
|
|
30
29
|
// Collect the CSS to be injected to the HTML to avoid FLOUC
|
|
31
30
|
// - We only collect the root import: https://github.com/vikejs/vike/issues/400
|
|
32
31
|
function collectCss(mod, styleUrls, visitedModules, importer) {
|