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

esifycss

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esifycss - npm Package Compare versions

Comparing version 1.4.33 to 1.4.34

2

lib/minifier/minifyScripts.d.ts
export declare const minifyScripts: (props: {
files: Array<string>;
files: Map<string, string>;
cssKey: string;
dest: string;
}) => Promise<void>;
import type { ScriptData } from './types';
export declare const minifyScriptForCSS: ([file, data]: [string, ScriptData]) => Promise<string>;
export declare const minifyScriptsForCSS: (props: {
files: Array<string>;
files: Map<string, string>;
cssKey: string;
dest: string;
}) => Promise<void>;

@@ -22,9 +22,3 @@ "use strict";

const parseResult = await (0, parseScripts_1.parseScripts)(props);
const cssList = [];
for (const script of parseResult.scripts) {
const css = await (0, exports.minifyScriptForCSS)(script).catch((error) => {
throw error;
});
cssList.push(css);
}
const cssList = await Promise.all([...parseResult.scripts].map(exports.minifyScriptForCSS));
await (0, updateFile_1.updateFile)(props.dest, cssList.join('\n'));

@@ -31,0 +25,0 @@ };

import type { ParseScriptsResult } from './types';
export declare const parseScripts: ({ files, cssKey }: {
files: Array<string>;
files: Map<string, string>;
cssKey: string;
}) => Promise<ParseScriptsResult>;

@@ -7,9 +7,19 @@ "use strict";

