@lcap/nasl 4.3.0-rc.5 → 4.4.0-beta.3

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.
Files changed (173) hide show
  1. package/out/generator/annotation/full.d.ts.map +1 -1
  2. package/out/generator/annotation/full.js +0 -32
  3. package/out/generator/annotation/full.js.map +1 -1
  4. package/out/generator/genBundleFiles.d.ts +3 -2
  5. package/out/generator/genBundleFiles.d.ts.map +1 -1
  6. package/out/generator/genBundleFiles.js +178 -140
  7. package/out/generator/genBundleFiles.js.map +1 -1
  8. package/out/generator/genSimpleBundleFile.d.ts +19 -0
  9. package/out/generator/genSimpleBundleFile.d.ts.map +1 -0
  10. package/out/generator/genSimpleBundleFile.js +114 -0
  11. package/out/generator/genSimpleBundleFile.js.map +1 -0
  12. package/out/generator/index.d.ts +1 -0
  13. package/out/generator/index.d.ts.map +1 -1
  14. package/out/generator/index.js +1 -0
  15. package/out/generator/index.js.map +1 -1
  16. package/out/generator/qiankun.d.ts +1 -1
  17. package/out/generator/qiankun.d.ts.map +1 -1
  18. package/out/generator/qiankun.js +4 -1
  19. package/out/generator/qiankun.js.map +1 -1
  20. package/out/generator/release-body/data.d.ts.map +1 -1
  21. package/out/generator/release-body/data.js +34 -1
  22. package/out/generator/release-body/data.js.map +1 -1
  23. package/out/generator/release-body/utils.d.ts +2 -6
  24. package/out/generator/release-body/utils.d.ts.map +1 -1
  25. package/out/generator/release-body/utils.js +101 -3
  26. package/out/generator/release-body/utils.js.map +1 -1
  27. package/out/generator/templates/chunk.d.ts +11 -0
  28. package/out/generator/templates/chunk.d.ts.map +1 -0
  29. package/out/generator/templates/chunk.js +29 -0
  30. package/out/generator/templates/chunk.js.map +1 -0
  31. package/out/generator/templates/runtime.d.ts +7 -0
  32. package/out/generator/templates/runtime.d.ts.map +1 -0
  33. package/out/generator/templates/runtime.js +409 -0
  34. package/out/generator/templates/runtime.js.map +1 -0
  35. package/out/generator/ui-library-declaration/basic.d.ts.map +1 -1
  36. package/out/generator/ui-library-declaration/basic.js +5 -5
  37. package/out/generator/ui-library-declaration/basic.js.map +1 -1
  38. package/out/generator/ui-library-declaration/dependency.d.ts.map +1 -1
  39. package/out/generator/ui-library-declaration/dependency.js +3 -3
  40. package/out/generator/ui-library-declaration/dependency.js.map +1 -1
  41. package/out/index.d.ts +1 -0
  42. package/out/index.d.ts.map +1 -1
  43. package/out/index.js +1 -0
  44. package/out/index.js.map +1 -1
  45. package/out/manager/diagnostic.d.ts.map +1 -1
  46. package/out/manager/diagnostic.js +0 -1
  47. package/out/manager/diagnostic.js.map +1 -1
  48. package/out/natural/getContext/nasl2Files.d.ts +15 -0
  49. package/out/natural/getContext/nasl2Files.d.ts.map +1 -0
  50. package/out/natural/getContext/nasl2Files.js +75 -0
  51. package/out/natural/getContext/nasl2Files.js.map +1 -0
  52. package/out/natural/index.d.ts +5 -1
  53. package/out/natural/index.d.ts.map +1 -1
  54. package/out/natural/index.js +7 -1
  55. package/out/natural/index.js.map +1 -1
  56. package/out/natural/parseNaturalTS.d.ts +6 -8
  57. package/out/natural/parseNaturalTS.d.ts.map +1 -1
  58. package/out/natural/parseNaturalTS.js +205 -54
  59. package/out/natural/parseNaturalTS.js.map +1 -1
  60. package/out/natural/parseNaturalTSXView.d.ts +7 -0
  61. package/out/natural/parseNaturalTSXView.d.ts.map +1 -0
  62. package/out/natural/parseNaturalTSXView.js +722 -0
  63. package/out/natural/parseNaturalTSXView.js.map +1 -0
  64. package/out/natural/transform2BatchActions.d.ts +96 -0
  65. package/out/natural/transform2BatchActions.d.ts.map +1 -0
  66. package/out/natural/transform2BatchActions.js +387 -0
  67. package/out/natural/transform2BatchActions.js.map +1 -0
  68. package/out/natural/transformTS2UI.d.ts.map +1 -1
  69. package/out/natural/transformTS2UI.js +16 -25
  70. package/out/natural/transformTS2UI.js.map +1 -1
  71. package/out/natural/transformTSCode.d.ts +2 -2
  72. package/out/natural/transformTSCode.d.ts.map +1 -1
  73. package/out/natural/transformTSCode.js +19 -11
  74. package/out/natural/transformTSCode.js.map +1 -1
  75. package/out/natural/transforms/transform2Entity.d.ts +2 -2
  76. package/out/natural/transforms/transform2Entity.d.ts.map +1 -1
  77. package/out/natural/transforms/transform2Entity.js +31 -7
  78. package/out/natural/transforms/transform2Entity.js.map +1 -1
  79. package/out/natural/transforms/transform2Enum.d.ts +2 -2
  80. package/out/natural/transforms/transform2Enum.d.ts.map +1 -1
  81. package/out/natural/transforms/transform2Enum.js +20 -4
  82. package/out/natural/transforms/transform2Enum.js.map +1 -1
  83. package/out/natural/transforms/transform2GlobalLogicDeclaration.d.ts +2 -2
  84. package/out/natural/transforms/transform2GlobalLogicDeclaration.d.ts.map +1 -1
  85. package/out/natural/transforms/transform2GlobalLogicDeclaration.js +4 -4
  86. package/out/natural/transforms/transform2GlobalLogicDeclaration.js.map +1 -1
  87. package/out/natural/transforms/transform2Logic.d.ts +4 -2
  88. package/out/natural/transforms/transform2Logic.d.ts.map +1 -1
  89. package/out/natural/transforms/transform2Logic.js +46 -8
  90. package/out/natural/transforms/transform2Logic.js.map +1 -1
  91. package/out/natural/transforms/transform2LogicItem.d.ts +65 -30
  92. package/out/natural/transforms/transform2LogicItem.d.ts.map +1 -1
  93. package/out/natural/transforms/transform2LogicItem.js +502 -222
  94. package/out/natural/transforms/transform2LogicItem.js.map +1 -1
  95. package/out/natural/transforms/transform2MetadataType.d.ts +3 -0
  96. package/out/natural/transforms/transform2MetadataType.d.ts.map +1 -0
  97. package/out/natural/transforms/transform2MetadataType.js +14 -0
  98. package/out/natural/transforms/transform2MetadataType.js.map +1 -0
  99. package/out/natural/transforms/transform2Structure.d.ts +2 -2
  100. package/out/natural/transforms/transform2Structure.d.ts.map +1 -1
  101. package/out/natural/transforms/transform2Structure.js +5 -5
  102. package/out/natural/transforms/transform2Structure.js.map +1 -1
  103. package/out/natural/transforms/transform2TypeAnnotation.d.ts +2 -2
  104. package/out/natural/transforms/transform2TypeAnnotation.d.ts.map +1 -1
  105. package/out/natural/transforms/transform2TypeAnnotation.js +10 -14
  106. package/out/natural/transforms/transform2TypeAnnotation.js.map +1 -1
  107. package/out/natural/transforms/transform2ValidationRule.d.ts +3 -0
  108. package/out/natural/transforms/transform2ValidationRule.d.ts.map +1 -0
  109. package/out/natural/transforms/transform2ValidationRule.js +24 -0
  110. package/out/natural/transforms/transform2ValidationRule.js.map +1 -0
  111. package/out/natural/transforms/transform2Variable.d.ts +3 -2
  112. package/out/natural/transforms/transform2Variable.d.ts.map +1 -1
  113. package/out/natural/transforms/transform2Variable.js +30 -6
  114. package/out/natural/transforms/transform2Variable.js.map +1 -1
  115. package/out/natural/transforms/transformThemeAndStyle.d.ts +24 -0
  116. package/out/natural/transforms/transformThemeAndStyle.d.ts.map +1 -0
  117. package/out/natural/transforms/transformThemeAndStyle.js +269 -0
  118. package/out/natural/transforms/transformThemeAndStyle.js.map +1 -0
  119. package/out/natural/transforms/utils.d.ts +37 -3
  120. package/out/natural/transforms/utils.d.ts.map +1 -1
  121. package/out/natural/transforms/utils.js +95 -13
  122. package/out/natural/transforms/utils.js.map +1 -1
  123. package/out/server/OQL/oql-cache.js +1 -1
  124. package/out/server/OQL/oql-cache.js.map +1 -1
  125. package/out/server/OQL/sqlCategory.json +410 -0
  126. package/out/server/OQL/sqlFunctions.json +695 -7
  127. package/out/server/OQL/utils.d.ts +1 -0
  128. package/out/server/OQL/utils.d.ts.map +1 -1
  129. package/out/server/OQL/utils.js +1 -0
  130. package/out/server/OQL/utils.js.map +1 -1
  131. package/out/server/index.d.ts +1 -0
  132. package/out/server/index.d.ts.map +1 -1
  133. package/out/server/index.js +1 -0
  134. package/out/server/index.js.map +1 -1
  135. package/out/server/naslServer.d.ts +5 -2
  136. package/out/server/naslServer.d.ts.map +1 -1
  137. package/out/server/naslServer.js +62 -34
  138. package/out/server/naslServer.js.map +1 -1
  139. package/out/service/initial/form-designer.d.ts +1 -1
  140. package/out/service/initial/form-designer.d.ts.map +1 -1
  141. package/out/service/initial/form-designer.js +4 -1
  142. package/out/service/initial/form-designer.js.map +1 -1
  143. package/out/service/initial/processV2.d.ts +1 -1
  144. package/out/service/initial/processV2.d.ts.map +1 -1
  145. package/out/service/initial/processV2.js +4 -1
  146. package/out/service/initial/processV2.js.map +1 -1
  147. package/out/service/initial/types.d.ts +1 -0
  148. package/out/service/initial/types.d.ts.map +1 -1
  149. package/out/service/storage/api.d.ts +9 -0
  150. package/out/service/storage/api.js +8 -0
  151. package/out/service/storage/api.js.map +1 -1
  152. package/out/service/storage/service.d.ts +3 -0
  153. package/out/service/storage/service.d.ts.map +1 -1
  154. package/out/service/storage/service.js +11 -0
  155. package/out/service/storage/service.js.map +1 -1
  156. package/out/service/storage/specTools.d.ts +34 -0
  157. package/out/service/storage/specTools.d.ts.map +1 -0
  158. package/out/service/storage/specTools.js +52 -0
  159. package/out/service/storage/specTools.js.map +1 -0
  160. package/out/utils/json-schema-to-nasl-type.d.ts +37 -0
  161. package/out/utils/json-schema-to-nasl-type.d.ts.map +1 -0
  162. package/out/utils/json-schema-to-nasl-type.js +195 -0
  163. package/out/utils/json-schema-to-nasl-type.js.map +1 -0
  164. package/package.json +12 -10
  165. package/sandbox/stdlib/nasl.oql.ts +1 -0
  166. package/out/generator/ui-library-declaration/utils.d.ts +0 -3
  167. package/out/generator/ui-library-declaration/utils.d.ts.map +0 -1
  168. package/out/generator/ui-library-declaration/utils.js +0 -20
  169. package/out/generator/ui-library-declaration/utils.js.map +0 -1
  170. package/out/natural/transforms/registerTransform.d.ts +0 -8
  171. package/out/natural/transforms/registerTransform.d.ts.map +0 -1
  172. package/out/natural/transforms/registerTransform.js +0 -24
  173. package/out/natural/transforms/registerTransform.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"full.d.ts","sourceRoot":"","sources":["../../../src/generator/annotation/full.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAGtD,WAAW;AACX,wBAAsB,+BAA+B,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oCAAiB,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAkEjJ"}
