@lcap/nasl-unified-frontend-generator 4.1.0-beta.2 → 4.1.0-beta.20
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.d.mts +107 -17
- package/dist/index.d.ts +107 -17
- package/dist/index.js +325 -205
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +321 -200
- package/dist/index.mjs.map +1 -1
- package/dist/playground.js +129551 -223
- package/dist/playground.js.map +1 -1
- package/dist/playground.mjs +129547 -218
- package/dist/playground.mjs.map +1 -1
- package/package.json +6 -6
package/dist/index.mjs
CHANGED
|
@@ -103,11 +103,11 @@ import axios2 from "axios";
|
|
|
103
103
|
import { trimStart } from "lodash";
|
|
104
104
|
|
|
105
105
|
// src/default-container.ts
|
|
106
|
-
import { Container as
|
|
106
|
+
import { Container as Container21 } from "inversify";
|
|
107
107
|
|
|
108
108
|
// src/plugins/vue/vue3/vue3-preset-plugin.ts
|
|
109
109
|
import "@abraham/reflection";
|
|
110
|
-
import { inject as inject15, injectable as
|
|
110
|
+
import { inject as inject15, injectable as injectable31 } from "inversify";
|
|
111
111
|
|
|
112
112
|
// src/service-metakind.ts
|
|
113
113
|
var ServiceMetaKind = {
|
|
@@ -1483,6 +1483,7 @@ import {
|
|
|
1483
1483
|
isUnparsed,
|
|
1484
1484
|
isValidationRule,
|
|
1485
1485
|
isVariable,
|
|
1486
|
+
isVariadicExpression,
|
|
1486
1487
|
isWhileStatement
|
|
1487
1488
|
} from "@lcap/nasl-concepts/asserts";
|
|
1488
1489
|
import { transfromMetadataType, transformUnionTypeAnnotation } from "@lcap/nasl-concepts/service";
|
|
@@ -2672,6 +2673,9 @@ query: {`;
|
|
|
2672
2673
|
s2.right,
|
|
2673
2674
|
callbackBag
|
|
2674
2675
|
)}`;
|
|
2676
|
+
} else if (isVariadicExpression(s2)) {
|
|
2677
|
+
const expressions = s2.expressions.map((exp) => getRuntimeStr(exp, callbackBag));
|
|
2678
|
+
return expressions.join(s2.operator);
|
|
2675
2679
|
} else if (isMatchCase(s2)) {
|
|
2676
2680
|
const p = s2.parentNode;
|
|
2677
2681
|
if (!isMatch(p)) {
|
|
@@ -3882,12 +3886,13 @@ function getReactComponentName(c) {
|
|
|
3882
3886
|
return c.component.tag;
|
|
3883
3887
|
}
|
|
3884
3888
|
var ReactCodegenPlugin = class {
|
|
3885
|
-
constructor(javaScriptCodegen, reactStateManager, frontendPerformance, projectOrganizer, entrypointManager, reactHookProviders) {
|
|
3889
|
+
constructor(javaScriptCodegen, reactStateManager, frontendPerformance, projectOrganizer, entrypointManager, rspackConfigPlugin, reactHookProviders) {
|
|
3886
3890
|
this.javaScriptCodegen = javaScriptCodegen;
|
|
3887
3891
|
this.reactStateManager = reactStateManager;
|
|
3888
3892
|
this.frontendPerformance = frontendPerformance;
|
|
3889
3893
|
this.projectOrganizer = projectOrganizer;
|
|
3890
3894
|
this.entrypointManager = entrypointManager;
|
|
3895
|
+
this.rspackConfigPlugin = rspackConfigPlugin;
|
|
3891
3896
|
this.reactHookProviders = reactHookProviders;
|
|
3892
3897
|
}
|
|
3893
3898
|
genReactFragment(c, ctx) {
|
|
@@ -4212,7 +4217,7 @@ var ReactCodegenPlugin = class {
|
|
|
4212
4217
|
const exts = packages.filter((x) => x.kind === "extension");
|
|
4213
4218
|
const imports = exts.map((ext) => {
|
|
4214
4219
|
return {
|
|
4215
|
-
from:
|
|
4220
|
+
from: `${ext.name}`,
|
|
4216
4221
|
import: `* as ${kebab2Pascal(ext.name)}`
|
|
4217
4222
|
};
|
|
4218
4223
|
}).filter(isNotNil);
|
|
@@ -4241,7 +4246,8 @@ var ReactCodegenPlugin = class {
|
|
|
4241
4246
|
* @param baseDir - 基目录
|
|
4242
4247
|
* @returns 组织后的文件列表
|
|
4243
4248
|
*/
|
|
4244
|
-
async genFiles(ir,
|
|
4249
|
+
async genFiles(ir, instruction) {
|
|
4250
|
+
const { baseDir, app, frontend, config, fs } = instruction;
|
|
4245
4251
|
const utilHooks = ReactFileDescription.empty("Hooks").merge(new ReactFileDescription("", [{ from: "./init" }], [], [])).merge(reactRouterPlugin.functions.__hooksDefinitions()).merge(apiClientPlugin.functions.__hooksDefinitions()).merge(reactComponentLibHackPlugin.functions.__hooksDefinitions()).merge(i18nPlugin.functions.__hooksDefinitions()).merge(this.buildLibraryHook(ir.packages)).merge(new ReactFileDescription("", [], [], [`export {nasl, genInitFromSchema};`]));
|
|
4246
4252
|
this.reactHookProviders?.forEach((reactHookProvider) => {
|
|
4247
4253
|
utilHooks.merge(reactHookProvider.genHookDefinition());
|
|
@@ -4261,6 +4267,13 @@ var ReactCodegenPlugin = class {
|
|
|
4261
4267
|
ir.configs.globalVariables,
|
|
4262
4268
|
ir.baseCtx
|
|
4263
4269
|
);
|
|
4270
|
+
const bundlerConfigFile = await this.rspackConfigPlugin.configBundlerConfig({
|
|
4271
|
+
app,
|
|
4272
|
+
frontend,
|
|
4273
|
+
config,
|
|
4274
|
+
fs,
|
|
4275
|
+
frameworkKind: "react"
|
|
4276
|
+
});
|
|
4264
4277
|
const files = await this.projectOrganizer.organize({
|
|
4265
4278
|
baseDir,
|
|
4266
4279
|
project: {
|
|
@@ -4273,7 +4286,8 @@ var ReactCodegenPlugin = class {
|
|
|
4273
4286
|
platformConfig: this.buildPlatformConfig(ir),
|
|
4274
4287
|
init: this.buildInit(ir),
|
|
4275
4288
|
masterCss,
|
|
4276
|
-
globalVariables
|
|
4289
|
+
globalVariables,
|
|
4290
|
+
bundlerConfigFile
|
|
4277
4291
|
}
|
|
4278
4292
|
});
|
|
4279
4293
|
return files;
|
|
@@ -4286,8 +4300,9 @@ ReactCodegenPlugin = __decorateClass([
|
|
|
4286
4300
|
__decorateParam(2, inject(ServiceMetaKind.FrontendPerformance)),
|
|
4287
4301
|
__decorateParam(3, inject(ServiceMetaKind.ProjectOrganizer)),
|
|
4288
4302
|
__decorateParam(4, inject(ServiceMetaKind.EntryPointManager)),
|
|
4289
|
-
__decorateParam(5,
|
|
4290
|
-
__decorateParam(
|
|
4303
|
+
__decorateParam(5, inject(ServiceMetaKind.FrontendBundlerFileConfig)),
|
|
4304
|
+
__decorateParam(6, multiInject(ServiceMetaKind.ReactHookProvider)),
|
|
4305
|
+
__decorateParam(6, optional())
|
|
4291
4306
|
], ReactCodegenPlugin);
|
|
4292
4307
|
function createImportIrFromReferencedComponent(c) {
|
|
4293
4308
|
switch (c.kind) {
|
|
@@ -4419,40 +4434,40 @@ var metadataPlugin = makePlugin({
|
|
|
4419
4434
|
// src/hack/material-config/material.config.js
|
|
4420
4435
|
var materials = {
|
|
4421
4436
|
framework: {
|
|
4422
|
-
version: "2.0
|
|
4437
|
+
version: "2.1.0",
|
|
4423
4438
|
core: "@lcap/basic-template",
|
|
4424
4439
|
pc: [
|
|
4425
4440
|
{
|
|
4426
4441
|
frameworkKind: "vue2",
|
|
4427
4442
|
name: "@lcap/pc-template",
|
|
4428
|
-
version: "2.0
|
|
4443
|
+
version: "2.1.0"
|
|
4429
4444
|
},
|
|
4430
4445
|
{
|
|
4431
4446
|
frameworkKind: "react",
|
|
4432
4447
|
name: "@lcap/pc-template-react",
|
|
4433
|
-
version: "2.0
|
|
4448
|
+
version: "2.1.0"
|
|
4434
4449
|
},
|
|
4435
4450
|
{
|
|
4436
4451
|
frameworkKind: "vue3",
|
|
4437
4452
|
name: "@lcap/pc-template-vue3",
|
|
4438
|
-
version: "2.0
|
|
4453
|
+
version: "2.1.0"
|
|
4439
4454
|
}
|
|
4440
4455
|
],
|
|
4441
4456
|
h5: [
|
|
4442
4457
|
{
|
|
4443
4458
|
frameworkKind: "vue2",
|
|
4444
4459
|
name: "@lcap/mobile-template",
|
|
4445
|
-
version: "2.0
|
|
4460
|
+
version: "2.1.0"
|
|
4446
4461
|
},
|
|
4447
4462
|
{
|
|
4448
4463
|
frameworkKind: "react",
|
|
4449
4464
|
name: "@lcap/mobile-template-react",
|
|
4450
|
-
version: "2.0
|
|
4465
|
+
version: "2.1.0"
|
|
4451
4466
|
},
|
|
4452
4467
|
{
|
|
4453
4468
|
frameworkKind: "vue3",
|
|
4454
4469
|
name: "@lcap/mobile-template-vue3",
|
|
4455
|
-
version: "2.0
|
|
4470
|
+
version: "2.1.0"
|
|
4456
4471
|
}
|
|
4457
4472
|
]
|
|
4458
4473
|
},
|
|
@@ -4503,7 +4518,7 @@ var materials = {
|
|
|
4503
4518
|
frameworkVersion: "vue@3.5.13",
|
|
4504
4519
|
name: "@lcap/vant",
|
|
4505
4520
|
libName: "LcapVant",
|
|
4506
|
-
version: "1.0.0
|
|
4521
|
+
version: "1.0.0"
|
|
4507
4522
|
}
|
|
4508
4523
|
]
|
|
4509
4524
|
},
|
|
@@ -4841,7 +4856,7 @@ function getReferencedLibComponent(e) {
|
|
|
4841
4856
|
if (tag === "Router") {
|
|
4842
4857
|
return { kind: "library", libraryName: "react-router-dom", tag: "Outlet" };
|
|
4843
4858
|
}
|
|
4844
|
-
const libraryName = foundExtension ?
|
|
4859
|
+
const libraryName = foundExtension ? `${foundExtension.name}` : DefaultComponentLibraryName;
|
|
4845
4860
|
return { kind: "library", libraryName, tag };
|
|
4846
4861
|
} else if (tag) {
|
|
4847
4862
|
return { kind: "library", libraryName: DefaultComponentLibraryName, tag };
|
|
@@ -5531,14 +5546,14 @@ var NASLAppIRBuilderPlugin = class {
|
|
|
5531
5546
|
}
|
|
5532
5547
|
enchanceHackForAppPackageInfos(app, commonAppConfig) {
|
|
5533
5548
|
app.loadPackageInfos(getPredefinedMaterialConfig());
|
|
5534
|
-
const
|
|
5535
|
-
|
|
5536
|
-
config.allNodesAPI = commonAppConfig.allNodesAPI;
|
|
5537
|
-
}
|
|
5538
|
-
config.allNodesAPI ??= {};
|
|
5549
|
+
const naslStoreConfig = getConfig();
|
|
5550
|
+
naslStoreConfig.allNodesAPI = commonAppConfig.allNodesAPI || {};
|
|
5539
5551
|
initialize({
|
|
5540
5552
|
getConfig: () => {
|
|
5541
|
-
return
|
|
5553
|
+
return {
|
|
5554
|
+
...commonAppConfig || {},
|
|
5555
|
+
...naslStoreConfig || {}
|
|
5556
|
+
};
|
|
5542
5557
|
}
|
|
5543
5558
|
});
|
|
5544
5559
|
}
|
|
@@ -5984,6 +5999,9 @@ var ProjectOrganizerPlugin = class {
|
|
|
5984
5999
|
const to = f.getFolder().replace(originalBizComponentsFolderMark, "/components/");
|
|
5985
6000
|
f.moveFileTo(to);
|
|
5986
6001
|
l2.debug(`${f.originalAbsolutePath} -> ${f.currentAbsolutePath}`);
|
|
6002
|
+
} else if (/(rspack|vite).config.(j|t)s$/.test(f.originalAbsolutePath)) {
|
|
6003
|
+
f.moveFileTo("/");
|
|
6004
|
+
l2.debug(`${f.originalAbsolutePath} -> ${f.currentAbsolutePath}`);
|
|
5987
6005
|
}
|
|
5988
6006
|
}
|
|
5989
6007
|
}
|
|
@@ -6820,10 +6838,10 @@ function normalizeStaticUrl(staticURL) {
|
|
|
6820
6838
|
return ensureUrlHasProtocol(staticURL.replace(/^\/\//, ""));
|
|
6821
6839
|
}
|
|
6822
6840
|
function getPublicPath(app, config, frontend) {
|
|
6841
|
+
let publicPath = `${getBasePath(app, config)}${frontend.basePath ?? ""}`;
|
|
6823
6842
|
if (config.isExport) {
|
|
6824
|
-
|
|
6843
|
+
publicPath = frontend.prefixPath || `/`;
|
|
6825
6844
|
}
|
|
6826
|
-
const publicPath = `${getBasePath(app, config)}${frontend.basePath ?? ""}`;
|
|
6827
6845
|
if (publicPath.endsWith("/")) {
|
|
6828
6846
|
return publicPath;
|
|
6829
6847
|
}
|
|
@@ -7040,6 +7058,7 @@ async function downloadDependenciesToLcapModules(feDeps, fs, config) {
|
|
|
7040
7058
|
downloadedDeps.forEach(({ pkgName, targetPath }) => {
|
|
7041
7059
|
packageJson.lcap_modules[pkgName] = `.${targetPath}`;
|
|
7042
7060
|
});
|
|
7061
|
+
packageJson = setApplicationName(packageJson, config.app?.name || config.app?.id);
|
|
7043
7062
|
fs.write("/package.json", JSON.stringify(packageJson, null, 2));
|
|
7044
7063
|
logger13.info("\u4E0B\u8F7D\u524D\u7AEF\u4F9D\u8D56\u5E93\u5230 lcap_modules \u76EE\u5F55\u5B8C\u6210");
|
|
7045
7064
|
} catch (error) {
|
|
@@ -7048,6 +7067,12 @@ async function downloadDependenciesToLcapModules(feDeps, fs, config) {
|
|
|
7048
7067
|
}
|
|
7049
7068
|
}
|
|
7050
7069
|
}
|
|
7070
|
+
function setApplicationName(packageJson, appName = Date.now().toString()) {
|
|
7071
|
+
if (packageJson && appName) {
|
|
7072
|
+
packageJson.name = appName;
|
|
7073
|
+
}
|
|
7074
|
+
return packageJson;
|
|
7075
|
+
}
|
|
7051
7076
|
|
|
7052
7077
|
// src/plugins/misc/bundler/bundler-config-data-plugin.ts
|
|
7053
7078
|
var logger11 = Logger("BundlerConfigDataPlugin");
|
|
@@ -7059,7 +7084,8 @@ var BundlerConfigDataPlugin = class {
|
|
|
7059
7084
|
const feDeps = [...extractAppLevelFrontendDeps(app), ...extractFrontendLevelDeps(frontend)];
|
|
7060
7085
|
await downloadDependenciesToLcapModules(feDeps, fs, {
|
|
7061
7086
|
STATIC_URL: config.STATIC_URL,
|
|
7062
|
-
frameworkKind
|
|
7087
|
+
frameworkKind,
|
|
7088
|
+
app
|
|
7063
7089
|
});
|
|
7064
7090
|
const orginDependencies = await downloadDependenciesToPackages(feDeps, fs, {
|
|
7065
7091
|
STATIC_URL: config.STATIC_URL
|
|
@@ -7069,13 +7095,12 @@ var BundlerConfigDataPlugin = class {
|
|
|
7069
7095
|
if (target) {
|
|
7070
7096
|
return {
|
|
7071
7097
|
name: dep.name,
|
|
7072
|
-
resolvedTo: `./src/${target}`.replace(/\/index\.js$/, "")
|
|
7073
|
-
scope: dep.kind === "extension" ? "@extension" : void 0
|
|
7098
|
+
resolvedTo: `./src/${target}`.replace(/\/index\.js$/, "")
|
|
7074
7099
|
};
|
|
7075
7100
|
}
|
|
7076
7101
|
return void 0;
|
|
7077
7102
|
}).filter(isNotNil).map((x) => {
|
|
7078
|
-
const name = x.
|
|
7103
|
+
const name = x.name;
|
|
7079
7104
|
return {
|
|
7080
7105
|
pkgName: name,
|
|
7081
7106
|
...x
|
|
@@ -7094,7 +7119,7 @@ var BundlerConfigDataPlugin = class {
|
|
|
7094
7119
|
const backendUrl = getBackendPath(app, config, logger11);
|
|
7095
7120
|
logger11.info(
|
|
7096
7121
|
{ publicPath, backendUrl, aliasMapStr },
|
|
7097
|
-
|
|
7122
|
+
"bundler\u914D\u7F6E"
|
|
7098
7123
|
);
|
|
7099
7124
|
this.frontendBundlerConfigPlugin.setCompilerConfig({
|
|
7100
7125
|
backendUrl,
|
|
@@ -7121,7 +7146,8 @@ var RspackConfigPlugin = class {
|
|
|
7121
7146
|
this.bundlerConfigDataPlugin = bundlerConfigDataPlugin;
|
|
7122
7147
|
this.frontendPerformancePlugin = frontendPerformancePlugin;
|
|
7123
7148
|
}
|
|
7124
|
-
async configBundlerConfig(
|
|
7149
|
+
async configBundlerConfig(instruction) {
|
|
7150
|
+
const { app, frontend, config, fs, frameworkKind } = instruction;
|
|
7125
7151
|
const { backendUrl, publicPath, aliasMapStr, dependenciesStr } = await this.bundlerConfigDataPlugin.getBundlerConfigData(
|
|
7126
7152
|
app,
|
|
7127
7153
|
frontend,
|
|
@@ -7138,17 +7164,42 @@ var RspackConfigPlugin = class {
|
|
|
7138
7164
|
);
|
|
7139
7165
|
}
|
|
7140
7166
|
rspackConfigSource = rspackConfigSource.replace(`const backendUrl = '';`, `const backendUrl = '${backendUrl}'`).replace(`const publicPath = '';`, `const publicPath = '${publicPath}';`).replace(`sourceMap: false,`, `sourceMap: ${config.env === "dev"},`).replace("alias: {}", `alias: {${aliasMapStr}}`).replace("const isDev = false", `const isDev = ${config.env === "dev"}`);
|
|
7141
|
-
if (config.needCompileViews && config.needCompileViews.length > 0 && config.cacheChunksMapCode) {
|
|
7167
|
+
if (!config.isExport && config.env === "dev" && config.needCompileViews && config.needCompileViews.length > 0 && config.cacheChunksMapCode) {
|
|
7142
7168
|
rspackConfigSource = rspackConfigSource.replace("isIncremental: false", "isIncremental: true").replace("chunksMap: ''", `chunksMap: \`${config.cacheChunksMapCode}\``);
|
|
7143
7169
|
}
|
|
7144
|
-
|
|
7145
|
-
|
|
7146
|
-
|
|
7147
|
-
|
|
7148
|
-
|
|
7149
|
-
|
|
7150
|
-
);
|
|
7170
|
+
rspackConfigSource = await this.processLoadOnDemand(rspackConfigSource, {
|
|
7171
|
+
app,
|
|
7172
|
+
frontend,
|
|
7173
|
+
config,
|
|
7174
|
+
fs,
|
|
7175
|
+
frameworkKind
|
|
7176
|
+
});
|
|
7177
|
+
}
|
|
7178
|
+
return new ReactFileDescription("rspack.config.js", [], [], [rspackConfigSource || ""]);
|
|
7179
|
+
}
|
|
7180
|
+
/**
|
|
7181
|
+
* 处理按需加载
|
|
7182
|
+
* 注意:此功能仅在非dev环境下的vue3框架中可以启用。
|
|
7183
|
+
* @param source 源代码
|
|
7184
|
+
* @param options 选项
|
|
7185
|
+
* @returns 处理后的代码
|
|
7186
|
+
*/
|
|
7187
|
+
async processLoadOnDemand(source, options) {
|
|
7188
|
+
let code = source;
|
|
7189
|
+
const { app, frontend, config, fs, frameworkKind } = options;
|
|
7190
|
+
const { env, feLoadDependenciesOnDemand, isExport } = config;
|
|
7191
|
+
const enablePerformance = feLoadDependenciesOnDemand && (isExport || env !== "dev") && ["vue3"].includes(frameworkKind);
|
|
7192
|
+
if (enablePerformance) {
|
|
7193
|
+
const feDeps = [...extractAppLevelFrontendDeps(app), ...extractFrontendLevelDeps(frontend)];
|
|
7194
|
+
code = code.replaceAll("// swc plugin placeholder", `experimental: {
|
|
7195
|
+
plugins: [
|
|
7196
|
+
['@lcap/swc-plugin-import', require('./scripts/generateSwcImportPluginConfig')([
|
|
7197
|
+
${feDeps.map((dep) => "'" + dep.name + "'").join(",\n")}
|
|
7198
|
+
])]
|
|
7199
|
+
]
|
|
7200
|
+
}`);
|
|
7151
7201
|
}
|
|
7202
|
+
return code;
|
|
7152
7203
|
}
|
|
7153
7204
|
static install(c) {
|
|
7154
7205
|
c.bind(ServiceMetaKind.FrontendBundlerFileConfig).to(RspackConfigPlugin).inSingletonScope();
|
|
@@ -7177,7 +7228,7 @@ var ReactPresetPlugin = class {
|
|
|
7177
7228
|
const frontend = app.findNodeByPath(instruction.frontend.nodePath);
|
|
7178
7229
|
const ir = this.irBuilder.buildIR(app, frontend, instruction.config);
|
|
7179
7230
|
const entryScript = this.microFrontendManager.produceScript(ir);
|
|
7180
|
-
const files = await this.reactCodeGenerator.genFiles(ir, instruction
|
|
7231
|
+
const files = await this.reactCodeGenerator.genFiles(ir, instruction);
|
|
7181
7232
|
const isDebug = instruction.config.debug;
|
|
7182
7233
|
const finalizedFiles = [
|
|
7183
7234
|
...files,
|
|
@@ -7558,10 +7609,16 @@ var Vue3LibrariesBuilderPlugin = class {
|
|
|
7558
7609
|
const exportArr = [];
|
|
7559
7610
|
const standardLib = ir.packages.find((x) => x.kind === "standard");
|
|
7560
7611
|
if (standardLib) {
|
|
7561
|
-
|
|
7562
|
-
|
|
7563
|
-
|
|
7564
|
-
|
|
7612
|
+
importArr.push(`import { ConfigProvider, transformKeys, Message, install } from '${standardLib.name}';`);
|
|
7613
|
+
exportArr.push(`export const LcapStandardUI = window.lcapStandardUI = {
|
|
7614
|
+
ConfigProvider,
|
|
7615
|
+
transformKeys,
|
|
7616
|
+
Message,
|
|
7617
|
+
install: (app) => {
|
|
7618
|
+
install(app);
|
|
7619
|
+
app.config.globalProperties.$message = Message;
|
|
7620
|
+
},
|
|
7621
|
+
};`);
|
|
7565
7622
|
const isPackageZipExists = await judgePackageZipExists(standardLib, config.STATIC_URL);
|
|
7566
7623
|
importArr.push(
|
|
7567
7624
|
`import '${standardLib.name}${isPackageZipExists ? "/dist-theme" : ""}/index.css';`
|
|
@@ -7569,18 +7626,31 @@ var Vue3LibrariesBuilderPlugin = class {
|
|
|
7569
7626
|
}
|
|
7570
7627
|
const extensions = ir.packages.filter((x) => x.kind === "extension");
|
|
7571
7628
|
for (const ext of extensions) {
|
|
7572
|
-
const formattedName = kebab2Pascal(ext.name.split("/").at(-1));
|
|
7573
7629
|
const isPackageZipExists = await judgePackageZipExists(ext, config.STATIC_URL);
|
|
7574
|
-
const
|
|
7575
|
-
|
|
7576
|
-
|
|
7630
|
+
const { feLoadDependenciesOnDemand } = config;
|
|
7631
|
+
if (!feLoadDependenciesOnDemand && ext.used) {
|
|
7632
|
+
const formattedName = kebab2Pascal(ext.name.split("/").at(-1));
|
|
7633
|
+
importArr.push(`import { install as ${formattedName}Install } from '${ext.name}';`);
|
|
7634
|
+
exportArr.push(`export const ${formattedName} = {
|
|
7635
|
+
install: ${formattedName}Install || (() => {}),
|
|
7636
|
+
};`);
|
|
7637
|
+
}
|
|
7638
|
+
if (ext.used && ext.hasCss) {
|
|
7577
7639
|
importArr.push(
|
|
7578
|
-
`import '${
|
|
7640
|
+
`import '${ext.name}${isPackageZipExists ? "/dist-theme" : ""}/index.css';`
|
|
7579
7641
|
);
|
|
7580
7642
|
}
|
|
7581
7643
|
}
|
|
7582
7644
|
return new ReactFileDescription("libraries.ts", [], [], [[...importArr, ...exportArr].join("\n")]);
|
|
7583
7645
|
}
|
|
7646
|
+
findPackageByNameFromAllNodesAPI(name, allNodesAPI = {}) {
|
|
7647
|
+
for (const key in allNodesAPI) {
|
|
7648
|
+
if (allNodesAPI[key]?.package?.name === name) {
|
|
7649
|
+
return allNodesAPI[key].package;
|
|
7650
|
+
}
|
|
7651
|
+
}
|
|
7652
|
+
return void 0;
|
|
7653
|
+
}
|
|
7584
7654
|
static install(c) {
|
|
7585
7655
|
c.bind(Vue3LibrariesBuilderPlugin).toSelf();
|
|
7586
7656
|
return c;
|
|
@@ -7795,7 +7865,7 @@ ComponentPathManager = __decorateClass([
|
|
|
7795
7865
|
injectable29()
|
|
7796
7866
|
], ComponentPathManager);
|
|
7797
7867
|
var Vue3ApplicationAssemblerPlugin = class {
|
|
7798
|
-
constructor(vue3CodegenPlugin, routesExtactor, routerBuilder, entryBuilder, librariesBuilder, entryCssBuilder, componentsIndexBuilder, clientLazyloadTemplateBuilder, platformBuilder, metaDataBuilder) {
|
|
7868
|
+
constructor(vue3CodegenPlugin, routesExtactor, routerBuilder, entryBuilder, librariesBuilder, entryCssBuilder, componentsIndexBuilder, clientLazyloadTemplateBuilder, platformBuilder, metaDataBuilder, rspackConfigPlugin) {
|
|
7799
7869
|
this.vue3CodegenPlugin = vue3CodegenPlugin;
|
|
7800
7870
|
this.routesExtactor = routesExtactor;
|
|
7801
7871
|
this.routerBuilder = routerBuilder;
|
|
@@ -7806,8 +7876,10 @@ var Vue3ApplicationAssemblerPlugin = class {
|
|
|
7806
7876
|
this.clientLazyloadTemplateBuilder = clientLazyloadTemplateBuilder;
|
|
7807
7877
|
this.platformBuilder = platformBuilder;
|
|
7808
7878
|
this.metaDataBuilder = metaDataBuilder;
|
|
7879
|
+
this.rspackConfigPlugin = rspackConfigPlugin;
|
|
7809
7880
|
}
|
|
7810
|
-
async assemble(ir,
|
|
7881
|
+
async assemble(ir, instruction) {
|
|
7882
|
+
const { config, fs, app, frontend } = instruction;
|
|
7811
7883
|
const manager = new ComponentPathManager();
|
|
7812
7884
|
const views = ir.views.flatMap((x) => {
|
|
7813
7885
|
return this.vue3CodegenPlugin.genFiles(x, manager);
|
|
@@ -7828,6 +7900,13 @@ var Vue3ApplicationAssemblerPlugin = class {
|
|
|
7828
7900
|
});
|
|
7829
7901
|
const routerFile = new ReactFileDescription("router.ts", router.imports, [], [router.code]);
|
|
7830
7902
|
const libraries = await this.librariesBuilder.buildLibrariesImport(ir, config);
|
|
7903
|
+
const bundlerConfigFile = await this.rspackConfigPlugin.configBundlerConfig({
|
|
7904
|
+
app,
|
|
7905
|
+
frontend,
|
|
7906
|
+
config,
|
|
7907
|
+
fs,
|
|
7908
|
+
frameworkKind: "vue3"
|
|
7909
|
+
});
|
|
7831
7910
|
return {
|
|
7832
7911
|
views,
|
|
7833
7912
|
bizComponents,
|
|
@@ -7838,7 +7917,8 @@ var Vue3ApplicationAssemblerPlugin = class {
|
|
|
7838
7917
|
clientLazyloadTemplate: this.clientLazyloadTemplateBuilder.buildClientLazyloadTemplate(ir),
|
|
7839
7918
|
componentsIndex: this.componentsIndexBuilder.buildComponentsIndex(ir),
|
|
7840
7919
|
libraries,
|
|
7841
|
-
entryCss: this.entryCssBuilder.buildLibrariesImport(ir)
|
|
7920
|
+
entryCss: this.entryCssBuilder.buildLibrariesImport(ir),
|
|
7921
|
+
bundlerConfig: bundlerConfigFile
|
|
7842
7922
|
};
|
|
7843
7923
|
}
|
|
7844
7924
|
static install(container) {
|
|
@@ -7858,9 +7938,185 @@ Vue3ApplicationAssemblerPlugin = __decorateClass([
|
|
|
7858
7938
|
__decorateParam(6, inject14(Vue3ComponentsIndexBuilderPlugin)),
|
|
7859
7939
|
__decorateParam(7, inject14(Vue3ClientLazyloadTemplateBuilderPlugin)),
|
|
7860
7940
|
__decorateParam(8, inject14(Vue3PlatformBuilderPlugin)),
|
|
7861
|
-
__decorateParam(9, inject14(Vue3MetaDataBuilderPlugin))
|
|
7941
|
+
__decorateParam(9, inject14(Vue3MetaDataBuilderPlugin)),
|
|
7942
|
+
__decorateParam(10, inject14(ServiceMetaKind.FrontendBundlerFileConfig))
|
|
7862
7943
|
], Vue3ApplicationAssemblerPlugin);
|
|
7863
7944
|
|
|
7945
|
+
// src/plugins/misc/program-analysis/analyzer-manager-plugin.ts
|
|
7946
|
+
import { injectable as injectable30 } from "inversify";
|
|
7947
|
+
|
|
7948
|
+
// src/plugins/misc/program-analysis/analysis/async-analysis.ts
|
|
7949
|
+
function buildAsyncAnalyzer() {
|
|
7950
|
+
const resultCache = /* @__PURE__ */ new WeakMap();
|
|
7951
|
+
function isSubtreeAsync(node, analyzeFunc = analyze) {
|
|
7952
|
+
let hasAsync = false;
|
|
7953
|
+
node.traverseStrictChildrenWithPruning((n) => {
|
|
7954
|
+
if (n === node) {
|
|
7955
|
+
return false;
|
|
7956
|
+
}
|
|
7957
|
+
if (hasAsync) {
|
|
7958
|
+
return true;
|
|
7959
|
+
} else if (n) {
|
|
7960
|
+
hasAsync = analyzeFunc(n);
|
|
7961
|
+
return hasAsync;
|
|
7962
|
+
}
|
|
7963
|
+
});
|
|
7964
|
+
return hasAsync;
|
|
7965
|
+
}
|
|
7966
|
+
function analyze(node) {
|
|
7967
|
+
if (!node) {
|
|
7968
|
+
return false;
|
|
7969
|
+
}
|
|
7970
|
+
if (resultCache.has(node)) {
|
|
7971
|
+
return resultCache.get(node);
|
|
7972
|
+
}
|
|
7973
|
+
function dispatch(node2) {
|
|
7974
|
+
switch (node2.concept) {
|
|
7975
|
+
case "CallLogic": {
|
|
7976
|
+
const calleeNode = node2.getCallNode();
|
|
7977
|
+
return analyze(calleeNode) || isSubtreeAsync(node2);
|
|
7978
|
+
}
|
|
7979
|
+
case "CallInterface": {
|
|
7980
|
+
return true;
|
|
7981
|
+
}
|
|
7982
|
+
case "CallFunction": {
|
|
7983
|
+
return isSubtreeAsync(node2);
|
|
7984
|
+
}
|
|
7985
|
+
case "Match": {
|
|
7986
|
+
return isSubtreeAsync(node2);
|
|
7987
|
+
}
|
|
7988
|
+
case "Function": {
|
|
7989
|
+
return isSubtreeAsync(node2);
|
|
7990
|
+
}
|
|
7991
|
+
case "JSBlock": {
|
|
7992
|
+
return true;
|
|
7993
|
+
}
|
|
7994
|
+
case "ExternalDestination":
|
|
7995
|
+
case "Destination": {
|
|
7996
|
+
return true;
|
|
7997
|
+
}
|
|
7998
|
+
case "NewStructure":
|
|
7999
|
+
case "NewComposite":
|
|
8000
|
+
case "NewMap":
|
|
8001
|
+
case "NewList": {
|
|
8002
|
+
return isSubtreeAsync(node2);
|
|
8003
|
+
}
|
|
8004
|
+
case "SubLogic": {
|
|
8005
|
+
return true;
|
|
8006
|
+
}
|
|
8007
|
+
case "Logic": {
|
|
8008
|
+
if (node2.likeComponent) {
|
|
8009
|
+
return node2.subLogics?.some(analyze) || isSubtreeAsync(node2);
|
|
8010
|
+
} else {
|
|
8011
|
+
return true;
|
|
8012
|
+
}
|
|
8013
|
+
}
|
|
8014
|
+
case "AnonymousFunction": {
|
|
8015
|
+
return isSubtreeAsync(node2);
|
|
8016
|
+
}
|
|
8017
|
+
case "BindEvent": {
|
|
8018
|
+
return node2.logics?.some(analyze) ?? false;
|
|
8019
|
+
}
|
|
8020
|
+
case "Interface":
|
|
8021
|
+
case "OverriddenLogic": {
|
|
8022
|
+
return true;
|
|
8023
|
+
}
|
|
8024
|
+
default: {
|
|
8025
|
+
return isSubtreeAsync(node2);
|
|
8026
|
+
}
|
|
8027
|
+
}
|
|
8028
|
+
}
|
|
8029
|
+
resultCache.set(node, true);
|
|
8030
|
+
const res = dispatch(node);
|
|
8031
|
+
resultCache.set(node, res);
|
|
8032
|
+
return res;
|
|
8033
|
+
}
|
|
8034
|
+
return {
|
|
8035
|
+
query: (node) => {
|
|
8036
|
+
return { async: analyze(node) };
|
|
8037
|
+
}
|
|
8038
|
+
};
|
|
8039
|
+
}
|
|
8040
|
+
|
|
8041
|
+
// src/plugins/misc/program-analysis/analysis/dep-analysis.ts
|
|
8042
|
+
import { analyzeDepRef } from "@lcap/nasl-concepts";
|
|
8043
|
+
function analyzeDeps(ir, config) {
|
|
8044
|
+
const { views, bizComponents, packages } = ir;
|
|
8045
|
+
const deps = {};
|
|
8046
|
+
views.forEach((view) => {
|
|
8047
|
+
const { libs } = analyzeDepRef(view.__raw, config);
|
|
8048
|
+
for (const key in libs) {
|
|
8049
|
+
deps[key] = deps[key] || [];
|
|
8050
|
+
libs[key].forEach((importer) => {
|
|
8051
|
+
if (!deps[key].some((d) => d.key === importer.key)) {
|
|
8052
|
+
deps[key].push(importer);
|
|
8053
|
+
}
|
|
8054
|
+
});
|
|
8055
|
+
}
|
|
8056
|
+
});
|
|
8057
|
+
bizComponents.forEach((component) => {
|
|
8058
|
+
const { libs } = analyzeDepRef(component.__raw, config);
|
|
8059
|
+
for (const key in libs) {
|
|
8060
|
+
deps[key] = deps[key] || [];
|
|
8061
|
+
libs[key].forEach((importer) => {
|
|
8062
|
+
if (!deps[key].some((d) => d.key === importer.key)) {
|
|
8063
|
+
deps[key].push(importer);
|
|
8064
|
+
}
|
|
8065
|
+
});
|
|
8066
|
+
}
|
|
8067
|
+
});
|
|
8068
|
+
packages.forEach((pkg) => {
|
|
8069
|
+
if (deps[pkg.name]) {
|
|
8070
|
+
pkg.used = true;
|
|
8071
|
+
}
|
|
8072
|
+
});
|
|
8073
|
+
}
|
|
8074
|
+
|
|
8075
|
+
// src/plugins/misc/program-analysis/analyzer-manager-plugin.ts
|
|
8076
|
+
var AnalyzerManagerPlugin = class {
|
|
8077
|
+
constructor() {
|
|
8078
|
+
this.options = {
|
|
8079
|
+
depAnalysis: true
|
|
8080
|
+
};
|
|
8081
|
+
}
|
|
8082
|
+
preProcess(app, frontend, config) {
|
|
8083
|
+
const analyzer = buildAsyncAnalyzer();
|
|
8084
|
+
if (this.getOptions().asyncAnalysis) {
|
|
8085
|
+
app.analyzer = analyzer;
|
|
8086
|
+
}
|
|
8087
|
+
return { app, frontend, config };
|
|
8088
|
+
}
|
|
8089
|
+
postProcess(ir, config) {
|
|
8090
|
+
if (this.getOptions().depAnalysis) {
|
|
8091
|
+
analyzeDeps(ir, config);
|
|
8092
|
+
}
|
|
8093
|
+
return ir;
|
|
8094
|
+
}
|
|
8095
|
+
/**
|
|
8096
|
+
* 设置完整的分析选项
|
|
8097
|
+
* @param options
|
|
8098
|
+
*/
|
|
8099
|
+
setOptions(options) {
|
|
8100
|
+
this.options = options;
|
|
8101
|
+
}
|
|
8102
|
+
/**
|
|
8103
|
+
* 获取分析选项
|
|
8104
|
+
* @returns 分析选项
|
|
8105
|
+
*/
|
|
8106
|
+
getOptions() {
|
|
8107
|
+
return this.options;
|
|
8108
|
+
}
|
|
8109
|
+
static install(c) {
|
|
8110
|
+
c.bind(ServiceMetaKind.IRPreProcesser).to(AnalyzerManagerPlugin);
|
|
8111
|
+
c.bind(ServiceMetaKind.IRPostProcesser).to(AnalyzerManagerPlugin);
|
|
8112
|
+
c.bind(ServiceMetaKind.AnalyzerManager).to(AnalyzerManagerPlugin);
|
|
8113
|
+
return c;
|
|
8114
|
+
}
|
|
8115
|
+
};
|
|
8116
|
+
AnalyzerManagerPlugin = __decorateClass([
|
|
8117
|
+
injectable30()
|
|
8118
|
+
], AnalyzerManagerPlugin);
|
|
8119
|
+
|
|
7864
8120
|
// src/plugins/vue/vue3/vue3-preset-plugin.ts
|
|
7865
8121
|
var logger12 = Logger("Vue3PresetPlugin");
|
|
7866
8122
|
var Vue3PresetPlugin = class {
|
|
@@ -7901,7 +8157,7 @@ var Vue3PresetPlugin = class {
|
|
|
7901
8157
|
});
|
|
7902
8158
|
ir.bizComponents = [];
|
|
7903
8159
|
}
|
|
7904
|
-
const assembledApplication = await this.applicationAssembler.assemble(ir, instruction
|
|
8160
|
+
const assembledApplication = await this.applicationAssembler.assemble(ir, instruction);
|
|
7905
8161
|
const finalizedFiles = await this.projectOrganizer.organize({
|
|
7906
8162
|
baseDir: instruction.baseDir,
|
|
7907
8163
|
project: assembledApplication,
|
|
@@ -7936,6 +8192,7 @@ var Vue3PresetPlugin = class {
|
|
|
7936
8192
|
c = VueRouterPlugin.install(c);
|
|
7937
8193
|
c.bind(ServiceMetaKind.ProjectOrganizer).to(ProjectOrganizerPlugin);
|
|
7938
8194
|
c.bind(ServiceMetaKind.FileSystemProvider).to(FileSystemPlugin).inSingletonScope();
|
|
8195
|
+
c = AnalyzerManagerPlugin.install(c);
|
|
7939
8196
|
c = BundlerConfigDataPlugin.install(c);
|
|
7940
8197
|
c = RspackConfigPlugin.install(c);
|
|
7941
8198
|
c = FrontendBundlerConfigPlugin.install(c);
|
|
@@ -7954,7 +8211,7 @@ var Vue3PresetPlugin = class {
|
|
|
7954
8211
|
}
|
|
7955
8212
|
};
|
|
7956
8213
|
Vue3PresetPlugin = __decorateClass([
|
|
7957
|
-
|
|
8214
|
+
injectable31(),
|
|
7958
8215
|
__decorateParam(0, inject15(ServiceMetaKind.IRBuilder)),
|
|
7959
8216
|
__decorateParam(1, inject15(ServiceMetaKind.FileSystemProvider)),
|
|
7960
8217
|
__decorateParam(2, inject15(NpmPackageJSONManagerPlugin)),
|
|
@@ -7965,9 +8222,9 @@ Vue3PresetPlugin = __decorateClass([
|
|
|
7965
8222
|
// src/default-container.ts
|
|
7966
8223
|
function makeDefaultContainer(kind = "react") {
|
|
7967
8224
|
if (kind === "react") {
|
|
7968
|
-
return ReactPresetPlugin.install(new
|
|
8225
|
+
return ReactPresetPlugin.install(new Container21());
|
|
7969
8226
|
} else if (kind === "vue3") {
|
|
7970
|
-
return Vue3PresetPlugin.install(new
|
|
8227
|
+
return Vue3PresetPlugin.install(new Container21());
|
|
7971
8228
|
} else {
|
|
7972
8229
|
throw new Error(`\u672A\u5B9E\u73B0${kind}\u7684\u9ED8\u8BA4\u5BB9\u5668`);
|
|
7973
8230
|
}
|
|
@@ -8014,18 +8271,9 @@ async function translateNASLToApp(app, frontend, config, baseDir = "./out", cont
|
|
|
8014
8271
|
app,
|
|
8015
8272
|
frontend,
|
|
8016
8273
|
config,
|
|
8017
|
-
baseDir
|
|
8274
|
+
baseDir,
|
|
8275
|
+
fs
|
|
8018
8276
|
});
|
|
8019
|
-
const frontendBundlerFileConfig = container.get(
|
|
8020
|
-
ServiceMetaKind.FrontendBundlerFileConfig
|
|
8021
|
-
);
|
|
8022
|
-
await frontendBundlerFileConfig.configBundlerConfig(
|
|
8023
|
-
app,
|
|
8024
|
-
frontend,
|
|
8025
|
-
config,
|
|
8026
|
-
fs,
|
|
8027
|
-
frontend.frameworkKind
|
|
8028
|
-
);
|
|
8029
8277
|
if (container.isBound(ServiceMetaKind.CodeGenerationLifecycleHooks)) {
|
|
8030
8278
|
const hooks = container.getAll(
|
|
8031
8279
|
ServiceMetaKind.CodeGenerationLifecycleHooks
|
|
@@ -8104,7 +8352,11 @@ async function compileAsProject(app, frontend, config, container) {
|
|
|
8104
8352
|
logger13.info("\u8FDC\u7A0B\u52A0\u8F7D\u6A21\u677F\u6210\u529F");
|
|
8105
8353
|
const files = res.files;
|
|
8106
8354
|
Object.entries(files).forEach(([k, v]) => {
|
|
8107
|
-
|
|
8355
|
+
if (typeof v.code === "string") {
|
|
8356
|
+
fs.write(k, v.code);
|
|
8357
|
+
} else if (v.code?.type === "Buffer") {
|
|
8358
|
+
fs.write(k, Buffer.from(v.code.data));
|
|
8359
|
+
}
|
|
8108
8360
|
});
|
|
8109
8361
|
} catch (error) {
|
|
8110
8362
|
throw new Error(`\u8FDC\u7A0B\u52A0\u8F7D\u6A21\u677F\u5931\u8D25`);
|
|
@@ -8163,137 +8415,6 @@ async function compileNASLToReactDist(app, frontend, config, http) {
|
|
|
8163
8415
|
}
|
|
8164
8416
|
}
|
|
8165
8417
|
|
|
8166
|
-
// src/plugins/misc/program-analysis/analyzer-manager-plugin.ts
|
|
8167
|
-
import { injectable as injectable31 } from "inversify";
|
|
8168
|
-
|
|
8169
|
-
// src/plugins/misc/program-analysis/analysis/async-analysis.ts
|
|
8170
|
-
function buildAsyncAnalyzer() {
|
|
8171
|
-
const resultCache = /* @__PURE__ */ new WeakMap();
|
|
8172
|
-
function isSubtreeAsync(node, analyzeFunc = analyze) {
|
|
8173
|
-
let hasAsync = false;
|
|
8174
|
-
node.traverseStrictChildrenWithPruning((n) => {
|
|
8175
|
-
if (n === node) {
|
|
8176
|
-
return false;
|
|
8177
|
-
}
|
|
8178
|
-
if (hasAsync) {
|
|
8179
|
-
return true;
|
|
8180
|
-
} else if (n) {
|
|
8181
|
-
hasAsync = analyzeFunc(n);
|
|
8182
|
-
return hasAsync;
|
|
8183
|
-
}
|
|
8184
|
-
});
|
|
8185
|
-
return hasAsync;
|
|
8186
|
-
}
|
|
8187
|
-
function analyze(node) {
|
|
8188
|
-
if (!node) {
|
|
8189
|
-
return false;
|
|
8190
|
-
}
|
|
8191
|
-
if (resultCache.has(node)) {
|
|
8192
|
-
return resultCache.get(node);
|
|
8193
|
-
}
|
|
8194
|
-
function dispatch(node2) {
|
|
8195
|
-
switch (node2.concept) {
|
|
8196
|
-
case "CallLogic": {
|
|
8197
|
-
const calleeNode = node2.getCallNode();
|
|
8198
|
-
return analyze(calleeNode) || isSubtreeAsync(node2);
|
|
8199
|
-
}
|
|
8200
|
-
case "CallInterface": {
|
|
8201
|
-
return true;
|
|
8202
|
-
}
|
|
8203
|
-
case "CallFunction": {
|
|
8204
|
-
return isSubtreeAsync(node2);
|
|
8205
|
-
}
|
|
8206
|
-
case "Match": {
|
|
8207
|
-
return isSubtreeAsync(node2);
|
|
8208
|
-
}
|
|
8209
|
-
case "Function": {
|
|
8210
|
-
return isSubtreeAsync(node2);
|
|
8211
|
-
}
|
|
8212
|
-
case "JSBlock": {
|
|
8213
|
-
return true;
|
|
8214
|
-
}
|
|
8215
|
-
case "ExternalDestination":
|
|
8216
|
-
case "Destination": {
|
|
8217
|
-
return true;
|
|
8218
|
-
}
|
|
8219
|
-
case "NewStructure":
|
|
8220
|
-
case "NewComposite":
|
|
8221
|
-
case "NewMap":
|
|
8222
|
-
case "NewList": {
|
|
8223
|
-
return isSubtreeAsync(node2);
|
|
8224
|
-
}
|
|
8225
|
-
case "SubLogic": {
|
|
8226
|
-
return true;
|
|
8227
|
-
}
|
|
8228
|
-
case "Logic": {
|
|
8229
|
-
if (node2.likeComponent) {
|
|
8230
|
-
return node2.subLogics?.some(analyze) || isSubtreeAsync(node2);
|
|
8231
|
-
} else {
|
|
8232
|
-
return true;
|
|
8233
|
-
}
|
|
8234
|
-
}
|
|
8235
|
-
case "AnonymousFunction": {
|
|
8236
|
-
return isSubtreeAsync(node2);
|
|
8237
|
-
}
|
|
8238
|
-
case "BindEvent": {
|
|
8239
|
-
return node2.logics?.some(analyze) ?? false;
|
|
8240
|
-
}
|
|
8241
|
-
case "Interface":
|
|
8242
|
-
case "OverriddenLogic": {
|
|
8243
|
-
return true;
|
|
8244
|
-
}
|
|
8245
|
-
default: {
|
|
8246
|
-
return isSubtreeAsync(node2);
|
|
8247
|
-
}
|
|
8248
|
-
}
|
|
8249
|
-
}
|
|
8250
|
-
resultCache.set(node, true);
|
|
8251
|
-
const res = dispatch(node);
|
|
8252
|
-
resultCache.set(node, res);
|
|
8253
|
-
return res;
|
|
8254
|
-
}
|
|
8255
|
-
return {
|
|
8256
|
-
query: (node) => {
|
|
8257
|
-
return { async: analyze(node) };
|
|
8258
|
-
}
|
|
8259
|
-
};
|
|
8260
|
-
}
|
|
8261
|
-
|
|
8262
|
-
// src/plugins/misc/program-analysis/analyzer-manager-plugin.ts
|
|
8263
|
-
var AnalyzerManagerPlugin = class {
|
|
8264
|
-
constructor() {
|
|
8265
|
-
this.options = {};
|
|
8266
|
-
}
|
|
8267
|
-
preProcess(app, frontend, config) {
|
|
8268
|
-
const analyzer = buildAsyncAnalyzer();
|
|
8269
|
-
if (this.getOptions().asyncAnalysis) {
|
|
8270
|
-
app.analyzer = analyzer;
|
|
8271
|
-
}
|
|
8272
|
-
return { app, frontend, config };
|
|
8273
|
-
}
|
|
8274
|
-
/**
|
|
8275
|
-
* 设置完整的分析选项
|
|
8276
|
-
* @param options
|
|
8277
|
-
*/
|
|
8278
|
-
setOptions(options) {
|
|
8279
|
-
this.options = options;
|
|
8280
|
-
}
|
|
8281
|
-
/**
|
|
8282
|
-
* 获取分析选项
|
|
8283
|
-
* @returns 分析选项
|
|
8284
|
-
*/
|
|
8285
|
-
getOptions() {
|
|
8286
|
-
return this.options;
|
|
8287
|
-
}
|
|
8288
|
-
static install(c) {
|
|
8289
|
-
c.bind(ServiceMetaKind.IRPreProcesser).to(AnalyzerManagerPlugin);
|
|
8290
|
-
c.bind(ServiceMetaKind.AnalyzerManager).to(AnalyzerManagerPlugin);
|
|
8291
|
-
}
|
|
8292
|
-
};
|
|
8293
|
-
AnalyzerManagerPlugin = __decorateClass([
|
|
8294
|
-
injectable31()
|
|
8295
|
-
], AnalyzerManagerPlugin);
|
|
8296
|
-
|
|
8297
8418
|
// src/plugins/misc/name-mangler/name-mangler-manager-plugin.ts
|
|
8298
8419
|
import { injectable as injectable32 } from "inversify";
|
|
8299
8420
|
|