const tokenizeString_1 = require("../util/tokenizeString");
const { readFile } = fs.promises;
const cache = new Map();
const parseScripts = async ({ files, cssKey }) => {
const scripts = new Map();
const tokens = new Map();
await Promise.all(files.map(async (file) => {
const code = await readFile(file, 'utf8');
const data = (0, parseCSSModuleScript_1.parseCSSModuleScript)({ code, cssKey });
const tasks = [];
for (const [source, file] of files) {
const { mtimeMs } = await fs.promises.stat(source);
let cached = cache.get(source);
if (cached && mtimeMs !== cached.mtimeMs) {
cached = undefined;
}
let data = cached && cached.data;
const code = await fs.promises.readFile(file, 'utf8');
if (!data) {
data = (0, parseCSSModuleScript_1.parseCSSModuleScript)({ code, cssKey });
cache.set(source, { mtimeMs, data });
}
for (const { css } of data.ranges) {

@@ -21,3 +31,4 @@ for (const token of (0, tokenizeString_1.tokenizeString)(css)) {

scripts.set(file, { ...data, script: code });
}));
}
await Promise.all(tasks);
return { scripts, tokens };

@@ -24,0 +35,0 @@ };

@@ -58,4 +58,3 @@ "use strict";

file: filePath,
})
.catch((error) => {
}).catch((error) => {
exposedPromise.resolve();

@@ -81,3 +80,3 @@ throw error;

async minifyScripts() {
const files = [...this.processedFiles].map((file) => `${file}${this.configuration.ext}`);
const files = new Map([...this.processedFiles].map((file) => [file, `${file}${this.configuration.ext}`]));
const { cssKey, output } = this.configuration;

@@ -84,0 +83,0 @@ if (output.type === 'css') {

@@ -292,3 +292,3 @@ "use strict";

await (0, updateFile_1.updateFile)(cssPath, [
'@keyframes foo {0%{color:red}100%{color:green}}',
'@keyframes foo {0%{color:gold}100%{color:green}}',
'.foo#bar {animation: 1s 0.5s linear infinite foo}',

@@ -300,3 +300,3 @@ ].join(''));

await (0, updateFile_1.updateFile)(cssPath, [
'@keyframes foo {0%{color:red}100%{color:green}}',
'@keyframes foo {0%{color:gold}100%{color:green}}',
'.foo#bar {animation: 2s 1s linear infinite foo}',

@@ -338,3 +338,4 @@ ].join(''));

test('watch-css', async (t) => {
const cssPath = path.join(t.context.directory, '/components/style.css');
const cssPath1 = path.join(t.context.directory, '/components/style1.css');
const cssPath2 = path.join(t.context.directory, '/components/style2.css');
const cssOutputPath = path.join(t.context.directory, 'output.css');

@@ -357,18 +358,43 @@ const { messageListener, waitForMessage } = createMessageListener();

});
await (0, updateFile_1.updateFile)(cssPath, [
'@keyframes foo {0%{color:red}100%{color:green}}',
'.foo#bar {animation: 1s 0.5s linear infinite foo}',
await (0, updateFile_1.updateFile)(cssPath1, [
'@keyframes foo1 {0%{color:gold}100%{color:green}}',
'.foo1#bar {animation: 1s 0.5s linear infinite foo1}',
].join(''));
await (0, updateFile_1.updateFile)(cssPath2, [
'@keyframes foo2 {0%{color:gold}100%{color:pink}}',
'.foo2#bar {animation: 1s 0.5s linear infinite foo2}',
].join(''));
await t.context.session.start().catch(t.fail);
const outputCss1 = await fs.promises.readFile(cssOutputPath, 'utf-8');
await (0, updateFile_1.updateFile)(cssPath, [
'@keyframes foo {0%{color:red}100%{color:green}}',
'.foo#bar {animation: 2s 1s linear infinite foo}',
t.log('outputCss1', outputCss1);
t.true(outputCss1.includes('color:green'));
t.true(outputCss1.includes('color:pink'));
const root1 = postcss.parse(outputCss1);
t.is(root1.nodes.length, 4);
await (0, updateFile_1.updateFile)(cssPath1, [
'@keyframes bar1 {0%{color:gold}100%{color:blue}}',
'.bar1#bar {animation: 2s 1s linear infinite bar1}',
].join(''));
await waitForMessage(`written: ${cssOutputPath}`);
const outputCss2 = await fs.promises.readFile(cssOutputPath, 'utf-8');
t.log('outputCss1', outputCss1);
t.log('outputCss2', outputCss2);
t.true(outputCss1 !== outputCss2);
t.false(outputCss2.includes('color:green'));
t.true(outputCss2.includes('color:blue'));
t.true(outputCss2.includes('color:pink'));
const root2 = postcss.parse(outputCss2);
t.is(root2.nodes.length, 4);
await (0, updateFile_1.updateFile)(cssPath2, [
'@keyframes bar2 {0%{color:gold}100%{color:red}}',
'.bar2#bar {animation: 1s 0.5s linear infinite bar2}',
].join(''));
await waitForMessage(`written: ${cssOutputPath}`);
const outputCss3 = await fs.promises.readFile(cssOutputPath, 'utf-8');
t.log('outputCss3', outputCss3);
t.false(outputCss3.includes('color:green'));
t.false(outputCss3.includes('color:pink'));
t.true(outputCss3.includes('color:blue'));
t.true(outputCss3.includes('color:red'));
const root3 = postcss.parse(outputCss3);
t.is(root3.nodes.length, 4);
});
//# sourceMappingURL=Session.test.js.map
declare type Resolve = () => void;
declare type Reject = (error: Error) => void;
declare type Reject = (error: unknown) => void;
export interface ExposedPromise {

@@ -4,0 +4,0 @@ readonly promise: Promise<void>;

{
"name": "esifycss",
"version": "1.4.33",
"version": "1.4.34",
"description": "Generates .js or .ts exports class names and custom properties",

@@ -53,11 +53,11 @@ "author": {

"dependencies": {
"@hookun/parse-animation-shorthand": "^0.1.2",
"acorn": "^8.5.0",
"acorn-walk": "^8.2.0",
"chokidar": "^3.5.2",
"commander": "^8.1.0",
"postcss": "^8.3.6",
"postcss-selector-parser": "^6.0.6",
"vlq": "^1.0.1"
"@hookun/parse-animation-shorthand": "0.1.2",
"acorn": "8.5.0",
"acorn-walk": "8.2.0",
"chokidar": "3.5.2",
"commander": "8.2.0",
"postcss": "8.3.7",
"postcss-selector-parser": "6.0.6",
"vlq": "1.0.1"
}
}

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

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