@iyio/protogen-runtime 0.0.9 → 0.0.10
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/esm/src/lib/default-plugins.js +7 -0
- package/esm/src/lib/default-plugins.js.map +1 -1
- package/esm/src/lib/plugins/bucketPlugin.js +2 -3
- package/esm/src/lib/plugins/bucketPlugin.js.map +1 -1
- package/esm/src/lib/plugins/fileWriter.js +23 -10
- package/esm/src/lib/plugins/fileWriter.js.map +1 -1
- package/esm/src/lib/plugins/functionPlugin.js +1 -2
- package/esm/src/lib/plugins/functionPlugin.js.map +1 -1
- package/esm/src/lib/plugins/nextJsAppPlugin.d.ts +26 -0
- package/esm/src/lib/plugins/nextJsAppPlugin.js +79 -0
- package/esm/src/lib/plugins/nextJsAppPlugin.js.map +1 -0
- package/esm/src/lib/plugins/nextJsAppTemplate.d.ts +13 -0
- package/esm/src/lib/plugins/nextJsAppTemplate.js +304 -0
- package/esm/src/lib/plugins/nextJsAppTemplate.js.map +1 -0
- package/esm/src/lib/plugins/paramPlugin.js +1 -2
- package/esm/src/lib/plugins/paramPlugin.js.map +1 -1
- package/esm/src/lib/plugins/reactCompPlugin.js +1 -2
- package/esm/src/lib/plugins/reactCompPlugin.js.map +1 -1
- package/esm/src/lib/plugins/serverFnPlugin.js +27 -19
- package/esm/src/lib/plugins/serverFnPlugin.js.map +1 -1
- package/esm/src/lib/plugins/siteCdkTemplate.d.ts +2 -0
- package/esm/src/lib/plugins/siteCdkTemplate.js +27 -0
- package/esm/src/lib/plugins/siteCdkTemplate.js.map +1 -0
- package/esm/src/lib/plugins/tablePlugin.js +2 -3
- package/esm/src/lib/plugins/tablePlugin.js.map +1 -1
- package/esm/src/lib/plugins/userPoolPlugin.js +2 -3
- package/esm/src/lib/plugins/userPoolPlugin.js.map +1 -1
- package/package.json +10 -6
- package/src/lib/default-plugins.js +7 -0
- package/src/lib/default-plugins.js.map +1 -1
- package/src/lib/plugins/bucketPlugin.js +1 -2
- package/src/lib/plugins/bucketPlugin.js.map +1 -1
- package/src/lib/plugins/fileWriter.js +23 -10
- package/src/lib/plugins/fileWriter.js.map +1 -1
- package/src/lib/plugins/functionPlugin.js +0 -1
- package/src/lib/plugins/functionPlugin.js.map +1 -1
- package/src/lib/plugins/nextJsAppPlugin.d.ts +26 -0
- package/src/lib/plugins/nextJsAppPlugin.js +82 -0
- package/src/lib/plugins/nextJsAppPlugin.js.map +1 -0
- package/src/lib/plugins/nextJsAppTemplate.d.ts +13 -0
- package/src/lib/plugins/nextJsAppTemplate.js +308 -0
- package/src/lib/plugins/nextJsAppTemplate.js.map +1 -0
- package/src/lib/plugins/paramPlugin.js +0 -1
- package/src/lib/plugins/paramPlugin.js.map +1 -1
- package/src/lib/plugins/reactCompPlugin.js +0 -1
- package/src/lib/plugins/reactCompPlugin.js.map +1 -1
- package/src/lib/plugins/serverFnPlugin.js +26 -18
- package/src/lib/plugins/serverFnPlugin.js.map +1 -1
- package/src/lib/plugins/siteCdkTemplate.d.ts +2 -0
- package/src/lib/plugins/siteCdkTemplate.js +31 -0
- package/src/lib/plugins/siteCdkTemplate.js.map +1 -0
- package/src/lib/plugins/tablePlugin.js +1 -2
- package/src/lib/plugins/tablePlugin.js.map +1 -1
- package/src/lib/plugins/userPoolPlugin.js +1 -2
- package/src/lib/plugins/userPoolPlugin.js.map +1 -1
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.nextJsAppPlugin = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@iyio/common");
|
|
6
|
+
const zod_1 = require("zod");
|
|
7
|
+
const nextJsAppTemplate_1 = require("./nextJsAppTemplate");
|
|
8
|
+
const siteCdkTemplate_1 = require("./siteCdkTemplate");
|
|
9
|
+
const supportedTypes = ['nextApp'];
|
|
10
|
+
const NextJsPluginConfig = zod_1.z.object({
|
|
11
|
+
/**
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
nextJsAppOverrideTemplateFiles: zod_1.z.boolean().optional(),
|
|
15
|
+
/**
|
|
16
|
+
* If defined a CDK construct file will be generated that can be used to deploy next apps
|
|
17
|
+
*/
|
|
18
|
+
nextJsAppCdkConstructFile: zod_1.z.string().optional(),
|
|
19
|
+
/**
|
|
20
|
+
* @default "Apps"
|
|
21
|
+
*/
|
|
22
|
+
nextJsAppCdkConstructClassName: zod_1.z.string().optional(),
|
|
23
|
+
});
|
|
24
|
+
exports.nextJsAppPlugin = {
|
|
25
|
+
configScheme: NextJsPluginConfig,
|
|
26
|
+
generate: ({ outputs, log, nodes, namespace, libStyle }, { nextJsAppOverrideTemplateFiles = false, nextJsAppCdkConstructClassName = 'Apps', nextJsAppCdkConstructFile = libStyle === 'nx' ? `packages/cdk/src/${nextJsAppCdkConstructClassName}.ts` : undefined, }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
27
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11;
|
|
28
|
+
const supported = nodes.filter(n => { var _a, _b, _c; return supportedTypes.some(t => n.types.some(nt => nt.type === t)) && ((_c = (_b = (_a = n.children) === null || _a === void 0 ? void 0 : _a['name']) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.trim()); });
|
|
29
|
+
log(`${supported.length} supported node(s)`);
|
|
30
|
+
if (!supported.length) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const sites = [];
|
|
34
|
+
for (const node of supported) {
|
|
35
|
+
const name = (_c = (_b = (_a = node.children) === null || _a === void 0 ? void 0 : _a['name']) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.trim();
|
|
36
|
+
if (!name) {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
outputs.push(...(0, nextJsAppTemplate_1.nextJsAppTemplate)({
|
|
40
|
+
mapOptions: {
|
|
41
|
+
targetDir: `packages/${name}`,
|
|
42
|
+
outputDefaults: {
|
|
43
|
+
overwrite: nextJsAppOverrideTemplateFiles
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
projectName: name,
|
|
47
|
+
namespace: (_g = (_f = (_e = (_d = node.children) === null || _d === void 0 ? void 0 : _d['namespace']) === null || _e === void 0 ? void 0 : _e.value) === null || _f === void 0 ? void 0 : _f.trim()) !== null && _g !== void 0 ? _g : namespace,
|
|
48
|
+
compLib: (_l = (_k = (_j = (_h = node.children) === null || _h === void 0 ? void 0 : _h['compLib']) === null || _j === void 0 ? void 0 : _j.value) === null || _k === void 0 ? void 0 : _k.trim()) !== null && _l !== void 0 ? _l : 'components',
|
|
49
|
+
frontendModule: (_q = (_p = (_o = (_m = node.children) === null || _m === void 0 ? void 0 : _m['frontendModule']) === null || _o === void 0 ? void 0 : _o.value) === null || _p === void 0 ? void 0 : _p.trim()) !== null && _q !== void 0 ? _q : 'frontendModule',
|
|
50
|
+
frontendLib: (_u = (_t = (_s = (_r = node.children) === null || _r === void 0 ? void 0 : _r['frontendLib']) === null || _s === void 0 ? void 0 : _s.value) === null || _t === void 0 ? void 0 : _t.trim()) !== null && _u !== void 0 ? _u : 'frontend',
|
|
51
|
+
siteTitle: (_y = (_x = (_w = (_v = node.children) === null || _v === void 0 ? void 0 : _v['siteTitle']) === null || _w === void 0 ? void 0 : _w.value) === null || _x === void 0 ? void 0 : _x.trim()) !== null && _y !== void 0 ? _y : name,
|
|
52
|
+
siteDescription: (_2 = (_1 = (_0 = (_z = node.children) === null || _z === void 0 ? void 0 : _z['siteDescription']) === null || _0 === void 0 ? void 0 : _0.value) === null || _1 === void 0 ? void 0 : _1.trim()) !== null && _2 !== void 0 ? _2 : name,
|
|
53
|
+
devPort: (_6 = (_5 = (_4 = (_3 = node.children) === null || _3 === void 0 ? void 0 : _3['devPort']) === null || _4 === void 0 ? void 0 : _4.value) === null || _5 === void 0 ? void 0 : _5.trim()) !== null && _6 !== void 0 ? _6 : '4200',
|
|
54
|
+
}));
|
|
55
|
+
const deploymentType = (_9 = (_8 = (_7 = node.children) === null || _7 === void 0 ? void 0 : _7['deploy']) === null || _8 === void 0 ? void 0 : _8.value) === null || _9 === void 0 ? void 0 : _9.trim();
|
|
56
|
+
if (deploymentType) {
|
|
57
|
+
switch (deploymentType) {
|
|
58
|
+
case 'static':
|
|
59
|
+
sites.push({
|
|
60
|
+
name: (0, common_1.strFirstToUpper)(name.replace(/-(\w)/g, (_, c) => c.toUpperCase())),
|
|
61
|
+
staticSite: {
|
|
62
|
+
nxExportedPackage: name,
|
|
63
|
+
cdn: true,
|
|
64
|
+
domainName: (_11 = (_10 = node.children) === null || _10 === void 0 ? void 0 : _10['domain']) === null || _11 === void 0 ? void 0 : _11.value,
|
|
65
|
+
createOutputs: true,
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
break;
|
|
69
|
+
default:
|
|
70
|
+
throw new Error(`deployment type ${deploymentType} is not supported by nextJsAppPlugin`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (nextJsAppCdkConstructFile) {
|
|
75
|
+
outputs.push({
|
|
76
|
+
path: nextJsAppCdkConstructFile,
|
|
77
|
+
content: (0, siteCdkTemplate_1.siteCdkTemplate)(nextJsAppCdkConstructClassName, sites),
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
};
|
|
82
|
+
//# sourceMappingURL=nextJsAppPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nextJsAppPlugin.js","sourceRoot":"","sources":["../../../../../../packages/protogen-runtime/src/lib/plugins/nextJsAppPlugin.ts"],"names":[],"mappings":";;;;AACA,yCAA+C;AAE/C,6BAAwB;AACxB,2DAAwD;AACxD,uDAAoD;AAEpD,MAAM,cAAc,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AAE,MAAM;aAC5D,CAAC,CAAC,CAAC;YAEJ,MAAM,cAAc,GAAC,MAAA,MAAA,MAAA,IAAI,CAAC,QAAQ,0CAAG,QAAQ,CAAC,0CAAE,KAAK,0CAAE,IAAI,EAAE,CAAC;YAC9D,IAAG,cAAc,EAAC;gBACd,QAAO,cAAc,EAAC;oBAElB,KAAK,QAAQ;wBACT,KAAK,CAAC,IAAI,CAAC;4BACP,IAAI,EAAC,IAAA,wBAAe,EAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAC,CAAC,CAAC,EAAC,CAAQ,EAAC,EAAE,CAAA,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;4BAC1E,UAAU,EAAC;gCACP,iBAAiB,EAAC,IAAI;gCACtB,GAAG,EAAC,IAAI;gCACR,UAAU,EAAC,OAAA,OAAA,IAAI,CAAC,QAAQ,4CAAG,QAAQ,CAAC,4CAAE,KAAK;gCAC3C,aAAa,EAAC,IAAI;6BACrB;yBACJ,CAAC,CAAA;wBAEF,MAAM;oBAEV;wBACI,MAAM,IAAI,KAAK,CAAC,mBAAmB,cAAc,sCAAsC,CAAC,CAAC;iBAEhG;aACJ;SAEJ;QAGD,IAAG,yBAAyB,EAAC;YACzB,OAAO,CAAC,IAAI,CAAC;gBACT,IAAI,EAAC,yBAAyB;gBAC9B,OAAO,EAAC,IAAA,iCAAe,EAAC,8BAA8B,EAAC,KAAK,CAAC;aAChE,CAAC,CAAA;SACL;IAEL,CAAC,CAAA;CACJ,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { protoFileMapToOutput as __transformer__ } from "@iyio/protogen";
|
|
2
|
+
export interface NextJsAppTemplateOptions {
|
|
3
|
+
mapOptions: Parameters<typeof __transformer__>[1];
|
|
4
|
+
namespace: string;
|
|
5
|
+
compLib: string;
|
|
6
|
+
frontendModule: string;
|
|
7
|
+
frontendLib: string;
|
|
8
|
+
siteTitle: string;
|
|
9
|
+
siteDescription: string;
|
|
10
|
+
projectName: string;
|
|
11
|
+
devPort: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const nextJsAppTemplate: ({ mapOptions: __transformerParam__, namespace, compLib, frontendModule, frontendLib, siteTitle, siteDescription, projectName, devPort, }: NextJsAppTemplateOptions) => import("@iyio/protogen").ProtoOutput[];
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.nextJsAppTemplate = void 0;
|
|
4
|
+
const protogen_1 = require("@iyio/protogen");
|
|
5
|
+
const nextJsAppTemplate = ({ mapOptions: __transformerParam__, namespace, compLib, frontendModule, frontendLib, siteTitle, siteDescription, projectName, devPort, }) => {
|
|
6
|
+
const files = {
|
|
7
|
+
".babelrc":
|
|
8
|
+
/*babelrc*/ `{
|
|
9
|
+
"presets": ["@nrwl/next/babel"],
|
|
10
|
+
"plugins": []
|
|
11
|
+
}
|
|
12
|
+
`,
|
|
13
|
+
".eslintrc.json":
|
|
14
|
+
/*json*/ `{
|
|
15
|
+
"extends": [
|
|
16
|
+
"plugin:@nrwl/nx/react-typescript",
|
|
17
|
+
"next",
|
|
18
|
+
"next/core-web-vitals",
|
|
19
|
+
"../../.eslintrc.json"
|
|
20
|
+
],
|
|
21
|
+
"ignorePatterns": ["!**/*", ".next/**/*"],
|
|
22
|
+
"overrides": [
|
|
23
|
+
{
|
|
24
|
+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
|
|
25
|
+
"rules": {
|
|
26
|
+
"@next/next/no-html-link-for-pages": [
|
|
27
|
+
"error",
|
|
28
|
+
"packages/web-app/pages"
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"files": ["*.ts", "*.tsx"],
|
|
34
|
+
"rules": {}
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"files": ["*.js", "*.jsx"],
|
|
38
|
+
"rules": {}
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
"rules": {
|
|
42
|
+
"@next/next/no-html-link-for-pages": "off"
|
|
43
|
+
},
|
|
44
|
+
"env": {
|
|
45
|
+
"jest": true
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
`,
|
|
49
|
+
"index.d.ts":
|
|
50
|
+
/*ts*/ `/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
51
|
+
declare module '*.svg' {
|
|
52
|
+
const content: any;
|
|
53
|
+
export const ReactComponent: any;
|
|
54
|
+
export default content;
|
|
55
|
+
}
|
|
56
|
+
`,
|
|
57
|
+
"jest.config.ts":
|
|
58
|
+
/*ts*/ `/* eslint-disable */
|
|
59
|
+
export default {
|
|
60
|
+
displayName: 'web-app',
|
|
61
|
+
preset: '../../jest.preset.js',
|
|
62
|
+
transform: {
|
|
63
|
+
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nrwl/react/plugins/jest',
|
|
64
|
+
'^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nrwl/next/babel'] }],
|
|
65
|
+
},
|
|
66
|
+
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
|
|
67
|
+
coverageDirectory: '../../coverage/packages/web-app',
|
|
68
|
+
};
|
|
69
|
+
`,
|
|
70
|
+
"next-env.d.ts":
|
|
71
|
+
/*ts*/ `/// <reference types="next" />
|
|
72
|
+
/// <reference types="next/image-types/global" />
|
|
73
|
+
|
|
74
|
+
// NOTE: This file should not be edited
|
|
75
|
+
// see https://nextjs.org/docs/basic-features/typescript for more information.
|
|
76
|
+
`,
|
|
77
|
+
"next.config.js":
|
|
78
|
+
/*js*/ `//@ts-check
|
|
79
|
+
|
|
80
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
81
|
+
const { withNx } = require('@nrwl/next/plugins/with-nx');
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* @type {import('@nrwl/next/plugins/with-nx').WithNxOptions}
|
|
85
|
+
**/
|
|
86
|
+
const nextConfig = {
|
|
87
|
+
nx: {
|
|
88
|
+
// Set this to true if you would like to to use SVGR
|
|
89
|
+
// See: https://github.com/gregberge/svgr
|
|
90
|
+
svgr: false,
|
|
91
|
+
},
|
|
92
|
+
typescript:{
|
|
93
|
+
ignoreBuildErrors:process.env['NX_IGNORE_NEXTJS_BUILD_ERROR']==='true'
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
module.exports = withNx(nextConfig);
|
|
98
|
+
`,
|
|
99
|
+
"pages/_app.tsx":
|
|
100
|
+
/*tsx*/ `import { DefaultGlobalStyle, MainLayout, PageWrapper } from '@${namespace}/${compLib}';
|
|
101
|
+
import { ${frontendModule}, defaultBaseLayoutStyleSheetProps, st } from '@${namespace}/${frontendLib}';
|
|
102
|
+
import { STATIC_ENV_VARS, __macro__ } from '@iyio/common';
|
|
103
|
+
import { NextJsApp } from '@iyio/nextjs-common';
|
|
104
|
+
import { AppProps } from 'next/app';
|
|
105
|
+
import Head from 'next/head';
|
|
106
|
+
|
|
107
|
+
export default function App(props:AppProps){
|
|
108
|
+
return (
|
|
109
|
+
<NextJsApp
|
|
110
|
+
appProps={props as any}
|
|
111
|
+
style={defaultBaseLayoutStyleSheetProps}
|
|
112
|
+
GlobalStyle={DefaultGlobalStyle}
|
|
113
|
+
scopeInit={${frontendModule}}
|
|
114
|
+
staticEnvVars={process.env['NODE_ENV']==='production'?undefined:__macro__(STATIC_ENV_VARS)}
|
|
115
|
+
layoutProps={{
|
|
116
|
+
pageTransitions:true,
|
|
117
|
+
LayoutWrapper:MainLayout,
|
|
118
|
+
PageWrapper
|
|
119
|
+
}}
|
|
120
|
+
>
|
|
121
|
+
<Head>
|
|
122
|
+
<title>${siteTitle}</title>
|
|
123
|
+
<meta name="theme-color" content={st.bgColor}/>
|
|
124
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"/>
|
|
125
|
+
<link rel="icon" type="image/png" href="/logo-icon.png"></link>
|
|
126
|
+
<meta property="og:title" content="${siteTitle}" />
|
|
127
|
+
<meta property="og:description" content="${siteDescription}" />
|
|
128
|
+
<meta property="og:type" content="website" />
|
|
129
|
+
<meta property="og:image" content={\`https://$\{process.env['NX_FRONTEND_DOMAIN']}/logo.png\`} />
|
|
130
|
+
<meta property="og:url" content={\`https://$\{process.env['NX_FRONTEND_DOMAIN']}/\`} />
|
|
131
|
+
</Head>
|
|
132
|
+
|
|
133
|
+
</NextJsApp>
|
|
134
|
+
)
|
|
135
|
+
}
|
|
136
|
+
`,
|
|
137
|
+
"pages/_document.tsx":
|
|
138
|
+
/*tsx*/ `import { DefaultStyleHead } from '@${namespace}/${compLib}';
|
|
139
|
+
import { Head, Html, Main, NextScript } from 'next/document';
|
|
140
|
+
|
|
141
|
+
export default function Document() {
|
|
142
|
+
return (
|
|
143
|
+
<Html>
|
|
144
|
+
<Head>
|
|
145
|
+
<DefaultStyleHead/>
|
|
146
|
+
</Head>
|
|
147
|
+
<body>
|
|
148
|
+
<Main />
|
|
149
|
+
<NextScript />
|
|
150
|
+
</body>
|
|
151
|
+
</Html>
|
|
152
|
+
)
|
|
153
|
+
}
|
|
154
|
+
`,
|
|
155
|
+
"pages/index.tsx":
|
|
156
|
+
/*tsx*/ `export default function Index()
|
|
157
|
+
{
|
|
158
|
+
|
|
159
|
+
return (
|
|
160
|
+
<h1>_🚧</h1>
|
|
161
|
+
)
|
|
162
|
+
|
|
163
|
+
}
|
|
164
|
+
`,
|
|
165
|
+
"project.json":
|
|
166
|
+
/*json*/ `{
|
|
167
|
+
"name": "${projectName}",
|
|
168
|
+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
169
|
+
"sourceRoot": "packages/${projectName}",
|
|
170
|
+
"projectType": "application",
|
|
171
|
+
"targets": {
|
|
172
|
+
"pre-build": {
|
|
173
|
+
"executor": "@nrwl/next:build",
|
|
174
|
+
"outputs": [
|
|
175
|
+
"{options.outputPath}"
|
|
176
|
+
],
|
|
177
|
+
"defaultConfiguration": "production",
|
|
178
|
+
"options": {
|
|
179
|
+
"root": "packages/${projectName}",
|
|
180
|
+
"outputPath": "dist/packages/${projectName}"
|
|
181
|
+
},
|
|
182
|
+
"configurations": {
|
|
183
|
+
"development": {
|
|
184
|
+
"outputPath": "packages/${projectName}"
|
|
185
|
+
},
|
|
186
|
+
"production": {}
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
"serve": {
|
|
190
|
+
"executor": "@nrwl/next:server",
|
|
191
|
+
"defaultConfiguration": "development",
|
|
192
|
+
"options": {
|
|
193
|
+
"buildTarget": "${projectName}:pre-build",
|
|
194
|
+
"dev": true,
|
|
195
|
+
"port": ${devPort}
|
|
196
|
+
},
|
|
197
|
+
"configurations": {
|
|
198
|
+
"development": {
|
|
199
|
+
"buildTarget": "${projectName}:pre-build:development",
|
|
200
|
+
"dev": true
|
|
201
|
+
},
|
|
202
|
+
"production": {
|
|
203
|
+
"buildTarget": "${projectName}:pre-build:production",
|
|
204
|
+
"dev": false
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
"export": {
|
|
209
|
+
"executor": "@nrwl/next:export",
|
|
210
|
+
"options": {
|
|
211
|
+
"buildTarget": "${projectName}:pre-build:production"
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
"build": {
|
|
215
|
+
"dependsOn": [
|
|
216
|
+
{
|
|
217
|
+
"target": "export",
|
|
218
|
+
"projects": "self"
|
|
219
|
+
}
|
|
220
|
+
],
|
|
221
|
+
"executor": "nx:run-commands",
|
|
222
|
+
"options": {
|
|
223
|
+
"cwd": "packages/${projectName}",
|
|
224
|
+
"command": "echo 'todo - ./build-serverless.sh'"
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
"test": {
|
|
228
|
+
"executor": "@nrwl/jest:jest",
|
|
229
|
+
"outputs": [
|
|
230
|
+
"{workspaceRoot}/coverage/{projectRoot}"
|
|
231
|
+
],
|
|
232
|
+
"options": {
|
|
233
|
+
"jestConfig": "packages/${projectName}/jest.config.ts",
|
|
234
|
+
"passWithNoTests": true
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
"lint": {
|
|
238
|
+
"executor": "@nrwl/linter:eslint",
|
|
239
|
+
"outputs": [
|
|
240
|
+
"{options.outputFile}"
|
|
241
|
+
],
|
|
242
|
+
"options": {
|
|
243
|
+
"lintFilePatterns": [
|
|
244
|
+
"packages/${projectName}/**/*.{ts,tsx,js,jsx}"
|
|
245
|
+
]
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
"tags": []
|
|
250
|
+
}
|
|
251
|
+
`,
|
|
252
|
+
"public/.gitkeep":
|
|
253
|
+
/*gitkeep*/ ``,
|
|
254
|
+
"tsconfig.json":
|
|
255
|
+
/*json*/ `{
|
|
256
|
+
"extends": "../../tsconfig.base.json",
|
|
257
|
+
"compilerOptions": {
|
|
258
|
+
"jsx": "preserve",
|
|
259
|
+
"allowJs": true,
|
|
260
|
+
"esModuleInterop": true,
|
|
261
|
+
"allowSyntheticDefaultImports": true,
|
|
262
|
+
"strict": true,
|
|
263
|
+
"forceConsistentCasingInFileNames": true,
|
|
264
|
+
"noUncheckedIndexedAccess": true,
|
|
265
|
+
"noEmit": true,
|
|
266
|
+
"resolveJsonModule": true,
|
|
267
|
+
"isolatedModules": true,
|
|
268
|
+
"incremental": true,
|
|
269
|
+
"types": ["jest", "node"],
|
|
270
|
+
"skipLibCheck": true
|
|
271
|
+
},
|
|
272
|
+
"include": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx", "next-env.d.ts"],
|
|
273
|
+
"exclude": [
|
|
274
|
+
"node_modules",
|
|
275
|
+
"jest.config.ts",
|
|
276
|
+
"src/**/*.spec.ts",
|
|
277
|
+
"src/**/*.test.ts"
|
|
278
|
+
]
|
|
279
|
+
}
|
|
280
|
+
`,
|
|
281
|
+
"tsconfig.spec.json":
|
|
282
|
+
/*json*/ `{
|
|
283
|
+
"extends": "./tsconfig.json",
|
|
284
|
+
"compilerOptions": {
|
|
285
|
+
"outDir": "../../dist/out-tsc",
|
|
286
|
+
"module": "commonjs",
|
|
287
|
+
"types": ["jest", "node"],
|
|
288
|
+
"jsx": "react"
|
|
289
|
+
},
|
|
290
|
+
"include": [
|
|
291
|
+
"jest.config.ts",
|
|
292
|
+
"src/**/*.test.ts",
|
|
293
|
+
"src/**/*.spec.ts",
|
|
294
|
+
"src/**/*.test.tsx",
|
|
295
|
+
"src/**/*.spec.tsx",
|
|
296
|
+
"src/**/*.test.js",
|
|
297
|
+
"src/**/*.spec.js",
|
|
298
|
+
"src/**/*.test.jsx",
|
|
299
|
+
"src/**/*.spec.jsx",
|
|
300
|
+
"src/**/*.d.ts"
|
|
301
|
+
]
|
|
302
|
+
}
|
|
303
|
+
`,
|
|
304
|
+
};
|
|
305
|
+
return (0, protogen_1.protoFileMapToOutput)(files, __transformerParam__);
|
|
306
|
+
};
|
|
307
|
+
exports.nextJsAppTemplate = nextJsAppTemplate;
|
|
308
|
+
//# sourceMappingURL=nextJsAppTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nextJsAppTemplate.js","sourceRoot":"","sources":["../../../../../../packages/protogen-runtime/src/lib/plugins/nextJsAppTemplate.ts"],"names":[],"mappings":";;;AAAA,6CAAyE;AAclE,MAAM,iBAAiB,GAAC,CAAC,EAC5B,UAAU,EAAC,oBAAoB,EAC/B,SAAS,EACT,OAAO,EACP,cAAc,EACd,WAAW,EACX,SAAS,EACT,eAAe,EACf,WAAW,EACX,OAAO,GACe,EAAC,EAAE;IACzB,MAAM,KAAK,GAAC;QAChB,UAAU;QACV,WAAW,CAAA;;;;CAIV;QACD,gBAAgB;QAChB,QAAQ,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkCP;QACD,YAAY;QACZ,MAAM,CAAA;;;;;;CAML;QACD,gBAAgB;QAChB,MAAM,CAAA;;;;;;;;;;;CAWL;QACD,eAAe;QACf,MAAM,CAAA;;;;;CAKL;QACD,gBAAgB;QAChB,MAAM,CAAA;;;;;;;;;;;;;;;;;;;;CAoBL;QACD,gBAAgB;QAChB,OAAO,CAAA,iEAAiE,SAAS,IAAI,OAAO;WACjF,cAAc,mDAAmD,SAAS,IAAI,WAAW;;;;;;;;;;;;yBAY3E,cAAc;;;;;;;;;yBASd,SAAS;;;;qDAImB,SAAS;2DACH,eAAe;;;;;;;;;CASzE;QACD,qBAAqB;QACrB,OAAO,CAAA,sCAAsC,SAAS,IAAI,OAAO;;;;;;;;;;;;;;;;CAgBhE;QACD,iBAAiB;QACjB,OAAO,CAAA;;;;;;;;CAQN;QACD,cAAc;QACd,QAAQ,CAAA;eACO,WAAW;;8BAEI,WAAW;;;;;;;;;;oCAUL,WAAW;+CACA,WAAW;;;;8CAIZ,WAAW;;;;;;;;;kCASvB,WAAW;;0BAEnB,OAAO;;;;sCAIK,WAAW;;;;sCAIX,WAAW;;;;;;;;kCAQf,WAAW;;;;;;;;;;;;mCAYV,WAAW;;;;;;;;;;0CAUJ,WAAW;;;;;;;;;;;gCAWrB,WAAW;;;;;;;CAO1C;QACD,iBAAiB;QACjB,WAAW,CAAA,EAAE;QACb,eAAe;QACf,QAAQ,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;CAyBP;QACD,oBAAoB;QACpB,QAAQ,CAAA;;;;;;;;;;;;;;;;;;;;;CAqBP;KACI,CAAA;IACD,OAAO,IAAA,+BAAe,EAAC,KAAK,EAAC,oBAAoB,CAAC,CAAC;AACvD,CAAC,CAAA;AAvTY,QAAA,iBAAiB,qBAuT7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paramPlugin.js","sourceRoot":"","sources":["../../../../../../packages/protogen-runtime/src/lib/plugins/paramPlugin.ts"],"names":[],"mappings":";;;;AAAA,yCAAuD;AACvD,
|
|
1
|
+
{"version":3,"file":"paramPlugin.js","sourceRoot":"","sources":["../../../../../../packages/protogen-runtime/src/lib/plugins/paramPlugin.ts"],"names":[],"mappings":";;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CAAC,CAAA,SAAS,CAAC,SAAS,CAAC,CAAC,EAAC,SAAS,CAAC,MAAM,GAAC,CAAC,CAAC,CAAA,CAAC,CAAA,SAAS,CAAC;YAChG,GAAG,CAAC,IAAI,CAAC,gBAAgB,SAAS,IAAI,MAAM,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;SAC7F;QAED,IAAG,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAC;YACxB,GAAG,CAAC,OAAO,CAAC,mDAAmD,CAAC,CAAC;SACpE;QACD,IAAG,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAC;YACxB,GAAG,CAAC,OAAO,CAAC,mDAAmD,CAAC,CAAC;SACpE;QACD,IAAG,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAC;YACzB,GAAG,CAAC,OAAO,CAAC,iDAAiD,CAAC,CAAC;SAClE;QAED,OAAO,CAAC,IAAI,CAAC;YACT,IAAI,EAAC,IAAA,kBAAS,EAAC,IAAI,EAAC,cAAc,CAAC;YACnC,OAAO,EAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;SACzB,CAAC,CAAA;QAEF,iBAAiB;QACjB,OAAO,CAAC,IAAI,CAAC;YACT,IAAI,EAAC,IAAA,kBAAS,EAAC,IAAI,EAAC,kBAAkB,CAAC;YACvC,OAAO,EAAC,EAAE;YACV,cAAc,EAAC,IAAI;YACnB,SAAS,EAAC;gBACN,IAAI,EAAC,IAAI;gBACT,SAAS,EAAC,IAAI;gBACd,SAAS,EAAC,+BAAoB;aACjC;SACJ,CAAC,CAAA;IACN,CAAC,CAAA;CACJ,CAAA"}
|
|
@@ -153,7 +153,6 @@ const generateComponentAsync = (node, { tab, importMap, outputs, namespace, libS
|
|
|
153
153
|
path: (0, common_1.joinPaths)(path, filename),
|
|
154
154
|
content: out.join('\n'),
|
|
155
155
|
autoMerge: true,
|
|
156
|
-
mergeHandler: protogen_1.protoMergeTsImports
|
|
157
156
|
});
|
|
158
157
|
return name;
|
|
159
158
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactCompPlugin.js","sourceRoot":"","sources":["../../../../../../packages/protogen-runtime/src/lib/plugins/reactCompPlugin.ts"],"names":[],"mappings":";;;;AAAA,yCAA4D;AAC5D,
|
|
1
|
+
{"version":3,"file":"reactCompPlugin.js","sourceRoot":"","sources":["../../../../../../packages/protogen-runtime/src/lib/plugins/reactCompPlugin.ts"],"names":[],"mappings":";;;;AAAA,yCAA4D;AAC5D,6CAAgQ;AAChQ,6BAAwB;AAExB,MAAM,cAAc,GAAC,CAAC,MAAM,EAAC,MAAM,EAAC,QAAQ,CAAC,CAAC;AAE9C,MAAM,qBAAqB,GAAC,OAAC,CAAC,MAAM,CACpC;IACI;;OAEG;IACH,aAAa,EAAC,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAEnC;;OAEG;IACH,sBAAsB,EAAC,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAE5C;;OAEG;IACH,qBAAqB,EAAC,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAG5C;;OAEG;IACH,gBAAgB,EAAC,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACzC,CAAC,CAAA;AAEW,QAAA,eAAe,GAC5B;IACI,YAAY,EAAC,qBAAqB;IAClC,QAAQ,EAAC,CAAO,GAAG,EAAC,MAAM,EAAC,EAAE;QAEzB,MAAM,EACF,GAAG,EACH,KAAK,EACL,OAAO,EACP,YAAY,EACZ,SAAS,EACT,QAAQ,GACX,GAAC,GAAG,CAAC;QAEN,MAAM,EACF,gBAAgB,GAAC,YAAY,EAC7B,aAAa,EACb,sBAAsB,GAAC,qBAAqB,EAC/C,GAAC,MAAM,CAAC;QAET,MAAM,EAAC,IAAI,EAAC,GAAC,IAAA,oCAAyB,EAClC,SAAS,EACT,gBAAgB,EAChB,aAAa,EAC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CAAC,IAAW,EAAC,EAAE;IAEnC,QAAO,IAAI,EAAC;QACR,KAAK,OAAO,CAAC,CAAC,OAAO,sBAAsB,CAAC;QAC5C,KAAK,eAAe,CAAC,CAAC,OAAO,4BAA4B,CAAC;QAC1D,KAAK,MAAM,CAAC,CAAC,OAAO,iBAAiB,CAAC;QACtC,KAAK,KAAK,CAAC,CAAC,OAAO,oBAAoB,CAAC;QACxC,KAAK,OAAO,CAAC;QACb;YACI,OAAO,sBAAsB,CAAC;KACrC;AACL,CAAC,CAAA"}
|
|
@@ -69,7 +69,7 @@ const ServerFnPluginConfig = zod_1.z.object({
|
|
|
69
69
|
exports.serverFnPlugin = {
|
|
70
70
|
configScheme: ServerFnPluginConfig,
|
|
71
71
|
generate: ({ importMap, outputs, tab, log, nodes, namespace, packagePaths, libStyle, paramMap, paramPackage, }, { serverFnPackage = 'fns', serverFnPath = serverFnPackage, serverFnClientPackage = 'fn-clients', serverFnIndexFilename = 'fn-index.ts', serverFnClientPath = serverFnClientPackage, serverFnHandlerName = 'handler', serverFnLibPackage = '@iyio/common', serverFnClientFilename = 'fn-clients.ts', serverFnLambdaPackage = '@iyio/aws-lambda', serverFnClientIndexFilename = 'fn-clients-index.ts', serverFnCdkConstructClassName = 'Fns', serverFnCdkConstructFile = libStyle === 'nx' ? `packages/cdk/src/${serverFnCdkConstructClassName}.ts` : undefined, serverFnInit = true, serverFnInitFunction = 'initBackend', serverFnInitFunctionPackage = `backend` }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
72
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
72
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
73
73
|
const { path } = (0, protogen_1.getProtoPluginPackAndPath)(namespace, serverFnPackage, serverFnPath, libStyle, { packagePaths, indexFilename: serverFnIndexFilename });
|
|
74
74
|
const cdkRelPath = ('../'
|
|
75
75
|
.repeat((0, common_1.getSubstringCount)(path, '/') - 1));
|
|
@@ -90,8 +90,16 @@ exports.serverFnPlugin = {
|
|
|
90
90
|
const imports = [];
|
|
91
91
|
const name = node.name;
|
|
92
92
|
const filepath = (0, common_1.joinPaths)(path, name + '.ts');
|
|
93
|
-
const
|
|
94
|
-
const
|
|
93
|
+
const inputNode = (_a = node.children) === null || _a === void 0 ? void 0 : _a['input'];
|
|
94
|
+
const outputNode = (_b = node.children) === null || _b === void 0 ? void 0 : _b['output'];
|
|
95
|
+
const inputIsArray = (_d = (_c = inputNode === null || inputNode === void 0 ? void 0 : inputNode.types[0]) === null || _c === void 0 ? void 0 : _c.isArray) !== null && _d !== void 0 ? _d : false;
|
|
96
|
+
const outputIsArray = (_f = (_e = outputNode === null || outputNode === void 0 ? void 0 : outputNode.types[0]) === null || _e === void 0 ? void 0 : _e.isArray) !== null && _f !== void 0 ? _f : false;
|
|
97
|
+
const inputType = (_g = inputNode === null || inputNode === void 0 ? void 0 : inputNode.type) !== null && _g !== void 0 ? _g : 'void';
|
|
98
|
+
const outputType = (_h = outputNode === null || outputNode === void 0 ? void 0 : outputNode.type) !== null && _h !== void 0 ? _h : 'void';
|
|
99
|
+
const tsInputType = inputType + (inputIsArray ? '[]' : '');
|
|
100
|
+
const tsOutputType = outputType + (outputIsArray ? '[]' : '');
|
|
101
|
+
const inputScheme = inputType + 'Scheme' + (inputIsArray ? '.array()' : '');
|
|
102
|
+
const outputScheme = outputType + 'Scheme' + (outputIsArray ? '.array()' : '');
|
|
95
103
|
const inputPackage = importMap[inputType + 'Scheme'];
|
|
96
104
|
const outputPackage = importMap[outputType + 'Scheme'];
|
|
97
105
|
const paramName = (0, protogen_1.protoAddContextParam)(name + 'Arn', paramPackage, paramMap, importMap);
|
|
@@ -99,14 +107,14 @@ exports.serverFnPlugin = {
|
|
|
99
107
|
const fnInfo = {
|
|
100
108
|
name,
|
|
101
109
|
createProps: {
|
|
102
|
-
createPublicUrl: ((
|
|
110
|
+
createPublicUrl: ((_k = (_j = node.children) === null || _j === void 0 ? void 0 : _j['$publicUrl']) === null || _k === void 0 ? void 0 : _k.value) === 'true',
|
|
103
111
|
handlerFileName: (0, common_1.joinPaths)(cdkRelPath, filepath),
|
|
104
112
|
handler: 'handler'
|
|
105
113
|
},
|
|
106
114
|
arnParam: paramName
|
|
107
115
|
};
|
|
108
116
|
infos.push(fnInfo);
|
|
109
|
-
const accessProp = (
|
|
117
|
+
const accessProp = (_l = node.children) === null || _l === void 0 ? void 0 : _l['$access'];
|
|
110
118
|
if (accessProp === null || accessProp === void 0 ? void 0 : accessProp.children) {
|
|
111
119
|
fnInfo.accessRequests = (0, protogen_1.protoNodeChildrenToAccessRequests)(accessProp);
|
|
112
120
|
}
|
|
@@ -115,22 +123,22 @@ exports.serverFnPlugin = {
|
|
|
115
123
|
if (node.comment) {
|
|
116
124
|
clientOut.push(...(0, protogen_1.protoFormatTsComment)(node.comment, '').split('\n'));
|
|
117
125
|
}
|
|
118
|
-
clientOut.push(`export const ${clientName}=(input:${
|
|
119
|
-
clientOut.push(`${tab}lambdaClient().invokeAsync<${
|
|
126
|
+
clientOut.push(`export const ${clientName}=(input:${tsInputType}):Promise<${tsOutputType}>=>(`);
|
|
127
|
+
clientOut.push(`${tab}lambdaClient().invokeAsync<${tsInputType},${tsOutputType}>({`);
|
|
120
128
|
clientOut.push(`${tab}${tab}fn:${paramName}(),`);
|
|
121
129
|
clientOut.push(`${tab}${tab}input,`);
|
|
122
130
|
if (inputPackage) {
|
|
123
131
|
clientInputs.push(inputType + 'Scheme');
|
|
124
|
-
clientOut.push(`${tab}${tab}inputScheme:${
|
|
132
|
+
clientOut.push(`${tab}${tab}inputScheme:${inputScheme},`);
|
|
125
133
|
}
|
|
126
134
|
if (outputPackage) {
|
|
127
135
|
clientInputs.push(outputType + 'Scheme');
|
|
128
|
-
clientOut.push(`${tab}${tab}outputScheme:${
|
|
136
|
+
clientOut.push(`${tab}${tab}outputScheme:${outputScheme},`);
|
|
129
137
|
}
|
|
130
138
|
clientOut.push(`${tab}})`);
|
|
131
139
|
clientOut.push(')');
|
|
132
140
|
clientOut.push('');
|
|
133
|
-
const handlerName = (
|
|
141
|
+
const handlerName = (_p = (_o = (_m = node.children) === null || _m === void 0 ? void 0 : _m['handlerName']) === null || _o === void 0 ? void 0 : _o.value) !== null && _p !== void 0 ? _p : serverFnHandlerName;
|
|
134
142
|
const isDefault = handlerName === 'default';
|
|
135
143
|
if (!(0, protogen_1.protoIsTsBuiltType)(inputType)) {
|
|
136
144
|
imports.push(inputType);
|
|
@@ -152,34 +160,35 @@ exports.serverFnPlugin = {
|
|
|
152
160
|
if (node.comment) {
|
|
153
161
|
out.push(...(0, protogen_1.protoFormatTsComment)(node.comment, '').split('\n'));
|
|
154
162
|
}
|
|
155
|
-
|
|
163
|
+
let startI = out.length;
|
|
156
164
|
out.push(`const ${name}=async (`);
|
|
157
165
|
out.push(`${tab}fnEvt:FnEvent${inputType === 'void' ? '' : ','}`);
|
|
158
|
-
out.push(`${inputType === 'void' ? '' : `${tab}input:${
|
|
159
|
-
out.push(`):Promise<${
|
|
166
|
+
out.push(`${inputType === 'void' ? '' : `${tab}input:${tsInputType}`}`);
|
|
167
|
+
out.push(`):Promise<${tsOutputType}>=>{`);
|
|
160
168
|
(0, protogen_1.protoLabelOutputLines)(out, 'head', startI);
|
|
161
169
|
out.push(`${tab}// do cool stuff`);
|
|
162
170
|
out.push(`${tab}throw new Error('${name} not implemented');`);
|
|
163
171
|
out.push('}');
|
|
164
172
|
out.push('');
|
|
173
|
+
startI = out.length;
|
|
165
174
|
out.push(isDefault ? `export default ${name};` : `export const ${handlerName}=createFnHandler(${name},{`);
|
|
166
175
|
if (inputPackage) {
|
|
167
176
|
imports.push(inputType + 'Scheme');
|
|
168
|
-
out.push(`${tab}inputScheme:${
|
|
177
|
+
out.push(`${tab}inputScheme:${inputScheme},`);
|
|
169
178
|
}
|
|
170
179
|
if (outputPackage) {
|
|
171
180
|
imports.push(outputType + 'Scheme');
|
|
172
|
-
out.push(`${tab}outputScheme:${
|
|
181
|
+
out.push(`${tab}outputScheme:${outputScheme},`);
|
|
173
182
|
}
|
|
174
183
|
out.push('});');
|
|
184
|
+
(0, protogen_1.protoLabelOutputLines)(out, 'handlerExport', startI);
|
|
175
185
|
(0, protogen_1.protoPrependTsImports)(imports, importMap, out);
|
|
176
186
|
outputs.push({
|
|
177
187
|
path: filepath,
|
|
178
188
|
content: out.join('\n'),
|
|
179
189
|
mainExport: isDefault ? undefined : handlerName,
|
|
180
190
|
mainExportAs: name,
|
|
181
|
-
autoMerge: true
|
|
182
|
-
mergeHandler: protogen_1.protoMergeTsImports
|
|
191
|
+
autoMerge: true
|
|
183
192
|
});
|
|
184
193
|
}
|
|
185
194
|
outputs.push({
|
|
@@ -210,7 +219,6 @@ exports.serverFnPlugin = {
|
|
|
210
219
|
outputs.push({
|
|
211
220
|
path: serverFnCdkConstructFile,
|
|
212
221
|
content: (0, serverFnCdkTemplate_1.serverFnCdkTemplate)(serverFnCdkConstructClassName, infos, importMap),
|
|
213
|
-
mergeHandler: protogen_1.protoMergeTsImports,
|
|
214
222
|
});
|
|
215
223
|
}
|
|
216
224
|
})
|