Created
March 6, 2024 13:40
-
-
Save andrewatwood/825ae87bfa0d9191cbc38cfbb21cbdab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/node_modules/@angular-devkit/build-angular/src/tools/vite/angular-memory-plugin.js b/node_modules/@angular-devkit/build-angular/src/tools/vite/angular-memory-plugin.js | |
index c97d397..a5ac37f 100755 | |
--- a/node_modules/@angular-devkit/build-angular/src/tools/vite/angular-memory-plugin.js | |
+++ b/node_modules/@angular-devkit/build-angular/src/tools/vite/angular-memory-plugin.js | |
@@ -167,6 +167,7 @@ function createAngularMemoryPlugin(options) { | |
outputFiles: {}, | |
// TODO: add support for critical css inlining. | |
inlineCriticalCss: false, | |
+ request: req, | |
}); | |
return indexHtmlTransformer && content ? await indexHtmlTransformer(content) : content; | |
}); | |
diff --git a/node_modules/@angular-devkit/build-angular/src/utils/server-rendering/render-page.js b/node_modules/@angular-devkit/build-angular/src/utils/server-rendering/render-page.js | |
index f36f38b..d3131a7 100755 | |
--- a/node_modules/@angular-devkit/build-angular/src/utils/server-rendering/render-page.js | |
+++ b/node_modules/@angular-devkit/build-angular/src/utils/server-rendering/render-page.js | |
@@ -37,21 +37,36 @@ exports.renderPage = void 0; | |
const node_assert_1 = __importDefault(require("node:assert")); | |
const node_path_1 = require("node:path"); | |
const load_esm_1 = require("../load-esm"); | |
+ | |
+const parseCookie = str => | |
+ str | |
+ .split(';') | |
+ .map(v => v.split('=')) | |
+ .reduce((acc, v) => { | |
+ acc[decodeURIComponent(v[0].trim())] = decodeURIComponent(v[1].trim()); | |
+ return acc; | |
+ }, {}); | |
+ | |
/** | |
* Renders each route in routes and writes them to <outputPath>/<route>/index.html. | |
*/ | |
-async function renderPage({ route, serverContext, document, inlineCriticalCss, outputFiles, loadBundle = load_esm_1.loadEsmModule, }) { | |
+async function renderPage({ route, serverContext, document, inlineCriticalCss, outputFiles, loadBundle = load_esm_1.loadEsmModule, request}) { | |
const { default: bootstrapAppFnOrModule } = await loadBundle('./main.server.mjs'); | |
const { ɵSERVER_CONTEXT, renderModule, renderApplication, ɵresetCompiledComponents, ɵConsole } = await loadBundle('./render-utils.server.mjs'); | |
// Need to clean up GENERATED_COMP_IDS map in `@angular/core`. | |
// Otherwise an incorrect component ID generation collision detected warning will be displayed in development. | |
// See: https://github.com/angular/angular-cli/issues/25924 | |
ɵresetCompiledComponents?.(); | |
+ request.cookies = parseCookie(request.headers?.['cookie'] || ''); | |
const platformProviders = [ | |
{ | |
provide: ɵSERVER_CONTEXT, | |
useValue: serverContext, | |
}, | |
+ { | |
+ provide: '__REQUEST_TOKEN_TEMP', | |
+ useValue: request, | |
+ }, | |
{ | |
provide: ɵConsole, | |
/** An Angular Console Provider that does not print a set of predefined logs. */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment