sveld 0.26.2 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,7 +1,6 @@
1
1
  # sveld
2
2
 
3
3
  [![NPM][npm]][npm-url]
4
- ![GitHub](https://img.shields.io/github/license/carbon-design-system/sveld?color=262626&style=for-the-badge)
5
4
  ![npm downloads to date](https://img.shields.io/npm/dt/sveld?color=262626&style=for-the-badge)
6
5
 
7
6
  `sveld` is a TypeScript definition generator for Svelte components. It analyzes props, events, slots, and other component features through static analysis. Types and signatures can be defined using [JSDoc notation](https://jsdoc.app/). The tool can also generate component documentation in Markdown and JSON formats.
@@ -50,7 +49,7 @@ type $Props = {
50
49
  */
51
50
  primary?: boolean;
52
51
 
53
- [key: `data-${string}`]: any;
52
+ [key: `data-${string}`]: unknown;
54
53
  };
55
54
 
56
55
  export type ButtonProps = Omit<$RestProps, keyof $Props> & $Props;
@@ -222,13 +221,13 @@ npx sveld --json --markdown
222
221
 
223
222
  ### Node.js
224
223
 
225
- You can also use `sveld` programmatically in Node.js.
224
+ You can also use `sveld` programmatically in Node.js. The package is **ESM-only**; `require("sveld")` is not supported. Use `import` or dynamic `import()`.
226
225
 
227
226
  If no `input` is specified, `sveld` will infer the entry point based on the `package.json#svelte` field.
228
227
 
229
228
  ```js
230
- const { sveld } = require("sveld");
231
- const pkg = require("./package.json");
229
+ import { sveld } from "sveld";
230
+ import pkg from "./package.json" with { type: "json" };
232
231
 
233
232
  sveld({
234
233
  input: "./src/index.js",
package/cli.js CHANGED
@@ -1,9 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- (() => {
4
- try {
5
- require("./lib").cli(process);
6
- } catch (error) {
7
- console.error(error);
8
- }
9
- })();
3
+ import("./lib/index.js").then(({ cli }) => cli(process)).catch(console.error);