@lwrjs/shared-utils 0.17.2-alpha.25 → 0.17.2-alpha.26

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.
@@ -25,6 +25,7 @@ var __toModule = (module2) => {
25
25
  __markAsModule(exports);
26
26
  __export(exports, {
27
27
  addHeadMarkup: () => addHeadMarkup,
28
+ addToHead: () => addToHead,
28
29
  createHeadMarkup: () => createHeadMarkup,
29
30
  replaceStringFromLocation: () => replaceStringFromLocation,
30
31
  serializeModuleToJson: () => serializeModuleToJson,
@@ -128,9 +129,14 @@ function createHeadMarkup(markup) {
128
129
  function addHeadMarkup(markup, stringBuilder) {
129
130
  const headMarkup = createHeadMarkup(markup);
130
131
  if (headMarkup) {
132
+ addToHead(headMarkup, stringBuilder);
133
+ }
134
+ }
135
+ function addToHead(markup, stringBuilder) {
136
+ if (markup) {
131
137
  const headIndex = stringBuilder.original.indexOf("</head>");
132
138
  if (headIndex >= 0) {
133
- stringBuilder.prependLeft(headIndex, headMarkup);
139
+ stringBuilder.prependLeft(headIndex, markup);
134
140
  } else {
135
141
  import_diagnostics.logger.error("Adding head markup failed. Could not find the </head> tag.");
136
142
  }
@@ -38,4 +38,10 @@ export declare function createHeadMarkup(markup: (HeadMarkup | undefined)[]): st
38
38
  * @param stringBuilder The string builder for a base document
39
39
  */
40
40
  export declare function addHeadMarkup(markup: (HeadMarkup | undefined)[], stringBuilder: LwrStringBuilder): void;
41
+ /**
42
+ * Add an HTML string to the <head> of a base doc
43
+ * @param markup An HTML string
44
+ * @param stringBuilder The string builder for a base document
45
+ */
46
+ export declare function addToHead(markup: string, stringBuilder: LwrStringBuilder): void;
41
47
  //# sourceMappingURL=serialize.d.ts.map
@@ -123,10 +123,22 @@ export function addHeadMarkup(markup, stringBuilder) {
123
123
  // Create HTML tags for each item in the SsrDataResponse.markup bag
124
124
  const headMarkup = createHeadMarkup(markup);
125
125
  if (headMarkup) {
126
+ // Add all the links to the <head> section of the base document
127
+ addToHead(headMarkup, stringBuilder);
128
+ }
129
+ }
130
+ /**
131
+ * Add an HTML string to the <head> of a base doc
132
+ * @param markup An HTML string
133
+ * @param stringBuilder The string builder for a base document
134
+ */
135
+ export function addToHead(markup, stringBuilder) {
136
+ // Create HTML tags for each item in the SsrDataResponse.markup bag
137
+ if (markup) {
126
138
  // Add all the links to the <head> section of the base document
127
139
  const headIndex = stringBuilder.original.indexOf('</head>');
128
140
  if (headIndex >= 0) {
129
- stringBuilder.prependLeft(headIndex, headMarkup);
141
+ stringBuilder.prependLeft(headIndex, markup);
130
142
  }
131
143
  else {
132
144
  logger.error('Adding head markup failed. Could not find the </head> tag.');
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.17.2-alpha.25",
7
+ "version": "0.17.2-alpha.26",
8
8
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
9
9
  "repository": {
10
10
  "type": "git",
@@ -37,7 +37,7 @@
37
37
  "build/**/*.d.ts"
38
38
  ],
39
39
  "dependencies": {
40
- "@lwrjs/diagnostics": "0.17.2-alpha.25",
40
+ "@lwrjs/diagnostics": "0.17.2-alpha.26",
41
41
  "es-module-lexer": "^1.5.4",
42
42
  "fast-json-stable-stringify": "^2.1.0",
43
43
  "magic-string": "^0.30.9",
@@ -50,7 +50,7 @@
50
50
  "slugify": "^1.4.5"
51
51
  },
52
52
  "devDependencies": {
53
- "@lwrjs/types": "0.17.2-alpha.25",
53
+ "@lwrjs/types": "0.17.2-alpha.26",
54
54
  "@types/mime-types": "2.1.4",
55
55
  "@types/path-to-regexp": "^1.7.0",
56
56
  "memfs": "^4.13.0"
@@ -58,5 +58,5 @@
58
58
  "engines": {
59
59
  "node": ">=20.0.0"
60
60
  },
61
- "gitHead": "7ea5e131db72533fb6ab0b5df51c213cfd51d203"
61
+ "gitHead": "7aeb8ed681eced0cf80abc41b5adee3f3fd5160b"
62
62
  }