@blinkk/root 3.0.4 → 3.0.5

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/cli.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  dev,
9
9
  preview,
10
10
  start
11
- } from "./chunk-URG2INLL.js";
11
+ } from "./chunk-VQPDCDKL.js";
12
12
  import "./chunk-6P3B7ZXL.js";
13
13
  import "./chunk-6NBKAR5Y.js";
14
14
  import "./chunk-7PSEEE6C.js";
package/dist/functions.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createPreviewServer,
3
3
  createProdServer
4
- } from "./chunk-URG2INLL.js";
4
+ } from "./chunk-VQPDCDKL.js";
5
5
  import "./chunk-6P3B7ZXL.js";
6
6
  import "./chunk-6NBKAR5Y.js";
7
7
  import "./chunk-7PSEEE6C.js";
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Normalizes line endings in a string to LF (`\n`).
3
+ *
4
+ * Converts CRLF (`\r\n`) and lone CR (`\r`) to LF.
5
+ */
6
+ export declare function normalizeLineEndings(value: string): string;
7
+ export interface JsonStringifyOptions {
8
+ /**
9
+ * Indentation passed through to `JSON.stringify`. Accepts a number of
10
+ * spaces or an indent string.
11
+ */
12
+ indent?: number | string;
13
+ }
14
+ /**
15
+ * Serializes data to a JSON string with Unix (LF) line endings.
16
+ *
17
+ * Unlike `JSON.stringify()`, this:
18
+ * - Recursively normalizes `\r\n` and `\r` to `\n` in string values, so
19
+ * round-tripping through `JSON.parse` won't yield CRLF line endings.
20
+ * - Normalizes line endings in the resulting JSON string itself.
21
+ */
22
+ export declare function jsonStringify(value: unknown, options?: JsonStringifyOptions): string;
@@ -0,0 +1 @@
1
+ export * from './jsonutils.js';
package/dist/utils.js ADDED
@@ -0,0 +1,30 @@
1
+ // src/utils/jsonutils.ts
2
+ function normalizeLineEndings(value) {
3
+ return value.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
4
+ }
5
+ function normalizeData(value) {
6
+ if (typeof value === "string") {
7
+ return normalizeLineEndings(value);
8
+ }
9
+ if (Array.isArray(value)) {
10
+ return value.map(normalizeData);
11
+ }
12
+ if (value && typeof value === "object") {
13
+ const result = {};
14
+ for (const key of Object.keys(value)) {
15
+ result[key] = normalizeData(value[key]);
16
+ }
17
+ return result;
18
+ }
19
+ return value;
20
+ }
21
+ function jsonStringify(value, options) {
22
+ const normalized = normalizeData(value);
23
+ const serialized = JSON.stringify(normalized, null, options?.indent);
24
+ return normalizeLineEndings(serialized);
25
+ }
26
+ export {
27
+ jsonStringify,
28
+ normalizeLineEndings
29
+ };
30
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/utils/jsonutils.ts"],
4
+ "sourcesContent": ["/**\n * Normalizes line endings in a string to LF (`\\n`).\n *\n * Converts CRLF (`\\r\\n`) and lone CR (`\\r`) to LF.\n */\nexport function normalizeLineEndings(value: string): string {\n return value.replace(/\\r\\n/g, '\\n').replace(/\\r/g, '\\n');\n}\n\nfunction normalizeData(value: unknown): unknown {\n if (typeof value === 'string') {\n return normalizeLineEndings(value);\n }\n if (Array.isArray(value)) {\n return value.map(normalizeData);\n }\n if (value && typeof value === 'object') {\n const result: Record<string, unknown> = {};\n for (const key of Object.keys(value as Record<string, unknown>)) {\n result[key] = normalizeData((value as Record<string, unknown>)[key]);\n }\n return result;\n }\n return value;\n}\n\nexport interface JsonStringifyOptions {\n /**\n * Indentation passed through to `JSON.stringify`. Accepts a number of\n * spaces or an indent string.\n */\n indent?: number | string;\n}\n\n/**\n * Serializes data to a JSON string with Unix (LF) line endings.\n *\n * Unlike `JSON.stringify()`, this:\n * - Recursively normalizes `\\r\\n` and `\\r` to `\\n` in string values, so\n * round-tripping through `JSON.parse` won't yield CRLF line endings.\n * - Normalizes line endings in the resulting JSON string itself.\n */\nexport function jsonStringify(\n value: unknown,\n options?: JsonStringifyOptions\n): string {\n const normalized = normalizeData(value);\n const serialized = JSON.stringify(normalized, null, options?.indent);\n return normalizeLineEndings(serialized);\n}\n"],
5
+ "mappings": ";AAKO,SAAS,qBAAqB,OAAuB;AAC1D,SAAO,MAAM,QAAQ,SAAS,IAAI,EAAE,QAAQ,OAAO,IAAI;AACzD;AAEA,SAAS,cAAc,OAAyB;AAC9C,MAAI,OAAO,UAAU,UAAU;AAC7B,WAAO,qBAAqB,KAAK;AAAA,EACnC;AACA,MAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,WAAO,MAAM,IAAI,aAAa;AAAA,EAChC;AACA,MAAI,SAAS,OAAO,UAAU,UAAU;AACtC,UAAM,SAAkC,CAAC;AACzC,eAAW,OAAO,OAAO,KAAK,KAAgC,GAAG;AAC/D,aAAO,GAAG,IAAI,cAAe,MAAkC,GAAG,CAAC;AAAA,IACrE;AACA,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAkBO,SAAS,cACd,OACA,SACQ;AACR,QAAM,aAAa,cAAc,KAAK;AACtC,QAAM,aAAa,KAAK,UAAU,YAAY,MAAM,SAAS,MAAM;AACnE,SAAO,qBAAqB,UAAU;AACxC;",
6
+ "names": []
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blinkk/root",
3
- "version": "3.0.4",
3
+ "version": "3.0.5",
4
4
  "author": "s@blinkk.com",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -63,6 +63,10 @@
63
63
  "./render": {
64
64
  "types": "./dist/render/render.d.ts",
65
65
  "import": "./dist/render.js"
66
+ },
67
+ "./utils": {
68
+ "types": "./dist/utils/utils.d.ts",
69
+ "import": "./dist/utils.js"
66
70
  }
67
71
  },
68
72
  "dependencies": {