vike 0.4.149 → 0.4.150-commit-d0822a3
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/node/plugin/index.js +0 -2
- package/dist/cjs/node/plugin/plugins/autoFullBuild.js +3 -2
- package/dist/cjs/node/plugin/plugins/buildConfig.js +17 -36
- package/dist/cjs/node/plugin/plugins/commonConfig/assertResolveAlias.js +3 -0
- package/dist/cjs/node/plugin/plugins/commonConfig.js +1 -1
- package/dist/cjs/node/plugin/plugins/config/resolveExtensions.js +1 -1
- package/dist/cjs/node/plugin/plugins/config/stemUtils.js +1 -1
- package/dist/cjs/node/plugin/plugins/devConfig/determineFsAllowList.js +1 -1
- package/dist/cjs/node/plugin/plugins/importBuild/getVikeManifest.js +38 -0
- package/dist/cjs/node/plugin/plugins/importBuild/index.js +57 -19
- package/dist/cjs/node/plugin/plugins/importUserCode/index.js +3 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +7 -0
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +1 -1
- package/dist/cjs/node/plugin/utils.js +1 -0
- package/dist/cjs/node/runtime/html/serializePageContextClientSide.js +2 -1
- package/dist/cjs/node/runtime/html/stream.js +57 -17
- package/dist/cjs/node/runtime/index-deprecated.js +3 -2
- package/dist/cjs/node/runtime/index.js +3 -2
- package/dist/cjs/node/runtime/renderPage/executeOnBeforeRenderAndDataHooks.js +33 -0
- package/dist/cjs/node/runtime/renderPage/getHttpResponseBody.js +2 -2
- package/dist/cjs/node/runtime/renderPage/getPageAssets/retrieveAssetsDev.js +13 -5
- package/dist/cjs/node/runtime/renderPage/getPageAssets/sortPageAssetsForEarlyHintsHeader.js +6 -0
- package/dist/cjs/node/runtime/renderPage/getPageAssets.js +1 -1
- package/dist/cjs/node/runtime/renderPage/inferMediaType.js +38 -0
- package/dist/cjs/node/runtime/renderPage/renderPageAlreadyRouted.js +4 -4
- package/dist/cjs/shared/page-configs/assertExports.js +11 -4
- package/dist/cjs/shared/route/resolveRedirects.js +2 -10
- package/dist/cjs/shared/route/resolveUrlPathname.js +48 -0
- package/dist/cjs/utils/debug.js +29 -15
- package/dist/cjs/utils/getDependencyPackageJson.js +1 -1
- package/dist/cjs/utils/getFilePathAbsolute.js +1 -1
- package/dist/cjs/utils/getOutDirs.js +11 -1
- package/dist/cjs/utils/injectRollupInputs.js +29 -0
- package/dist/cjs/utils/isPlainObject.js +1 -1
- package/dist/cjs/utils/projectInfo.js +1 -1
- package/dist/cjs/utils/requireResolve.js +1 -1
- package/dist/esm/client/client-routing-runtime/getPageContextFromHooks.js +105 -66
- package/dist/esm/client/client-routing-runtime/renderPageClientSide.js +1 -1
- package/dist/esm/node/plugin/index.js +0 -2
- package/dist/esm/node/plugin/plugins/autoFullBuild.js +3 -2
- package/dist/esm/node/plugin/plugins/buildConfig.js +17 -36
- package/dist/esm/node/plugin/plugins/commonConfig/assertResolveAlias.js +3 -0
- package/dist/esm/node/plugin/plugins/commonConfig.js +1 -1
- package/dist/esm/node/plugin/plugins/config/resolveExtensions.js +1 -1
- package/dist/esm/node/plugin/plugins/config/stemUtils.js +1 -1
- package/dist/esm/node/plugin/plugins/devConfig/determineFsAllowList.js +1 -1
- package/dist/esm/node/plugin/plugins/importBuild/getVikeManifest.d.ts +5 -0
- package/dist/esm/node/plugin/plugins/importBuild/getVikeManifest.js +32 -0
- package/dist/esm/node/plugin/plugins/importBuild/index.js +59 -21
- package/dist/esm/node/plugin/plugins/importUserCode/index.js +3 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/debug.d.ts +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +7 -0
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +1 -1
- package/dist/esm/node/plugin/utils.d.ts +1 -0
- package/dist/esm/node/plugin/utils.js +1 -0
- package/dist/esm/node/runtime/html/serializePageContextClientSide.js +2 -1
- package/dist/esm/node/runtime/html/stream.js +57 -17
- package/dist/esm/node/runtime/index-deprecated.js +3 -2
- package/dist/esm/node/runtime/index.js +3 -2
- package/dist/esm/node/runtime/renderPage/{executeOnBeforeRenderHook.d.ts → executeOnBeforeRenderAndDataHooks.d.ts} +2 -2
- package/dist/esm/node/runtime/renderPage/executeOnBeforeRenderAndDataHooks.js +30 -0
- package/dist/esm/node/runtime/renderPage/getHttpResponseBody.js +2 -2
- package/dist/esm/node/runtime/renderPage/getPageAssets/retrieveAssetsDev.js +13 -5
- package/dist/esm/node/runtime/renderPage/getPageAssets/sortPageAssetsForEarlyHintsHeader.js +6 -0
- package/dist/esm/node/runtime/renderPage/getPageAssets.js +1 -1
- package/dist/esm/node/runtime/renderPage/inferMediaType.d.ts +2 -2
- package/dist/esm/node/runtime/renderPage/inferMediaType.js +38 -0
- package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.js +4 -4
- package/dist/esm/shared/VikeNamespace.d.ts +2 -1
- package/dist/esm/shared/page-configs/Config.d.ts +22 -5
- package/dist/esm/shared/page-configs/assertExports.js +11 -4
- package/dist/esm/shared/route/resolveRedirects.js +2 -10
- package/dist/esm/shared/route/resolveUrlPathname.d.ts +12 -0
- package/dist/esm/shared/route/resolveUrlPathname.js +45 -0
- package/dist/esm/shared/types.d.ts +5 -0
- package/dist/esm/types/index.d.ts +1 -1
- package/dist/esm/utils/debug.d.ts +2 -2
- package/dist/esm/utils/debug.js +29 -15
- package/dist/esm/utils/debugGlob.d.ts +1 -1
- package/dist/esm/utils/getDependencyPackageJson.js +1 -1
- package/dist/esm/utils/getFilePathAbsolute.js +1 -1
- package/dist/esm/utils/getOutDirs.js +11 -1
- package/dist/esm/utils/injectRollupInputs.d.ts +7 -0
- package/dist/esm/utils/injectRollupInputs.js +26 -0
- package/dist/esm/utils/isPlainObject.js +1 -1
- package/dist/esm/utils/projectInfo.d.ts +2 -2
- package/dist/esm/utils/projectInfo.js +1 -1
- package/dist/esm/utils/requireResolve.js +1 -1
- package/package.json +10 -3
- package/dist/cjs/node/plugin/plugins/manifest.js +0 -59
- package/dist/cjs/node/runtime/renderPage/executeOnBeforeRenderHook.js +0 -23
- package/dist/esm/node/plugin/plugins/manifest.d.ts +0 -3
- package/dist/esm/node/plugin/plugins/manifest.js +0 -53
- package/dist/esm/node/runtime/renderPage/executeOnBeforeRenderHook.js +0 -20
|
@@ -12,7 +12,6 @@ const buildConfig_js_1 = require("./plugins/buildConfig.js");
|
|
|
12
12
|
const previewConfig_js_1 = require("./plugins/previewConfig.js");
|
|
13
13
|
const autoFullBuild_js_1 = require("./plugins/autoFullBuild.js");
|
|
14
14
|
const index_js_1 = require("./plugins/devConfig/index.js");
|
|
15
|
-
const manifest_js_1 = require("./plugins/manifest.js");
|
|
16
15
|
const packageJsonFile_js_1 = require("./plugins/packageJsonFile.js");
|
|
17
16
|
const removeRequireHookPlugin_js_1 = require("./plugins/removeRequireHookPlugin.js");
|
|
18
17
|
const index_js_2 = require("./plugins/importUserCode/index.js");
|
|
@@ -39,7 +38,6 @@ function plugin(vikeConfig) {
|
|
|
39
38
|
(0, buildConfig_js_1.buildConfig)(),
|
|
40
39
|
(0, previewConfig_js_1.previewConfig)(),
|
|
41
40
|
...(0, autoFullBuild_js_1.autoFullBuild)(),
|
|
42
|
-
...(0, manifest_js_1.manifest)(),
|
|
43
41
|
(0, packageJsonFile_js_1.packageJsonFile)(),
|
|
44
42
|
(0, removeRequireHookPlugin_js_1.removeRequireHookPlugin)(),
|
|
45
43
|
(0, distFileNames_js_1.distFileNames)(),
|
|
@@ -63,9 +63,10 @@ async function triggerFullBuild(config, configVike, bundle) {
|
|
|
63
63
|
return; // already triggered
|
|
64
64
|
if (isDisabled(configVike))
|
|
65
65
|
return;
|
|
66
|
+
/* Is this @vitejs/plugin-legacy workaround still needed? Should we re-implement it?
|
|
66
67
|
// vike.json missing => it isn't a `$ vite build` call (e.g. @vitejs/plugin-legacy calls Vite's build() API) => skip
|
|
67
|
-
if (!bundle['vike.json'])
|
|
68
|
-
|
|
68
|
+
if (!bundle['vike.json']) return
|
|
69
|
+
*/
|
|
69
70
|
const configFromCli = !(0, isViteCliCall_js_1.isViteCliCall)() ? null : (0, isViteCliCall_js_1.getViteConfigFromCli)();
|
|
70
71
|
const configInline = {
|
|
71
72
|
...configFromCli,
|
|
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.analyzeClientEntries = exports.assertRollupInput = exports.buildConfig = void 0;
|
|
7
7
|
const utils_js_1 = require("../utils.js");
|
|
8
|
-
const virtualFileImportUserCode_js_1 = require("../../shared/virtual-files/virtualFileImportUserCode.js");
|
|
9
8
|
const getVikeConfig_js_1 = require("./importUserCode/v1-design/getVikeConfig.js");
|
|
10
9
|
const helpers_js_1 = require("../../../shared/page-configs/helpers.js");
|
|
11
10
|
const findPageFiles_js_1 = require("../shared/findPageFiles.js");
|
|
@@ -16,7 +15,7 @@ const module_1 = require("module");
|
|
|
16
15
|
const getClientEntryFilePath_js_1 = require("../../shared/getClientEntryFilePath.js");
|
|
17
16
|
const promises_1 = __importDefault(require("fs/promises"));
|
|
18
17
|
const path_1 = __importDefault(require("path"));
|
|
19
|
-
// @ts-ignore
|
|
18
|
+
// @ts-ignore Shimmed by dist-cjs-fixup.js for CJS build.
|
|
20
19
|
const importMetaUrl = `file://${__filename}`;
|
|
21
20
|
const require_ = (0, module_1.createRequire)(importMetaUrl);
|
|
22
21
|
const manifestTempFile = '_temp_manifest.json';
|
|
@@ -30,14 +29,9 @@ function buildConfig() {
|
|
|
30
29
|
order: 'post',
|
|
31
30
|
async handler(config) {
|
|
32
31
|
assertRollupInput(config);
|
|
33
|
-
const userInputs = normalizeRollupInput(config.build.rollupOptions.input);
|
|
34
32
|
const entries = await getEntries(config);
|
|
35
33
|
(0, utils_js_1.assert)(Object.keys(entries).length > 0);
|
|
36
|
-
|
|
37
|
-
...entries,
|
|
38
|
-
...userInputs
|
|
39
|
-
};
|
|
40
|
-
config.build.rollupOptions.input = input;
|
|
34
|
+
config.build.rollupOptions.input = (0, utils_js_1.injectRollupInputs)(entries, config);
|
|
41
35
|
addLogHook();
|
|
42
36
|
}
|
|
43
37
|
},
|
|
@@ -76,12 +70,12 @@ async function getEntries(config) {
|
|
|
76
70
|
const { pageConfigs } = await (0, getVikeConfig_js_1.getVikeConfig)(config, false);
|
|
77
71
|
(0, utils_js_1.assertUsage)(Object.keys(pageFileEntries).length !== 0 || pageConfigs.length !== 0, 'At least one page should be defined, see https://vike.dev/add');
|
|
78
72
|
if ((0, utils_js_1.viteIsSSR)(config)) {
|
|
79
|
-
const
|
|
73
|
+
const pageEntries = getPageEntries(pageConfigs);
|
|
80
74
|
const entries = {
|
|
81
|
-
|
|
82
|
-
importBuild: resolve('dist/esm/node/importBuild.js'),
|
|
75
|
+
// importBuild: resolve('dist/esm/node/importBuild.js'), // TODO/next-major-release: remove
|
|
83
76
|
...pageFileEntries,
|
|
84
|
-
|
|
77
|
+
// Ensure Rollup generates a bundle per page: https://github.com/vikejs/vike/issues/349#issuecomment-1166247275
|
|
78
|
+
...pageEntries
|
|
85
79
|
};
|
|
86
80
|
return entries;
|
|
87
81
|
}
|
|
@@ -106,6 +100,14 @@ async function getEntries(config) {
|
|
|
106
100
|
return entries;
|
|
107
101
|
}
|
|
108
102
|
}
|
|
103
|
+
function getPageEntries(pageConfigs) {
|
|
104
|
+
const pageEntries = {};
|
|
105
|
+
pageConfigs.forEach((pageConfig) => {
|
|
106
|
+
const { entryName, entryTarget } = getEntryFromPageConfig(pageConfig, false);
|
|
107
|
+
pageEntries[entryName] = entryTarget;
|
|
108
|
+
});
|
|
109
|
+
return pageEntries;
|
|
110
|
+
}
|
|
109
111
|
function analyzeClientEntries(pageConfigs, config) {
|
|
110
112
|
let hasClientRouting = false;
|
|
111
113
|
let hasServerRouting = false;
|
|
@@ -120,6 +122,7 @@ function analyzeClientEntries(pageConfigs, config) {
|
|
|
120
122
|
hasServerRouting = true;
|
|
121
123
|
}
|
|
122
124
|
{
|
|
125
|
+
// Ensure Rollup generates a bundle per page: https://github.com/vikejs/vike/issues/349#issuecomment-1166247275
|
|
123
126
|
const { entryName, entryTarget } = getEntryFromPageConfig(pageConfig, true);
|
|
124
127
|
clientEntries[entryName] = entryTarget;
|
|
125
128
|
}
|
|
@@ -138,14 +141,6 @@ function analyzeClientEntries(pageConfigs, config) {
|
|
|
138
141
|
return { hasClientRouting, hasServerRouting, clientEntries };
|
|
139
142
|
}
|
|
140
143
|
exports.analyzeClientEntries = analyzeClientEntries;
|
|
141
|
-
function analyzeServerEntries(pageConfigs) {
|
|
142
|
-
const serverEntries = {};
|
|
143
|
-
pageConfigs.forEach((pageConfig) => {
|
|
144
|
-
const { entryName, entryTarget } = getEntryFromPageConfig(pageConfig, false);
|
|
145
|
-
serverEntries[entryName] = entryTarget;
|
|
146
|
-
});
|
|
147
|
-
return serverEntries;
|
|
148
|
-
}
|
|
149
144
|
// Ensure Rollup creates entries for each page file, see https://github.com/vikejs/vike/issues/350
|
|
150
145
|
// (Otherwise the page files may be missing in the client manifest.json)
|
|
151
146
|
async function getPageFileEntries(config, includeAssetsImportedByServer) {
|
|
@@ -201,20 +196,6 @@ function resolve(filePath) {
|
|
|
201
196
|
// [RELATIVE_PATH_FROM_DIST] Current directory: node_modules/vike/dist/esm/node/plugin/plugins/
|
|
202
197
|
return require_.resolve(`../../../../../${filePath}`);
|
|
203
198
|
}
|
|
204
|
-
function normalizeRollupInput(input) {
|
|
205
|
-
if (!input) {
|
|
206
|
-
return {};
|
|
207
|
-
}
|
|
208
|
-
// Usually `input` is an oject, but the user can set it as a `string` or `string[]`
|
|
209
|
-
if (typeof input === 'string') {
|
|
210
|
-
input = [input];
|
|
211
|
-
}
|
|
212
|
-
if (Array.isArray(input)) {
|
|
213
|
-
return Object.fromEntries(input.map((input) => [input, input]));
|
|
214
|
-
}
|
|
215
|
-
(0, utils_js_1.assert)((0, utils_js_1.isObject)(input));
|
|
216
|
-
return input;
|
|
217
|
-
}
|
|
218
199
|
function addLogHook() {
|
|
219
200
|
const tty = process.stdout.isTTY && !process.env.CI; // Equals https://github.com/vitejs/vite/blob/193d55c7b9cbfec5b79ebfca276d4a721e7de14d/packages/vite/src/node/plugins/reporter.ts#L27
|
|
220
201
|
if (!tty)
|
|
@@ -243,9 +224,9 @@ function addLogHook() {
|
|
|
243
224
|
});
|
|
244
225
|
}
|
|
245
226
|
function assertRollupInput(config) {
|
|
246
|
-
const userInputs = normalizeRollupInput(config.build.rollupOptions.input);
|
|
227
|
+
const userInputs = (0, utils_js_1.normalizeRollupInput)(config.build.rollupOptions.input);
|
|
247
228
|
const htmlInputs = Object.values(userInputs).filter((entry) => entry.endsWith('.html') || entry.endsWith('.htm'));
|
|
248
229
|
const htmlInput = htmlInputs[0];
|
|
249
|
-
(0, utils_js_1.assertUsage)(htmlInput === undefined, `The entry ${htmlInput} of config build.rollupOptions.input is an HTML entry which is forbidden when using
|
|
230
|
+
(0, utils_js_1.assertUsage)(htmlInput === undefined, `The entry ${htmlInput} of config build.rollupOptions.input is an HTML entry which is forbidden when using Vike, instead follow https://vike.dev/add`);
|
|
250
231
|
}
|
|
251
232
|
exports.assertRollupInput = assertRollupInput;
|
|
@@ -40,6 +40,9 @@ function assertResolveAlias(config) {
|
|
|
40
40
|
// Allow un-distinguishable aliases set by @preact/preset-vite
|
|
41
41
|
if (find.startsWith('react'))
|
|
42
42
|
return;
|
|
43
|
+
// Allow un-distinguishable aliases set by @vitejs/plugin-vue2 https://github.com/vikejs/vike/issues/1329
|
|
44
|
+
if (find === 'vue')
|
|
45
|
+
return;
|
|
43
46
|
{
|
|
44
47
|
const msg = `${errPrefix} defines an invalid ${picocolors_1.default.cyan('resolve.alias')}: a path alias cannot be the empty string ${picocolors_1.default.cyan("''")}`;
|
|
45
48
|
(0, utils_js_1.assertUsage)(find !== '', msg);
|
|
@@ -11,7 +11,7 @@ const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
|
11
11
|
const path_1 = __importDefault(require("path"));
|
|
12
12
|
const module_1 = require("module");
|
|
13
13
|
const assertResolveAlias_js_1 = require("./commonConfig/assertResolveAlias.js");
|
|
14
|
-
// @ts-ignore
|
|
14
|
+
// @ts-ignore Shimmed by dist-cjs-fixup.js for CJS build.
|
|
15
15
|
const importMetaUrl = `file://${__filename}`;
|
|
16
16
|
const require_ = (0, module_1.createRequire)(importMetaUrl);
|
|
17
17
|
function commonConfig() {
|
|
@@ -10,7 +10,7 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
10
10
|
const fileTypes_js_1 = require("../../../../shared/getPageFiles/fileTypes.js");
|
|
11
11
|
const module_1 = require("module");
|
|
12
12
|
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
13
|
-
// @ts-ignore
|
|
13
|
+
// @ts-ignore Shimmed by dist-cjs-fixup.js for CJS build.
|
|
14
14
|
const importMetaUrl = `file://${__filename}`;
|
|
15
15
|
const require_ = (0, module_1.createRequire)(importMetaUrl);
|
|
16
16
|
function resolveExtensions(configs, config) {
|
|
@@ -9,7 +9,7 @@ const path_1 = __importDefault(require("path"));
|
|
|
9
9
|
const utils_js_1 = require("../../utils.js");
|
|
10
10
|
const import_1 = require("@brillout/import");
|
|
11
11
|
const module_1 = require("module");
|
|
12
|
-
// @ts-ignore
|
|
12
|
+
// @ts-ignore Shimmed by dist-cjs-fixup.js for CJS build.
|
|
13
13
|
const importMetaUrl = `file://${__filename}`;
|
|
14
14
|
const require_ = (0, module_1.createRequire)(importMetaUrl);
|
|
15
15
|
async function getStemPackages(userAppRootDir) {
|
|
@@ -11,7 +11,7 @@ const utils_js_1 = require("../../utils.js");
|
|
|
11
11
|
const module_1 = require("module");
|
|
12
12
|
const path_2 = require("path");
|
|
13
13
|
const url_1 = require("url");
|
|
14
|
-
// @ts-ignore
|
|
14
|
+
// @ts-ignore Shimmed by dist-cjs-fixup.js for CJS build.
|
|
15
15
|
const importMetaUrl = `file://${__filename}`;
|
|
16
16
|
const require_ = (0, module_1.createRequire)(importMetaUrl);
|
|
17
17
|
const __dirname_ = (0, path_2.dirname)((0, url_1.fileURLToPath)(importMetaUrl));
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getVikeManifest = void 0;
|
|
7
|
+
const utils_js_1 = require("../../utils.js");
|
|
8
|
+
const assertPluginManifest_js_1 = require("../../../shared/assertPluginManifest.js");
|
|
9
|
+
const extractExportNamesPlugin_js_1 = require("../extractExportNamesPlugin.js");
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
11
|
+
const globalContext_js_1 = require("../../../runtime/globalContext.js");
|
|
12
|
+
function getVikeManifest(config, configVike) {
|
|
13
|
+
const runtimeManifest = (0, globalContext_js_1.getRuntimeManifest)(configVike);
|
|
14
|
+
const manifest = {
|
|
15
|
+
version: utils_js_1.projectInfo.projectVersion,
|
|
16
|
+
usesClientRouter: (0, extractExportNamesPlugin_js_1.isUsingClientRouter)(),
|
|
17
|
+
manifestKeyMap: getManifestKeyMap(configVike, config),
|
|
18
|
+
...runtimeManifest
|
|
19
|
+
};
|
|
20
|
+
(0, assertPluginManifest_js_1.assertPluginManifest)(manifest);
|
|
21
|
+
return manifest;
|
|
22
|
+
}
|
|
23
|
+
exports.getVikeManifest = getVikeManifest;
|
|
24
|
+
function getManifestKeyMap(configVike, config) {
|
|
25
|
+
const manifestKeyMap = {};
|
|
26
|
+
configVike.extensions
|
|
27
|
+
.map(({ pageConfigsDistFiles }) => pageConfigsDistFiles)
|
|
28
|
+
.flat()
|
|
29
|
+
.filter(utils_js_1.isNotNullish)
|
|
30
|
+
.forEach(({ importPath, filePath }) => {
|
|
31
|
+
// Recreating https://github.com/vitejs/vite/blob/8158ece72b66307e7b607b98496891610ca70ea2/packages/vite/src/node/plugins/manifest.ts#L38
|
|
32
|
+
const filePathRelative = path_1.default.posix.relative(config.root, (0, utils_js_1.toPosixPath)(filePath));
|
|
33
|
+
(0, utils_js_1.assertPosixPath)(filePathRelative);
|
|
34
|
+
(0, utils_js_1.assertPosixPath)(importPath);
|
|
35
|
+
manifestKeyMap[importPath] = filePathRelative;
|
|
36
|
+
});
|
|
37
|
+
return manifestKeyMap;
|
|
38
|
+
}
|
|
@@ -8,47 +8,85 @@ const plugin_js_1 = require("@brillout/vite-plugin-import-build/plugin.js");
|
|
|
8
8
|
const utils_js_1 = require("../../utils.js");
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
10
|
const module_1 = require("module");
|
|
11
|
-
|
|
11
|
+
const getConfigVike_js_1 = require("../../../shared/getConfigVike.js");
|
|
12
|
+
const getVikeManifest_js_1 = require("./getVikeManifest.js");
|
|
13
|
+
const promises_1 = __importDefault(require("fs/promises"));
|
|
14
|
+
const virtualFileImportUserCode_js_1 = require("../../../shared/virtual-files/virtualFileImportUserCode.js");
|
|
15
|
+
// @ts-ignore Shimmed by dist-cjs-fixup.js for CJS build.
|
|
12
16
|
const importMetaUrl = `file://${__filename}`;
|
|
13
17
|
const require_ = (0, module_1.createRequire)(importMetaUrl);
|
|
18
|
+
const ASSETS_MAP = '__VITE_ASSETS_MAP__';
|
|
14
19
|
function importBuild() {
|
|
15
20
|
let config;
|
|
21
|
+
let configVike;
|
|
16
22
|
return [
|
|
17
23
|
{
|
|
18
24
|
name: 'vike:importBuild:config',
|
|
19
25
|
enforce: 'post',
|
|
20
|
-
configResolved(config_) {
|
|
26
|
+
async configResolved(config_) {
|
|
21
27
|
config = config_;
|
|
28
|
+
configVike = await (0, getConfigVike_js_1.getConfigVike)(config);
|
|
29
|
+
},
|
|
30
|
+
async writeBundle(options, bundle) {
|
|
31
|
+
if (!(0, utils_js_1.viteIsSSR)(config))
|
|
32
|
+
return;
|
|
33
|
+
await replace_ASSETS_MAP(options, bundle);
|
|
22
34
|
}
|
|
23
35
|
},
|
|
24
36
|
(0, plugin_js_1.importBuild)({
|
|
25
|
-
getImporterCode: (
|
|
26
|
-
|
|
27
|
-
return getImporterCode(config, pageFilesEntry);
|
|
37
|
+
getImporterCode: () => {
|
|
38
|
+
return getEntryCode(config, configVike);
|
|
28
39
|
},
|
|
29
40
|
libraryName: utils_js_1.projectInfo.projectName
|
|
30
41
|
})
|
|
31
42
|
];
|
|
32
43
|
}
|
|
33
44
|
exports.importBuild = importBuild;
|
|
34
|
-
function
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
require_.resolve(`../../../../../../dist/esm/node/runtime/globalContext/loadImportBuild.js`));
|
|
38
|
-
const { outDirServer } = (0, utils_js_1.getOutDirs)(config);
|
|
39
|
-
const filePathRelative = path_1.default.posix.relative(outDirServer, filePathAbsolute);
|
|
40
|
-
// The only reason we went for using CJS require() instead of ESM import() is because import() doesn't support .json files
|
|
45
|
+
function getEntryCode(config, configVike) {
|
|
46
|
+
const importPath = getImportPath(config);
|
|
47
|
+
const vikeManifest = (0, getVikeManifest_js_1.getVikeManifest)(config, configVike);
|
|
41
48
|
const importerCode = [
|
|
42
|
-
|
|
43
|
-
`
|
|
49
|
+
` import { setImportBuildGetters } from '${importPath}';`,
|
|
50
|
+
` import * as pageFiles from '${virtualFileImportUserCode_js_1.virtualFileIdImportUserCodeServer}';`,
|
|
44
51
|
' setImportBuildGetters({',
|
|
45
|
-
` pageFiles: () =>
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
52
|
+
` pageFiles: () => pageFiles,`,
|
|
53
|
+
// TODO: rename clientManifest -> assetManifest
|
|
54
|
+
` clientManifest: () => { return ${ASSETS_MAP} },`,
|
|
55
|
+
// TODO: rename pluginManifest -> vikeManifest
|
|
56
|
+
` pluginManifest: () => (${JSON.stringify(vikeManifest, null, 2)}),`,
|
|
49
57
|
' });',
|
|
50
|
-
'})()',
|
|
51
58
|
''
|
|
52
59
|
].join('\n');
|
|
53
60
|
return importerCode;
|
|
54
61
|
}
|
|
62
|
+
async function replace_ASSETS_MAP(options, bundle) {
|
|
63
|
+
const { dir } = options;
|
|
64
|
+
(0, utils_js_1.assert)(dir);
|
|
65
|
+
// I guess importBuild won't be found in the bundle when using @vitejs/plugin-legacy
|
|
66
|
+
const importBuildEntry = (0, plugin_js_1.findImportBuildBundleEntry)(bundle);
|
|
67
|
+
const importBuildFilePath = path_1.default.join(dir, importBuildEntry.fileName);
|
|
68
|
+
const assetsJsonFilePath = path_1.default.join(dir, '..', 'assets.json');
|
|
69
|
+
const [assetsJsonString, importBuildFileContent] = await Promise.all([
|
|
70
|
+
await promises_1.default.readFile(assetsJsonFilePath, 'utf8'),
|
|
71
|
+
await promises_1.default.readFile(importBuildFilePath, 'utf8')
|
|
72
|
+
]);
|
|
73
|
+
const importBuildFileContentFixed = importBuildFileContent.replace(ASSETS_MAP, assetsJsonString);
|
|
74
|
+
(0, utils_js_1.assert)(importBuildFileContentFixed !== importBuildFileContent);
|
|
75
|
+
await promises_1.default.writeFile(importBuildFilePath, importBuildFileContentFixed);
|
|
76
|
+
}
|
|
77
|
+
function getImportPath(config) {
|
|
78
|
+
// We resolve filePathAbsolute even if we don't use it: we use require.resolve() as an assertion that the relative path is correct
|
|
79
|
+
const filePathAbsolute = (0, utils_js_1.toPosixPath)(
|
|
80
|
+
// [RELATIVE_PATH_FROM_DIST] Current file: node_modules/vike/dist/esm/node/plugin/plugins/importBuild/index.js
|
|
81
|
+
require_.resolve(`../../../../../../dist/esm/node/runtime/globalContext/loadImportBuild.js`));
|
|
82
|
+
if (
|
|
83
|
+
// Let's implement a new config if a user needs the import to be a relative path instead of 'vike/__internal/loadImportBuild' (AFAIK a relative path is needed only if a framework has npm package 'vike' as direct dependency instead of a peer dependency and if the user of that framework uses pnpm)
|
|
84
|
+
true) {
|
|
85
|
+
return 'vike/__internal/loadImportBuild';
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
const { outDirServer } = (0, utils_js_1.getOutDirs)(config);
|
|
89
|
+
const filePathRelative = path_1.default.posix.relative(outDirServer, filePathAbsolute);
|
|
90
|
+
return filePathRelative;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -111,7 +111,9 @@ function handleHotUpdate(ctx, config, configVike) {
|
|
|
111
111
|
return;
|
|
112
112
|
}
|
|
113
113
|
if (isVikeConfig) {
|
|
114
|
-
|
|
114
|
+
/* Tailwind breaks this assertion, see https://github.com/vikejs/vike/discussions/1330#discussioncomment-7787238
|
|
115
|
+
assert(!isViteModule)
|
|
116
|
+
*/
|
|
115
117
|
reloadConfig(file, config, configVike, 'modified');
|
|
116
118
|
const virtualModules = getVirtualModules(server);
|
|
117
119
|
return virtualModules;
|
|
@@ -37,6 +37,9 @@ const configDefinitionsBuiltIn = {
|
|
|
37
37
|
guard: {
|
|
38
38
|
env: { server: true, client: 'if-client-routing' }
|
|
39
39
|
},
|
|
40
|
+
data: {
|
|
41
|
+
env: { server: true }
|
|
42
|
+
},
|
|
40
43
|
iKnowThePerformanceRisksOfAsyncRouteFunctions: {
|
|
41
44
|
env: { server: true, client: 'if-client-routing', eager: true }
|
|
42
45
|
},
|
|
@@ -77,6 +80,10 @@ const configDefinitionsBuiltIn = {
|
|
|
77
80
|
env: { client: true },
|
|
78
81
|
_computed: (configValueSources) => !isConfigSet(configValueSources, 'onBeforeRender') ? null : getConfigEnv(configValueSources, 'onBeforeRender')
|
|
79
82
|
},
|
|
83
|
+
dataEnv: {
|
|
84
|
+
env: { client: true },
|
|
85
|
+
_computed: (configValueSources) => !isConfigSet(configValueSources, 'data') ? null : getConfigEnv(configValueSources, 'data')
|
|
86
|
+
},
|
|
80
87
|
hooksTimeout: {
|
|
81
88
|
env: { server: true, client: true }
|
|
82
89
|
}
|
package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js
CHANGED
|
@@ -126,5 +126,5 @@ async function isUsingGit(userRootDir) {
|
|
|
126
126
|
async function runCmd(cmd, cwd) {
|
|
127
127
|
const res = await execA(cmd, { cwd });
|
|
128
128
|
(0, utils_js_1.assert)(res.stderr === '');
|
|
129
|
-
return res.stdout.toString().
|
|
129
|
+
return res.stdout.toString().split('\n').filter(Boolean);
|
|
130
130
|
}
|
|
@@ -40,3 +40,4 @@ __exportStar(require("../../utils/getPropAccessNotation.js"), exports);
|
|
|
40
40
|
__exportStar(require("../../utils/mergeCumulativeValues.js"), exports);
|
|
41
41
|
__exportStar(require("../../utils/deepEqual.js"), exports);
|
|
42
42
|
__exportStar(require("../../utils/assertKeys.js"), exports);
|
|
43
|
+
__exportStar(require("../../utils/injectRollupInputs.js"), exports);
|
|
@@ -20,7 +20,8 @@ const PASS_TO_CLIENT = [
|
|
|
20
20
|
'_abortCaller',
|
|
21
21
|
*/
|
|
22
22
|
'_pageContextInitHasClientData',
|
|
23
|
-
'_pageId'
|
|
23
|
+
'_pageId',
|
|
24
|
+
'data' // for data() hook
|
|
24
25
|
];
|
|
25
26
|
const PASS_TO_CLIENT_ERROR_PAGE = ['pageProps', 'is404', '_isError'];
|
|
26
27
|
function serializePageContextClientSide(pageContext) {
|
|
@@ -200,7 +200,9 @@ exports.pipeToStreamWritableNode = pipeToStreamWritableNode;
|
|
|
200
200
|
async function processStream(streamOriginal, { injectStringAtBegin, injectStringAtEnd, onErrorWhileStreaming, enableEagerStreaming }) {
|
|
201
201
|
const buffer = [];
|
|
202
202
|
let streamOriginalHasStartedEmitting = false;
|
|
203
|
-
let
|
|
203
|
+
let streamOriginalEnded = false;
|
|
204
|
+
let streamClosed = false;
|
|
205
|
+
let onEndWasCalled = false;
|
|
204
206
|
let isReadyToWrite = false;
|
|
205
207
|
let wrapperCreated = false;
|
|
206
208
|
let shouldFlushStream = false;
|
|
@@ -224,6 +226,14 @@ async function processStream(streamOriginal, { injectStringAtBegin, injectString
|
|
|
224
226
|
writeStream(injectionBegin); // Adds injectionBegin to buffer
|
|
225
227
|
flushStream(); // Sets shouldFlushStream to true
|
|
226
228
|
}
|
|
229
|
+
// We call onStreamEvent() also when the stream ends in order to properly handle the situation when the stream didn't emit any data
|
|
230
|
+
const onStreamDataOrEnd = (cb) => {
|
|
231
|
+
(0, utils_js_1.assert)(streamOriginalEnded === false);
|
|
232
|
+
streamOriginalHasStartedEmitting = true;
|
|
233
|
+
cb();
|
|
234
|
+
if (wrapperCreated)
|
|
235
|
+
resolvePromise();
|
|
236
|
+
};
|
|
227
237
|
const { streamWrapper, streamWrapperOperations } = await createStreamWrapper({
|
|
228
238
|
streamOriginal,
|
|
229
239
|
onReadyToWrite() {
|
|
@@ -241,19 +251,21 @@ async function processStream(streamOriginal, { injectStringAtBegin, injectString
|
|
|
241
251
|
}
|
|
242
252
|
},
|
|
243
253
|
onData(chunk) {
|
|
244
|
-
(
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
if (wrapperCreated)
|
|
248
|
-
resolvePromise();
|
|
254
|
+
onStreamDataOrEnd(() => {
|
|
255
|
+
writeStream(chunk);
|
|
256
|
+
});
|
|
249
257
|
},
|
|
250
|
-
async onEnd(
|
|
258
|
+
async onEnd(
|
|
259
|
+
// Should we use this `isCancel`? Maybe we can skip `injectStringAtEnd()`?
|
|
260
|
+
isCancel) {
|
|
251
261
|
try {
|
|
262
|
+
(0, utils_js_1.assert)(!onEndWasCalled);
|
|
263
|
+
onEndWasCalled = true;
|
|
252
264
|
debug('stream end');
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
265
|
+
// We call onStreamEvent() also here in case the stream didn't emit any data
|
|
266
|
+
onStreamDataOrEnd(() => {
|
|
267
|
+
streamOriginalEnded = true;
|
|
268
|
+
});
|
|
257
269
|
if (injectStringAtEnd) {
|
|
258
270
|
const injectEnd = await injectStringAtEnd();
|
|
259
271
|
writeStream(injectEnd);
|
|
@@ -261,10 +273,12 @@ async function processStream(streamOriginal, { injectStringAtBegin, injectString
|
|
|
261
273
|
await promiseReadyToWrite; // E.g. if the user calls the pipe wrapper after the original writable has ended
|
|
262
274
|
(0, utils_js_1.assert)(isReady());
|
|
263
275
|
flushBuffer();
|
|
276
|
+
streamClosed = true;
|
|
264
277
|
debug('stream ended');
|
|
265
278
|
}
|
|
266
279
|
catch (err) {
|
|
267
|
-
//
|
|
280
|
+
// 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?)
|
|
281
|
+
// Show "[vike][Bug] You stumbled upon a bug in Vike's source code" to user while printing original error
|
|
268
282
|
if (!(0, utils_js_1.isBug)(err)) {
|
|
269
283
|
console.error(err);
|
|
270
284
|
(0, utils_js_1.assert)(false);
|
|
@@ -288,6 +302,7 @@ async function processStream(streamOriginal, { injectStringAtBegin, injectString
|
|
|
288
302
|
function flushBuffer() {
|
|
289
303
|
if (!isReady())
|
|
290
304
|
return;
|
|
305
|
+
(0, utils_js_1.assert)(!streamClosed);
|
|
291
306
|
buffer.forEach((chunk) => {
|
|
292
307
|
streamWrapperOperations.writeChunk(chunk);
|
|
293
308
|
});
|
|
@@ -485,6 +500,17 @@ async function createStreamWrapper({ streamOriginal, onError, onData, onEnd, onF
|
|
|
485
500
|
if (isStreamReadableWeb(streamOriginal)) {
|
|
486
501
|
debug('onRenderHtml() hook returned Web Readable');
|
|
487
502
|
const readableOriginal = streamOriginal;
|
|
503
|
+
let controllerProxyIsClosed = false;
|
|
504
|
+
let isClosed = false;
|
|
505
|
+
let isCancel = false;
|
|
506
|
+
const closeStream = async () => {
|
|
507
|
+
if (isClosed)
|
|
508
|
+
return;
|
|
509
|
+
isClosed = true;
|
|
510
|
+
await onEnd(isCancel);
|
|
511
|
+
controllerProxy.close();
|
|
512
|
+
controllerProxyIsClosed = true;
|
|
513
|
+
};
|
|
488
514
|
let controllerProxy;
|
|
489
515
|
assertReadableStreamConstructor();
|
|
490
516
|
const readableProxy = new ReadableStream({
|
|
@@ -498,16 +524,30 @@ async function createStreamWrapper({ streamOriginal, onError, onData, onEnd, onF
|
|
|
498
524
|
controllerProxy.close();
|
|
499
525
|
},
|
|
500
526
|
async onEnd() {
|
|
501
|
-
await
|
|
502
|
-
controllerProxy.close();
|
|
527
|
+
await closeStream();
|
|
503
528
|
}
|
|
504
529
|
});
|
|
530
|
+
},
|
|
531
|
+
async cancel(...args) {
|
|
532
|
+
isCancel = true;
|
|
533
|
+
await readableOriginal.cancel(...args);
|
|
534
|
+
// If readableOriginal has implemented readableOriginal.cancel() then the onEnd() callback and therfore closeStream() may already have been called at this point
|
|
535
|
+
await closeStream();
|
|
505
536
|
}
|
|
506
537
|
});
|
|
507
538
|
const writeChunk = (chunk) => {
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
539
|
+
if (
|
|
540
|
+
// 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`.
|
|
541
|
+
!controllerProxyIsClosed) {
|
|
542
|
+
controllerProxy.enqueue(encodeForWebStream(chunk));
|
|
543
|
+
if (debug.isEnabled) {
|
|
544
|
+
debug('data written (Web Readable)', String(chunk));
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
else {
|
|
548
|
+
if (debug.isEnabled) {
|
|
549
|
+
debug('data emitted but not written (Web Readable)', String(chunk));
|
|
550
|
+
}
|
|
511
551
|
}
|
|
512
552
|
};
|
|
513
553
|
// Readables don't have the notion of flushing
|
|
@@ -20,6 +20,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
20
20
|
};
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
22
|
exports.RenderErrorPage = void 0;
|
|
23
|
+
const isBrowser_js_1 = require("../../utils/isBrowser.js");
|
|
24
|
+
const assert_js_1 = require("../../utils/assert.js");
|
|
25
|
+
(0, assert_js_1.assertUsage)(!(0, isBrowser_js_1.isBrowser)(), "It's forbidden to `import { something } from 'vike'` on the client-side: the module 'vike' is a server-only module.", { showStackTrace: true });
|
|
23
26
|
__exportStar(require("./index-common.js"), exports);
|
|
24
27
|
__exportStar(require("../../types/index-dreprecated.js"), exports);
|
|
25
28
|
const utils_js_1 = require("./utils.js");
|
|
@@ -57,5 +60,3 @@ exports.RenderErrorPage = RenderErrorPage;
|
|
|
57
60
|
picocolors_1.default.green(" import type { something } from 'vike/types'"),
|
|
58
61
|
"Make sure to import renderPage(), escapeInject, html, dangerouslySkipEscape(), pipeWebStream(), pipeNodeStream(), pipeStream(), stampPipe() from 'vike/server'. (Or inspect the error stack below to find the import causing this warning.)"
|
|
59
62
|
].join('\n'), { showStackTrace: true, onlyOnce: true });
|
|
60
|
-
const utils_js_2 = require("./utils.js");
|
|
61
|
-
(0, utils_js_2.assertUsage)(!(0, utils_js_2.isBrowser)(), "It's forbidden to `import { something } from 'vike'` in code loaded in the browser: the module 'vike' is a server-only module.", { showStackTrace: true });
|
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
const isBrowser_js_1 = require("../../utils/isBrowser.js");
|
|
18
|
+
const assert_js_1 = require("../../utils/assert.js");
|
|
19
|
+
(0, assert_js_1.assertUsage)(!(0, isBrowser_js_1.isBrowser)(), "It's forbidden to `import { something } from 'vike/server'` on the client-side: the module 'vike/server' is a server-only module.", { showStackTrace: true });
|
|
17
20
|
__exportStar(require("./index-common.js"), exports);
|
|
18
|
-
const utils_js_1 = require("./utils.js");
|
|
19
|
-
(0, utils_js_1.assertUsage)(!(0, utils_js_1.isBrowser)(), "It's forbidden to `import { something } from 'vike/server'` in code loaded on the client-side: the module 'vike/server' is a server-only module.", { showStackTrace: true });
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.executeOnBeforeRenderAndDataHooks = void 0;
|
|
4
|
+
const getHook_js_1 = require("../../../shared/hooks/getHook.js");
|
|
5
|
+
const preparePageContextForUserConsumptionServerSide_js_1 = require("./preparePageContextForUserConsumptionServerSide.js");
|
|
6
|
+
const utils_js_1 = require("../utils.js");
|
|
7
|
+
const assertOnBeforeRenderHookReturn_js_1 = require("../../../shared/assertOnBeforeRenderHookReturn.js");
|
|
8
|
+
async function executeOnBeforeRenderAndDataHooks(pageContext) {
|
|
9
|
+
if (pageContext._pageContextAlreadyProvidedByOnPrerenderHook) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const dataHook = (0, getHook_js_1.getHook)(pageContext, 'data');
|
|
13
|
+
const onBeforeRenderHook = (0, getHook_js_1.getHook)(pageContext, 'onBeforeRender');
|
|
14
|
+
if (!dataHook && !onBeforeRenderHook) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
(0, preparePageContextForUserConsumptionServerSide_js_1.preparePageContextForUserConsumptionServerSide)(pageContext);
|
|
18
|
+
if (dataHook) {
|
|
19
|
+
const hookResult = await (0, utils_js_1.executeHook)(() => dataHook.hookFn(pageContext), dataHook);
|
|
20
|
+
// Note: hookResult can be anything (e.g. an object) and is to be assigned to pageContext.data
|
|
21
|
+
const pageContextFromHook = {
|
|
22
|
+
data: hookResult
|
|
23
|
+
};
|
|
24
|
+
Object.assign(pageContext, pageContextFromHook);
|
|
25
|
+
}
|
|
26
|
+
if (onBeforeRenderHook) {
|
|
27
|
+
const hookResult = await (0, utils_js_1.executeHook)(() => onBeforeRenderHook.hookFn(pageContext), onBeforeRenderHook);
|
|
28
|
+
(0, assertOnBeforeRenderHookReturn_js_1.assertOnBeforeRenderHookReturn)(hookResult, onBeforeRenderHook.hookFilePath);
|
|
29
|
+
const pageContextFromHook = hookResult?.pageContext;
|
|
30
|
+
Object.assign(pageContext, pageContextFromHook);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.executeOnBeforeRenderAndDataHooks = executeOnBeforeRenderAndDataHooks;
|
|
@@ -76,7 +76,7 @@ function getHttpResponseBodyStreamHandlers(htmlRender, renderHook) {
|
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
78
|
else {
|
|
79
|
-
(0, utils_js_1.assert)((0, stream_js_1.
|
|
79
|
+
(0, utils_js_1.assert)((0, stream_js_1.isStreamReadableNode)(htmlRender) || (0, stream_js_1.isStreamPipeNode)(htmlRender));
|
|
80
80
|
(0, utils_js_1.assertUsage)(false, getErrMsgMixingStreamTypes('Web Writable'));
|
|
81
81
|
}
|
|
82
82
|
}
|
|
@@ -86,7 +86,7 @@ function getHttpResponseBodyStreamHandlers(htmlRender, renderHook) {
|
|
|
86
86
|
return;
|
|
87
87
|
}
|
|
88
88
|
else {
|
|
89
|
-
(0, utils_js_1.assert)((0, stream_js_1.
|
|
89
|
+
(0, utils_js_1.assert)((0, stream_js_1.isStreamReadableWeb)(htmlRender) || (0, stream_js_1.isStreamPipeWeb)(htmlRender));
|
|
90
90
|
(0, utils_js_1.assertUsage)(false, getErrMsgMixingStreamTypes('Node.js Writable'));
|
|
91
91
|
}
|
|
92
92
|
}
|