(pre: ICodeStruct)
| 12 | |
| 13 | const pluginFactory: BuilderComponentPluginFactory<unknown> = () => { |
| 14 | const plugin: BuilderComponentPlugin = async (pre: ICodeStruct) => { |
| 15 | const next: ICodeStruct = { |
| 16 | ...pre, |
| 17 | }; |
| 18 | |
| 19 | const ir = next.ir as IProjectInfo; |
| 20 | const scope = Scope.createRootScope(); |
| 21 | const constantStr = generateCompositeType(ir.constants || {}, scope); |
| 22 | |
| 23 | next.chunks.push({ |
| 24 | type: ChunkType.STRING, |
| 25 | fileType: FileType.JS, |
| 26 | name: COMMON_CHUNK_NAME.FileVarDefine, |
| 27 | content: ` |
| 28 | const __$$constants = (${constantStr}); |
| 29 | `, |
| 30 | linkAfter: [ |
| 31 | COMMON_CHUNK_NAME.ExternalDepsImport, |
| 32 | COMMON_CHUNK_NAME.InternalDepsImport, |
| 33 | COMMON_CHUNK_NAME.ImportAliasDefine, |
| 34 | ], |
| 35 | }); |
| 36 | |
| 37 | next.chunks.push({ |
| 38 | type: ChunkType.STRING, |
| 39 | fileType: FileType.JS, |
| 40 | name: COMMON_CHUNK_NAME.FileExport, |
| 41 | content: ` |
| 42 | export default __$$constants; |
| 43 | `, |
| 44 | linkAfter: [ |
| 45 | COMMON_CHUNK_NAME.ExternalDepsImport, |
| 46 | COMMON_CHUNK_NAME.InternalDepsImport, |
| 47 | COMMON_CHUNK_NAME.ImportAliasDefine, |
| 48 | COMMON_CHUNK_NAME.FileVarDefine, |
| 49 | COMMON_CHUNK_NAME.FileUtilDefine, |
| 50 | COMMON_CHUNK_NAME.FileMainContent, |
| 51 | ], |
| 52 | }); |
| 53 | |
| 54 | return next; |
| 55 | }; |
| 56 | return plugin; |
| 57 | }; |
| 58 |
nothing calls this directly
no test coverage detected
searching dependent graphs…