New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.1.0-rc.5 to 0.1.0

5

CHANGELOG.md

@@ -8,2 +8,7 @@ # Changelog

## [0.1.0](https://github.com/IBM/carbon-icons-svelte/releases/tag/v0.1.0) - 2020-11-19
- Allow custom `restProps` type as a definition
- Fix "undefined" event by checking if the event name is undefined
## [0.1.0-rc.5](https://github.com/IBM/carbon-icons-svelte/releases/tag/v0.1.0-rc.5) - 2020-11-18

@@ -10,0 +15,0 @@

17

lib/ComponentParser.js

@@ -13,13 +13,2 @@ "use strict";

};
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
var __spreadArrays = (this && this.__spreadArrays) || function () {

@@ -116,2 +105,4 @@ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;

ComponentParser.prototype.addDispatchedEvent = function (name, detail) {
if (name === undefined)
return;
if (this.events.has(name)) {

@@ -134,3 +125,3 @@ var existing_event = this.events.get(name);

tags.forEach(function (_a) {
var tag = _a.tag, tagType = _a.type, name = _a.name, description = _a.description, rest = __rest(_a, ["tag", "type", "name", "description"]);
var tag = _a.tag, tagType = _a.type, name = _a.name, description = _a.description;
var type = _this.aliasType(tagType);

@@ -141,3 +132,3 @@ switch (tag) {

type: "Element",
name: name
name: type
};

@@ -144,0 +135,0 @@ break;

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

if (((_a = def.rest_props) === null || _a === void 0 ? void 0 : _a.type) === "Element") {
prop_def = "\n export interface " + props_name + " extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap[\"" + def.rest_props.name + "\"]> {\n " + props + "\n }\n ";
var extend_tag_map = def.rest_props.name
.split("|")
.map(function (name) { return "svelte.JSX.HTMLAttributes<HTMLElementTagNameMap[\"" + name.trim() + "\"]>"; })
.join(",");
prop_def = "\n export interface " + props_name + " extends " + extend_tag_map + " {\n " + props + "\n }\n ";
}

@@ -104,0 +108,0 @@ else {

{
"name": "sveld",
"version": "0.1.0-rc.5",
"version": "0.1.0",
"license": "Apache-2.0",
"description": "Documentation generator for Svelte component libraries.",
"description": "Generate TypeScript definitions for your Svelte components.",
"author": "Eric Liu (https://github.com/metonym)",

@@ -7,0 +7,0 @@ "main": "./lib/index.js",

@@ -6,5 +6,5 @@ # sveld

`sveld` is a documentation generator for Svelte component libraries. It uses the Svelte compiler to generate TypeScript definitions as well as component documentation in Markdown and JSON output formats. Component documentation (e.g. prop types, descriptions, slot signatures) can be augmented through JSDoc annotations, a markup language for JavaScript code.
`sveld` generates TypeScript definitions for Svelte components. It uses the Svelte compiler to statically analyze a Svelte component for props, events, slots and more. Prop types and signatures can be augmented using JSDoc notation. This library can also output component documentation in Markdown and JSON output formats.
The purpose of this project is to enhance the end user experience of consuming third party Svelte components and libraries with minimal documentation effort required by the author. For example, TypeScript definitions may be used during development via intelligent code completion in Integrated Development Environments (IDE) like VSCode.
The purpose of this project is to make third party Svelte components and libraries compatible with the Svelte Language Server and TypeScript with minimal effort by the author. For example, TypeScript definitions may be used during development via intelligent code completion in Integrated Development Environments (IDE) like VSCode.

@@ -15,6 +15,7 @@ The core of this library is extracted from [carbon-components-svelte](https://github.com/IBM/carbon-components-svelte).

Say that you have a basic Button component:
Given a Svelte file, sveld can infer basic prop types to generate TypeScript definitions compatible with the [Svelte Language Server](https://github.com/sveltejs/language-tools):
**Button.svelte**
```svelte
<!-- Button.svelte -->
<script>

@@ -30,6 +31,5 @@ export let type = "button";

sveld can statically analyze the component and infer basic prop types to generate TypeScript definitions compatible with the [Svelte Language Server](https://github.com/sveltejs/language-tools):
**Button.d.ts**
```ts
// Button.d.ts
/// <reference types="svelte" />

@@ -60,5 +60,5 @@

Sometimes, inferred prop types are not enough.
Sometimes, inferring prop types is insufficient.
You can augment the definitions using [JSDoc](https://jsdoc.app/) annotations.
Prop/event/slot types and signatures can be augmented using [JSDoc](https://jsdoc.app/) notations.

@@ -78,3 +78,2 @@ ```js

```ts
// Button.d.ts
/// <reference types="svelte" />

@@ -180,3 +179,3 @@

```sh
sveld
npx sveld
```

@@ -187,3 +186,3 @@

```sh
sveld --json --markdown
npx sveld --json --markdown
```

@@ -190,0 +189,0 @@

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