@govtechsg/sgds-web-component 3.30.1-rc.1 → 3.30.1-rc.2
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/custom-elements.json
CHANGED
|
@@ -32036,7 +32036,7 @@
|
|
|
32036
32036
|
"package": {
|
|
32037
32037
|
"name": "@govtechsg/sgds-web-component",
|
|
32038
32038
|
"description": "",
|
|
32039
|
-
"version": "3.30.1-rc.
|
|
32039
|
+
"version": "3.30.1-rc.2",
|
|
32040
32040
|
"author": "GovTechSG",
|
|
32041
32041
|
"license": "MIT"
|
|
32042
32042
|
}
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
let node_module = require("node:module");
|
|
3
2
|
//#region src/utils/ssr-nonce-patch.ts
|
|
4
3
|
/**
|
|
5
4
|
* Patches @lit-labs/ssr's LitElementRenderer.renderShadow() to respect
|
|
6
5
|
* globalThis.litNonce for CSP nonce injection.
|
|
7
6
|
*
|
|
8
|
-
* Uses
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* Uses new Function("return require")() to get a synchronous require
|
|
8
|
+
* that is invisible to both Rolldown and webpack. Bundlers cannot
|
|
9
|
+
* statically analyze new Function(), so they leave it alone.
|
|
10
|
+
* At runtime in Node.js, it returns the real require function.
|
|
11
11
|
*/
|
|
12
12
|
if (typeof window === "undefined") try {
|
|
13
|
-
const mod = (
|
|
13
|
+
const mod = new Function("return require")()("@lit-labs/ssr/lib/lit-element-renderer.js");
|
|
14
14
|
const LitElementRenderer = mod.LitElementRenderer || mod.default?.LitElementRenderer;
|
|
15
15
|
if (LitElementRenderer && !LitElementRenderer._sgdsNoncePatched) {
|
|
16
16
|
LitElementRenderer._sgdsNoncePatched = true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssr-nonce-patch.cjs.js","names":[
|
|
1
|
+
{"version":3,"file":"ssr-nonce-patch.cjs.js","names":[],"sources":["../../../src/utils/ssr-nonce-patch.ts"],"sourcesContent":["/**\n * Patches @lit-labs/ssr's LitElementRenderer.renderShadow() to respect\n * globalThis.litNonce for CSP nonce injection.\n *\n * Uses new Function(\"return require\")() to get a synchronous require\n * that is invisible to both Rolldown and webpack. Bundlers cannot\n * statically analyze new Function(), so they leave it alone.\n * At runtime in Node.js, it returns the real require function.\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nif (typeof window === \"undefined\") {\n try {\n // new Function hides require from all bundlers — synchronous at runtime\n const _require = new Function(\"return require\")() as (\n id: string\n ) => any;\n const mod = _require(\"@lit-labs/ssr/lib/lit-element-renderer.js\");\n const LitElementRenderer =\n mod.LitElementRenderer || mod.default?.LitElementRenderer;\n\n if (LitElementRenderer && !LitElementRenderer._sgdsNoncePatched) {\n LitElementRenderer._sgdsNoncePatched = true;\n\n const originalRenderShadow =\n LitElementRenderer.prototype.renderShadow;\n\n LitElementRenderer.prototype.renderShadow = function (\n renderInfo: unknown\n ) {\n const result = originalRenderShadow.call(this, renderInfo);\n if (!result) return result;\n\n const nonce = (globalThis as any).litNonce;\n if (!nonce) return result;\n\n return result.map((item: unknown) => {\n if (typeof item === \"string\" && item === \"<style>\") {\n return `<style nonce=\"${nonce}\">`;\n }\n return item;\n });\n };\n }\n } catch {\n // @lit-labs/ssr not available — nonce injection disabled\n }\n}\n"],"mappings":";;;;;;;;;;;AAYA,IAAI,OAAO,WAAW,aACpB,IAAI;CAKF,MAAM,MAHW,IAAI,SAAS,gBAAgB,CAAC,CAG5B,CAAC,CAAC,2CAA2C;CAChE,MAAM,qBACJ,IAAI,sBAAsB,IAAI,SAAS;CAEzC,IAAI,sBAAsB,CAAC,mBAAmB,mBAAmB;EAC/D,mBAAmB,oBAAoB;EAEvC,MAAM,uBACJ,mBAAmB,UAAU;EAE/B,mBAAmB,UAAU,eAAe,SAC1C,YACA;GACA,MAAM,SAAS,qBAAqB,KAAK,MAAM,UAAU;GACzD,IAAI,CAAC,QAAQ,OAAO;GAEpB,MAAM,QAAS,WAAmB;GAClC,IAAI,CAAC,OAAO,OAAO;GAEnB,OAAO,OAAO,KAAK,SAAkB;IACnC,IAAI,OAAO,SAAS,YAAY,SAAS,WACvC,OAAO,iBAAiB,MAAM;IAEhC,OAAO;GACT,CAAC;EACH;CACF;AACF,QAAQ,CAER"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { createRequire } from "node:module";
|
|
3
2
|
//#region src/utils/ssr-nonce-patch.ts
|
|
4
3
|
/**
|
|
5
4
|
* Patches @lit-labs/ssr's LitElementRenderer.renderShadow() to respect
|
|
6
5
|
* globalThis.litNonce for CSP nonce injection.
|
|
7
6
|
*
|
|
8
|
-
* Uses
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* Uses new Function("return require")() to get a synchronous require
|
|
8
|
+
* that is invisible to both Rolldown and webpack. Bundlers cannot
|
|
9
|
+
* statically analyze new Function(), so they leave it alone.
|
|
10
|
+
* At runtime in Node.js, it returns the real require function.
|
|
11
11
|
*/
|
|
12
12
|
if (typeof window === "undefined") try {
|
|
13
|
-
const mod =
|
|
13
|
+
const mod = new Function("return require")()("@lit-labs/ssr/lib/lit-element-renderer.js");
|
|
14
14
|
const LitElementRenderer = mod.LitElementRenderer || mod.default?.LitElementRenderer;
|
|
15
15
|
if (LitElementRenderer && !LitElementRenderer._sgdsNoncePatched) {
|
|
16
16
|
LitElementRenderer._sgdsNoncePatched = true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssr-nonce-patch.js","names":[],"sources":["../../../src/utils/ssr-nonce-patch.ts"],"sourcesContent":["/**\n * Patches @lit-labs/ssr's LitElementRenderer.renderShadow() to respect\n * globalThis.litNonce for CSP nonce injection.\n *\n * Uses
|
|
1
|
+
{"version":3,"file":"ssr-nonce-patch.js","names":[],"sources":["../../../src/utils/ssr-nonce-patch.ts"],"sourcesContent":["/**\n * Patches @lit-labs/ssr's LitElementRenderer.renderShadow() to respect\n * globalThis.litNonce for CSP nonce injection.\n *\n * Uses new Function(\"return require\")() to get a synchronous require\n * that is invisible to both Rolldown and webpack. Bundlers cannot\n * statically analyze new Function(), so they leave it alone.\n * At runtime in Node.js, it returns the real require function.\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nif (typeof window === \"undefined\") {\n try {\n // new Function hides require from all bundlers — synchronous at runtime\n const _require = new Function(\"return require\")() as (\n id: string\n ) => any;\n const mod = _require(\"@lit-labs/ssr/lib/lit-element-renderer.js\");\n const LitElementRenderer =\n mod.LitElementRenderer || mod.default?.LitElementRenderer;\n\n if (LitElementRenderer && !LitElementRenderer._sgdsNoncePatched) {\n LitElementRenderer._sgdsNoncePatched = true;\n\n const originalRenderShadow =\n LitElementRenderer.prototype.renderShadow;\n\n LitElementRenderer.prototype.renderShadow = function (\n renderInfo: unknown\n ) {\n const result = originalRenderShadow.call(this, renderInfo);\n if (!result) return result;\n\n const nonce = (globalThis as any).litNonce;\n if (!nonce) return result;\n\n return result.map((item: unknown) => {\n if (typeof item === \"string\" && item === \"<style>\") {\n return `<style nonce=\"${nonce}\">`;\n }\n return item;\n });\n };\n }\n } catch {\n // @lit-labs/ssr not available — nonce injection disabled\n }\n}\n"],"mappings":";;;;;;;;;;;AAYA,IAAI,OAAO,WAAW,aACpB,IAAI;CAKF,MAAM,MAHW,IAAI,SAAS,gBAAgB,CAAC,CAG5B,CAAC,CAAC,2CAA2C;CAChE,MAAM,qBACJ,IAAI,sBAAsB,IAAI,SAAS;CAEzC,IAAI,sBAAsB,CAAC,mBAAmB,mBAAmB;EAC/D,mBAAmB,oBAAoB;EAEvC,MAAM,uBACJ,mBAAmB,UAAU;EAE/B,mBAAmB,UAAU,eAAe,SAC1C,YACA;GACA,MAAM,SAAS,qBAAqB,KAAK,MAAM,UAAU;GACzD,IAAI,CAAC,QAAQ,OAAO;GAEpB,MAAM,QAAS,WAAmB;GAClC,IAAI,CAAC,OAAO,OAAO;GAEnB,OAAO,OAAO,KAAK,SAAkB;IACnC,IAAI,OAAO,SAAS,YAAY,SAAS,WACvC,OAAO,iBAAiB,MAAM;IAEhC,OAAO;GACT,CAAC;EACH;CACF;AACF,QAAQ,CAER"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Patches @lit-labs/ssr's LitElementRenderer.renderShadow() to respect
|
|
3
3
|
* globalThis.litNonce for CSP nonce injection.
|
|
4
4
|
*
|
|
5
|
-
* Uses
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* Uses new Function("return require")() to get a synchronous require
|
|
6
|
+
* that is invisible to both Rolldown and webpack. Bundlers cannot
|
|
7
|
+
* statically analyze new Function(), so they leave it alone.
|
|
8
|
+
* At runtime in Node.js, it returns the real require function.
|
|
8
9
|
*/
|
|
9
|
-
export {};
|