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

sveld

Package Overview
Dependencies
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sveld - npm Package Compare versions

Comparing version 0.8.1 to 0.8.2

6

CHANGELOG.md

@@ -8,6 +8,8 @@ # Changelog

## [0.8.2](https://github.com/IBM/sveld/releases/tag/v0.8.2) - 2021-07-11
- write constant props as accessors in the `SvelteComponentTyped` interface
## [0.8.1](https://github.com/IBM/sveld/releases/tag/v0.8.1) - 2021-07-10
**Fixes**
- type function declarations as accessors in the `SvelteComponentTyped` interface

@@ -14,0 +16,0 @@ - omit module name from generated TypeScript class if it's the reserved keyword "default"

@@ -118,10 +118,9 @@ "use strict";

filePath = entry_1.source, ext = path.parse(filePath).ext;
if (!(ext === '.svelte')) return [3 /*break*/, 4];
if (!(ext === ".svelte")) return [3 /*break*/, 4];
return [4 /*yield*/, fs.readFile(path.resolve(dir, filePath), "utf-8")];
case 2:
source = _c.sent();
return [4 /*yield*/, compiler_1.preprocess(source, [
svelte_preprocess_1.typescript(),
svelte_preprocess_1.replace([[/<style.+<\/style>/gims, ""]]),
], { filename: path.basename(filePath) })];
return [4 /*yield*/, compiler_1.preprocess(source, [svelte_preprocess_1.typescript(), svelte_preprocess_1.replace([[/<style.+<\/style>/gims, ""]])], {
filename: path.basename(filePath)
})];
case 3:

@@ -128,0 +127,0 @@ processed = (_c.sent()).code;

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

var props = def.props
.filter(function (prop) { return !prop.isFunctionDeclaration; })
.filter(function (prop) { return !prop.isFunctionDeclaration && prop.kind !== "const"; })
.map(function (prop) {

@@ -139,6 +139,12 @@ var _a;

return def.props
.filter(function (prop) { return prop.isFunctionDeclaration; })
.filter(function (prop) { return prop.isFunctionDeclaration || prop.kind === "const"; })
.map(function (prop) {
var _a;
var prop_comments = [addCommentLine((_a = prop.description) === null || _a === void 0 ? void 0 : _a.replace(/\n/g, "\n* "))].filter(Boolean).join("");
var prop_comments = [
addCommentLine((_a = prop.description) === null || _a === void 0 ? void 0 : _a.replace(/\n/g, "\n* ")),
addCommentLine(prop.constant, "@constant"),
addCommentLine(prop.value, "@default " + (typeof prop.value === "string" ? prop.value.replace(/\s+/g, " ") : prop.value)),
]
.filter(Boolean)
.join("");
return "\n " + (prop_comments.length > 0 ? "/**\n" + prop_comments + "*/" : EMPTY_STR) + "\n " + prop.name + ": " + prop.type + ";";

@@ -161,3 +167,3 @@ })

}), props_name = _a.props_name, prop_def = _a.prop_def;
return "\n /// <reference types=\"svelte\" />\n import { SvelteComponentTyped } from \"svelte\";\n " + genImports({ "extends": _extends }) + "\n " + getTypeDefs({ typedefs: typedefs }) + "\n " + prop_def + "\n\n export default class " + (moduleName === 'default' ? '' : moduleName) + " extends SvelteComponentTyped<\n " + props_name + ",\n {" + genEventDef({ events: events }) + "},\n {" + genSlotDef({ slots: slots }) + "}\n > {\n " + genAccessors({ props: props }) + "\n }";
return "\n /// <reference types=\"svelte\" />\n import { SvelteComponentTyped } from \"svelte\";\n " + genImports({ "extends": _extends }) + "\n " + getTypeDefs({ typedefs: typedefs }) + "\n " + prop_def + "\n\n export default class " + (moduleName === "default" ? "" : moduleName) + " extends SvelteComponentTyped<\n " + props_name + ",\n {" + genEventDef({ events: events }) + "},\n {" + genSlotDef({ slots: slots }) + "}\n > {\n " + genAccessors({ props: props }) + "\n }";
}

@@ -164,0 +170,0 @@ exports.writeTsDefinition = writeTsDefinition;

{
"name": "sveld",
"version": "0.8.1",
"version": "0.8.2",
"license": "Apache-2.0",

@@ -5,0 +5,0 @@ "description": "Generate TypeScript definitions for your Svelte components.",

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