@kuma-ui/compiler
Advanced tools
Comparing version 1.0.5 to 1.0.6
@@ -148,2 +148,49 @@ "use strict"; | ||
var import_sheet = require("@kuma-ui/sheet"); | ||
// src/utils/stableStringify.ts | ||
function stableStringify(data) { | ||
const seen = []; | ||
return function stringify(node) { | ||
if (node && node.toJSON && typeof node.toJSON === "function") { | ||
node = node.toJSON(); | ||
} | ||
if (node === void 0) | ||
return; | ||
if (typeof node == "number") | ||
return isFinite(node) ? "" + node : "null"; | ||
if (typeof node !== "object") | ||
return JSON.stringify(node); | ||
let i, out; | ||
if (Array.isArray(node)) { | ||
out = "["; | ||
for (i = 0; i < node.length; i++) { | ||
if (i) | ||
out += ","; | ||
out += stringify(node[i]) || "null"; | ||
} | ||
return out + "]"; | ||
} | ||
if (node === null) | ||
return "null"; | ||
if (seen.indexOf(node) !== -1) { | ||
throw new TypeError("Converting circular structure to JSON"); | ||
} | ||
const seenIndex = seen.push(node) - 1; | ||
const keys = Object.keys(node).sort(); | ||
out = ""; | ||
for (i = 0; i < keys.length; i++) { | ||
const key = keys[i]; | ||
const value = stringify(node[key]); | ||
if (!value) | ||
continue; | ||
if (out) | ||
out += ","; | ||
out += JSON.stringify(key) + ":" + value; | ||
} | ||
seen.splice(seenIndex, 1); | ||
return "{" + out + "}"; | ||
}(data); | ||
} | ||
// src/extractor/extract.ts | ||
var extractProps = (componentName, jsx, propsMap) => { | ||
@@ -196,3 +243,3 @@ const styledProps = {}; | ||
}; | ||
const key = generateKey(combinedProps); | ||
const key = stableStringify(combinedProps); | ||
let generatedStyle = styleCache[key]; | ||
@@ -241,5 +288,2 @@ if (!generatedStyle) { | ||
}; | ||
var generateKey = (props) => { | ||
return Object.entries(props).filter(([, value]) => value !== void 0).sort((a, b) => a[0].localeCompare(b[0])).map(([key, value]) => `${key}:${value}`).join("|"); | ||
}; | ||
var styleCache = {}; | ||
@@ -298,4 +342,3 @@ | ||
const originalComponentName = Object.keys(bindings).find( | ||
(key) => bindings[key] === jsxTagName && // eslint-disable-next-line @typescript-eslint/no-unsafe-argument -- FIXME | ||
Object.values(import_componentList2.componentList).some((c) => c === key) | ||
(key) => bindings[key] === jsxTagName && Object.values(import_componentList2.componentList).some((c) => c === key) | ||
); | ||
@@ -302,0 +345,0 @@ if (!originalComponentName) |
@@ -30,2 +30,49 @@ "use strict"; | ||
var import_sheet = require("@kuma-ui/sheet"); | ||
// src/utils/stableStringify.ts | ||
function stableStringify(data) { | ||
const seen = []; | ||
return function stringify(node) { | ||
if (node && node.toJSON && typeof node.toJSON === "function") { | ||
node = node.toJSON(); | ||
} | ||
if (node === void 0) | ||
return; | ||
if (typeof node == "number") | ||
return isFinite(node) ? "" + node : "null"; | ||
if (typeof node !== "object") | ||
return JSON.stringify(node); | ||
let i, out; | ||
if (Array.isArray(node)) { | ||
out = "["; | ||
for (i = 0; i < node.length; i++) { | ||
if (i) | ||
out += ","; | ||
out += stringify(node[i]) || "null"; | ||
} | ||
return out + "]"; | ||
} | ||
if (node === null) | ||
return "null"; | ||
if (seen.indexOf(node) !== -1) { | ||
throw new TypeError("Converting circular structure to JSON"); | ||
} | ||
const seenIndex = seen.push(node) - 1; | ||
const keys = Object.keys(node).sort(); | ||
out = ""; | ||
for (i = 0; i < keys.length; i++) { | ||
const key = keys[i]; | ||
const value = stringify(node[key]); | ||
if (!value) | ||
continue; | ||
if (out) | ||
out += ","; | ||
out += JSON.stringify(key) + ":" + value; | ||
} | ||
seen.splice(seenIndex, 1); | ||
return "{" + out + "}"; | ||
}(data); | ||
} | ||
// src/extractor/extract.ts | ||
var extractProps = (componentName, jsx, propsMap) => { | ||
@@ -78,3 +125,3 @@ const styledProps = {}; | ||
}; | ||
const key = generateKey(combinedProps); | ||
const key = stableStringify(combinedProps); | ||
let generatedStyle = styleCache[key]; | ||
@@ -123,5 +170,2 @@ if (!generatedStyle) { | ||
}; | ||
var generateKey = (props) => { | ||
return Object.entries(props).filter(([, value]) => value !== void 0).sort((a, b) => a[0].localeCompare(b[0])).map(([key, value]) => `${key}:${value}`).join("|"); | ||
}; | ||
var styleCache = {}; | ||
@@ -128,0 +172,0 @@ // Annotate the CommonJS export names for ESM import in node: |
@@ -32,2 +32,49 @@ "use strict"; | ||
var import_sheet = require("@kuma-ui/sheet"); | ||
// src/utils/stableStringify.ts | ||
function stableStringify(data) { | ||
const seen = []; | ||
return function stringify(node) { | ||
if (node && node.toJSON && typeof node.toJSON === "function") { | ||
node = node.toJSON(); | ||
} | ||
if (node === void 0) | ||
return; | ||
if (typeof node == "number") | ||
return isFinite(node) ? "" + node : "null"; | ||
if (typeof node !== "object") | ||
return JSON.stringify(node); | ||
let i, out; | ||
if (Array.isArray(node)) { | ||
out = "["; | ||
for (i = 0; i < node.length; i++) { | ||
if (i) | ||
out += ","; | ||
out += stringify(node[i]) || "null"; | ||
} | ||
return out + "]"; | ||
} | ||
if (node === null) | ||
return "null"; | ||
if (seen.indexOf(node) !== -1) { | ||
throw new TypeError("Converting circular structure to JSON"); | ||
} | ||
const seenIndex = seen.push(node) - 1; | ||
const keys = Object.keys(node).sort(); | ||
out = ""; | ||
for (i = 0; i < keys.length; i++) { | ||
const key = keys[i]; | ||
const value = stringify(node[key]); | ||
if (!value) | ||
continue; | ||
if (out) | ||
out += ","; | ||
out += JSON.stringify(key) + ":" + value; | ||
} | ||
seen.splice(seenIndex, 1); | ||
return "{" + out + "}"; | ||
}(data); | ||
} | ||
// src/extractor/extract.ts | ||
var extractProps = (componentName, jsx, propsMap) => { | ||
@@ -80,3 +127,3 @@ const styledProps = {}; | ||
}; | ||
const key = generateKey(combinedProps); | ||
const key = stableStringify(combinedProps); | ||
let generatedStyle = styleCache[key]; | ||
@@ -125,5 +172,2 @@ if (!generatedStyle) { | ||
}; | ||
var generateKey = (props) => { | ||
return Object.entries(props).filter(([, value]) => value !== void 0).sort((a, b) => a[0].localeCompare(b[0])).map(([key, value]) => `${key}:${value}`).join("|"); | ||
}; | ||
var styleCache = {}; | ||
@@ -130,0 +174,0 @@ // Annotate the CommonJS export names for ESM import in node: |
@@ -150,2 +150,49 @@ "use strict"; | ||
var import_sheet = require("@kuma-ui/sheet"); | ||
// src/utils/stableStringify.ts | ||
function stableStringify(data) { | ||
const seen = []; | ||
return function stringify(node) { | ||
if (node && node.toJSON && typeof node.toJSON === "function") { | ||
node = node.toJSON(); | ||
} | ||
if (node === void 0) | ||
return; | ||
if (typeof node == "number") | ||
return isFinite(node) ? "" + node : "null"; | ||
if (typeof node !== "object") | ||
return JSON.stringify(node); | ||
let i, out; | ||
if (Array.isArray(node)) { | ||
out = "["; | ||
for (i = 0; i < node.length; i++) { | ||
if (i) | ||
out += ","; | ||
out += stringify(node[i]) || "null"; | ||
} | ||
return out + "]"; | ||
} | ||
if (node === null) | ||
return "null"; | ||
if (seen.indexOf(node) !== -1) { | ||
throw new TypeError("Converting circular structure to JSON"); | ||
} | ||
const seenIndex = seen.push(node) - 1; | ||
const keys = Object.keys(node).sort(); | ||
out = ""; | ||
for (i = 0; i < keys.length; i++) { | ||
const key = keys[i]; | ||
const value = stringify(node[key]); | ||
if (!value) | ||
continue; | ||
if (out) | ||
out += ","; | ||
out += JSON.stringify(key) + ":" + value; | ||
} | ||
seen.splice(seenIndex, 1); | ||
return "{" + out + "}"; | ||
}(data); | ||
} | ||
// src/extractor/extract.ts | ||
var extractProps = (componentName, jsx, propsMap) => { | ||
@@ -198,3 +245,3 @@ const styledProps = {}; | ||
}; | ||
const key = generateKey(combinedProps); | ||
const key = stableStringify(combinedProps); | ||
let generatedStyle = styleCache[key]; | ||
@@ -243,5 +290,2 @@ if (!generatedStyle) { | ||
}; | ||
var generateKey = (props) => { | ||
return Object.entries(props).filter(([, value]) => value !== void 0).sort((a, b) => a[0].localeCompare(b[0])).map(([key, value]) => `${key}:${value}`).join("|"); | ||
}; | ||
var styleCache = {}; | ||
@@ -300,4 +344,3 @@ | ||
const originalComponentName = Object.keys(bindings).find( | ||
(key) => bindings[key] === jsxTagName && // eslint-disable-next-line @typescript-eslint/no-unsafe-argument -- FIXME | ||
Object.values(import_componentList2.componentList).some((c) => c === key) | ||
(key) => bindings[key] === jsxTagName && Object.values(import_componentList2.componentList).some((c) => c === key) | ||
); | ||
@@ -304,0 +347,0 @@ if (!originalComponentName) |
{ | ||
"name": "@kuma-ui/compiler", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "🐻 Kuma UI is a utility-first, zero-runtime CSS-in-JS library that offers an outstanding developer experience and optimized performance.", | ||
@@ -34,5 +34,5 @@ "repository": { | ||
"ts-pattern": "^5.0.1", | ||
"@kuma-ui/core": "^1.1.2", | ||
"@kuma-ui/sheet": "^1.0.1", | ||
"@kuma-ui/system": "^1.2.0" | ||
"@kuma-ui/core": "^1.1.3", | ||
"@kuma-ui/sheet": "^1.0.2", | ||
"@kuma-ui/system": "^1.2.1" | ||
}, | ||
@@ -39,0 +39,0 @@ "publishConfig": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
83845
46
2181
Updated@kuma-ui/core@^1.1.3
Updated@kuma-ui/sheet@^1.0.2
Updated@kuma-ui/system@^1.2.1