@kosdev-code/kos-codegen-core 0.1.0-next.871 → 0.1.0-next.888
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/index.d.ts +2 -2
- package/index.d.ts.map +1 -1
- package/index.js +854 -335
- package/index.js.map +1 -1
- package/index.mjs +855 -336
- package/index.mjs.map +1 -1
- package/lib/generators/add-container-support/generate-add-container-support.d.ts +14 -0
- package/lib/generators/add-container-support/generate-add-container-support.d.ts.map +1 -1
- package/lib/generators/add-parent-aware/generate-add-parent-aware.d.ts +15 -0
- package/lib/generators/add-parent-aware/generate-add-parent-aware.d.ts.map +1 -0
- package/lib/generators/add-parent-aware/index.d.ts +2 -0
- package/lib/generators/add-parent-aware/index.d.ts.map +1 -0
- package/lib/generators/augment/find-model-declaration.d.ts +11 -0
- package/lib/generators/augment/find-model-declaration.d.ts.map +1 -0
- package/lib/generators/augment/resolve-child-model.d.ts +16 -0
- package/lib/generators/augment/resolve-child-model.d.ts.map +1 -0
- package/lib/generators/augment/resolve-model-file.d.ts.map +1 -1
- package/lib/generators/augment/ts-toolkit.d.ts +19 -1
- package/lib/generators/augment/ts-toolkit.d.ts.map +1 -1
- package/lib/generators/generate-container-model.d.ts +7 -0
- package/lib/generators/generate-container-model.d.ts.map +1 -1
- package/lib/generators/generate-model-project.d.ts +36 -0
- package/lib/generators/generate-model-project.d.ts.map +1 -0
- package/lib/generators/generate-view-model.d.ts +35 -0
- package/lib/generators/generate-view-model.d.ts.map +1 -0
- package/lib/generators/index.d.ts +21 -16
- package/lib/generators/index.d.ts.map +1 -1
- package/lib/generators/member-mutators/add-child.d.ts +10 -2
- package/lib/generators/member-mutators/add-child.d.ts.map +1 -1
- package/lib/generators/registration/upsert-chain-entry.d.ts +13 -0
- package/lib/generators/registration/upsert-chain-entry.d.ts.map +1 -0
- package/package.json +2 -2
- package/templates/kos-container-model/model/types/index.d.ts.template +2 -2
- package/templates/kos-model-project/project/.eslintrc.json.template +33 -0
- package/templates/kos-model-project/project/.kos.json.template +14 -0
- package/templates/kos-model-project/project/README.md.template +7 -0
- package/templates/kos-model-project/project/package.json.template +9 -0
- package/templates/kos-model-project/project/project.json.template +35 -0
- package/templates/kos-model-project/project/src/index.ts.template +1 -0
- package/templates/kos-model-project/project/src/lib/__projectName__.ts.template +3 -0
- package/templates/kos-model-project/project/tsconfig.json.template +20 -0
- package/templates/kos-model-project/project/tsconfig.lib.json.template +10 -0
- package/templates/kos-model-project/project/vite.config.ts.template +47 -0
- package/templates/kos-view-model/__nameDashCase__-view-model.ts.template +30 -0
- package/templates/kos-view-model/index.ts.template +1 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/// <reference types='vitest' />
|
|
2
|
+
import { defineConfig } from 'vite';
|
|
3
|
+
import dts from 'vite-plugin-dts';
|
|
4
|
+
import * as path from 'path';
|
|
5
|
+
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
|
|
6
|
+
import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin';
|
|
7
|
+
|
|
8
|
+
export default defineConfig(() => ({
|
|
9
|
+
root: __dirname,
|
|
10
|
+
cacheDir: '<%= offsetFromRoot %>node_modules/.vite/<%= projectRoot %>',
|
|
11
|
+
plugins: [
|
|
12
|
+
nxViteTsPaths(),
|
|
13
|
+
nxCopyAssetsPlugin(['*.md']),
|
|
14
|
+
dts({
|
|
15
|
+
entryRoot: 'src',
|
|
16
|
+
tsconfigPath: path.join(__dirname, 'tsconfig.lib.json'),
|
|
17
|
+
pathsToAliases: false,
|
|
18
|
+
}),
|
|
19
|
+
],
|
|
20
|
+
// Uncomment this if you are using workers.
|
|
21
|
+
// worker: {
|
|
22
|
+
// plugins: [ nxViteTsPaths() ],
|
|
23
|
+
// },
|
|
24
|
+
// Configuration for building your library.
|
|
25
|
+
// See: https://vitejs.dev/guide/build.html#library-mode
|
|
26
|
+
build: {
|
|
27
|
+
outDir: '<%= offsetFromRoot %>dist/<%= projectRoot %>',
|
|
28
|
+
emptyOutDir: true,
|
|
29
|
+
reportCompressedSize: true,
|
|
30
|
+
commonjsOptions: {
|
|
31
|
+
transformMixedEsModules: true,
|
|
32
|
+
},
|
|
33
|
+
lib: {
|
|
34
|
+
// Could also be a dictionary or array of multiple entry points.
|
|
35
|
+
entry: 'src/index.ts',
|
|
36
|
+
name: '<%= projectName %>',
|
|
37
|
+
fileName: 'index',
|
|
38
|
+
// Change this to the formats you want to support.
|
|
39
|
+
// Don't forget to update your package.json as well.
|
|
40
|
+
formats: ['es' as const],
|
|
41
|
+
},
|
|
42
|
+
rollupOptions: {
|
|
43
|
+
// External packages that should not be bundled into your library.
|
|
44
|
+
external: [],
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
}));
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UI-only state for the <%= nameProperCase %> view, held <% if (constructorParams.length) { %>beside the KOS data models it
|
|
3
|
+
* reads rather than inside them<% } else { %>outside the KOS data models<% } %>. A ViewModel is not registered and is
|
|
4
|
+
* not part of the model graph; create one per component with
|
|
5
|
+
* `useViewModel(() => new <%= nameProperCase %>ViewModel(<%= constructorArgs %>))`.
|
|
6
|
+
*/
|
|
7
|
+
<% if (internal) { %>import {
|
|
8
|
+
kosViewModel,
|
|
9
|
+
kosLoggerAware,
|
|
10
|
+
type KosViewModelLoggerAware,
|
|
11
|
+
} from "../../../core/core/decorators";
|
|
12
|
+
<% } else { %>import {
|
|
13
|
+
kosViewModel,
|
|
14
|
+
kosLoggerAware,
|
|
15
|
+
type KosViewModelLoggerAware,
|
|
16
|
+
} from "@kosdev-code/kos-ui-sdk";
|
|
17
|
+
<% } %><% modelImports.forEach(function (imp) { %>import type { <%= imp.types.join(", ") %> } from "<%= imp.module %>";
|
|
18
|
+
<% }); %>
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
|
|
20
|
+
export interface <%= nameProperCase %>ViewModel extends KosViewModelLoggerAware {}
|
|
21
|
+
|
|
22
|
+
@kosViewModel({ typeId: "<%= typeId %>"<% if (devToolsEnabled) { %>, devToolsEnabled: true<% } %> })
|
|
23
|
+
@kosLoggerAware()
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
|
|
25
|
+
export class <%= nameProperCase %>ViewModel {
|
|
26
|
+
<% if (constructorParams.length === 0) { %> constructor() {}
|
|
27
|
+
<% } else { %> constructor(
|
|
28
|
+
<% constructorParams.forEach(function (param, index) { %> private readonly <%= param.name %>: <%= param.type %><% if (index < constructorParams.length - 1) { %>,<% } %>
|
|
29
|
+
<% }); %> ) {}
|
|
30
|
+
<% } %>}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { <%= nameProperCase %>ViewModel } from "./<%= nameDashCase %>-view-model";
|