Comparing version 0.13.1 to 0.13.2
@@ -8,7 +8,11 @@ # Changelog | ||
## Unreleased | ||
<!-- ## Unreleased | ||
- add isAccessor field to API | ||
- update Markdown writer to generate a separate table for accessors | ||
- update Markdown writer to generate a separate table for accessors --> | ||
## [0.13.2](https://github.com/carbon-design-system/sveld/releases/tag/v0.13.2) - 2022-02-10 | ||
- do not wrap TS `@event` detail in `CustomEvent` if type contains `CustomEvent` | ||
## [0.13.1](https://github.com/carbon-design-system/sveld/releases/tag/v0.13.1) - 2022-01-22 | ||
@@ -15,0 +19,0 @@ |
@@ -137,5 +137,11 @@ "use strict"; | ||
function genEventDef(def) { | ||
var createDispatchedEvent = function (detail) { | ||
if (detail === void 0) { detail = ANY_TYPE; } | ||
if (/CustomEvent/.test(detail)) | ||
return detail; | ||
return "CustomEvent<".concat(detail, ">"); | ||
}; | ||
return def.events | ||
.map(function (event) { | ||
return "".concat(clampKey(event.name), ": ").concat(event.type === "dispatched" ? "CustomEvent<".concat(event.detail || ANY_TYPE, ">") : "WindowEventMap[\"".concat(event.name, "\"]"), ";"); | ||
return "".concat(clampKey(event.name), ": ").concat(event.type === "dispatched" ? createDispatchedEvent(event.detail) : "WindowEventMap[\"".concat(event.name, "\"]"), ";"); | ||
}) | ||
@@ -142,0 +148,0 @@ .join("\n"); |
{ | ||
"name": "sveld", | ||
"version": "0.13.1", | ||
"version": "0.13.2", | ||
"license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "description": "Generate TypeScript definitions for your Svelte components.", |
@@ -110,3 +110,4 @@ # sveld | ||
- [Installation](#installation) | ||
- [Set-up with Rollup](#set-up-with-rollup) | ||
- [Rollup](#rollup) | ||
- [Node.js](#nodejs) | ||
- [CLI](#cli) | ||
@@ -122,2 +123,3 @@ - [Publishing to NPM](#publishing-to-npm) | ||
- [@extends](#extends) | ||
- [@component comments](#component-comments) | ||
- [Contributing](#contributing) | ||
@@ -128,5 +130,5 @@ - [License](#license) | ||
sveld uses the Svelte compiler to statically analyze all Svelte components exported from a library to generate documentation that is useful for the end user. | ||
`sveld` uses the Svelte compiler to statically analyze Svelte components exported from a library to generate documentation useful to the end user. | ||
Extracted metadata: | ||
Extracted metadata include: | ||
@@ -139,3 +141,3 @@ - props | ||
This library adopts a progressively enhanced approach. Any property type that cannot be inferred (e.g. "hello" is a string) falls back to "any" to minimize incorrectly typed properties or signatures. To mitigate this, the library author can add JSDoc annotations to specify types that cannot be reliably inferred. This represents a progressively enhanced approach because JSDocs are comments that can be ignored by the compiler. | ||
This library adopts a progressively enhanced approach. Any property type that cannot be inferred (e.g., "hello" is a string) falls back to "any" to minimize incorrectly typed properties or signatures. To mitigate this, the library author can add JSDoc annotations to specify types that cannot be reliably inferred. This represents a progressively enhanced approach because JSDocs are comments that can be ignored by the compiler. | ||
@@ -154,2 +156,4 @@ The generated TypeScript definitions for a component extends the `SvelteComponentTyped` interface available in svelte version 3.31. | ||
npm i -D sveld | ||
# OR | ||
pnpm i -D sveld | ||
``` | ||
@@ -177,4 +181,16 @@ | ||
When building the library with Rollup, TypeScript definitions will be written to the `types` folder. | ||
When building the library with Rollup, TypeScript definitions will be written to the `types` folder by default. | ||
Use the `typesOptions.outDir` option to customize the output folder. | ||
For example, specify the following for the output to be emitted to the `dist` folder: | ||
```diff | ||
sveld({ | ||
+ typesOptions: { | ||
+ outDir: 'dist' | ||
+ } | ||
}) | ||
``` | ||
The [integration](integration) folder contains example set-ups: | ||
@@ -264,3 +280,3 @@ | ||
Without a `@type` annotation, sveld will infer the primitive type for a prop: | ||
Without a `@type` annotation, `sveld` will infer the primitive type for a prop: | ||
@@ -328,3 +344,3 @@ ```js | ||
Use the `@slot` tag for typing component slots. | ||
Use the `@slot` tag for typing component slots. Note that `@slot` is a non-standard JSDoc tag. | ||
@@ -390,5 +406,5 @@ Signature: | ||
sveld can pick up inline HTML elements that `$$restProps` is forwarded to. However, it cannot infer the underlying element for instantiated components. | ||
`sveld` can pick up inline HTML elements that `$$restProps` is forwarded to. However, it cannot infer the underlying element for instantiated components. | ||
You can use the `@restProps` tag to explicitly define element tags that `$$restProps` is forwarded to. | ||
You can use the `@restProps` tag to specify the element tags that `$$restProps` is forwarded to. | ||
@@ -395,0 +411,0 @@ Signature: |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
120519
1946
495