zova-cli-set-front 1.1.180 → 1.1.181
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.
|
@@ -7,6 +7,7 @@ module.exports = {
|
|
|
7
7
|
ast = ast
|
|
8
8
|
.replace('<script setup lang="ts">', '<script setup lang="ts" generic="T">')
|
|
9
9
|
.replace('defineProps<Props>', 'defineProps<Props<T>>')
|
|
10
|
+
.replace('PartialSome<Props', 'PartialSome<Props<T>')
|
|
10
11
|
.replace('defineEmits<Emits>', 'defineEmits<Emits<T>>');
|
|
11
12
|
// ok
|
|
12
13
|
return ast;
|
|
@@ -8,7 +8,7 @@ module.exports = {
|
|
|
8
8
|
if (ast.includes(`e: '${eventName}'`)) throw new Error('Model exists');
|
|
9
9
|
// Props
|
|
10
10
|
ast = ast.replace(/export interface Props([^\{]*) \{/, $0 => {
|
|
11
|
-
return `${$0}\n ${modelName}
|
|
11
|
+
return `${$0}\n ${modelName}: number;`;
|
|
12
12
|
});
|
|
13
13
|
// Emits
|
|
14
14
|
ast = ast.replace(/export type Emits([^\{]*) = \{/, $0 => {
|
|
@@ -23,7 +23,7 @@ module.exports = {
|
|
|
23
23
|
return `${localName}: number;\n\n ${$0}`;
|
|
24
24
|
});
|
|
25
25
|
ast = ast.replace(/protected async __init__([^\{]*) \{/, $0 => {
|
|
26
|
-
return `${$0}\n this.${localName} = this.$useModel(${modelName === 'modelValue' ? '' : `'${modelName}'`})
|
|
26
|
+
return `${$0}\n this.${localName} = this.$useModel(${modelName === 'modelValue' ? '' : `'${modelName}'`});`;
|
|
27
27
|
});
|
|
28
28
|
// ok
|
|
29
29
|
return ast;
|
|
@@ -10,13 +10,17 @@ module.exports = {
|
|
|
10
10
|
const matchController = ast.match(/import \{ (Controller[^, ]*)/);
|
|
11
11
|
const className = matchController[1];
|
|
12
12
|
ast = ast
|
|
13
|
+
.replace(', useController', ', PartialSome, useController')
|
|
14
|
+
.replace('{ useController', '{ PartialSome, useController')
|
|
13
15
|
.replace(', PropsBase', '')
|
|
14
16
|
.replace(/import \{ ([^\}]*) \} from '.\/controller.js';/, (_, $1) => {
|
|
15
17
|
return `import { ${$1}, Props } from './controller.js';`;
|
|
16
18
|
})
|
|
17
19
|
.replace(
|
|
18
20
|
/const props = [^;]*;/,
|
|
19
|
-
`const props = withDefaults(
|
|
21
|
+
`const props = withDefaults(
|
|
22
|
+
defineProps<PartialSome<Props${genericT}, keyof typeof ${className}.$propsDefault>>(),
|
|
23
|
+
${className}.$propsDefault);`,
|
|
20
24
|
);
|
|
21
25
|
// ok
|
|
22
26
|
return ast;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zova-cli-set-front",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.181",
|
|
4
4
|
"description": "zova cli-set-front",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"zova-shared": "^1.0.4",
|
|
49
49
|
"zova-vite": "^1.0.176"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "217980580472e623b09c2a69059a1827c17d09ab"
|
|
52
52
|
}
|