Skip to content

Commit 97ea214

Browse files
committed
fix: no default value for propsDestructure
1 parent afd956e commit 97ea214

File tree

3 files changed

+119
-170
lines changed

3 files changed

+119
-170
lines changed

src/core/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ function resolveOptions(rawOptions: Options): ResolvedOptions {
173173
optionsAPI: true,
174174
prodDevtools: false,
175175
prodHydrationMismatchDetails: false,
176-
propsDestructure: false,
177176
...rawOptions.features,
178177
customElement:
179178
(rawOptions.features?.customElement || rawOptions.customElement) ??

tests/__snapshots__/esbuild.test.ts.snap

Lines changed: 60 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,16 @@ var export_helper_default = (sfc, props) => {
1616
// tests/fixtures/basic.vue
1717
console.log("Hello world");
1818
var _sfc_main = {};
19-
var _hoisted_1 = /* @__PURE__ */ _createElementVNode(
20-
"h1",
21-
null,
22-
"Hello World",
23-
-1
24-
/* HOISTED */
25-
);
26-
var _hoisted_2 = [
27-
_hoisted_1
28-
];
2919
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
30-
return _openBlock(), _createElementBlock("div", null, [..._hoisted_2]);
20+
return _openBlock(), _createElementBlock("div", null, _cache[0] || (_cache[0] = [
21+
_createElementVNode(
22+
"h1",
23+
null,
24+
"Hello World",
25+
-1
26+
/* HOISTED */
27+
)
28+
]));
3129
}
3230
var basic_default = /* @__PURE__ */ export_helper_default(_sfc_main, [["render", _sfc_render], ["__file", "#FILE#"]]);
3331
export {
@@ -54,18 +52,16 @@ var export_helper_default = (sfc, props) => {
5452
// tests/fixtures/basic.vue
5553
console.log("Hello world");
5654
var _sfc_main = {};
57-
var _hoisted_1 = /* @__PURE__ */ _createElementVNode(
58-
"h1",
59-
null,
60-
"Hello World",
61-
-1
62-
/* HOISTED */
63-
);
64-
var _hoisted_2 = [
65-
_hoisted_1
66-
];
6755
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
68-
return _openBlock(), _createElementBlock("div", null, _hoisted_2);
56+
return _openBlock(), _createElementBlock("div", null, _cache[0] || (_cache[0] = [
57+
_createElementVNode(
58+
"h1",
59+
null,
60+
"Hello World",
61+
-1
62+
/* HOISTED */
63+
)
64+
]));
6965
}
7066
var basic_default = /* @__PURE__ */ export_helper_default(_sfc_main, [["render", _sfc_render]]);
7167
export {
@@ -191,18 +187,16 @@ var _sfc_main = {
191187
return __returned__;
192188
}
193189
};
194-
var _hoisted_1 = /* @__PURE__ */ _createElementVNode(
195-
"h1",
196-
null,
197-
"Hello World",
198-
-1
199-
/* HOISTED */
200-
);
201-
var _hoisted_2 = [
202-
_hoisted_1
203-
];
204190
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
205-
return _openBlock(), _createElementBlock("div", null, [..._hoisted_2]);
191+
return _openBlock(), _createElementBlock("div", null, _cache[0] || (_cache[0] = [
192+
_createElementVNode(
193+
"h1",
194+
null,
195+
"Hello World",
196+
-1
197+
/* HOISTED */
198+
)
199+
]));
206200
}
207201
var script_setup_default = /* @__PURE__ */ export_helper_default(_sfc_main, [["render", _sfc_render], ["__file", "#FILE#"]]);
208202
export {
@@ -216,21 +210,19 @@ exports[`esbuild > tests/fixtures/script-setup.vue > isProduction = false 2`] =
216210
exports[`esbuild > tests/fixtures/script-setup.vue > isProduction = true 1`] = `
217211
"// tests/fixtures/script-setup.vue
218212
import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
219-
var _hoisted_1 = /* @__PURE__ */ _createElementVNode(
220-
"h1",
221-
null,
222-
"Hello World",
223-
-1
224-
/* HOISTED */
225-
);
226-
var _hoisted_2 = [
227-
_hoisted_1
228-
];
229213
var _sfc_main = {
230214
__name: "script-setup",
231215
setup(__props) {
232216
return (_ctx, _cache) => {
233-
return _openBlock(), _createElementBlock("div", null, _hoisted_2);
217+
return _openBlock(), _createElementBlock("div", null, _cache[0] || (_cache[0] = [
218+
_createElementVNode(
219+
"h1",
220+
null,
221+
"Hello World",
222+
-1
223+
/* HOISTED */
224+
)
225+
]));
234226
};
235227
}
236228
};
@@ -262,16 +254,11 @@ var str = "bar";
262254
var _sfc_main = /* @__PURE__ */ _defineComponent({
263255
__name: "script-setup-ts",
264256
props: {
265-
foo: { type: String, required: true },
266-
bar: { type: Number, required: true },
267-
baz: { type: Boolean, required: true }
257+
foo: { type: String, required: true, default: "123" },
258+
bar: { type: Number, required: true, default: 123 },
259+
baz: { type: Boolean, required: true, default: true }
268260
},
269261
setup(__props, { expose: __expose }) {
270-
const {
271-
foo = "123",
272-
bar = 123,
273-
baz = true
274-
} = __props;
275262
__expose({
276263
str
277264
});
@@ -280,18 +267,16 @@ var _sfc_main = /* @__PURE__ */ _defineComponent({
280267
return __returned__;
281268
}
282269
});
283-
var _hoisted_1 = /* @__PURE__ */ _createElementVNode(
284-
"h1",
285-
null,
286-
"Hello World",
287-
-1
288-
/* HOISTED */
289-
);
290-
var _hoisted_2 = [
291-
_hoisted_1
292-
];
293270
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
294-
return _openBlock(), _createElementBlock("div", null, [..._hoisted_2]);
271+
return _openBlock(), _createElementBlock("div", null, _cache[0] || (_cache[0] = [
272+
_createElementVNode(
273+
"h1",
274+
null,
275+
"Hello World",
276+
-1
277+
/* HOISTED */
278+
)
279+
]));
295280
}
296281
var script_setup_ts_default = /* @__PURE__ */ export_helper_default(_sfc_main, [["render", _sfc_render], ["__file", "#FILE#"]]);
297282
export {
@@ -306,35 +291,28 @@ exports[`esbuild > tests/fixtures/script-setup-ts.vue > isProduction = true 1`]
306291
"// tests/fixtures/script-setup-ts.vue
307292
import { defineComponent as _defineComponent } from "vue";
308293
import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
309-
var _hoisted_1 = /* @__PURE__ */ _createElementVNode(
310-
"h1",
311-
null,
312-
"Hello World",
313-
-1
314-
/* HOISTED */
315-
);
316-
var _hoisted_2 = [
317-
_hoisted_1
318-
];
319294
var str = "bar";
320295
var _sfc_main = /* @__PURE__ */ _defineComponent({
321296
__name: "script-setup-ts",
322297
props: {
323-
foo: {},
324-
bar: {},
325-
baz: { type: Boolean }
298+
foo: { default: "123" },
299+
bar: { default: 123 },
300+
baz: { type: Boolean, default: true }
326301
},
327302
setup(__props, { expose: __expose }) {
328-
const {
329-
foo = "123",
330-
bar = 123,
331-
baz = true
332-
} = __props;
333303
__expose({
334304
str
335305
});
336306
return (_ctx, _cache) => {
337-
return _openBlock(), _createElementBlock("div", null, _hoisted_2);
307+
return _openBlock(), _createElementBlock("div", null, _cache[0] || (_cache[0] = [
308+
_createElementVNode(
309+
"h1",
310+
null,
311+
"Hello World",
312+
-1
313+
/* HOISTED */
314+
)
315+
]));
338316
};
339317
}
340318
});

0 commit comments

Comments
 (0)