New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@kuma-ui/vite

Package Overview
Dependencies
Maintainers
3
Versions
102
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kuma-ui/vite - npm Package Compare versions

Comparing version 0.6.0 to 0.7.0-next.1

7

dist/index.d.ts
import { Plugin } from 'vite';
type VitePluginOption = {
breakpoints?: Record<string, string>;
};
declare function kumaUI(options?: VitePluginOption): Plugin;
declare function kumaUI(): Plugin;
export { VitePluginOption, kumaUI as default };
export { kumaUI as default };

@@ -38,12 +38,76 @@ "use strict";

var import_path = __toESM(require("path"));
var import_esbuild = require("esbuild");
var import_eval = __toESM(require("eval"));
var import_sheet = require("@kuma-ui/sheet");
function kumaUI(options) {
var import_fs = require("fs");
var import_system = require("@kuma-ui/system");
function kumaUI() {
let mode;
if (options?.breakpoints && Object.keys(options.breakpoints).length > 0) {
import_sheet.theme.setBreakpoints(options.breakpoints);
const dir = (0, import_fs.readdirSync)(".");
let configPath;
dir.forEach((filePath) => {
if (filePath.startsWith("kuma.config."))
configPath = filePath;
});
if (configPath) {
const filename = import_path.default.join(process.cwd(), configPath);
const result = (0, import_esbuild.buildSync)({
bundle: true,
target: "es2017",
write: false,
platform: "node",
format: typeof require !== "undefined" ? "cjs" : "esm",
absWorkingDir: process.cwd(),
outfile: filename + ".out",
entryPoints: [filename],
logLevel: "silent"
});
const config = (0, import_eval.default)(result.outputFiles[0].text, configPath);
if (config.default) {
import_sheet.theme.setUserTheme(config.default);
}
}
const cssLookup = {};
const userTheme = import_sheet.theme.getUserTheme();
let themeCss = "";
const runtimeTheme = {
components: {},
tokens: userTheme.colors || {},
breakpoints: userTheme.breakpoints || {}
};
for (const componentKey in userTheme.components) {
const component = userTheme.components[componentKey];
const componentVariants = {};
let componentBaseStyle = void 0;
const style = new import_system.StyleGenerator(component?.baseStyle);
themeCss += style.getCSS();
componentBaseStyle = style.getClassName();
for (const variantKey in component?.variants) {
const variant = component?.variants[variantKey];
const style2 = new import_system.StyleGenerator(variant);
themeCss += style2.getCSS();
Object.assign(componentVariants, {
[variantKey]: style2.getClassName()
});
}
Object.assign(runtimeTheme.components, {
[componentKey]: {
baseStyle: componentBaseStyle,
variants: componentVariants
}
});
}
import_sheet.theme.setRuntimeUserTheme(runtimeTheme);
return {
name: "kuma-ui",
enforce: "pre",
config(config) {
if (!config.define)
config.define = {};
config.define = Object.assign(config.define, {
"globalThis.__KUMA_USER_THEME__": JSON.stringify(runtimeTheme),
"globalThis.__KUMA_RUNTIME_USER_THEME__": JSON.stringify(runtimeTheme)
});
return config;
},
async transform(code, id) {

@@ -54,5 +118,6 @@ if (id.includes("@kuma-ui"))

return;
if (!/import\s+.+\s+from\s+['"]\@kuma-ui\/core['"]/.test(code))
if (/node_modules/.test(id))
return;
requireReact(code, id);
if (!code.includes("@kuma-ui/core"))
return;
const result = await (0, import_babel_plugin.transform)(code, id);

@@ -65,7 +130,7 @@ if (!result?.code)

const css = result.metadata.css || "";
cssLookup[cssFilename] = css;
cssLookup[cssId] = css;
cssLookup[cssFilename] = css + themeCss;
cssLookup[cssId] = css + themeCss;
import_sheet.sheet.reset();
if (mode === "serve")
return injectCSS(css, cssId) + result.code;
return injectCSS(css + themeCss, cssId) + result.code;
return `import ${JSON.stringify(cssFilename)};

@@ -95,12 +160,2 @@ ` + result.code;

}
var requireReact = (code, id) => {
if (id.endsWith(".jsx") || id.endsWith(".tsx")) {
if (!/^\s*import\s+React\s+from\s+['"]react['"]/.test(code)) {
return {
code: "import React from 'react';\n" + code,
map: { mappings: "" }
};
}
}
};
var injectCSS = (cssContent, fileId) => {

@@ -107,0 +162,0 @@ return `

{
"name": "@kuma-ui/vite",
"version": "0.6.0",
"version": "0.7.0-next.1",
"description": "🐻 Kuma UI is a utility-first, zero-runtime CSS-in-JS library that offers an outstanding developer experience and optimized performance.",

@@ -30,4 +30,7 @@ "repository": {

"dependencies": {
"@kuma-ui/babel-plugin": "^0.11.0",
"@kuma-ui/sheet": "^0.5.1"
"esbuild": "^0.18.0",
"eval": "^0.1.8",
"@kuma-ui/babel-plugin": "^0.12.0-next.1",
"@kuma-ui/sheet": "^0.6.0-next.1",
"@kuma-ui/system": "^0.7.0-next.1"
},

@@ -34,0 +37,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc