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

@effect/language-service

Package Overview
Dependencies
Maintainers
3
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@effect/language-service - npm Package Compare versions

Comparing version 0.0.13 to 0.0.14

2

package.json
{
"name": "@effect/language-service",
"version": "0.0.13",
"version": "0.0.14",
"license": "MIT",

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

declare const _default: {
asyncAwaitToGen: import("./definition").RefactorDefinition;
asyncAwaitToGenTryPromise: import("./definition").RefactorDefinition;
removePipe: import("./definition").RefactorDefinition;
addPipe: import("./definition").RefactorDefinition;
functionToArrow: import("./definition").RefactorDefinition;

@@ -7,0 +5,0 @@ toggleTypeAnnotation: import("./definition").RefactorDefinition;

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

exports.default = void 0;
var _addPipe = /*#__PURE__*/_interopRequireDefault( /*#__PURE__*/require("@effect/language-service/refactors/addPipe"));
var _asyncAwaitToGen = /*#__PURE__*/_interopRequireDefault( /*#__PURE__*/require("@effect/language-service/refactors/asyncAwaitToGen"));
var _asyncAwaitToGenTryPromise = /*#__PURE__*/_interopRequireDefault( /*#__PURE__*/require("@effect/language-service/refactors/asyncAwaitToGenTryPromise"));
var _functionToArrow = /*#__PURE__*/_interopRequireDefault( /*#__PURE__*/require("@effect/language-service/refactors/functionToArrow"));
var _removePipe = /*#__PURE__*/_interopRequireDefault( /*#__PURE__*/require("@effect/language-service/refactors/removePipe"));
var _toggleReturnTypeAnnotation = /*#__PURE__*/_interopRequireDefault( /*#__PURE__*/require("@effect/language-service/refactors/toggleReturnTypeAnnotation"));

@@ -20,4 +18,2 @@ var _toggleTypeAnnotation = /*#__PURE__*/_interopRequireDefault( /*#__PURE__*/require("@effect/language-service/refactors/toggleTypeAnnotation"));

asyncAwaitToGenTryPromise: _asyncAwaitToGenTryPromise.default,
removePipe: _removePipe.default,
addPipe: _addPipe.default,
functionToArrow: _functionToArrow.default,

@@ -24,0 +20,0 @@ toggleTypeAnnotation: _toggleTypeAnnotation.default,

@@ -112,6 +112,2 @@ import * as O from "@effect/language-service/utils/Option";

export declare function isNodeInRange(textRange: ts.TextRange): (node: ts.Node) => boolean;
export declare function isPipeCall(ts: TypeScriptApi): (node: ts.Node) => node is ts.CallExpression;
export declare function asPipeableCallExpression(ts: TypeScriptApi): (node: ts.Node) => O.None | O.Some<readonly [ts.LeftHandSideExpression, ts.Expression]>;
export declare function asPipeArguments(ts: TypeScriptApi): (initialNode: ts.Node) => readonly ts.Expression[];
export declare function isPipeableCallExpression(ts: TypeScriptApi): (node: ts.Node) => node is ts.CallExpression;
export declare function findModuleImportIdentifierName(ts: TypeScriptApi): (sourceFile: ts.SourceFile, moduleName: string) => O.Option<string>;

@@ -118,0 +114,0 @@ export declare function transformAsyncAwaitToEffectGen(ts: TypeScriptApi): (node: ts.FunctionDeclaration | ts.ArrowFunction | ts.FunctionExpression, effectName: string, onAwait: (expression: ts.Expression) => ts.Expression) => ts.FunctionDeclaration | ts.FunctionExpression | ts.ArrowFunction;

@@ -8,4 +8,2 @@ "use strict";

exports.addReturnTypeAnnotation = addReturnTypeAnnotation;
exports.asPipeArguments = asPipeArguments;
exports.asPipeableCallExpression = asPipeableCallExpression;
exports.collectAll = collectAll;

@@ -20,4 +18,2 @@ exports.findModuleImportIdentifierName = findModuleImportIdentifierName;

exports.isNodeInRange = isNodeInRange;
exports.isPipeCall = isPipeCall;
exports.isPipeableCallExpression = isPipeableCallExpression;
exports.removeReturnTypeAnnotation = removeReturnTypeAnnotation;

@@ -109,47 +105,2 @@ exports.toTextRange = toTextRange;

}
function isPipeCall(ts) {
return node => {
if (!ts.isCallExpression(node)) return false;
const expression = node.expression;
if (!ts.isIdentifier(expression)) return false;
if (expression.getText(node.getSourceFile()) !== "pipe") return false;
return true;
};
}
function asPipeableCallExpression(ts) {
return node => {
// ensure the node is a call expression
if (!ts.isCallExpression(node)) return O.none;
// with just 1 arg
if (node.arguments.length !== 1) return O.none;
const arg = node.arguments[0];
// ideally T.map(n => n * 2) could be piped to pipe(n => n * 2, T.map)
// but does not make any sense.
if (ts.isArrowFunction(arg)) return O.none;
// same goes for identifiers, string literal or numbers
if (ts.isStringLiteral(arg) || ts.isNumericLiteral(arg) || ts.isIdentifier(arg)) return O.none;
return O.some([node.expression, arg]);
};
}
function asPipeArguments(ts) {
return initialNode => {
let result = Ch.empty;
let currentNode = O.some(initialNode);
while (O.isSome(currentNode)) {
const node = currentNode.value;
const maybePipeable = asPipeableCallExpression(ts)(node);
if (O.isNone(maybePipeable)) {
result = (0, _Function.pipe)(result, Ch.append(node));
break;
}
const [exp, arg] = maybePipeable.value;
result = (0, _Function.pipe)(result, Ch.append(exp));
currentNode = O.some(arg);
}
return Ch.reverse(result);
};
}
function isPipeableCallExpression(ts) {
return node => O.isSome(asPipeableCallExpression(ts)(node));
}
function findModuleImportIdentifierName(ts) {

@@ -156,0 +107,0 @@ return (sourceFile, moduleName) => {

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 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