1
+ {"version":3,"file":"full.d.ts","sourceRoot":"","sources":["../../../src/generator/annotation/full.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAGtD,WAAW;AACX,wBAAsB,+BAA+B,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oCAAiB,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAoBjJ"}
@@ -11,38 +11,6 @@ async function getFullAnnotationAndModuleGraph(app, server, logger = nasl_utils_
11
11
  await server.openApp(app);
12
12
  await logger.info(utils_1.LogEventName, '结束 TS 代码翻译');
13
13
  await logger.info(utils_1.LogEventName, '开始类型标注');
14
- // // 使用增量标注的模块图建立初始引用关系图
15
- // // @ts-ignore
16
- // server.symbolGraph = new SymbolGraph(app);
17
- // // @ts-ignore
18
- // server.refMgr = new ReferenceManager(server.symbolGraph, app);
19
- // console.time('Collect All Global Definitions');
20
- // // TODO wudengke 重构一下,把所有对nasl的加载放到一个函数里处理
21
- // parseBuiltInFnTsDeclToMaps('nasl.util', naslStdlibMap['nasl.util.ts']);
22
- // server.refMgr.buildTsQNameDefs('nasl.auth', naslStdlibMap['nasl.auth.ts']);
23
- // server.refMgr.buildTsQNameDefs('nasl.http', naslStdlibMap['nasl.http.ts']);
24
- // server.refMgr.buildTsQNameDefs('nasl.logging', naslStdlibMap['nasl.logging.ts']);
25
- // server.refMgr.buildTsQNameDefs('nasl.error', naslStdlibMap['nasl.error.ts']);
26
- // server.refMgr.buildTsQNameDefs('nasl.configuration', naslStdlibMap['nasl.configuration.ts']);
27
- // server.refMgr.buildTsQNameDefs('nasl.ui', naslStdlibMap['nasl.ui.ts']);
28
- // server.typingEnv = env.typeBindings;
29
- // // @ts-ignore
30
- // globalserver.getAllDiagnostics = () => {
31
- // errorDiagnoser.getAllDiagnostics(server.toRaw(app));
32
- // };
33
- // // @ts-ignore
34
- // globalserver.checkNode = (node) => {
35
- // const { semErr, checkNode } = errorDiagnoser;
36
- // semErr.clear();
37
- // checkNode(server.toRaw(node));
38
- // return semErr;
39
- // };
40
- // console.timeEnd('Collect All Global Definitions');
41
- // // 必须先做这个
42
- // env.setRefMgr(server.toRaw(server.refMgr));
43
- // // 先检查 Entity、Structure、Enum
44
- // console.log('先检查 Entity、Structure、Enum、依赖库、连接器中的定义');
45
- // // 检查所有全局逻辑
46
14
  const annotationData = await (0, body_1.__getNaslAnnotatedJSON)(app);
47
15
  await logger.info(utils_1.LogEventName, '结束类型标注');
48
16
  await logger.info(utils_1.LogEventName, '开始构建模块依赖图');
@@ -1 +1 @@
1
- {"version":3,"file":"full.js","sourceRoot":"","sources":["../../../src/generator/annotation/full.ts"],"names":[],"mappings":";;;AACA,iDAAkD;AAElD,+CAA8D;AAE9D,mCAAsE;AAEtE,WAAW;AACJ,KAAK,UAAU,+BAA+B,CAAC,GAAQ,EAAE,MAAkB,EAAE,MAAM,GAAG,2BAAc;IACzG,MAAM,MAAM,CAAC,IAAI,CAAC,oBAAY,EAAE,UAAU,CAAC,CAAC;IAC5C,MAAM,MAAM,CAAC,IAAI,CAAC,oBAAY,EAAE,YAAY,CAAC,CAAC;IAC9C,MAAM,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC1B,MAAM,MAAM,CAAC,IAAI,CAAC,oBAAY,EAAE,YAAY,CAAC,CAAC;IAC9C,MAAM,MAAM,CAAC,IAAI,CAAC,oBAAY,EAAE,QAAQ,CAAC,CAAC;IAE1C,yBAAyB;IACzB,g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C,IAAI,CAAC,oBAAY,EAAE,YAAY,CAAC,CAAC;IAC9C,MAAM,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC1B,MAAM,MAAM,CAAC,IAAI,CAAC,oBAAY,EAAE,YAAY,CAAC,CAAC;IAC9C,MAAM,MAAM,CAAC,IAAI,CAAC,oBAAY,EAAE,QAAQ,CAAC,CAAC;IAE1C,MAAM,cAAc,GAAW,MAAM,IAAA,6BAAsB,EAAC,GAAG,CAAC,CAAC;IAEjE,MAAM,MAAM,CAAC,IAAI,CAAC,oBAAY,EAAE,QAAQ,CAAC,CAAC;IAC1C,MAAM,MAAM,CAAC,IAAI,CAAC,oBAAY,EAAE,WAAW,CAAC,CAAC;IAC7C,MAAM,WAAW,GAAG,IAAA,qCAA6B,EAAC,GAAG,CAAC,CAAC;IACvD,MAAM,MAAM,CAAC,IAAI,CAAC,oBAAY,EAAE,WAAW,CAAC,CAAC;IAC7C,OAAO;QACL,cAAc;QACd,WAAW;QACX,cAAc,EAAE,EAAE;QAClB,MAAM,EAAE,IAAI;QACZ,uBAAuB,EAAE,KAAK;KAC/B,CAAC;AACJ,CAAC;AApBD,0EAoBC"}
@@ -9,11 +9,12 @@ export interface Route {
9
9
  component?: RawOptions;
10
10
  children?: Array<Route>;
11
11
  redirect?: string;
12
- lazyPath?: string;
13
12
  meta?: {
14
13
  [key: string]: any;
15
14
  };
15
+ fullPath?: string;
16
16
  }
17
+ export declare function stringifyMetaData(obj: any): string;
17
18
  export declare function genBundleFiles(app: App, frontend: Frontend, config: Config): Promise<any[]>;
18
19
  export declare function genFrontendBundleFiles(app: App, frontends: Array<Frontend>, config: Config): Promise<any[]>;
19
20
  export declare function getOneFiles(options: {
@@ -21,7 +22,7 @@ export declare function getOneFiles(options: {
21
22
  frontend: Frontend;
22
23
  view: View;
23
24
  action: 'current' | 'all';
24
- cacheRouters: Route[];
25
+ cacheRouters: string;
25
26
  config: Config;
26
27
  }): Promise<any[]>;
27
28
  //# sourceMapping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,MAAM,EAAE,MAAM,CAAC;CAChB,kBAwKA"}
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.getOneFiles = exports.genFrontendBundleFiles = exports.genBundleFiles = exports.checkOfficalPermissTemplate = exports.officalEntityList37 = exports.entityList = void 0;
29
+ exports.getOneFiles = exports.genFrontendBundleFiles = exports.genBundleFiles = exports.stringifyMetaData = exports.checkOfficalPermissTemplate = exports.officalEntityList37 = exports.entityList = void 0;
30
30
  const JSON5 = __importStar(require("json5"));
31
31
  const VueCompiler = __importStar(require("vue-template-compiler"));
32
32
  const vue_template_es2015_compiler_1 = __importDefault(require("vue-template-es2015-compiler"));
@@ -40,9 +40,11 @@ const concepts_1 = require("../concepts");
40
40
  const compileComponent_1 = require("./compileComponent");
41
41
  const nasl_unified_frontend_generator_1 = require("@lcap/nasl-unified-frontend-generator");
42
42
  const microApp_1 = require("./microApp");
43
- // @ts-ignore FIXME wudengke 类型在构建前找不到的问题
43
+ // @ts-ignore FIXME 类型在构建前找不到的问题
44
44
  const nasl_unified_frontend_generator_2 = require("@lcap/nasl-unified-frontend-generator");
45
45
  const axios_1 = __importDefault(require("axios"));
46
+ const runtime_1 = require("./templates/runtime");
47
+ const chunk_1 = require("./templates/chunk");
46
48
  const officalEntityMap = {
47
49
  LCAPUser: ['id', 'createdTime', 'updatedTime', 'userId', 'userName', 'password', 'phone', 'email', 'displayName', 'status', 'source'],
48
50
  LCAPLogicViewMapping: ['id', 'logicIdentifier', 'resourceName', 'resourceType', 'group', 'changeTime'],
@@ -103,6 +105,7 @@ function stringifyMetaData(obj) {
103
105
  }
104
106
  return JSON5.stringify(obj);
105
107
  }
108
+ exports.stringifyMetaData = stringifyMetaData;
106
109
  // 编译模板, 类似 vue-loader 的 compileTemplate
107
110
  function compileTemplate(template) {
108
111
  const toFunction = (code) => {
@@ -139,8 +142,8 @@ function genComponentCode(component) {
139
142
  })()`;
140
143
  }
141
144
  // 生成导入组件代码
142
- function genImportComponetCode(componentPath) {
143
- return `() => importComponent('${componentPath}')`;
145
+ function genImportComponetCode(chunkId) {
146
+ return `() => __webpack_require__.e("${chunkId}").then(__webpack_require__.bind(__webpack_require__, "./${chunkId}.js"))`;
144
147
  }
145
148
  // 生成导出组件代码
146
149
  function genExportComponetCode(component) {
@@ -148,12 +151,13 @@ function genExportComponetCode(component) {
148
151
  const optionCode = renderCode
149
152
  ? `render: __render__,\n staticRenderFns: __staticRenderFns__,`
150
153
  : `template: \`${component.template.replace(/[`$]/g, (m) => `\\${m}`)}\`,`;
151
- return `var componentOptions = ${component.script ? `(function(){\n${component.script.trim().replace(/export default |module\.exports +=/, 'return ')}\n})()` : '{}'};
154
+ let code = `var componentOptions = ${component.script ? `(function(){\n${component.script.trim().replace(/export default |module\.exports +=/, 'return ')}\n})()` : '{}'};
152
155
  ${renderCode}
153
156
  Object.assign(componentOptions, {
154
157
  ${optionCode}
155
158
  });
156
- return componentOptions;`;
159
+ `;
160
+ return code;
157
161
  }
158
162
  // 获取文件路径
159
163
  // name 或者 文件 至少有一个必填
@@ -166,27 +170,44 @@ const getCompletePath = (name, fileContent, config) => {
166
170
  fileName += `${(0, nasl_utils_1.genHash)(fileContent)}.`;
167
171
  }
168
172
  fileName += `min.js`;
169
- // if(config?.isExport && !fileName.includes('bundle')&& !fileName.includes('router')){
170
- // fileName =`${config.sysPrefixPath}/${fileName}`
171
- // }
172
173
  return fileName;
173
174
  };
