@modern-js/bff-generator 3.7.29 → 3.7.31
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/index.js +16 -304
- package/package.json +4 -4
- package/templates/framework/app/express/app.handlebars +0 -9
- package/templates/framework/app/koa/app.js.handlebars +0 -12
- package/templates/framework/app/koa/app.ts.handlebars +0 -12
- package/templates/function/app/js/express.js.handlebars +0 -8
- package/templates/function/app/js/koa.js.handlebars +0 -8
- package/templates/function/app/ts/express.ts.handlebars +0 -9
- package/templates/function/app/ts/koa.ts.handlebars +0 -9
- package/templates/function/base/index.handlebars +0 -7
- package/templates/function/info/[type].js.handlebars +0 -18
- package/templates/function/info/[type].ts.handlebars +0 -24
package/dist/index.js
CHANGED
|
@@ -86984,203 +86984,6 @@ var Language;
|
|
|
86984
86984
|
Language2["JS"] = "js";
|
|
86985
86985
|
})(Language || (Language = {}));
|
|
86986
86986
|
|
|
86987
|
-
// ../../generator-common/dist/esm-node/newAction/common/index.js
|
|
86988
|
-
var ActionType;
|
|
86989
|
-
(function(ActionType2) {
|
|
86990
|
-
ActionType2["Function"] = "function";
|
|
86991
|
-
ActionType2["Element"] = "element";
|
|
86992
|
-
ActionType2["Refactor"] = "refactor";
|
|
86993
|
-
})(ActionType || (ActionType = {}));
|
|
86994
|
-
var ActionElement;
|
|
86995
|
-
(function(ActionElement2) {
|
|
86996
|
-
ActionElement2["Entry"] = "entry";
|
|
86997
|
-
ActionElement2["Server"] = "server";
|
|
86998
|
-
})(ActionElement || (ActionElement = {}));
|
|
86999
|
-
var ActionFunction;
|
|
87000
|
-
(function(ActionFunction2) {
|
|
87001
|
-
ActionFunction2["TailwindCSS"] = "tailwindcss";
|
|
87002
|
-
ActionFunction2["BFF"] = "bff";
|
|
87003
|
-
ActionFunction2["MicroFrontend"] = "micro_frontend";
|
|
87004
|
-
ActionFunction2["I18n"] = "i18n";
|
|
87005
|
-
ActionFunction2["StorybookV7"] = "storybookV7";
|
|
87006
|
-
ActionFunction2["RuntimeApi"] = "runtimeApi";
|
|
87007
|
-
ActionFunction2["SSG"] = "ssg";
|
|
87008
|
-
ActionFunction2["Polyfill"] = "polyfill";
|
|
87009
|
-
ActionFunction2["Proxy"] = "proxy";
|
|
87010
|
-
ActionFunction2["SWC"] = "swc";
|
|
87011
|
-
ActionFunction2["ModuleDoc"] = "module_doc";
|
|
87012
|
-
})(ActionFunction || (ActionFunction = {}));
|
|
87013
|
-
var ActionRefactor;
|
|
87014
|
-
(function(ActionRefactor2) {
|
|
87015
|
-
ActionRefactor2["ReactRouter5"] = "react_router_5";
|
|
87016
|
-
})(ActionRefactor || (ActionRefactor = {}));
|
|
87017
|
-
|
|
87018
|
-
// ../../generator-common/dist/esm-node/mwa/common.js
|
|
87019
|
-
var Framework;
|
|
87020
|
-
(function(Framework2) {
|
|
87021
|
-
Framework2["Express"] = "express";
|
|
87022
|
-
Framework2["Koa"] = "koa";
|
|
87023
|
-
})(Framework || (Framework = {}));
|
|
87024
|
-
var getFrameworkSchema = (_extra = {}) => {
|
|
87025
|
-
return {
|
|
87026
|
-
type: "string",
|
|
87027
|
-
title: i18n2.t(localeKeys2.framework.self),
|
|
87028
|
-
enum: Object.values(Framework).map((framework) => ({
|
|
87029
|
-
value: framework,
|
|
87030
|
-
label: i18n2.t(localeKeys2.framework[framework])
|
|
87031
|
-
}))
|
|
87032
|
-
};
|
|
87033
|
-
};
|
|
87034
|
-
var FrameworkAppendTypeContent = {
|
|
87035
|
-
["express"]: `/// <reference types='@modern-js/plugin-express/types' />`,
|
|
87036
|
-
["koa"]: `/// <reference types='@modern-js/plugin-koa/types' />`
|
|
87037
|
-
};
|
|
87038
|
-
|
|
87039
|
-
// ../../generator-common/dist/esm-node/newAction/mwa/index.js
|
|
87040
|
-
var MWAActionTypes = [
|
|
87041
|
-
ActionType.Element,
|
|
87042
|
-
ActionType.Function,
|
|
87043
|
-
ActionType.Refactor
|
|
87044
|
-
];
|
|
87045
|
-
var MWAActionFunctions = [
|
|
87046
|
-
ActionFunction.TailwindCSS,
|
|
87047
|
-
ActionFunction.BFF,
|
|
87048
|
-
ActionFunction.SSG,
|
|
87049
|
-
ActionFunction.SWC,
|
|
87050
|
-
ActionFunction.MicroFrontend,
|
|
87051
|
-
ActionFunction.Polyfill,
|
|
87052
|
-
ActionFunction.Proxy,
|
|
87053
|
-
ActionFunction.StorybookV7
|
|
87054
|
-
];
|
|
87055
|
-
var MWAActionElements = [
|
|
87056
|
-
ActionElement.Entry,
|
|
87057
|
-
ActionElement.Server
|
|
87058
|
-
];
|
|
87059
|
-
var MWAActionReactors = [
|
|
87060
|
-
ActionRefactor.ReactRouter5
|
|
87061
|
-
];
|
|
87062
|
-
var MWAActionTypesMap = {
|
|
87063
|
-
[ActionType.Element]: MWAActionElements,
|
|
87064
|
-
[ActionType.Function]: MWAActionFunctions,
|
|
87065
|
-
[ActionType.Refactor]: MWAActionReactors
|
|
87066
|
-
};
|
|
87067
|
-
var MWAActionFunctionsDevDependencies = {
|
|
87068
|
-
[ActionFunction.SSG]: "@modern-js/plugin-ssg",
|
|
87069
|
-
[ActionFunction.StorybookV7]: "@modern-js/storybook",
|
|
87070
|
-
[ActionFunction.Proxy]: "@modern-js/plugin-proxy",
|
|
87071
|
-
[ActionFunction.TailwindCSS]: "tailwindcss",
|
|
87072
|
-
[ActionFunction.SWC]: "@modern-js/plugin-swc"
|
|
87073
|
-
};
|
|
87074
|
-
var MWAActionFunctionsDependencies = {
|
|
87075
|
-
[ActionFunction.BFF]: "@modern-js/plugin-bff",
|
|
87076
|
-
[ActionFunction.MicroFrontend]: "@modern-js/plugin-garfish",
|
|
87077
|
-
[ActionFunction.TailwindCSS]: "@modern-js/plugin-tailwindcss",
|
|
87078
|
-
[ActionFunction.Polyfill]: "@modern-js/plugin-polyfill"
|
|
87079
|
-
};
|
|
87080
|
-
var MWAActionFunctionsAppendTypeContent = {
|
|
87081
|
-
[ActionFunction.MicroFrontend]: `/// <reference types='@modern-js/plugin-garfish/types' />`
|
|
87082
|
-
};
|
|
87083
|
-
var MWAActionRefactorDependencies = {
|
|
87084
|
-
[ActionRefactor.ReactRouter5]: "@modern-js/plugin-router-v5"
|
|
87085
|
-
};
|
|
87086
|
-
var MWAActionReactorAppendTypeContent = {
|
|
87087
|
-
[ActionRefactor.ReactRouter5]: `/// <reference types='@modern-js/plugin-router-v5/types' />`
|
|
87088
|
-
};
|
|
87089
|
-
var MWANewActionGenerators = {
|
|
87090
|
-
[ActionType.Element]: {
|
|
87091
|
-
[ActionElement.Entry]: "@modern-js/entry-generator",
|
|
87092
|
-
[ActionElement.Server]: "@modern-js/server-generator"
|
|
87093
|
-
},
|
|
87094
|
-
[ActionType.Function]: {
|
|
87095
|
-
[ActionFunction.TailwindCSS]: "@modern-js/tailwindcss-generator",
|
|
87096
|
-
[ActionFunction.BFF]: "@modern-js/bff-generator",
|
|
87097
|
-
[ActionFunction.MicroFrontend]: "@modern-js/dependence-generator",
|
|
87098
|
-
[ActionFunction.StorybookV7]: "@modern-js/storybook-next-generator",
|
|
87099
|
-
[ActionFunction.SSG]: "@modern-js/ssg-generator",
|
|
87100
|
-
[ActionFunction.Polyfill]: "@modern-js/dependence-generator",
|
|
87101
|
-
[ActionFunction.Proxy]: "@modern-js/dependence-generator",
|
|
87102
|
-
[ActionFunction.SWC]: "@modern-js/dependence-generator"
|
|
87103
|
-
},
|
|
87104
|
-
[ActionType.Refactor]: {
|
|
87105
|
-
[ActionRefactor.ReactRouter5]: "@modern-js/router-v5-generator"
|
|
87106
|
-
}
|
|
87107
|
-
};
|
|
87108
|
-
var MWANewActionPluginName = {
|
|
87109
|
-
[ActionType.Element]: {
|
|
87110
|
-
[ActionElement.Server]: "serverPlugin"
|
|
87111
|
-
},
|
|
87112
|
-
[ActionType.Function]: {
|
|
87113
|
-
[ActionFunction.TailwindCSS]: "tailwindcssPlugin",
|
|
87114
|
-
[ActionFunction.BFF]: "bffPlugin",
|
|
87115
|
-
[ActionFunction.MicroFrontend]: "garfishPlugin",
|
|
87116
|
-
[ActionFunction.SSG]: "ssgPlugin",
|
|
87117
|
-
[ActionFunction.Polyfill]: "polyfillPlugin",
|
|
87118
|
-
[ActionFunction.Proxy]: "proxyPlugin",
|
|
87119
|
-
[ActionFunction.SWC]: "swcPlugin"
|
|
87120
|
-
},
|
|
87121
|
-
[ActionType.Refactor]: {
|
|
87122
|
-
[ActionRefactor.ReactRouter5]: "routerPlugin"
|
|
87123
|
-
}
|
|
87124
|
-
};
|
|
87125
|
-
var MWANewActionPluginDependence = {
|
|
87126
|
-
[ActionType.Element]: {
|
|
87127
|
-
[ActionElement.Server]: "@modern-js/plugin-server"
|
|
87128
|
-
},
|
|
87129
|
-
[ActionType.Function]: {
|
|
87130
|
-
[ActionFunction.TailwindCSS]: "@modern-js/plugin-tailwindcss",
|
|
87131
|
-
[ActionFunction.BFF]: "@modern-js/plugin-bff",
|
|
87132
|
-
[ActionFunction.MicroFrontend]: "@modern-js/plugin-garfish",
|
|
87133
|
-
[ActionFunction.SSG]: "@modern-js/plugin-ssg",
|
|
87134
|
-
[ActionFunction.Polyfill]: "@modern-js/plugin-polyfill",
|
|
87135
|
-
[ActionFunction.Proxy]: "@modern-js/plugin-proxy",
|
|
87136
|
-
[ActionFunction.SWC]: "@modern-js/plugin-swc"
|
|
87137
|
-
},
|
|
87138
|
-
[ActionType.Refactor]: {
|
|
87139
|
-
[ActionRefactor.ReactRouter5]: "@modern-js/plugin-router-v5"
|
|
87140
|
-
}
|
|
87141
|
-
};
|
|
87142
|
-
var BFFPluginName = {
|
|
87143
|
-
[Framework.Express]: "expressPlugin",
|
|
87144
|
-
[Framework.Koa]: "koaPlugin"
|
|
87145
|
-
};
|
|
87146
|
-
var BFFPluginDependence = {
|
|
87147
|
-
[Framework.Express]: "@modern-js/plugin-express",
|
|
87148
|
-
[Framework.Koa]: "@modern-js/plugin-koa"
|
|
87149
|
-
};
|
|
87150
|
-
|
|
87151
|
-
// ../../generator-common/dist/esm-node/mwa/bff.js
|
|
87152
|
-
var BFFType;
|
|
87153
|
-
(function(BFFType2) {
|
|
87154
|
-
BFFType2["Func"] = "func";
|
|
87155
|
-
BFFType2["Framework"] = "framework";
|
|
87156
|
-
})(BFFType || (BFFType = {}));
|
|
87157
|
-
var getBFFTypeSchema = (_extra = {}) => {
|
|
87158
|
-
return {
|
|
87159
|
-
type: "string",
|
|
87160
|
-
title: i18n2.t(localeKeys2.bff.bffType.self),
|
|
87161
|
-
enum: Object.values(BFFType).map((bffType) => ({
|
|
87162
|
-
value: bffType,
|
|
87163
|
-
label: i18n2.t(localeKeys2.bff.bffType[bffType])
|
|
87164
|
-
}))
|
|
87165
|
-
};
|
|
87166
|
-
};
|
|
87167
|
-
var getBFFchemaProperties = (extra) => {
|
|
87168
|
-
return {
|
|
87169
|
-
bffType: getBFFTypeSchema(extra),
|
|
87170
|
-
framework: getFrameworkSchema(extra)
|
|
87171
|
-
};
|
|
87172
|
-
};
|
|
87173
|
-
var getBFFSchema = (extra = {}) => {
|
|
87174
|
-
return {
|
|
87175
|
-
type: "object",
|
|
87176
|
-
properties: getBFFchemaProperties(extra)
|
|
87177
|
-
};
|
|
87178
|
-
};
|
|
87179
|
-
var MWADefaultBffConfig = {
|
|
87180
|
-
bffType: "func",
|
|
87181
|
-
frameWork: Framework.Express
|
|
87182
|
-
};
|
|
87183
|
-
|
|
87184
86987
|
// ../../generator-utils/dist/esm/index.js
|
|
87185
86988
|
var import_path5 = __toESM(require("path"));
|
|
87186
86989
|
|
|
@@ -88491,7 +88294,6 @@ function isEmptyApiDir(apiDir) {
|
|
|
88491
88294
|
}
|
|
88492
88295
|
var handleTemplateFile = (context, generator, appApi) => __async(void 0, null, function* () {
|
|
88493
88296
|
const jsonAPI = new JsonAPI(generator);
|
|
88494
|
-
const ans = yield appApi.getInputBySchemaFunc(getBFFSchema, context.config);
|
|
88495
88297
|
const appDir = context.materials.default.basePath;
|
|
88496
88298
|
const apiDir = import_path6.default.join(appDir, "api");
|
|
88497
88299
|
if (import_fs_extra.default.existsSync(apiDir) && !isEmptyApiDir(apiDir)) {
|
|
@@ -88501,7 +88303,6 @@ var handleTemplateFile = (context, generator, appApi) => __async(void 0, null, f
|
|
|
88501
88303
|
throw Error("The 'api' directory is already exist");
|
|
88502
88304
|
}
|
|
88503
88305
|
}
|
|
88504
|
-
const { bffType, framework } = ans;
|
|
88505
88306
|
const language = isTsProject(appDir) ? Language.TS : Language.JS;
|
|
88506
88307
|
const getBffPluginVersion = (packageName) => {
|
|
88507
88308
|
return getModernPluginVersion(Solution.MWA, packageName, {
|
|
@@ -88510,34 +88311,18 @@ var handleTemplateFile = (context, generator, appApi) => __async(void 0, null, f
|
|
|
88510
88311
|
cwd: context.materials.default.basePath
|
|
88511
88312
|
});
|
|
88512
88313
|
};
|
|
88513
|
-
context.config.bffPluginName = BFFPluginName[framework];
|
|
88514
|
-
context.config.bffPluginDependence = BFFPluginDependence[framework];
|
|
88515
|
-
let updateInfo = {};
|
|
88516
|
-
if (framework === Framework.Express || framework === Framework.Koa) {
|
|
88517
|
-
updateInfo = {
|
|
88518
|
-
[`devDependencies.@types/${framework}`]: `~${yield getPackageVersion(`@types/${framework}`)}`
|
|
88519
|
-
};
|
|
88520
|
-
}
|
|
88521
|
-
updateInfo = __spreadProps(__spreadValues({}, updateInfo), {
|
|
88522
|
-
[`dependencies.${framework}`]: `~${yield getPackageVersion(
|
|
88523
|
-
framework
|
|
88524
|
-
)}`
|
|
88525
|
-
});
|
|
88526
88314
|
yield jsonAPI.update(
|
|
88527
88315
|
context.materials.default.get(import_path6.default.join(appDir, "package.json")),
|
|
88528
88316
|
{
|
|
88529
88317
|
query: {},
|
|
88530
88318
|
update: {
|
|
88531
|
-
$set:
|
|
88319
|
+
$set: {
|
|
88532
88320
|
"dependencies.@modern-js/plugin-bff": `${yield getBffPluginVersion(
|
|
88533
88321
|
"@modern-js/plugin-bff"
|
|
88534
88322
|
)}`,
|
|
88535
|
-
[`dependencies.@modern-js/plugin-${framework}`]: `${yield getBffPluginVersion(
|
|
88536
|
-
`@modern-js/plugin-${framework}`
|
|
88537
|
-
)}`,
|
|
88538
88323
|
"devDependencies.ts-node": "~10.8.1",
|
|
88539
88324
|
"devDependencies.tsconfig-paths": "~3.14.1"
|
|
88540
|
-
}
|
|
88325
|
+
}
|
|
88541
88326
|
}
|
|
88542
88327
|
},
|
|
88543
88328
|
true
|
|
@@ -88559,81 +88344,24 @@ var handleTemplateFile = (context, generator, appApi) => __async(void 0, null, f
|
|
|
88559
88344
|
);
|
|
88560
88345
|
}
|
|
88561
88346
|
}
|
|
88562
|
-
if (
|
|
88563
|
-
|
|
88564
|
-
|
|
88565
|
-
|
|
88566
|
-
{
|
|
88567
|
-
|
|
88568
|
-
|
|
88569
|
-
|
|
88570
|
-
"compilerOptions.paths.@api/*": ["./api/*"]
|
|
88571
|
-
}
|
|
88347
|
+
if (language === Language.TS) {
|
|
88348
|
+
yield jsonAPI.update(
|
|
88349
|
+
context.materials.default.get(import_path6.default.join(appDir, "tsconfig.json")),
|
|
88350
|
+
{
|
|
88351
|
+
query: {},
|
|
88352
|
+
update: {
|
|
88353
|
+
$set: {
|
|
88354
|
+
"compilerOptions.paths.@api/*": ["./api/lambda/*"]
|
|
88572
88355
|
}
|
|
88573
|
-
}
|
|
88574
|
-
|
|
88575
|
-
|
|
88576
|
-
}
|
|
88577
|
-
yield appApi.forgeTemplate(
|
|
88578
|
-
"templates/function/base/*",
|
|
88579
|
-
void 0,
|
|
88580
|
-
(resourceKey) => resourceKey.replace("templates/function/base/", "api/").replace(".handlebars", `.${language}`)
|
|
88581
|
-
);
|
|
88582
|
-
yield appApi.forgeTemplate(
|
|
88583
|
-
`templates/function/info/*`,
|
|
88584
|
-
(resourceKey) => resourceKey.includes(language),
|
|
88585
|
-
(resourceKey) => resourceKey.replace("templates/function/info/", "api/info/").replace(".handlebars", ``)
|
|
88356
|
+
}
|
|
88357
|
+
},
|
|
88358
|
+
true
|
|
88586
88359
|
);
|
|
88587
|
-
yield appApi.forgeTemplate(
|
|
88588
|
-
`templates/function/app/${language}/${framework}.${language}.handlebars`,
|
|
88589
|
-
void 0,
|
|
88590
|
-
(resourceKey) => resourceKey.replace(
|
|
88591
|
-
`templates/function/app/${language}/${framework}.${language}.handlebars`,
|
|
88592
|
-
`api/_app.${language}`
|
|
88593
|
-
)
|
|
88594
|
-
);
|
|
88595
|
-
} else {
|
|
88596
|
-
if (language === Language.TS) {
|
|
88597
|
-
yield jsonAPI.update(
|
|
88598
|
-
context.materials.default.get(import_path6.default.join(appDir, "tsconfig.json")),
|
|
88599
|
-
{
|
|
88600
|
-
query: {},
|
|
88601
|
-
update: {
|
|
88602
|
-
$set: {
|
|
88603
|
-
"compilerOptions.paths.@api/*": ["./api/lambda/*"]
|
|
88604
|
-
}
|
|
88605
|
-
}
|
|
88606
|
-
},
|
|
88607
|
-
true
|
|
88608
|
-
);
|
|
88609
|
-
}
|
|
88610
88360
|
yield appApi.forgeTemplate(
|
|
88611
88361
|
`templates/framework/lambda/*`,
|
|
88612
88362
|
void 0,
|
|
88613
88363
|
(resourceKey) => resourceKey.replace(`templates/framework/`, "api/").replace(".handlebars", `.${language}`)
|
|
88614
88364
|
);
|
|
88615
|
-
yield appApi.forgeTemplate(
|
|
88616
|
-
`templates/framework/app/${framework}/**/*`,
|
|
88617
|
-
(resourceKey) => framework === Framework.Koa ? resourceKey.includes(language) : true,
|
|
88618
|
-
(resourceKey) => resourceKey.replace(`templates/framework/app/${framework}/`, "api/").replace(
|
|
88619
|
-
".handlebars",
|
|
88620
|
-
framework === Framework.Express ? `.${language}` : ""
|
|
88621
|
-
)
|
|
88622
|
-
);
|
|
88623
|
-
}
|
|
88624
|
-
const appendTypeContent = FrameworkAppendTypeContent[framework];
|
|
88625
|
-
if (appendTypeContent && language === Language.TS) {
|
|
88626
|
-
const typePath = import_path6.default.join(appDir, "src", "modern-app-env.d.ts");
|
|
88627
|
-
if (import_fs_extra.default.existsSync(typePath)) {
|
|
88628
|
-
const npmrc = import_fs_extra.default.readFileSync(typePath, "utf-8");
|
|
88629
|
-
if (!npmrc.includes(appendTypeContent)) {
|
|
88630
|
-
import_fs_extra.default.writeFileSync(typePath, `${npmrc}${appendTypeContent}
|
|
88631
|
-
`, "utf-8");
|
|
88632
|
-
}
|
|
88633
|
-
} else {
|
|
88634
|
-
import_fs_extra.default.ensureFileSync(typePath);
|
|
88635
|
-
import_fs_extra.default.writeFileSync(typePath, appendTypeContent, "utf-8");
|
|
88636
|
-
}
|
|
88637
88365
|
}
|
|
88638
88366
|
});
|
|
88639
88367
|
var src_default = (context, generator) => __async(void 0, null, function* () {
|
|
@@ -88664,13 +88392,7 @@ var src_default = (context, generator) => __async(void 0, null, function* () {
|
|
|
88664
88392
|
const appDir = context.materials.default.basePath;
|
|
88665
88393
|
const configFile = yield getModernConfigFile(appDir);
|
|
88666
88394
|
const isTS = configFile.endsWith("ts");
|
|
88667
|
-
const {
|
|
88668
|
-
pluginName,
|
|
88669
|
-
bffPluginName,
|
|
88670
|
-
pluginDependence,
|
|
88671
|
-
bffPluginDependence,
|
|
88672
|
-
shouldUsePluginNameExport
|
|
88673
|
-
} = context.config;
|
|
88395
|
+
const { pluginName, pluginDependence, shouldUsePluginNameExport } = context.config;
|
|
88674
88396
|
console.info(
|
|
88675
88397
|
import_chalk.default.green(`
|
|
88676
88398
|
[INFO]`),
|
|
@@ -88685,33 +88407,23 @@ var src_default = (context, generator) => __async(void 0, null, function* () {
|
|
|
88685
88407
|
`import { ${pluginName} } from '${pluginDependence}';`
|
|
88686
88408
|
)
|
|
88687
88409
|
);
|
|
88688
|
-
console.info(
|
|
88689
|
-
import_chalk.default.yellow.bold(
|
|
88690
|
-
`import { ${bffPluginName} } from '${bffPluginDependence}';`
|
|
88691
|
-
)
|
|
88692
|
-
);
|
|
88693
88410
|
} else {
|
|
88694
88411
|
console.info(
|
|
88695
88412
|
import_chalk.default.yellow.bold(`import ${pluginName} from '${pluginDependence}';`)
|
|
88696
88413
|
);
|
|
88697
|
-
console.info(
|
|
88698
|
-
import_chalk.default.yellow.bold(
|
|
88699
|
-
`import ${bffPluginName} from '${bffPluginDependence}';`
|
|
88700
|
-
)
|
|
88701
|
-
);
|
|
88702
88414
|
}
|
|
88703
88415
|
if (isTS) {
|
|
88704
88416
|
console.info(`
|
|
88705
88417
|
export default defineConfig({
|
|
88706
88418
|
...,
|
|
88707
|
-
plugins: [..., ${import_chalk.default.yellow.bold(`${pluginName}()
|
|
88419
|
+
plugins: [..., ${import_chalk.default.yellow.bold(`${pluginName}()`)}],
|
|
88708
88420
|
});
|
|
88709
88421
|
`);
|
|
88710
88422
|
} else {
|
|
88711
88423
|
console.info(`
|
|
88712
88424
|
module.exports = {
|
|
88713
88425
|
...,
|
|
88714
|
-
plugins: [..., ${import_chalk.default.yellow.bold(`${pluginName}()
|
|
88426
|
+
plugins: [..., ${import_chalk.default.yellow.bold(`${pluginName}()`)}],
|
|
88715
88427
|
};
|
|
88716
88428
|
`);
|
|
88717
88429
|
}
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "3.7.
|
|
18
|
+
"version": "3.7.31",
|
|
19
19
|
"jsnext:source": "./src/index.ts",
|
|
20
20
|
"types": "./src/index.ts",
|
|
21
21
|
"main": "./dist/index.js",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"@types/node": "^14",
|
|
33
33
|
"jest": "^29",
|
|
34
34
|
"typescript": "^5",
|
|
35
|
-
"@modern-js/generator-common": "3.7.
|
|
36
|
-
"@modern-js/generator-utils": "3.7.
|
|
37
|
-
"@modern-js/plugin-i18n": "2.67.
|
|
35
|
+
"@modern-js/generator-common": "3.7.31",
|
|
36
|
+
"@modern-js/generator-utils": "3.7.31",
|
|
37
|
+
"@modern-js/plugin-i18n": "2.67.6",
|
|
38
38
|
"@scripts/build": "2.66.0",
|
|
39
39
|
"@scripts/jest-config": "2.66.0"
|
|
40
40
|
},
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { hook } from '@modern-js/runtime/server';
|
|
2
|
-
import { Request, Response, NextFunction } from 'express';
|
|
3
|
-
|
|
4
|
-
export default hook(({ addMiddleware }) => {
|
|
5
|
-
addMiddleware(async (req: Request, res: Response, next: NextFunction) => {
|
|
6
|
-
console.info(`access url: ${req.url}`);
|
|
7
|
-
next();
|
|
8
|
-
});
|
|
9
|
-
});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export default async (type, { query }) => {
|
|
2
|
-
const { username } = query;
|
|
3
|
-
return {
|
|
4
|
-
type,
|
|
5
|
-
username,
|
|
6
|
-
message: 'Hello Modern.js',
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export const post = async (type, { query, data }) => {
|
|
11
|
-
const { username } = query;
|
|
12
|
-
const { message } = data;
|
|
13
|
-
return Promise.resolve({
|
|
14
|
-
type,
|
|
15
|
-
username,
|
|
16
|
-
message: `Hello Modern.js. Your message: ${message}`,
|
|
17
|
-
});
|
|
18
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
type UserQuery = { username: string };
|
|
2
|
-
type UserPostData = { message: string };
|
|
3
|
-
|
|
4
|
-
export default async (type: string, { query }: { query: UserQuery }) => {
|
|
5
|
-
const { username } = query;
|
|
6
|
-
return {
|
|
7
|
-
type,
|
|
8
|
-
username,
|
|
9
|
-
message: 'Hello Modern.js',
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const post = async (
|
|
14
|
-
type: string,
|
|
15
|
-
{ query, data }: { query: UserQuery; data: UserPostData },
|
|
16
|
-
) => {
|
|
17
|
-
const { username } = query;
|
|
18
|
-
const { message } = data;
|
|
19
|
-
return Promise.resolve({
|
|
20
|
-
type,
|
|
21
|
-
username,
|
|
22
|
-
message: `Hello Modern.js. Your message: ${message}`,
|
|
23
|
-
});
|
|
24
|
-
};
|