Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@stylable/language-service

Package Overview
Dependencies
Maintainers
5
Versions
165
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stylable/language-service - npm Package Compare versions

Comparing version 3.2.0 to 3.2.1

4

cjs/lib/completion-providers.js

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

const path_1 = __importDefault(require("path"));
const postcss_value_parser_1 = __importDefault(require("postcss-value-parser"));
const core_1 = require("@stylable/core");

@@ -13,3 +14,2 @@ const completion_types_1 = require("./completion-types");

const postcss_ast_utils_1 = require("./utils/postcss-ast-utils");
const pvp = require('postcss-value-parser');
class ProviderPosition {

@@ -197,3 +197,3 @@ constructor(line, character) {

fullLineText.includes(':')) {
const parsed = pvp(fullLineText.slice(fullLineText.indexOf(':') + 1)).nodes;
const parsed = postcss_value_parser_1.default(fullLineText.slice(fullLineText.indexOf(':') + 1)).nodes;
const node = parsed[parsed.length - 1];

@@ -200,0 +200,0 @@ if (node.type === 'div' ||

@@ -1,10 +0,7 @@

import { ParsedValue, StateParsedValue } from '@stylable/core';
import { SignatureHelp } from 'vscode-languageserver';
import { StateParsedValue } from '@stylable/core';
import { ProviderPosition } from '../completion-providers';
import { ParsedFuncOrDivValue } from '../types';
export declare function resolveStateTypeOrValidator(pos: ProviderPosition, line: string): string | boolean | null;
export declare function createStateValidatorSignature(type: string): SignatureHelp | null;
export declare function createStateTypeSignature(): SignatureHelp;
export declare function isParsedNodeFunction(node: ParsedValue): node is ParsedFuncOrDivValue;
export declare function isParsedNodeDiv(node: ParsedValue): node is ParsedFuncOrDivValue;
export declare function isBetweenLengths(location: number, length: number, modifier: {

@@ -11,0 +8,0 @@ length: number;

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const postcss_value_parser_1 = __importDefault(require("postcss-value-parser"));
const core_1 = require("@stylable/core");
const pvp = require('postcss-value-parser');
// Goes over an '-st-states' declaration value

@@ -15,3 +18,3 @@ // parses the state and position to resolve if inside a state with a parameter

const value = line.slice(valueStartChar);
const stateParts = pvp(value).nodes;
const { nodes: stateParts } = postcss_value_parser_1.default(value);
let requiredHinting = false;

@@ -23,3 +26,3 @@ const validator = { length: 0, requiredHinting: false };

length += statePart.value.length;
if (isParsedNodeFunction(statePart)) {
if (statePart.type === 'function') {
const stateNodes = statePart.nodes;

@@ -40,3 +43,3 @@ length++; // opening state parenthesis

}
else if (isParsedNodeDiv(statePart)) {
else if (statePart.type === 'div') {
length = length + statePart.before.length + statePart.after.length;

@@ -57,3 +60,3 @@ }

({ length, requiredHinting } = resolvePosInState(pos.character, length, typeNode.value));
if (!requiredHinting && isParsedNodeFunction(typeNode)) {
if (!requiredHinting && typeNode.type === 'function') {
length++; // opening type parenthesis

@@ -63,3 +66,3 @@ validator = resolvePosInState(pos.character, length, typeNode.before);

length = validator.length;
typeNode.nodes.forEach((valNode) => {
typeNode.nodes.forEach(valNode => {
({ validator, length, stateTypeValidatorToHint } = resolveStateValidator(pos, length, valNode, stateTypeValidatorToHint, typeNode));

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

stateTypeValidatorToHint = isValidatorsHintingRequired(validator.requiredHinting, stateTypeValidatorToHint, typeNode.value);
if (isParsedNodeFunction(valNode)) {
if (valNode.type === 'function') {
length++; // opening arg parenthesis

@@ -135,10 +138,2 @@ const argsLength = valNode.nodes.reduce((sum, node) => {

}
function isParsedNodeFunction(node) {
return node.type === 'function';
}
exports.isParsedNodeFunction = isParsedNodeFunction;
function isParsedNodeDiv(node) {
return node.type === 'div';
}
exports.isParsedNodeDiv = isParsedNodeDiv;
function isBetweenLengths(location, length, modifier) {

@@ -145,0 +140,0 @@ return location >= length && location <= length + modifier.length;

@@ -0,5 +1,5 @@

import ts from 'typescript';
import postcss from 'postcss';
import { IFileSystem } from '@file-services/types';
import { CSSResolve, Stylable, StylableMeta } from '@stylable/core';
import postcss from 'postcss';
import ts from 'typescript';
import { Location, ParameterInformation, Position, SignatureHelp } from 'vscode-languageserver';

@@ -6,0 +6,0 @@ import { ProviderPosition, ProviderRange } from './completion-providers';

@@ -6,6 +6,7 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@stylable/core");
const path_1 = __importDefault(require("path"));
const typescript_1 = __importDefault(require("typescript"));
const postcss_1 = __importDefault(require("postcss"));
const typescript_1 = __importDefault(require("typescript"));
const postcss_value_parser_1 = __importDefault(require("postcss-value-parser"));
const core_1 = require("@stylable/core");
const vscode_uri_1 = require("vscode-uri");

@@ -16,3 +17,2 @@ const completion_providers_1 = require("./completion-providers");

const selector_analyzer_1 = require("./utils/selector-analyzer");
const valueParser = require('postcss-value-parser');
const selectorTokenizer = require('css-selector-tokenizer');

@@ -233,5 +233,5 @@ function findLast(arr, predicate) {

}
const parsed = valueParser(value);
const parsed = postcss_value_parser_1.default(value);
let mixin = '';
const rev = parsed.nodes.reverse()[0];
const rev = parsed.nodes[parsed.nodes.length - 1];
if (rev.type === 'function' && !!rev.unclosed) {

@@ -243,3 +243,3 @@ mixin = rev.value;

}
const activeParam = parsed.nodes.reverse()[0].nodes.reduce((acc, cur) => {
const activeParam = rev.nodes.reduce((acc, cur) => {
return cur.type === 'div' ? acc + 1 : acc;

@@ -1269,3 +1269,3 @@ }, 0);

const value = lineText.slice(valueStart, position.character);
const parsed = valueParser(value.trim());
const parsed = postcss_value_parser_1.default(value.trim());
const names = parsed.nodes

@@ -1292,3 +1292,3 @@ .filter((n) => n.type === 'function' || n.type === 'word')

}
const parsed = valueParser(res.currentLine).nodes;
const parsed = postcss_value_parser_1.default(res.currentLine).nodes;
let val = findNode(parsed, position.character);

@@ -1295,0 +1295,0 @@ while (val.nodes && val.nodes.length > 0) {

@@ -1,2 +0,1 @@

import { ParsedValue } from '@stylable/core';
import ts from 'typescript';

@@ -24,6 +23,2 @@ import { Command, CompletionItem, Diagnostic, Location, NotificationType, ParameterInformation, Position, Range, TextEdit } from 'vscode-languageserver';

}
export interface ParsedFuncOrDivValue extends ParsedValue {
before: string;
after: string;
}
//# sourceMappingURL=types.d.ts.map
{
"name": "@stylable/language-service",
"version": "3.2.0",
"version": "3.2.1",
"description": "Stylable Language Services - syntax highlighting, completions, hinting and more for the Stylable CSS preprocessor.",

@@ -14,12 +14,14 @@ "main": "./cjs/index.js",

},
"peerDependencies": {
"typescript": ">=3.6"
},
"dependencies": {
"@file-services/node": "^2.1.1",
"@file-services/typescript": "^2.1.2",
"@stylable/core": "^3.2.0",
"@stylable/core": "^3.2.1",
"css-selector-tokenizer": "^0.7.1",
"postcss": "^7.0.26",
"postcss-value-parser": "^4.0.2",
"typescript": "~3.7.5",
"postcss": "^7.0.27",
"postcss-value-parser": "^4.0.3",
"vscode-css-languageservice": "^4.0.2",
"vscode-languageserver": "^6.1.0",
"vscode-languageserver": "^6.1.1",
"vscode-uri": "^2.1.1"

@@ -41,3 +43,3 @@ },

"license": "BSD-3-Clause",
"gitHead": "fc7eef9837dab10f9041f8ffaeb1073167ee43ef"
"gitHead": "508088f302c67f2837256a5c37ade110352146ea"
}
import path from 'path';
import postcss from 'postcss';
import postcssValueParser from 'postcss-value-parser';
import ts from 'typescript';

@@ -58,3 +59,2 @@

const pvp = require('postcss-value-parser');

@@ -346,3 +346,3 @@ export interface ProviderOptions {

) {
const parsed = pvp(fullLineText.slice(fullLineText.indexOf(':') + 1)).nodes;
const parsed = postcssValueParser(fullLineText.slice(fullLineText.indexOf(':') + 1)).nodes;
const node = parsed[parsed.length - 1];

@@ -349,0 +349,0 @@ if (

@@ -1,8 +0,6 @@

import { ParsedValue, StateParsedValue, systemValidators } from '@stylable/core';
import postcssValueParser from 'postcss-value-parser';
import { ParameterInformation, SignatureHelp, SignatureInformation } from 'vscode-languageserver';
import { StateParsedValue, systemValidators } from '@stylable/core';
import { ProviderPosition } from '../completion-providers';
import { ParsedFuncOrDivValue } from '../types';
const pvp = require('postcss-value-parser');
// Goes over an '-st-states' declaration value

@@ -21,3 +19,3 @@ // parses the state and position to resolve if inside a state with a parameter

const value = line.slice(valueStartChar);
const stateParts: ParsedValue[] = pvp(value).nodes;
const { nodes: stateParts } = postcssValueParser(value);
let requiredHinting = false;

@@ -31,3 +29,3 @@ const validator = { length: 0, requiredHinting: false };

if (isParsedNodeFunction(statePart)) {
if (statePart.type === 'function') {
const stateNodes = statePart.nodes;

@@ -65,3 +63,3 @@ length++; // opening state parenthesis

length++; // closing state parenthesis
} else if (isParsedNodeDiv(statePart)) {
} else if (statePart.type === 'div') {
length = length + statePart.before.length + statePart.after.length;

@@ -80,3 +78,3 @@ }

function resolveStateType(
stateNodes: ParsedValue[],
stateNodes: postcssValueParser.Node[],
length: number,

@@ -91,3 +89,3 @@ requiredHinting: boolean,

if (!requiredHinting && isParsedNodeFunction(typeNode)) {
if (!requiredHinting && typeNode.type === 'function') {
length++; // opening type parenthesis

@@ -101,3 +99,3 @@ validator = resolvePosInState(pos.character, length, typeNode.before);

length = validator.length;
typeNode.nodes.forEach((valNode: ParsedValue) => {
typeNode.nodes.forEach(valNode => {
({ validator, length, stateTypeValidatorToHint } = resolveStateValidator(

@@ -128,3 +126,3 @@ pos,

length: number,
valNode: ParsedValue,
valNode: postcssValueParser.Node,
stateTypeValidatorToHint: string | null,

@@ -139,3 +137,3 @@ typeNode: any

);
if (isParsedNodeFunction(valNode)) {
if (valNode.type === 'function') {
length++; // opening arg parenthesis

@@ -206,10 +204,2 @@ const argsLength = valNode.nodes.reduce((sum: number, node: any) => {

export function isParsedNodeFunction(node: ParsedValue): node is ParsedFuncOrDivValue {
return node.type === 'function';
}
export function isParsedNodeDiv(node: ParsedValue): node is ParsedFuncOrDivValue {
return node.type === 'div';
}
export function isBetweenLengths(location: number, length: number, modifier: { length: number }) {

@@ -216,0 +206,0 @@ return location >= length && location <= length + modifier.length;

@@ -1,2 +0,1 @@

import { ParsedValue } from '@stylable/core';
import ts from 'typescript';

@@ -39,6 +38,1 @@ import {

}
export interface ParsedFuncOrDivValue extends ParsedValue {
before: string;
after: string;
}

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

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 too big to display

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