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

derw

Package Overview
Dependencies
Maintainers
1
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

derw - npm Package Compare versions

Comparing version 0.0.9-6 to 0.0.9-7

2

build/builtins.d.ts

@@ -1,4 +0,4 @@

declare type BuiltinTypes = "boolean" | "number" | "string" | "void" | "any";
declare type BuiltinTypes = "boolean" | "number" | "string" | "void" | "any" | "Promise";
export declare function isBuiltinType(potentialType: string): potentialType is BuiltinTypes;
export declare function isReservedName(potentialName: string): boolean;
export {};

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

function isBuiltinType(potentialType) {
return (["boolean", "number", "string", "void", "any"].indexOf(potentialType) > -1);
return (["boolean", "number", "string", "void", "any", "Promise"].indexOf(potentialType) > -1);
}

@@ -8,0 +8,0 @@ exports.isBuiltinType = isBuiltinType;

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

case "Const": {
return generateConst(expression);
return generateConst(expression, true);
}

@@ -659,3 +659,3 @@ case "Function": {

return (function (y) {
return y + ";";
return "await " + y + ";";
})(generateFunctionCall(expression));

@@ -665,3 +665,3 @@ }

return (function (y) {
return y + ";";
return "await " + y + ";";
})(generateModuleReference(expression));

@@ -697,2 +697,4 @@ }

const maybeLetBody = generateLetBlock(function_.letBody);
const isAsync = function_.doBody !== null;
const maybeAsyncPrefix = isAsync ? "async " : "";
const maybeDoBody = function_.doBody === null ? "" : (function (y) {

@@ -711,3 +713,3 @@ return `\n${Common_1.prefixLines(y, 4)}`;

return y.join("\n");
})([`function ${function_.name}(${args}) {${maybeLetBody}${maybeDoBody}`, `${body}`, `}`]);
})([`${maybeAsyncPrefix}function ${function_.name}(${args}) {${maybeLetBody}${maybeDoBody}`, `${body}`, `}`]);
}

@@ -749,3 +751,3 @@ function generateInlineIf(expression) {

}
function generateConst(constDef) {
function generateConst(constDef, isAsync) {
const body = (function () {

@@ -782,3 +784,4 @@ switch (constDef.value.kind) {

})();
return `const ${constDef.name} = ${body};`;
const maybeAsyncPrefix = isAsync ? "await " : "";
return `const ${constDef.name} = ${maybeAsyncPrefix}${body};`;
}

@@ -807,3 +810,3 @@ function generateBlock(syntax, unionTypeNames) {

case "Const": {
return generateConst(syntax);
return generateConst(syntax, false);
}

@@ -810,0 +813,0 @@ case "Comment": {

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

case "Const": {
return generateConst(expression, imports);
return generateConst(expression, imports, true);
}

@@ -1028,3 +1028,3 @@ case "Function": {

return (function (y) {
return y + ";";
return "await " + y + ";";
})(generateFunctionCall(expression));

@@ -1034,3 +1034,3 @@ }

return (function (y) {
return y + ";";
return "await " + y + ";";
})(generateModuleReference(expression));

@@ -1075,6 +1075,12 @@ }

const maybeLetBody = generateLetBlock(function_.letBody, List.append(filteredTypeArguments, parentTypeArguments), imports);
const maybeDoBody = function_.doBody === null ? "" : (function (y) {
const isAsync = function_.doBody !== null;
const maybeAsyncPrefix = isAsync ? "async " : "";
const maybeDoBody = function_.doBody !== null ? (function (y) {
return `\n${Common_1.prefixLines(y, 4)}`;
})(generateDoBlock(function_.doBody, parentTypeArguments, parentTypes, imports));
const returnType = generateTopLevelType(function_.returnType, imports);
})(generateDoBlock(function_.doBody, parentTypeArguments, parentTypes, imports)) : "";
const returnType = isAsync ? generateTopLevelType({
kind: "FixedType",
name: "Promise",
args: [function_.returnType]
}, imports) : generateTopLevelType(function_.returnType, imports);
const isSimpleBody = types_1.isSimpleValue(function_.body.kind);

@@ -1093,3 +1099,3 @@ const bodyPrefix = isSimpleBody ? "return " : "";

return y.join("\n");
})([`function ${function_.name}${typeArgumentsString}(${args}): ${returnType} {${maybeLetBody}${maybeDoBody}`, `${body}`, `}`]);
})([`${maybeAsyncPrefix}function ${function_.name}${typeArgumentsString}(${args}): ${returnType} {${maybeLetBody}${maybeDoBody}`, `${body}`, `}`]);
}

@@ -1132,3 +1138,3 @@ function generateInlineIf(expression) {

}
function generateConst(constDef, imports) {
function generateConst(constDef, imports, isAsync) {
const body = (function () {

@@ -1165,4 +1171,5 @@ switch (constDef.value.kind) {

})();
const maybeAsyncPrefix = isAsync ? "await " : "";
const typeDef = generateTopLevelType(constDef.type, imports);
return `const ${constDef.name}: ${typeDef} = ${body};`;
return `const ${constDef.name}: ${typeDef} = ${maybeAsyncPrefix}${body};`;
}

@@ -1190,3 +1197,3 @@ function generateBlock(syntax, parentTypeArguments, parentTypes, imports) {

case "Const": {
return generateConst(syntax, actualImports);
return generateConst(syntax, actualImports, false);
}

@@ -1193,0 +1200,0 @@ case "Comment": {

{
"name": "derw",
"version": "0.0.9-6",
"version": "0.0.9-7",
"description": "An Elm-inspired language that transpiles to TypeScript",

@@ -5,0 +5,0 @@ "main": "index.js",

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