sveld 0.15.0 → 0.15.1

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/CHANGELOG.md CHANGED
@@ -10,6 +10,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
10
10
  - add isAccessor field to API
11
11
  - update Markdown writer to generate a separate table for accessors -->
12
12
 
13
+ ## [0.15.1](https://github.com/carbon-design-system/sveld/releases/tag/v0.15.1) - 2022-05-01
14
+
15
+ - function exported from `<script context="module">` should be typed as functions, not types
16
+
13
17
  ## [0.15.0](https://github.com/carbon-design-system/sveld/releases/tag/v0.15.0) - 2022-04-14
14
18
 
15
19
  - add `jsonOptions.outDir` option to emit JSON files for individual components
@@ -221,7 +221,14 @@ function genModuleExports(def) {
221
221
  .map(function (prop) {
222
222
  var _a;
223
223
  var prop_comments = [addCommentLine((_a = prop.description) === null || _a === void 0 ? void 0 : _a.replace(/\n/g, "\n* "))].filter(Boolean).join("");
224
- return "\n ".concat(prop_comments.length > 0 ? "/**\n".concat(prop_comments, "*/") : EMPTY_STR, "\n export type ").concat(prop.name, " = ").concat(prop.type || ANY_TYPE, ";");
224
+ var type_def = "export type ".concat(prop.name, " = ").concat(prop.type || ANY_TYPE, ";");
225
+ var is_function = prop.type && /=>/.test(prop.type);
226
+ if (is_function) {
227
+ var _b = prop.type.split("=>"), first = _b[0], second = _b[1], rest = _b.slice(2);
228
+ var rest_type = rest.map(function (item) { return "=>" + item; }).join("");
229
+ type_def = "export declare function ".concat(prop.name).concat(first, ":").concat(second).concat(rest_type, ";");
230
+ }
231
+ return "\n ".concat(prop_comments.length > 0 ? "/**\n".concat(prop_comments, "*/") : EMPTY_STR, "\n ").concat(type_def);
225
232
  })
226
233
  .join("\n");
227
234
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sveld",
3
- "version": "0.15.0",
3
+ "version": "0.15.1",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Generate TypeScript definitions for your Svelte components.",
6
6
  "main": "./lib/index.js",
@@ -16,12 +16,12 @@
16
16
  "prepack": "tsc"
17
17
  },
18
18
  "dependencies": {
19
- "@rollup/plugin-node-resolve": "^13.2.0",
19
+ "@rollup/plugin-node-resolve": "^13.2.1",
20
20
  "acorn": "^8.7.0",
21
21
  "comment-parser": "^1.3.1",
22
22
  "fast-glob": "^3.2.11",
23
23
  "prettier": "^2.6.2",
24
- "rollup": "^2.70.1",
24
+ "rollup": "^2.70.2",
25
25
  "rollup-plugin-svelte": "^7.1.0",
26
26
  "svelte": "^3.47.0",
27
27
  "svelte-preprocess": "^4.10.6",
@@ -29,15 +29,15 @@
29
29
  },
30
30
  "devDependencies": {
31
31
  "@sveltejs/vite-plugin-svelte": "1.0.0-next.41",
32
- "@types/node": "^17.0.24",
32
+ "@types/node": "^17.0.25",
33
33
  "@types/prettier": "^2.6.0",
34
- "carbon-components-svelte": "^0.62.3",
35
- "carbon-preprocess-svelte": "^0.8.2",
36
- "codemirror": "^5.65.2",
34
+ "carbon-components-svelte": "^0.63.1",
35
+ "carbon-preprocess-svelte": "^0.9.0",
36
+ "codemirror": "^5.65.3",
37
37
  "prettier-plugin-svelte": "^2.7.0",
38
38
  "svelte-highlight": "^6.0.1",
39
39
  "vite": "^2.9.5",
40
- "vitest": "^0.9.3"
40
+ "vitest": "^0.9.4"
41
41
  },
42
42
  "bin": {
43
43
  "sveld": "./cli.js"