174
- function genRouterFileContent(routes, defaultRoute) {
175
+ function genRouterFileContent(routes, defaultRoute, config) {
176
+ // 单页面发布
177
+ if (config.isOneFile) {
178
+ let code = config?.cacheRouters;
179
+ const changedChunks = config?.asyncChunksMap;
180
+ let newRoutesCode = 'window.lcap_routes = [\n';
181
+ routes.forEach((route) => {
182
+ newRoutesCode += `${routeToString(route)},\n`;
183
+ });
184
+ newRoutesCode += '];\n';
185
+ const [start, end] = ['// lcap_routes start', '// lcap_routes end'];
186
+ // 将start和end之间的代码替换掉
187
+ code = code.slice(0, code.indexOf(start) + start.length) + '\n' + newRoutesCode + code.slice(code.indexOf(end));
188
+ const placeholderIdx = code.indexOf('// lcap_changed_chunks placeholder');
189
+ // 前面插入代码
190
+ if (placeholderIdx !== -1) {
191
+ code = code.slice(0, placeholderIdx) + `Object.assign(lcap_changed_chunks, ${JSON.stringify(changedChunks)});\n` + code.slice(placeholderIdx);
192
+ }
193
+ return code;
194
+ }
175
195
  function routeToString(route) {
176
196
  let content = `{
177
197
  path: '${route.path}',\n`;
178
- if (route?.lazyPath) {
179
- const routeLazyPath = route.lazyPath;
180
- content += `lazyPath: '${routeLazyPath}',\n`;
181
- content += `component: ${genImportComponetCode(route.lazyPath)},\n`;
198
+ if (route?.fullPath) {
199
+ // 单页面发布时需要
200
+ content += `fullPath: '${route.fullPath}',\n`;
201
+ const chunkId = (0, nasl_utils_1.genHash)(route.fullPath);
202
+ content += `component: ${genImportComponetCode(chunkId)},\n`;
182
203
  }
183
204
  if (route?.meta) {
184
205
  content += `meta: ${stringifyMetaData(route.meta)},`;
185
206
  }
186
- if (route?.children?.length) {
207
+ if (route.children?.length) {
187
208
  content += `children: [
188
- ${route.children.map(routeToString).join(',\n')}
189
- ],\n`;
209
+ ${route.children?.map?.(routeToString)?.join(',\n')}
210
+ ],\n`;
190
211
  }
191
212
  if (route?.redirect) {
192
213
  content += `redirect: '${route?.redirect}',\n`;
@@ -194,35 +215,64 @@ function genRouterFileContent(routes, defaultRoute) {
194
215
  content += '}';
195
216
  return content;
196
217
  }
218
+ // 生成异步块映射表
219
+ const name = config?.app?.name;
220
+ let code = `window["${name}LcapChunksMap"] = ${JSON5.stringify(config?.asyncChunksMap || {})};\n`;
197
221
  // 生成路由配置
198
- let routesStr = `const routers = [`;
222
+ code += `// lcap_routes start
223
+ window.lcap_routes = [\n`;
199
224
  routes.forEach((route) => {
200
- routesStr += `${routeToString(route)},\n`;
225
+ code += `${routeToString(route)},\n`;
201
226
  });
202
227
  if (defaultRoute) {
203
- routesStr += `{
228
+ code += `{
204
229
  path: '*',
205
230
  redirect: '${defaultRoute}',
206
231
  }\n`;
207
232
  }
208
- routesStr += `];
209
- return routers;`;
210
- return routesStr;
233
+ code += `];
234
+ // lcap_routes end\n`;
235
+ // changedChunk
236
+ code += `var lcap_changed_chunks = {};
237
+
238
+ // lcap_changed_chunks placeholder
239
+
240
+ Object.keys(lcap_changed_chunks).forEach(function(chunkId) {
241
+ window["${name}LcapChunksMap"][chunkId] = lcap_changed_chunks[chunkId];
242
+ });`;
243
+ return (0, chunk_1.generate)({
244
+ name: config?.app?.name,
245
+ chunkId: 'router',
246
+ moduleId: 'router',
247
+ content: code,
248
+ exports: [],
249
+ exec: false,
250
+ });
211
251
  }
212
252
  // 生成路由文件
213
253
  function genRouteFiles(routes, defaultRoute, config) {
214
254
  // 生成路由文件列表
215
255
  const routeFiles = [];
256
+ const asyncChunksMap = {};
216
257
  function routeToFile(route) {
217
258
  if (route?.component?.script) {
218
259
  const content = genExportComponetCode(route.component);
219
- const lazyPath = getCompletePath(null, content, config);
220
- route.lazyPath = lazyPath;
221
- // let outFilePath =`${config?.sysPrefixPath? config?.sysPrefixPath +'/' :''}${lazyPath}`;
260
+ const chunkId = (0, nasl_utils_1.genHash)(route.fullPath);
261
+ const contentHash = (0, nasl_utils_1.genHash)(content);
222
262
  routeFiles.push({
223
- name: lazyPath,
224
- content,
263
+ name: chunkId + '.' + contentHash + '.js',
264
+ content: (0, chunk_1.generate)({
265
+ name: config?.app?.name,
266
+ chunkId,
267
+ moduleId: chunkId,
268
+ content,
269
+ exports: [
270
+ ['componentOptions', 'default'],
271
+ ],
272
+ exec: false,
273
+ }),
225
274
  });
275
+ asyncChunksMap[chunkId] = contentHash;
226
276
  }
227
277
  if (route?.children?.length) {
228
278
  route.children.map(routeToFile);
@@ -231,13 +281,16 @@ function genRouteFiles(routes, defaultRoute, config) {
231
281
  routes.forEach((route) => {
232
282
  routeToFile(route);
233
283
  });
234
- let routerPath = getCompletePath('router', null, config);
235
284
  routeFiles.push({
236
- name: routerPath,
285
+ name: getCompletePath('router', null, config),
237
286
  isRouterFile: true,
238
- content: genRouterFileContent(routes, defaultRoute),
287
+ content: genRouterFileContent(routes, defaultRoute, Object.assign({}, config, { asyncChunksMap })),
239
288
  });
240
- return routeFiles;
289
+ const { publicPath } = config;
290
+ return routeFiles.map(file => ({
291
+ ...file,
292
+ name: publicPath + file.name,
293
+ }));
241
294
  }
242
295
  async function genBundleFiles(app, frontend, config) {
243
296
  config.sysPrefixPath = app?.sysPrefixPath;
@@ -322,24 +375,8 @@ async function genBundleFiles(app, frontend, config) {
322
375
  (0, nasl_log_1.clearLogs)(app);
323
376
  }
324
377
  }
325
- const getBundleFileName = () => {
326
- if (config.isPreviewFe && config.previewVersion) {
327
- return `mockBundle-${config.previewVersion}`;
328
- }
329
- else {
330
- return 'bundle';
331
- }
332
- };
333
- let baseUrl = `${config.USER_STATIC_URL}/${config.tenant}/${app.id}/${config.env}`;
334
- let { basePath } = frontend;
335
- // isPreviewFe 资产中心的预览模式,优先级最高
336
- if (config.isPreviewFe) {
337
- baseUrl = `${config.USER_STATIC_URL}/asset-center/preview/${config.tenant}/${app.id}/${config.env}`;
338
- }
339
- else if (config.isExport) {
340
- baseUrl = '';
341
- }
342
- let completePath = `${baseUrl}${basePath || ''}/`;
378
+ // @ts-expect-error
379
+ const publicPath = (0, nasl_unified_frontend_generator_2.getPublicPath)(app, config, frontend);
343
380
  /**
344
381
  * vue.config.js page options
345
382
  */
@@ -379,11 +416,18 @@ async function genBundleFiles(app, frontend, config) {
379
416
  }
380
417
  }
381
418
  }
419
+ let fullPath = `/${viewName}`;
420
+ let parent = view.parentNode;
421
+ while (parent?.concept === 'View') {
422
+ fullPath = `/${parent.name}${fullPath}`;
423
+ parent = parent.parentNode;
424
+ }
382
425
  const route = {
383
426
  path: routePath,
384
427
  component: (0, compileComponent_1.compileComponent)(componentMap[view.id]),
385
428
  children: [],
386
429
  meta: view.getRouteMeta(),
430
+ fullPath,
387
431
  };
388
432
  const viewChildren = view.children;
389
433
  if (Array.isArray(viewChildren) && viewChildren.length) {
@@ -458,15 +502,7 @@ async function genBundleFiles(app, frontend, config) {
458
502
  // authResourcePathMap={}
459
503
  }
460
504
  const authResourcePaths = Object.keys(authResourcePathMap);
461
- const routerFiles = genRouteFiles(routes, defaultRoute, config);
462
- routerFiles.forEach(item => {
463
- let temp = completePath;
464
- // if(completePath=='/'){temp=''}else{temp = `${completePath}/`}
465
- if (config?.isExport && config?.sysPrefixPath?.length > 0) {
466
- temp = config?.sysPrefixPath + temp;
467
- }
468
- item.name = temp + item.name;
469
- });
505
+ const routerFiles = genRouteFiles(routes, defaultRoute, Object.assign({}, config, { app, publicPath }));
470
506
  let fileI18nInfo = {
471
507
  enabled: false,
472
508
  locale: 'zh-CN',
@@ -581,8 +617,6 @@ async function genBundleFiles(app, frontend, config) {
581
617
  }
582
618
  const assetsInfo = app.genAllAssetsInfo(STATIC_URL, frontend.type, frontendType.frameworkKind);
583
619
  const customNames = JSON5.stringify(assetsInfo.custom.names);
584
- let content1 = `(async function(){
585
- `;
586
620
  let contentScale = '';
587
621
  if (frontend.globalScaleEnabled)
588
622
  contentScale = `{
@@ -692,67 +726,6 @@ async function genBundleFiles(app, frontend, config) {
692
726
  let contentImport = `
693
727
  var platformConfig = ${platformConfig};
694
728
  var metaData = ${metaDataStr};
695
-
696
- var getCompletePath = (path) => {
697
- return '${config?.isExport ? config.sysPrefixPath : ''}${completePath}' + path;
698
- }
699
-
700
- // 低版本
701
- function importXMLHttpRequestComponent (scriptUrl) {
702
- return new Promise(function(resolve, reject) {
703
- var xhr = new XMLHttpRequest();
704
- xhr.open('GET', scriptUrl, true);
705
- xhr.onreadystatechange = function() {
706
- if (xhr.readyState === 4) {
707
- if (xhr.status === 200) {
708
- var scriptContent = xhr.responseText;
709
- try {
710
- var func = new Function('importComponent', 'window', scriptContent + '\\n//# sourceURL=' + scriptUrl);
711
- var result = func(window.importComponent, window);
712
- resolve(result);
713
- } catch (error) {
714
- if (typeof window.$appUtils.createErrorLayout === 'function') {
715
- window.$appUtils.createErrorLayout(error);
716
- }
717
- reject(error);
718
- }
719
- } else {
720
- reject(new Error('Failed to fetch script'));
721
- }
722
- }
723
- };
724
- xhr.send();
725
- });
726
- };
727
- function importFetchComponent(scriptUrl) {
728
- return fetch(scriptUrl)
729
- .then(function(response) {
730
- if (!response.ok) {
731
- throw new Error('Network response was not ok');
732
- }
733
- return response.text();
734
- }).then(function(scriptText) {
735
- var func = new Function('importComponent', 'window', scriptText + '\\n//# sourceURL=' + scriptUrl);
736
- var result = func(window.importComponent, window);
737
- return result;
738
- })
739
- .catch(error => {
740
- console.error('Error loading script:', error);
741
- if (typeof window.$appUtils.createErrorLayout === 'function') {
742
- window.$appUtils.createErrorLayout(error);
743
- }
744
- });
745
- }
746
- window.importComponent = (scriptUrl) => {
747
- scriptUrl = getCompletePath(scriptUrl);
748
- // 浏览器支持fetch,直接使用fetch
749
- if (window.fetch) {
750
- return importFetchComponent(scriptUrl);
751
- }
752
- return importXMLHttpRequestComponent(scriptUrl);
753
- }
754
-
755
- var routes = await importComponent('${getCompletePath('router', null, config)}?t=' + Date.now());
756
729
  `;
757
730
  // 按页面维度发布先不考虑鉴权,页面维度新增的页面都算是不鉴权的数组中
758
731
  // 只有完全页面维度新增的才会进入到这个数组中
@@ -771,11 +744,11 @@ async function genBundleFiles(app, frontend, config) {
771
744
  }
772
745
  });
773
746
  }
774
- iterateRouters(routes);` : '';
747
+ iterateRouters(window.lcap_routes);` : '';
775
748
  let contentCreateLCAPApp = `
776
749
  window.createLcapApp = () => {
777
750
  ${compRegStr}
778
- appVM = window.cloudAdminDesigner.init(platformConfig.appConfig, platformConfig, routes, metaData);
751
+ var appVM = window.cloudAdminDesigner.init(platformConfig.appConfig, platformConfig, window.lcap_routes, metaData);
779
752
  try {
780
753
  var push = appVM.$router.history.push;
781
754
  appVM.$router.history.push = function (a, b) {
@@ -854,8 +827,6 @@ async function genBundleFiles(app, frontend, config) {
854
827
  if(shortcutIconLink) parent.document.head.appendChild(shortcutIconLink);
855
828
  }
856
829
  ` : '';
857
- let content10 = `
858
- })();`;
859
830
  let contentDevOnly = config.env === 'dev' ? `
860
831
  var _div = document.createElement('div');
861
832
  _div.classList = "div-load"
@@ -971,10 +942,21 @@ async function genBundleFiles(app, frontend, config) {
971
942
  };
972
943
  fetchAnnoData();
973
944
  ` : '';
974
- let content = [content1, contentScale, contentStyleCss, contentDocIcon, contentCustomNames, contentImport,
975
- contentLogReportCode, contentRouter, contentCreateLCAPApp, contentPCIframe, content10,
976
- contentDevOnly, contentVueDirectives.join(''), contentViewElemAnno].join('');
977
- content1 = null;
945
+ let content = [
946
+ `__webpack_require__('./router.js');`,
947
+ contentScale,
948
+ contentStyleCss,
949
+ contentDocIcon,
950
+ contentCustomNames,
951
+ contentImport,
952
+ contentLogReportCode,
953
+ contentRouter,
954
+ contentCreateLCAPApp,
955
+ contentPCIframe,
956
+ contentDevOnly,
957
+ contentVueDirectives.join(''),
958
+ contentViewElemAnno
959
+ ].join('');
978
960
  contentScale = null;
979
961
  contentStyleCss = null;
980
962
  contentDocIcon = null;
@@ -984,19 +966,29 @@ async function genBundleFiles(app, frontend, config) {
984
966
  contentRouter = null;
985
967
  contentCreateLCAPApp = null;
986
968
  contentPCIframe = null;
987
- content10 = null;
988
969
  contentDevOnly = null;
989
970
  contentVueDirectives = null;
990
971
  contentViewElemAnno = null;
991
972
  const timestamp = Date.now();
992
973
  utils.delay(100);
993
- let bundleMinPath = completePath + getCompletePath(getBundleFileName(), content, config);
974
+ content = (0, chunk_1.generate)({
975
+ name: app.name,
976
+ chunkId: 'bundle',
977
+ moduleId: 'bundle',
978
+ content,
979
+ exports: [],
980
+ exec: true,
981
+ });
982
+ let clientPath = publicPath + 'client.js';
983
+ let runtimePath = publicPath + 'runtime.js';
984
+ let routerPath = publicPath + getCompletePath('router', null, config);
985
+ let bundleMinPath = publicPath + getCompletePath(getBundleFileName(config), content, config);
994
986
  const otherJsList = frontend?.appletsConfig?.enable ? ['//res.wx.qq.com/open/js/jweixin-1.3.2.js'] : [];
995
987
  const microAppIntegration = (0, microApp_1.integrateMicroApp)(frontend);
996
988
  if (config?.debug) {
997
989
  otherJsList.push(`${STATIC_URL}/packages/@lcap/breakpoint-client@1.0.0/dist/index.js?time=${timestamp}`);
998
990
  }
999
- let jsAssetsList = assetsInfo.basic.js.concat(assetsInfo.custom.js, otherJsList).concat([bundleMinPath]);
991
+ let jsAssetsList = assetsInfo.basic.js.concat(assetsInfo.custom.js, otherJsList).concat([runtimePath, routerPath, bundleMinPath]);
1000
992
  let cssAssetsList = assetsInfo.basic.css.concat(assetsInfo.custom.css);
1001
993
  if (config.isPreviewFe) {
1002
994
  const changeToRelativePath = (str) => {
@@ -1107,6 +1099,11 @@ async function genBundleFiles(app, frontend, config) {
1107
1099
  refresh: config.refresh,
1108
1100
  }));
1109
1101
  }
1102
+ // encode url
1103
+ if ((0, nasl_unified_frontend_generator_2.isEnabledEncode)()) {
1104
+ jsAssetsList = jsAssetsList.map(nasl_unified_frontend_generator_2.encodeFetchFileURL);
1105
+ cssAssetsList = cssAssetsList.map(nasl_unified_frontend_generator_2.encodeFetchFileURL);
1106
+ }
1110
1107
  const dynamicAssets = optimizeAssetClassification(jsAssetsList);
1111
1108
  // CSS 资源默认最后
1112
1109
  if (cssAssetsList.length > 0) {
@@ -1187,18 +1184,26 @@ async function genBundleFiles(app, frontend, config) {
1187
1184
  `;
1188
1185
  const outputs = [
1189
1186
  {
1190
- name: bundleMinPath,
1191
- content,
1187
+ name: clientPath,
1188
+ content: assetsContent,
1192
1189
  },
1193
1190
  {
1194
- name: basePath ? `${baseUrl}${basePath}/client.js` : `${baseUrl}/client.js`,
1195
- content: assetsContent,
1191
+ name: runtimePath,
1192
+ content: (0, runtime_1.generate)({
1193
+ name: app.name,
1194
+ publicPath: JSON.stringify(publicPath),
1195
+ }),
1196
+ },
1197
+ {
1198
+ name: bundleMinPath,
1199
+ content,
1196
1200
  },
1197
1201
  ...routerFiles,
1198
1202
  ];
1199
1203
  assetsContent = null;
1200
1204
  content = null;
1201
1205
  processAssetsInOutputs(outputs, frontend, config);
1206
+ console.info('编译结果', outputs.map((x) => x.name));
1202
1207
  return outputs;
1203
1208
  }
1204
1209
  exports.genBundleFiles = genBundleFiles;
@@ -1331,16 +1336,23 @@ async function getOneFiles(options) {
1331
1336
  if (isRootView) {
1332
1337
  routePath = `${frontend.prefixPath}/${viewName}`;
1333
1338
  }
1339
+ let fullPath = `/${viewName}`;
1340
+ let parent = view.parentNode;
1341
+ while (parent?.concept === 'View') {
1342
+ fullPath = `/${parent.name}${fullPath}`;
1343
+ parent = parent.parentNode;
1344
+ }
1334
1345
  const route = {
1335
1346
  path: routePath,
1336
1347
  component: (0, compileComponent_1.compileComponent)(viewOption),
1337
1348
  children: [],
1338
1349
  meta: view.getRouteMeta(),
1350
+ fullPath,
1339
1351
  };
1340
1352
  return route;
1341
1353
  }
1342
- let currentView = view;
1343
1354
  let currentRoute = null;
1355
+ let currentView = view;
1344
1356
  while (currentView?.concept === 'View') {
1345
1357
  if (currentRoute) {
1346
1358
  const child = currentRoute;
@@ -1374,6 +1386,7 @@ async function getOneFiles(options) {
1374
1386
  // 如果找到了现有路由,更新 component 和 meta
1375
1387
  existingRoute.component = newRoute.component;
1376
1388
  existingRoute.meta = newRoute.meta;
1389
+ existingRoute.fullPath = newRoute.fullPath;
1377
1390
  // 递归合并子路由
1378
1391
  if (newRoute.children) {
1379
1392
  existingRoute.children = existingRoute.children || [];
@@ -1390,9 +1403,25 @@ async function getOneFiles(options) {
1390
1403
  routes.unshift(newRoute);
1391
1404
  }
1392
1405
  }
1406
+ let existingRoutes = [];
1407
+ try {
1408
+ // 获取// lcap_routes start 到 // lcap_routes end 之间的代码
1409
+ const [start, end] = ['// lcap_routes start', '// lcap_routes end'];
1410
+ const routesCode = cacheRouters
1411
+ .substring(cacheRouters.indexOf(start) + start.length, cacheRouters.indexOf(end))
1412
+ .replace('window.lcap_routes = ', 'return ');
1413
+ const fn = new Function(`${routesCode}`);
1414
+ existingRoutes = fn();
1415
+ }
1416
+ catch (error) {
1417
+ console.error('路由代码 eval 失败:', error);
1418
+ }
1393
1419
  // Bug-3156542745982976: 原本直接找到顶层直接删除,在新增节点,遗漏处理中间层也有节点的情况,单页发布就直接增量合并,为了性能,暂时不考虑删除节点
1394
- addOrUpdateRoute(cacheRouters, currentRoute);
1395
- const routerFiles = genRouteFiles(cacheRouters, null);
1420
+ addOrUpdateRoute(existingRoutes, currentRoute);
1421
+ // @ts-expect-error
1422
+ const publicPath = (0, nasl_unified_frontend_generator_2.getPublicPath)(app, config, frontend);
1423
+ const routerFiles = genRouteFiles(existingRoutes, null, Object.assign({}, config, { app, cacheRouters, isOneFile: true, publicPath }));
1424
+ console.info('编译结果', routerFiles.map((x) => x.name));
1396
1425
  return routerFiles;
1397
1426
  }
1398
1427
  exports.getOneFiles = getOneFiles;
@@ -1486,4 +1515,13 @@ function processAssetsInOutputs(outputs, frontend, config) {
1486
1515
  });
1487
1516
  }
1488
1517
  }
1518
+ function getBundleFileName(config) {
1519
+ if (config.isPreviewFe && config.previewVersion) {
1520
+ return `mockBundle-${config.previewVersion}`;
1521
+ }
1522
+ else {
1523
+ return 'bundle';
1524
+ }
1525
+ }
1526
+ ;
1489
1527
  //# sourceMappingURL=genBundleFiles.js.map