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

cssmodules-language-server

Package Overview
Dependencies
Maintainers
0
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cssmodules-language-server - npm Package Compare versions

Comparing version 1.4.0 to 1.4.1

5

lib/CompletionProvider.js

@@ -36,3 +36,2 @@ "use strict";

exports.CSSModulesCompletionProvider = exports.COMPLETION_TRIGGERS = void 0;
const os_1 = require("os");
const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol");

@@ -144,3 +143,3 @@ const lsp = __importStar(require("vscode-languageserver/node"));

const fileContent = textdocument.getText();
const lines = fileContent.split(os_1.EOL);
const lines = fileContent.split((0, utils_1.getEOL)(fileContent));
const currentLine = lines[position.line];

@@ -169,3 +168,3 @@ if (typeof currentLine !== 'string')

});
return res.map((x, i) => (Object.assign(Object.assign({}, x), { kind: lsp.CompletionItemKind.Text, data: i + 1 })));
return res.map((x, i) => (Object.assign(Object.assign({}, x), { kind: lsp.CompletionItemKind.Field, data: i + 1 })));
});

@@ -172,0 +171,0 @@ }

8

lib/DefinitionProvider.js

@@ -16,3 +16,2 @@ "use strict";

exports.CSSModulesDefinitionProvider = void 0;
const os_1 = require("os");
const path_1 = __importDefault(require("path"));

@@ -46,3 +45,4 @@ const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol");

const fileContent = textdocument.getText();
const lines = fileContent.split(os_1.EOL);
const EOL = (0, utils_1.getEOL)(fileContent);
const lines = fileContent.split(EOL);
const currentLine = lines[position.line];

@@ -69,3 +69,3 @@ if (typeof currentLine !== 'string') {

language: 'css',
value: (0, utils_1.stringifyClassname)(field, node.declarations, node.comments),
value: (0, utils_1.stringifyClassname)(field, node.declarations, node.comments, EOL),
},

@@ -78,3 +78,3 @@ };

const fileContent = textdocument.getText();
const lines = fileContent.split(os_1.EOL);
const lines = fileContent.split((0, utils_1.getEOL)(fileContent));
const currentLine = lines[position.line];

@@ -81,0 +81,0 @@ if (typeof currentLine !== 'string') {

@@ -60,3 +60,4 @@ import { Position } from 'vscode-languageserver-protocol';

export declare function getAllClassNames(filePath: string, keyword: string, classnameTransformer: StringTransformer): Promise<string[]>;
export declare function stringifyClassname(classname: string, declarations: string[], comments: string[]): string;
export declare function stringifyClassname(classname: string, declarations: string[], comments: string[], EOL: string): string;
export declare function getEOL(text: string): string;
export {};

@@ -15,5 +15,4 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.stringifyClassname = exports.getAllClassNames = exports.filePathToClassnameDict = exports.log = exports.getWords = exports.getPosition = exports.isImportLineMatch = exports.getTransformer = exports.findImportPath = exports.genImportRegExp = exports.getCurrentDirFromUri = void 0;
exports.getEOL = exports.stringifyClassname = exports.getAllClassNames = exports.filePathToClassnameDict = exports.log = exports.getWords = exports.getPosition = exports.isImportLineMatch = exports.getTransformer = exports.findImportPath = exports.genImportRegExp = exports.getCurrentDirFromUri = void 0;
const fs_1 = __importDefault(require("fs"));
const os_1 = require("os");
const path_1 = __importDefault(require("path"));

@@ -203,2 +202,3 @@ const url_1 = __importDefault(require("url"));

const content = fs_1.default.readFileSync(filepath, { encoding: 'utf8' });
const EOL = getEOL(content);
const { ext } = path_1.default.parse(filepath);

@@ -258,3 +258,3 @@ /**

const diffStr = node.selector.slice(0, diff);
const lines = diffStr.split(os_1.EOL);
const lines = diffStr.split(EOL);
const lastLine = lines[lines.length - 1];

@@ -333,7 +333,7 @@ dict[classnameTransformer(name)] = {

exports.getAllClassNames = getAllClassNames;
function stringifyClassname(classname, declarations, comments) {
function stringifyClassname(classname, declarations, comments, EOL) {
const commentString = comments.length
? comments
.map(x => {
const lines = x.split(os_1.EOL);
const lines = x.split(EOL);
if (lines.length < 2) {

@@ -346,5 +346,5 @@ return `/*${x} */`;

' */',
].join(os_1.EOL);
].join(EOL);
})
.join(os_1.EOL) + os_1.EOL
.join(EOL) + EOL
: '';

@@ -356,4 +356,21 @@ return (commentString +

...(declarations.length ? ['}'] : []),
].join(os_1.EOL));
].join(EOL));
}
exports.stringifyClassname = stringifyClassname;
// https://github.com/wkillerud/some-sass/blob/main/vscode-extension/src/utils/string.ts
function getEOL(text) {
for (let i = 0; i < text.length; i++) {
const ch = text.charAt(i);
if (ch === '\r') {
if (i + 1 < text.length && text.charAt(i + 1) === '\n') {
return '\r\n';
}
return '\r';
}
if (ch === '\n') {
return '\n';
}
}
return '\n';
}
exports.getEOL = getEOL;
{
"name": "cssmodules-language-server",
"version": "1.4.0",
"version": "1.4.1",
"description": "language server for cssmodules",

@@ -5,0 +5,0 @@ "bin": {

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