@vue-jsx-vapor/macros 2.3.2 → 2.3.3

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/dist/api.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_core = require('./core-B1Tt-ieP.cjs');
1
+ const require_core = require('./core-CdPKEM79.cjs');
2
2
 
3
3
  exports.getMacroExpression = require_core.getMacroExpression
4
4
  exports.getParamsStart = require_core.getParamsStart
package/dist/api.d.cts CHANGED
@@ -1,10 +1,11 @@
1
1
  import { OptionsResolved } from "./options.d-B3WOiT_L.cjs";
2
- import { CodeTransform, MagicString } from "@vue-macros/common";
2
+ import { CodeTransform, MagicStringAST } from "@vue-macros/common";
3
3
  import { ArrowFunctionExpression, CallExpression, FunctionDeclaration, FunctionExpression, Node } from "@babel/types";
4
4
 
5
5
  //#region src/core/restructure.d.ts
6
6
  type Options = {
7
7
  withDefaultsFrom?: string;
8
+ skipDefaultProps?: boolean;
8
9
  generateRestProps?: (restPropsName: string, index: number, list: Prop[]) => string | undefined;
9
10
  };
10
11
  type Prop = {
@@ -13,9 +14,8 @@ type Prop = {
13
14
  value: string;
14
15
  defaultValue?: string;
15
16
  isRest?: boolean;
16
- isRequired?: boolean;
17
17
  };
18
- declare function restructure(s: MagicString, node: FunctionalNode, options?: Options): Prop[];
18
+ declare function restructure(s: MagicStringAST, node: FunctionalNode, options?: Options): Prop[];
19
19
 
20
20
  //#endregion
21
21
  //#region src/core/index.d.ts
package/dist/api.d.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  import { OptionsResolved } from "./options.d-DtyRfe-9.js";
2
- import { CodeTransform, MagicString } from "@vue-macros/common";
2
+ import { CodeTransform, MagicStringAST } from "@vue-macros/common";
3
3
  import { ArrowFunctionExpression, CallExpression, FunctionDeclaration, FunctionExpression, Node } from "@babel/types";
4
4
 
5
5
  //#region src/core/restructure.d.ts
6
6
  type Options = {
7
7
  withDefaultsFrom?: string;
8
+ skipDefaultProps?: boolean;
8
9
  generateRestProps?: (restPropsName: string, index: number, list: Prop[]) => string | undefined;
9
10
  };
10
11
  type Prop = {
@@ -13,9 +14,8 @@ type Prop = {
13
14
  value: string;
14
15
  defaultValue?: string;
15
16
  isRest?: boolean;
16
- isRequired?: boolean;
17
17
  };
18
- declare function restructure(s: MagicString, node: FunctionalNode, options?: Options): Prop[];
18
+ declare function restructure(s: MagicStringAST, node: FunctionalNode, options?: Options): Prop[];
19
19
 
20
20
  //#endregion
21
21
  //#region src/core/index.d.ts
package/dist/api.js CHANGED
@@ -1,3 +1,3 @@
1
- import { getMacroExpression, getParamsStart, isFunctionalNode, restructure, transformJsxMacros } from "./core-cHgZBgtA.js";
1
+ import { getMacroExpression, getParamsStart, isFunctionalNode, restructure, transformJsxMacros } from "./core-B_EM_kTA.js";
2
2
 
3
3
  export { getMacroExpression, getParamsStart, isFunctionalNode, restructure, transformJsxMacros };
package/dist/astro.cjs CHANGED
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, '__esModule', { value: true });
3
- require('./core-B1Tt-ieP.cjs');
4
- require('./raw-3ZelnSQR.cjs');
3
+ require('./core-CdPKEM79.cjs');
4
+ require('./raw-oJpqvj1N.cjs');
5
5
  require('./options-CNIhAQHD.cjs');
6
- const require_src = require('./src-DwQLomPw.cjs');
6
+ const require_src = require('./src-CY9FOMwg.cjs');
7
7
 
8
8
  //#region src/astro.ts
9
9
  var astro_default = (options) => ({
package/dist/astro.js CHANGED
@@ -1,7 +1,7 @@
1
- import "./core-cHgZBgtA.js";
2
- import "./raw-9SXDNxBH.js";
1
+ import "./core-B_EM_kTA.js";
2
+ import "./raw-9H5vTeLe.js";
3
3
  import "./options-pbSvpKdV.js";
4
- import { src_default } from "./src-BfZoaRPY.js";
4
+ import { src_default } from "./src-CjDaDFw_.js";
5
5
 
6
6
  //#region src/astro.ts
7
7
  var astro_default = (options) => ({
@@ -22,33 +22,28 @@ function restructure(s, node, options = {}) {
22
22
  const propList = [];
23
23
  for (const param of node.params) {
24
24
  const path = `${HELPER_PREFIX}props${index++ || ""}`;
25
- const props = getProps(param, path, s, [], options);
25
+ const props = getProps(s, options, param, path);
26
26
  if (props) {
27
- const hasDefaultValue = props.some((i) => i.defaultValue);
28
27
  s.overwrite(param.start, param.end, path);
29
- propList.push(...hasDefaultValue ? props.map((i) => ({
30
- ...i,
31
- path: i.path.replace(HELPER_PREFIX, `${HELPER_PREFIX}default_`)
32
- })) : props);
28
+ propList.push(...props);
33
29
  }
34
30
  }
35
31
  if (propList.length) {
36
32
  const defaultValues = {};
37
33
  const rests = [];
38
34
  for (const prop of propList) {
35
+ if (prop.isRest) rests.push(prop);
39
36
  if (prop.defaultValue) {
40
- const basePath = prop.path.split(/\.|\[/)[0];
41
- (defaultValues[basePath] ??= []).push(prop);
37
+ const paths = prop.path.split(/\.|\[/);
38
+ if (!options.skipDefaultProps || paths.length !== 1) (defaultValues[paths[0]] ??= []).push(prop);
42
39
  }
43
- if (prop.isRest) rests.push(prop);
44
40
  }
41
+ for (const [index$1, rest] of rests.entries()) prependFunctionalNode(node, s, options.generateRestProps?.(rest.name, index$1, rests) ?? `\nconst ${rest.name} = ${importHelperFn(s, 0, "createPropsRestProxy")}(${rest.path}, [${rest.value}])`);
45
42
  for (const [path, values] of Object.entries(defaultValues)) {
46
43
  const createPropsDefaultProxy = importHelperFn(s, 0, "createPropsDefaultProxy", void 0, options.withDefaultsFrom ?? withDefaultsHelperId);
47
- const resolvedPath = path.replace(`${HELPER_PREFIX}default_`, HELPER_PREFIX);
48
44
  const resolvedValues = values.map((i) => `'${i.path.replace(path, "")}${i.value}': ${i.defaultValue}`).join(", ");
49
- prependFunctionalNode(node, s, `\nconst ${path} = ${createPropsDefaultProxy}(${resolvedPath}, {${resolvedValues}})`);
45
+ prependFunctionalNode(node, s, `\n${path} = ${createPropsDefaultProxy}(${path}, {${resolvedValues}})`);
50
46
  }
51
- for (const [index$1, rest] of rests.entries()) prependFunctionalNode(node, s, options.generateRestProps?.(rest.name, index$1, rests) ?? `\nconst ${rest.name} = ${importHelperFn(s, 0, "createPropsRestProxy")}(${rest.path}, [${rest.value}])`);
52
47
  walkIdentifiers(node.body, (id, parent) => {
53
48
  const prop = propList.find((i) => i.name === id.name);
54
49
  if (prop && !prop.isRest) s.overwrite(id.start, id.end, `${parent?.type === "ObjectProperty" && parent.shorthand ? `${id.name}: ` : ""}${prop.path}${prop.value}`);
@@ -56,7 +51,7 @@ function restructure(s, node, options = {}) {
56
51
  }
57
52
  return propList;
58
53
  }
59
- function getProps(node, path = "", s, props = [], options) {
54
+ function getProps(s, options, node, path = "", props = []) {
60
55
  const properties = node.type === "ObjectPattern" ? node.properties : node.type === "ArrayPattern" ? node.elements : [];
61
56
  if (!properties.length) return;
62
57
  const propNames = [];
@@ -73,22 +68,25 @@ function getProps(node, path = "", s, props = [], options) {
73
68
  path,
74
69
  name: prop.left.name,
75
70
  value: `[${index}]`,
76
- defaultValue: s.slice(prop.right.start, prop.right.end)
71
+ defaultValue: s.sliceNode(getDefaultValue(prop.right))
77
72
  });
78
73
  propNames.push(`'${prop.left.name}'`);
79
74
  } else if (prop?.type === "ObjectProperty" && prop.key.type === "Identifier") {
80
- if (prop.value.type === "AssignmentPattern" && prop.value.left.type === "Identifier") props.push({
75
+ if (prop.value.type === "AssignmentPattern") if (prop.value.left.type === "Identifier") props.push({
81
76
  path,
82
77
  name: prop.value.left.name,
83
78
  value: `.${prop.key.name}`,
84
- defaultValue: s.slice(prop.value.right.start, prop.value.right.end),
85
- isRequired: prop.value.right.type === "TSNonNullExpression"
86
- });
87
- else if (!getProps(prop.value, `${path}.${prop.key.name}`, s, props, options)) props.push({
88
- path,
89
- name: prop.value.type === "Identifier" ? prop.value.name : prop.key.name,
90
- value: `.${prop.key.name}`
79
+ defaultValue: s.sliceNode(getDefaultValue(prop.value.right))
91
80
  });
81
+ else getProps(s, options, prop.value.left, `${path}.${prop.key.name}`, props);
82
+ else if (!getProps(s, options, prop.value, `${path}.${prop.key.name}`, props)) {
83
+ const name = prop.value.type === "Identifier" ? prop.value.name : prop.key.name;
84
+ props.push({
85
+ path,
86
+ name,
87
+ value: `.${prop.key.name}`
88
+ });
89
+ }
92
90
  propNames.push(`'${prop.key.name}'`);
93
91
  } else if (prop?.type === "RestElement" && prop.argument.type === "Identifier" && !prop.argument.name.startsWith(`${HELPER_PREFIX}props`)) props.push({
94
92
  path,
@@ -96,10 +94,15 @@ function getProps(node, path = "", s, props = [], options) {
96
94
  value: propNames.join(", "),
97
95
  isRest: true
98
96
  });
99
- else if (prop) getProps(prop, `${path}[${index}]`, s, props, options);
97
+ else if (prop) getProps(s, options, prop, `${path}[${index}]`, props);
100
98
  });
101
99
  return props.length ? props : void 0;
102
100
  }
101
+ function getDefaultValue(node) {
102
+ if (node.type === "TSNonNullExpression") return getDefaultValue(node.expression);
103
+ if (node.type === "TSAsExpression") return getDefaultValue(node.expression);
104
+ return node;
105
+ }
103
106
  function prependFunctionalNode(node, s, result) {
104
107
  const isBlockStatement = node.body.type === "BlockStatement";
105
108
  const start = node.body.extra?.parenthesized ? node.body.extra.parenStart : node.body.start;
@@ -164,37 +167,49 @@ function transformDefineComponent(root, propsName, map, s, autoReturnFunction =
164
167
  if (defineComponentName && !["defineComponent", "defineVaporComponent"].includes(defineComponentName)) importHelperFn(s, 0, "defineComponent", defineComponentName);
165
168
  let hasRestProp = false;
166
169
  const props = {};
167
- if (root.params[0]) if (root.params[0].type === "Identifier") getWalkedIds(root, propsName).forEach((id) => props[id] = null);
168
- else {
169
- const restructuredProps = restructure(s, root, { generateRestProps: (restPropsName, index, list) => {
170
- if (index === list.length - 1) {
171
- hasRestProp = true;
172
- const useAttrs = importHelperFn(s, 0, "useAttrs");
173
- return `const ${restPropsName} = ${useAttrs}()`;
170
+ if (root.params[0]) {
171
+ if (root.params[0].type === "Identifier") getWalkedIds(root, propsName).forEach((id) => props[id] = null);
172
+ else if (root.params[0].type === "ObjectPattern") {
173
+ const restructuredProps = root.params[0];
174
+ for (const prop of restructuredProps.properties) {
175
+ if (prop.type !== "ObjectProperty" || prop.key.type !== "Identifier") continue;
176
+ const propName = prop.key.name;
177
+ if (prop.value.type !== "AssignmentPattern") {
178
+ props[propName] = null;
179
+ continue;
180
+ }
181
+ const defaultValue = getDefaultValue(prop.value.right);
182
+ const isRequired = prop.value.right.type === "TSNonNullExpression";
183
+ const propOptions = [];
184
+ if (isRequired) propOptions.push("required: true");
185
+ if (defaultValue) {
186
+ const { value, type, skipFactory } = getTypeAndValue(s, defaultValue);
187
+ if (type) propOptions.push(`type: ${type}`);
188
+ if (value) propOptions.push(`default: ${value}`);
189
+ if (skipFactory) propOptions.push("skipFactory: true");
190
+ }
191
+ if (propOptions.length) props[propName] = `{ ${propOptions.join(", ")} }`;
192
+ else props[propName] = null;
174
193
  }
175
- } });
176
- for (const prop of restructuredProps) if (prop.path.endsWith("props") && !prop.isRest) props[prop.name] = prop.isRequired ? "{ required: true }" : null;
177
- }
178
- for (const { expression, isRequired } of map.defineModel || []) {
179
- const modelOptions = expression.arguments[0]?.type === "ObjectExpression" ? expression.arguments[0] : expression.arguments[1]?.type === "ObjectExpression" ? expression.arguments[1] : void 0;
180
- const options = {};
181
- if (isRequired) options.required = true;
182
- for (const prop of modelOptions?.properties || []) if (prop.type === "ObjectProperty" && prop.key.type === "Identifier" && [
183
- "validator",
184
- "type",
185
- "required"
186
- ].includes(prop.key.name)) options[prop.key.name] = s.sliceNode(prop.value);
187
- const propName = expression.arguments[0]?.type === "StringLiteral" ? expression.arguments[0].value : "modelValue";
188
- props[propName] = Object.keys(options).length ? `{ ${Object.entries(options).map(([key, value]) => `${key}: ${value}`).join(", ")} }` : null;
189
- props[`onUpdate:${propName}`] = null;
190
- props[`${propName === "modelValue" ? "model" : propName}Modifiers`] = null;
194
+ restructure(s, root, {
195
+ skipDefaultProps: true,
196
+ generateRestProps: (restPropsName, index, list) => {
197
+ if (index === list.length - 1) {
198
+ hasRestProp = true;
199
+ const useAttrs = importHelperFn(s, 0, "useAttrs");
200
+ return `const ${restPropsName} = ${useAttrs}()`;
201
+ }
202
+ }
203
+ });
204
+ }
191
205
  }
192
- const propsString = Object.entries(props).map(([key, value]) => `'${key}': ${value}`).join(", ");
206
+ transformDefineModel$1(s, map.defineModel, props);
207
+ const propsString = Object.entries(props).map(([key, value]) => `'${key}': ${value}`).join(", \n");
193
208
  if (propsString) {
194
209
  const argument = map.defineComponent.arguments[1];
195
- if (!argument) s.appendRight(root.end, `, {${hasRestProp ? "inheritAttrs: false," : ""} props: { ${propsString} } }`);
210
+ if (!argument) s.appendRight(root.end, `, {${hasRestProp ? "inheritAttrs: false," : ""} props: {\n${propsString}\n} }`);
196
211
  else if (argument.type === "ObjectExpression") {
197
- prependObjectExpression(argument, "props", `{ ${propsString} }`, s);
212
+ prependObjectExpression(argument, "props", `{\n${propsString}\n}`, s);
198
213
  if (hasRestProp) prependObjectExpression(argument, "inheritAttrs", "false", s);
199
214
  }
200
215
  }
@@ -211,9 +226,70 @@ function getWalkedIds(root, propsName) {
211
226
  const prop = parent.property.type === "Identifier" ? parent.property.name : parent.property.type === "StringLiteral" ? parent.property.value : "";
212
227
  if (prop) walkedIds.add(prop);
213
228
  }
214
- }, false);
229
+ });
215
230
  return walkedIds;
216
231
  }
232
+ function transformDefineModel$1(s, defineModel, props) {
233
+ for (const { expression, isRequired } of defineModel || []) {
234
+ const modelOptions = expression.arguments[0]?.type === "ObjectExpression" ? expression.arguments[0] : expression.arguments[1]?.type === "ObjectExpression" ? expression.arguments[1] : void 0;
235
+ const options = {};
236
+ if (isRequired) options.required = true;
237
+ let defaultValueNode;
238
+ for (const prop of modelOptions?.properties || []) if (prop.type === "ObjectProperty" && prop.key.type === "Identifier" && [
239
+ "validator",
240
+ "type",
241
+ "required",
242
+ "default"
243
+ ].includes(prop.key.name)) {
244
+ if (prop.key.name === "default") defaultValueNode = prop.value;
245
+ options[prop.key.name] = s.sliceNode(prop.value);
246
+ }
247
+ if (defaultValueNode && !options.type) {
248
+ const { value, type, skipFactory } = getTypeAndValue(s, defaultValueNode);
249
+ if (type) options.type = type;
250
+ if (value) options.default = value;
251
+ if (skipFactory) options.skipFactory = "true";
252
+ }
253
+ const propName = expression.arguments[0]?.type === "StringLiteral" ? expression.arguments[0].value : "modelValue";
254
+ props[propName] = Object.keys(options).length ? `{ ${Object.entries(options).map(([key, value]) => `${key}: ${value}`).join(", ")} }` : null;
255
+ props[`onUpdate:${propName}`] = null;
256
+ props[`${propName === "modelValue" ? "model" : propName}Modifiers`] = null;
257
+ }
258
+ }
259
+ function getTypeAndValue(s, node) {
260
+ let value = "";
261
+ let type = "";
262
+ let skipFactory = false;
263
+ if (node.type === "StringLiteral") {
264
+ type = "String";
265
+ value = `'${node.value}'`;
266
+ } else if (node.type === "BooleanLiteral") {
267
+ type = "Boolean";
268
+ value = String(node.value);
269
+ } else if (node.type === "NumericLiteral") {
270
+ type = "Number";
271
+ value = String(node.value);
272
+ } else if (node.type === "ObjectExpression") {
273
+ type = "Object";
274
+ value = `() => (${s.sliceNode(node)})`;
275
+ } else if (node.type === "ArrayExpression") {
276
+ type = "Array";
277
+ value = `() => (${s.sliceNode(node)})`;
278
+ } else if (isFunctionalNode(node)) {
279
+ type = "Function";
280
+ value = s.sliceNode(node);
281
+ } else if (node.type === "Identifier") if (node.name === "undefined") value = "undefined";
282
+ else {
283
+ skipFactory = true;
284
+ value = s.sliceNode(node);
285
+ }
286
+ else if (node.type === "NullLiteral") value = "null";
287
+ return {
288
+ value,
289
+ type,
290
+ skipFactory
291
+ };
292
+ }
217
293
 
218
294
  //#endregion
219
295
  //#region src/core/define-expose.ts
@@ -24,33 +24,28 @@ function restructure(s, node, options = {}) {
24
24
  const propList = [];
25
25
  for (const param of node.params) {
26
26
  const path = `${__vue_macros_common.HELPER_PREFIX}props${index++ || ""}`;
27
- const props = getProps(param, path, s, [], options);
27
+ const props = getProps(s, options, param, path);
28
28
  if (props) {
29
- const hasDefaultValue = props.some((i) => i.defaultValue);
30
29
  s.overwrite(param.start, param.end, path);
31
- propList.push(...hasDefaultValue ? props.map((i) => ({
32
- ...i,
33
- path: i.path.replace(__vue_macros_common.HELPER_PREFIX, `${__vue_macros_common.HELPER_PREFIX}default_`)
34
- })) : props);
30
+ propList.push(...props);
35
31
  }
36
32
  }
37
33
  if (propList.length) {
38
34
  const defaultValues = {};
39
35
  const rests = [];
40
36
  for (const prop of propList) {
37
+ if (prop.isRest) rests.push(prop);
41
38
  if (prop.defaultValue) {
42
- const basePath = prop.path.split(/\.|\[/)[0];
43
- (defaultValues[basePath] ??= []).push(prop);
39
+ const paths = prop.path.split(/\.|\[/);
40
+ if (!options.skipDefaultProps || paths.length !== 1) (defaultValues[paths[0]] ??= []).push(prop);
44
41
  }
45
- if (prop.isRest) rests.push(prop);
46
42
  }
43
+ for (const [index$1, rest] of rests.entries()) prependFunctionalNode(node, s, options.generateRestProps?.(rest.name, index$1, rests) ?? `\nconst ${rest.name} = ${(0, __vue_macros_common.importHelperFn)(s, 0, "createPropsRestProxy")}(${rest.path}, [${rest.value}])`);
47
44
  for (const [path, values] of Object.entries(defaultValues)) {
48
45
  const createPropsDefaultProxy = (0, __vue_macros_common.importHelperFn)(s, 0, "createPropsDefaultProxy", void 0, options.withDefaultsFrom ?? withDefaultsHelperId);
49
- const resolvedPath = path.replace(`${__vue_macros_common.HELPER_PREFIX}default_`, __vue_macros_common.HELPER_PREFIX);
50
46
  const resolvedValues = values.map((i) => `'${i.path.replace(path, "")}${i.value}': ${i.defaultValue}`).join(", ");
51
- prependFunctionalNode(node, s, `\nconst ${path} = ${createPropsDefaultProxy}(${resolvedPath}, {${resolvedValues}})`);
47
+ prependFunctionalNode(node, s, `\n${path} = ${createPropsDefaultProxy}(${path}, {${resolvedValues}})`);
52
48
  }
53
- for (const [index$1, rest] of rests.entries()) prependFunctionalNode(node, s, options.generateRestProps?.(rest.name, index$1, rests) ?? `\nconst ${rest.name} = ${(0, __vue_macros_common.importHelperFn)(s, 0, "createPropsRestProxy")}(${rest.path}, [${rest.value}])`);
54
49
  (0, __vue_compiler_sfc.walkIdentifiers)(node.body, (id, parent) => {
55
50
  const prop = propList.find((i) => i.name === id.name);
56
51
  if (prop && !prop.isRest) s.overwrite(id.start, id.end, `${parent?.type === "ObjectProperty" && parent.shorthand ? `${id.name}: ` : ""}${prop.path}${prop.value}`);
@@ -58,7 +53,7 @@ function restructure(s, node, options = {}) {
58
53
  }
59
54
  return propList;
60
55
  }
61
- function getProps(node, path = "", s, props = [], options) {
56
+ function getProps(s, options, node, path = "", props = []) {
62
57
  const properties = node.type === "ObjectPattern" ? node.properties : node.type === "ArrayPattern" ? node.elements : [];
63
58
  if (!properties.length) return;
64
59
  const propNames = [];
@@ -75,22 +70,25 @@ function getProps(node, path = "", s, props = [], options) {
75
70
  path,
76
71
  name: prop.left.name,
77
72
  value: `[${index}]`,
78
- defaultValue: s.slice(prop.right.start, prop.right.end)
73
+ defaultValue: s.sliceNode(getDefaultValue(prop.right))
79
74
  });
80
75
  propNames.push(`'${prop.left.name}'`);
81
76
  } else if (prop?.type === "ObjectProperty" && prop.key.type === "Identifier") {
82
- if (prop.value.type === "AssignmentPattern" && prop.value.left.type === "Identifier") props.push({
77
+ if (prop.value.type === "AssignmentPattern") if (prop.value.left.type === "Identifier") props.push({
83
78
  path,
84
79
  name: prop.value.left.name,
85
80
  value: `.${prop.key.name}`,
86
- defaultValue: s.slice(prop.value.right.start, prop.value.right.end),
87
- isRequired: prop.value.right.type === "TSNonNullExpression"
88
- });
89
- else if (!getProps(prop.value, `${path}.${prop.key.name}`, s, props, options)) props.push({
90
- path,
91
- name: prop.value.type === "Identifier" ? prop.value.name : prop.key.name,
92
- value: `.${prop.key.name}`
81
+ defaultValue: s.sliceNode(getDefaultValue(prop.value.right))
93
82
  });
83
+ else getProps(s, options, prop.value.left, `${path}.${prop.key.name}`, props);
84
+ else if (!getProps(s, options, prop.value, `${path}.${prop.key.name}`, props)) {
85
+ const name = prop.value.type === "Identifier" ? prop.value.name : prop.key.name;
86
+ props.push({
87
+ path,
88
+ name,
89
+ value: `.${prop.key.name}`
90
+ });
91
+ }
94
92
  propNames.push(`'${prop.key.name}'`);
95
93
  } else if (prop?.type === "RestElement" && prop.argument.type === "Identifier" && !prop.argument.name.startsWith(`${__vue_macros_common.HELPER_PREFIX}props`)) props.push({
96
94
  path,
@@ -98,10 +96,15 @@ function getProps(node, path = "", s, props = [], options) {
98
96
  value: propNames.join(", "),
99
97
  isRest: true
100
98
  });
101
- else if (prop) getProps(prop, `${path}[${index}]`, s, props, options);
99
+ else if (prop) getProps(s, options, prop, `${path}[${index}]`, props);
102
100
  });
103
101
  return props.length ? props : void 0;
104
102
  }
103
+ function getDefaultValue(node) {
104
+ if (node.type === "TSNonNullExpression") return getDefaultValue(node.expression);
105
+ if (node.type === "TSAsExpression") return getDefaultValue(node.expression);
106
+ return node;
107
+ }
105
108
  function prependFunctionalNode(node, s, result) {
106
109
  const isBlockStatement = node.body.type === "BlockStatement";
107
110
  const start = node.body.extra?.parenthesized ? node.body.extra.parenStart : node.body.start;
@@ -166,37 +169,49 @@ function transformDefineComponent(root, propsName, map, s, autoReturnFunction =
166
169
  if (defineComponentName && !["defineComponent", "defineVaporComponent"].includes(defineComponentName)) (0, __vue_macros_common.importHelperFn)(s, 0, "defineComponent", defineComponentName);
167
170
  let hasRestProp = false;
168
171
  const props = {};
169
- if (root.params[0]) if (root.params[0].type === "Identifier") getWalkedIds(root, propsName).forEach((id) => props[id] = null);
170
- else {
171
- const restructuredProps = restructure(s, root, { generateRestProps: (restPropsName, index, list) => {
172
- if (index === list.length - 1) {
173
- hasRestProp = true;
174
- const useAttrs = (0, __vue_macros_common.importHelperFn)(s, 0, "useAttrs");
175
- return `const ${restPropsName} = ${useAttrs}()`;
172
+ if (root.params[0]) {
173
+ if (root.params[0].type === "Identifier") getWalkedIds(root, propsName).forEach((id) => props[id] = null);
174
+ else if (root.params[0].type === "ObjectPattern") {
175
+ const restructuredProps = root.params[0];
176
+ for (const prop of restructuredProps.properties) {
177
+ if (prop.type !== "ObjectProperty" || prop.key.type !== "Identifier") continue;
178
+ const propName = prop.key.name;
179
+ if (prop.value.type !== "AssignmentPattern") {
180
+ props[propName] = null;
181
+ continue;
182
+ }
183
+ const defaultValue = getDefaultValue(prop.value.right);
184
+ const isRequired = prop.value.right.type === "TSNonNullExpression";
185
+ const propOptions = [];
186
+ if (isRequired) propOptions.push("required: true");
187
+ if (defaultValue) {
188
+ const { value, type, skipFactory } = getTypeAndValue(s, defaultValue);
189
+ if (type) propOptions.push(`type: ${type}`);
190
+ if (value) propOptions.push(`default: ${value}`);
191
+ if (skipFactory) propOptions.push("skipFactory: true");
192
+ }
193
+ if (propOptions.length) props[propName] = `{ ${propOptions.join(", ")} }`;
194
+ else props[propName] = null;
176
195
  }
177
- } });
178
- for (const prop of restructuredProps) if (prop.path.endsWith("props") && !prop.isRest) props[prop.name] = prop.isRequired ? "{ required: true }" : null;
179
- }
180
- for (const { expression, isRequired } of map.defineModel || []) {
181
- const modelOptions = expression.arguments[0]?.type === "ObjectExpression" ? expression.arguments[0] : expression.arguments[1]?.type === "ObjectExpression" ? expression.arguments[1] : void 0;
182
- const options = {};
183
- if (isRequired) options.required = true;
184
- for (const prop of modelOptions?.properties || []) if (prop.type === "ObjectProperty" && prop.key.type === "Identifier" && [
185
- "validator",
186
- "type",
187
- "required"
188
- ].includes(prop.key.name)) options[prop.key.name] = s.sliceNode(prop.value);
189
- const propName = expression.arguments[0]?.type === "StringLiteral" ? expression.arguments[0].value : "modelValue";
190
- props[propName] = Object.keys(options).length ? `{ ${Object.entries(options).map(([key, value]) => `${key}: ${value}`).join(", ")} }` : null;
191
- props[`onUpdate:${propName}`] = null;
192
- props[`${propName === "modelValue" ? "model" : propName}Modifiers`] = null;
196
+ restructure(s, root, {
197
+ skipDefaultProps: true,
198
+ generateRestProps: (restPropsName, index, list) => {
199
+ if (index === list.length - 1) {
200
+ hasRestProp = true;
201
+ const useAttrs = (0, __vue_macros_common.importHelperFn)(s, 0, "useAttrs");
202
+ return `const ${restPropsName} = ${useAttrs}()`;
203
+ }
204
+ }
205
+ });
206
+ }
193
207
  }
194
- const propsString = Object.entries(props).map(([key, value]) => `'${key}': ${value}`).join(", ");
208
+ transformDefineModel$1(s, map.defineModel, props);
209
+ const propsString = Object.entries(props).map(([key, value]) => `'${key}': ${value}`).join(", \n");
195
210
  if (propsString) {
196
211
  const argument = map.defineComponent.arguments[1];
197
- if (!argument) s.appendRight(root.end, `, {${hasRestProp ? "inheritAttrs: false," : ""} props: { ${propsString} } }`);
212
+ if (!argument) s.appendRight(root.end, `, {${hasRestProp ? "inheritAttrs: false," : ""} props: {\n${propsString}\n} }`);
198
213
  else if (argument.type === "ObjectExpression") {
199
- prependObjectExpression(argument, "props", `{ ${propsString} }`, s);
214
+ prependObjectExpression(argument, "props", `{\n${propsString}\n}`, s);
200
215
  if (hasRestProp) prependObjectExpression(argument, "inheritAttrs", "false", s);
201
216
  }
202
217
  }
@@ -213,9 +228,70 @@ function getWalkedIds(root, propsName) {
213
228
  const prop = parent.property.type === "Identifier" ? parent.property.name : parent.property.type === "StringLiteral" ? parent.property.value : "";
214
229
  if (prop) walkedIds.add(prop);
215
230
  }
216
- }, false);
231
+ });
217
232
  return walkedIds;
218
233
  }
234
+ function transformDefineModel$1(s, defineModel, props) {
235
+ for (const { expression, isRequired } of defineModel || []) {
236
+ const modelOptions = expression.arguments[0]?.type === "ObjectExpression" ? expression.arguments[0] : expression.arguments[1]?.type === "ObjectExpression" ? expression.arguments[1] : void 0;
237
+ const options = {};
238
+ if (isRequired) options.required = true;
239
+ let defaultValueNode;
240
+ for (const prop of modelOptions?.properties || []) if (prop.type === "ObjectProperty" && prop.key.type === "Identifier" && [
241
+ "validator",
242
+ "type",
243
+ "required",
244
+ "default"
245
+ ].includes(prop.key.name)) {
246
+ if (prop.key.name === "default") defaultValueNode = prop.value;
247
+ options[prop.key.name] = s.sliceNode(prop.value);
248
+ }
249
+ if (defaultValueNode && !options.type) {
250
+ const { value, type, skipFactory } = getTypeAndValue(s, defaultValueNode);
251
+ if (type) options.type = type;
252
+ if (value) options.default = value;
253
+ if (skipFactory) options.skipFactory = "true";
254
+ }
255
+ const propName = expression.arguments[0]?.type === "StringLiteral" ? expression.arguments[0].value : "modelValue";
256
+ props[propName] = Object.keys(options).length ? `{ ${Object.entries(options).map(([key, value]) => `${key}: ${value}`).join(", ")} }` : null;
257
+ props[`onUpdate:${propName}`] = null;
258
+ props[`${propName === "modelValue" ? "model" : propName}Modifiers`] = null;
259
+ }
260
+ }
261
+ function getTypeAndValue(s, node) {
262
+ let value = "";
263
+ let type = "";
264
+ let skipFactory = false;
265
+ if (node.type === "StringLiteral") {
266
+ type = "String";
267
+ value = `'${node.value}'`;
268
+ } else if (node.type === "BooleanLiteral") {
269
+ type = "Boolean";
270
+ value = String(node.value);
271
+ } else if (node.type === "NumericLiteral") {
272
+ type = "Number";
273
+ value = String(node.value);
274
+ } else if (node.type === "ObjectExpression") {
275
+ type = "Object";
276
+ value = `() => (${s.sliceNode(node)})`;
277
+ } else if (node.type === "ArrayExpression") {
278
+ type = "Array";
279
+ value = `() => (${s.sliceNode(node)})`;
280
+ } else if (isFunctionalNode(node)) {
281
+ type = "Function";
282
+ value = s.sliceNode(node);
283
+ } else if (node.type === "Identifier") if (node.name === "undefined") value = "undefined";
284
+ else {
285
+ skipFactory = true;
286
+ value = s.sliceNode(node);
287
+ }
288
+ else if (node.type === "NullLiteral") value = "null";
289
+ return {
290
+ value,
291
+ type,
292
+ skipFactory
293
+ };
294
+ }
219
295
 
220
296
  //#endregion
221
297
  //#region src/core/define-expose.ts
package/dist/esbuild.cjs CHANGED
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, '__esModule', { value: true });
3
- require('./core-B1Tt-ieP.cjs');
4
- require('./raw-3ZelnSQR.cjs');
3
+ require('./core-CdPKEM79.cjs');
4
+ require('./raw-oJpqvj1N.cjs');
5
5
  require('./options-CNIhAQHD.cjs');
6
- const require_src = require('./src-DwQLomPw.cjs');
6
+ const require_src = require('./src-CY9FOMwg.cjs');
7
7
 
8
8
  //#region src/esbuild.ts
9
9
  var esbuild_default = require_src.src_default.esbuild;
package/dist/esbuild.js CHANGED
@@ -1,7 +1,7 @@
1
- import "./core-cHgZBgtA.js";
2
- import "./raw-9SXDNxBH.js";
1
+ import "./core-B_EM_kTA.js";
2
+ import "./raw-9H5vTeLe.js";
3
3
  import "./options-pbSvpKdV.js";
4
- import { src_default } from "./src-BfZoaRPY.js";
4
+ import { src_default } from "./src-CjDaDFw_.js";
5
5
 
6
6
  //#region src/esbuild.ts
7
7
  var esbuild_default = src_default.esbuild;
package/dist/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, '__esModule', { value: true });
2
- require('./core-B1Tt-ieP.cjs');
3
- require('./raw-3ZelnSQR.cjs');
2
+ require('./core-CdPKEM79.cjs');
3
+ require('./raw-oJpqvj1N.cjs');
4
4
  const require_options = require('./options-CNIhAQHD.cjs');
5
- const require_src = require('./src-DwQLomPw.cjs');
5
+ const require_src = require('./src-CY9FOMwg.cjs');
6
6
 
7
7
  exports.default = require_src.src_default
8
8
  exports.resolveOptions = require_options.resolveOptions
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import "./core-cHgZBgtA.js";
2
- import "./raw-9SXDNxBH.js";
1
+ import "./core-B_EM_kTA.js";
2
+ import "./raw-9H5vTeLe.js";
3
3
  import { resolveOptions } from "./options-pbSvpKdV.js";
4
- import { src_default } from "./src-BfZoaRPY.js";
4
+ import { src_default } from "./src-CjDaDFw_.js";
5
5
 
6
6
  export { src_default as default, resolveOptions };
package/dist/nuxt.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, '__esModule', { value: true });
3
3
  const require_chunk = require('./chunk-BCwAaXi7.cjs');
4
- require('./core-B1Tt-ieP.cjs');
5
- require('./raw-3ZelnSQR.cjs');
4
+ require('./core-CdPKEM79.cjs');
5
+ require('./raw-oJpqvj1N.cjs');
6
6
  require('./options-CNIhAQHD.cjs');
7
- require('./src-DwQLomPw.cjs');
8
- const require_vite = require('./vite-C5QxH0B9.cjs');
9
- const require_webpack = require('./webpack-B-EPKx0G.cjs');
7
+ require('./src-CY9FOMwg.cjs');
8
+ const require_vite = require('./vite-CtRiheet.cjs');
9
+ const require_webpack = require('./webpack-YO7qm0E9.cjs');
10
10
  const __nuxt_kit = require_chunk.__toESM(require("@nuxt/kit"));
11
11
  require("@nuxt/schema");
12
12
 
package/dist/nuxt.js CHANGED
@@ -1,9 +1,9 @@
1
- import "./core-cHgZBgtA.js";
2
- import "./raw-9SXDNxBH.js";
1
+ import "./core-B_EM_kTA.js";
2
+ import "./raw-9H5vTeLe.js";
3
3
  import "./options-pbSvpKdV.js";
4
- import "./src-BfZoaRPY.js";
5
- import { vite_default } from "./vite-DPLCEtsm.js";
6
- import { webpack_default } from "./webpack-1cYmRdvx.js";
4
+ import "./src-CjDaDFw_.js";
5
+ import { vite_default } from "./vite-HbXTfQl_.js";
6
+ import { webpack_default } from "./webpack-5inEmXrh.js";
7
7
  import { addVitePlugin, addWebpackPlugin, defineNuxtModule } from "@nuxt/kit";
8
8
  import "@nuxt/schema";
9
9
 
@@ -1,4 +1,4 @@
1
- import { helperPrefix, transformJsxMacros, useModelHelperId, use_model_default, withDefaultsHelperId, with_defaults_default } from "./core-cHgZBgtA.js";
1
+ import { helperPrefix, transformJsxMacros, useModelHelperId, use_model_default, withDefaultsHelperId, with_defaults_default } from "./core-B_EM_kTA.js";
2
2
  import { resolveOptions } from "./options-pbSvpKdV.js";
3
3
  import { createFilter, normalizePath } from "@vue-macros/common";
4
4
  import { compileStyleAsync } from "@vue/compiler-sfc";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const require_chunk = require('./chunk-BCwAaXi7.cjs');
3
- const require_core = require('./core-B1Tt-ieP.cjs');
3
+ const require_core = require('./core-CdPKEM79.cjs');
4
4
  const require_options = require('./options-CNIhAQHD.cjs');
5
5
  const __vue_macros_common = require_chunk.__toESM(require("@vue-macros/common"));
6
6
  const __vue_compiler_sfc = require_chunk.__toESM(require("@vue/compiler-sfc"));
package/dist/raw.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, '__esModule', { value: true });
2
- require('./core-B1Tt-ieP.cjs');
3
- const require_raw = require('./raw-3ZelnSQR.cjs');
2
+ require('./core-CdPKEM79.cjs');
3
+ const require_raw = require('./raw-oJpqvj1N.cjs');
4
4
  require('./options-CNIhAQHD.cjs');
5
5
 
6
6
  exports.default = require_raw.raw_default
package/dist/raw.js CHANGED
@@ -1,5 +1,5 @@
1
- import "./core-cHgZBgtA.js";
2
- import { raw_default } from "./raw-9SXDNxBH.js";
1
+ import "./core-B_EM_kTA.js";
2
+ import { raw_default } from "./raw-9H5vTeLe.js";
3
3
  import "./options-pbSvpKdV.js";
4
4
 
5
5
  export { raw_default as default };
package/dist/rolldown.cjs CHANGED
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, '__esModule', { value: true });
3
- require('./core-B1Tt-ieP.cjs');
4
- require('./raw-3ZelnSQR.cjs');
3
+ require('./core-CdPKEM79.cjs');
4
+ require('./raw-oJpqvj1N.cjs');
5
5
  require('./options-CNIhAQHD.cjs');
6
- const require_src = require('./src-DwQLomPw.cjs');
6
+ const require_src = require('./src-CY9FOMwg.cjs');
7
7
 
8
8
  //#region src/rolldown.ts
9
9
  var rolldown_default = require_src.src_default.rolldown;
package/dist/rolldown.js CHANGED
@@ -1,7 +1,7 @@
1
- import "./core-cHgZBgtA.js";
2
- import "./raw-9SXDNxBH.js";
1
+ import "./core-B_EM_kTA.js";
2
+ import "./raw-9H5vTeLe.js";
3
3
  import "./options-pbSvpKdV.js";
4
- import { src_default } from "./src-BfZoaRPY.js";
4
+ import { src_default } from "./src-CjDaDFw_.js";
5
5
 
6
6
  //#region src/rolldown.ts
7
7
  var rolldown_default = src_default.rolldown;
package/dist/rollup.cjs CHANGED
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, '__esModule', { value: true });
3
- require('./core-B1Tt-ieP.cjs');
4
- require('./raw-3ZelnSQR.cjs');
3
+ require('./core-CdPKEM79.cjs');
4
+ require('./raw-oJpqvj1N.cjs');
5
5
  require('./options-CNIhAQHD.cjs');
6
- const require_src = require('./src-DwQLomPw.cjs');
6
+ const require_src = require('./src-CY9FOMwg.cjs');
7
7
 
8
8
  //#region src/rollup.ts
9
9
  var rollup_default = require_src.src_default.rollup;
package/dist/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
- import "./core-cHgZBgtA.js";
2
- import "./raw-9SXDNxBH.js";
1
+ import "./core-B_EM_kTA.js";
2
+ import "./raw-9H5vTeLe.js";
3
3
  import "./options-pbSvpKdV.js";
4
- import { src_default } from "./src-BfZoaRPY.js";
4
+ import { src_default } from "./src-CjDaDFw_.js";
5
5
 
6
6
  //#region src/rollup.ts
7
7
  var rollup_default = src_default.rollup;
package/dist/rspack.cjs CHANGED
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, '__esModule', { value: true });
3
- require('./core-B1Tt-ieP.cjs');
4
- require('./raw-3ZelnSQR.cjs');
3
+ require('./core-CdPKEM79.cjs');
4
+ require('./raw-oJpqvj1N.cjs');
5
5
  require('./options-CNIhAQHD.cjs');
6
- const require_src = require('./src-DwQLomPw.cjs');
6
+ const require_src = require('./src-CY9FOMwg.cjs');
7
7
 
8
8
  //#region src/rspack.ts
9
9
  var rspack_default = require_src.src_default.rspack;
package/dist/rspack.js CHANGED
@@ -1,7 +1,7 @@
1
- import "./core-cHgZBgtA.js";
2
- import "./raw-9SXDNxBH.js";
1
+ import "./core-B_EM_kTA.js";
2
+ import "./raw-9H5vTeLe.js";
3
3
  import "./options-pbSvpKdV.js";
4
- import { src_default } from "./src-BfZoaRPY.js";
4
+ import { src_default } from "./src-CjDaDFw_.js";
5
5
 
6
6
  //#region src/rspack.ts
7
7
  var rspack_default = src_default.rspack;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const require_chunk = require('./chunk-BCwAaXi7.cjs');
3
- const require_raw = require('./raw-3ZelnSQR.cjs');
3
+ const require_raw = require('./raw-oJpqvj1N.cjs');
4
4
  const unplugin = require_chunk.__toESM(require("unplugin"));
5
5
 
6
6
  //#region src/index.ts
@@ -1,4 +1,4 @@
1
- import { raw_default } from "./raw-9SXDNxBH.js";
1
+ import { raw_default } from "./raw-9H5vTeLe.js";
2
2
  import { createUnplugin } from "unplugin";
3
3
 
4
4
  //#region src/index.ts
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const require_src = require('./src-DwQLomPw.cjs');
2
+ const require_src = require('./src-CY9FOMwg.cjs');
3
3
 
4
4
  //#region src/vite.ts
5
5
  var vite_default = require_src.src_default.vite;
@@ -1,4 +1,4 @@
1
- import { src_default } from "./src-BfZoaRPY.js";
1
+ import { src_default } from "./src-CjDaDFw_.js";
2
2
 
3
3
  //#region src/vite.ts
4
4
  var vite_default = src_default.vite;
package/dist/vite.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, '__esModule', { value: true });
2
- require('./core-B1Tt-ieP.cjs');
3
- require('./raw-3ZelnSQR.cjs');
2
+ require('./core-CdPKEM79.cjs');
3
+ require('./raw-oJpqvj1N.cjs');
4
4
  require('./options-CNIhAQHD.cjs');
5
- require('./src-DwQLomPw.cjs');
6
- const require_vite = require('./vite-C5QxH0B9.cjs');
5
+ require('./src-CY9FOMwg.cjs');
6
+ const require_vite = require('./vite-CtRiheet.cjs');
7
7
 
8
8
  exports.default = require_vite.vite_default
package/dist/vite.js CHANGED
@@ -1,7 +1,7 @@
1
- import "./core-cHgZBgtA.js";
2
- import "./raw-9SXDNxBH.js";
1
+ import "./core-B_EM_kTA.js";
2
+ import "./raw-9H5vTeLe.js";
3
3
  import "./options-pbSvpKdV.js";
4
- import "./src-BfZoaRPY.js";
5
- import { vite_default } from "./vite-DPLCEtsm.js";
4
+ import "./src-CjDaDFw_.js";
5
+ import { vite_default } from "./vite-HbXTfQl_.js";
6
6
 
7
7
  export { vite_default as default };
@@ -1,4 +1,4 @@
1
- import { src_default } from "./src-BfZoaRPY.js";
1
+ import { src_default } from "./src-CjDaDFw_.js";
2
2
 
3
3
  //#region src/webpack.ts
4
4
  var webpack_default = src_default.webpack;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const require_src = require('./src-DwQLomPw.cjs');
2
+ const require_src = require('./src-CY9FOMwg.cjs');
3
3
 
4
4
  //#region src/webpack.ts
5
5
  var webpack_default = require_src.src_default.webpack;
package/dist/webpack.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, '__esModule', { value: true });
2
- require('./core-B1Tt-ieP.cjs');
3
- require('./raw-3ZelnSQR.cjs');
2
+ require('./core-CdPKEM79.cjs');
3
+ require('./raw-oJpqvj1N.cjs');
4
4
  require('./options-CNIhAQHD.cjs');
5
- require('./src-DwQLomPw.cjs');
6
- const require_webpack = require('./webpack-B-EPKx0G.cjs');
5
+ require('./src-CY9FOMwg.cjs');
6
+ const require_webpack = require('./webpack-YO7qm0E9.cjs');
7
7
 
8
8
  exports.default = require_webpack.webpack_default
package/dist/webpack.js CHANGED
@@ -1,7 +1,7 @@
1
- import "./core-cHgZBgtA.js";
2
- import "./raw-9SXDNxBH.js";
1
+ import "./core-B_EM_kTA.js";
2
+ import "./raw-9H5vTeLe.js";
3
3
  import "./options-pbSvpKdV.js";
4
- import "./src-BfZoaRPY.js";
5
- import { webpack_default } from "./webpack-1cYmRdvx.js";
4
+ import "./src-CjDaDFw_.js";
5
+ import { webpack_default } from "./webpack-5inEmXrh.js";
6
6
 
7
7
  export { webpack_default as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue-jsx-vapor/macros",
3
- "version": "2.3.2",
3
+ "version": "2.3.3",
4
4
  "description": "Macros for Vue JSX Vapor",
5
5
  "type": "module",
6
6
  "keywords": [