This release is 18 versions behind 5.0.12 — the latest version of @lost-c3/lib. Jump to latest
Lost for easy making Construct 3 Addons.
This package works with DenoIt is unknown whether this package works with Cloudflare Workers, Node.js, Bun, Browsers




JSR Score
35%
Published
4 months ago (3.3.2)
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110import { Paths } from "../shared/paths.ts"; import { AddonFolders } from "../shared/paths/addon-folders.ts"; import type { AddonType, LostConfig } from "./config.ts"; import type { PluginProperty } from "./entities/plugin-property.ts"; type LostAddonDataFile = { readonly type: AddonFileType; readonly path: string; readonly dependencyType?: 'external-css' | 'copy-to-output' | 'external-dom-script' | 'external-runtime-script'; readonly mimeType?: MIMEFileType } type AddonIconData = { readonly iconType: AddonIconMimeType; readonly path: string; } export class LostAddonData { readonly hasDefaultImage: boolean; readonly icon: AddonIconData; readonly config: LostConfig<AddonType>; readonly remoteScripts: string[] = []; readonly files: LostAddonDataFile[] = []; readonly pluginProperties: PluginProperty<any, any, any>[]; constructor( hasDefaultImage: boolean, icon: AddonIconData, config: LostConfig<AddonType>, pluginProperties: PluginProperty<any, any, any>[], remoteScripts: string[], userFiles: AddonUserFile[], userScripts: AddonUserScriptFile[], userModules: AddonUserModuleFile[], userDomSideScripts: AddonUserDomSideScriptFile[] ) { this.hasDefaultImage = hasDefaultImage; this.icon = icon; this.config = config; this.pluginProperties = pluginProperties; this.remoteScripts = remoteScripts; for (const file of userFiles) { let path: string; const folders = Paths.getFoldersAfterFolder(file.localPath, AddonFolders.Files); if (folders.length > 0) { path = `${file.finalPath}/${folders.join('/')}/${file.localName}` } else { path = `${file.finalPath}/${file.localName}` } this.files.push({ type: 'file', path, dependencyType: file.dependencyType, mimeType: (file as AddonFileCopyToOutput).mimeType }) } for (const file of userScripts) { let path: string; const folders = Paths.getFoldersAfterFolder(file.localPath, AddonFolders.Scripts); if (folders.length > 0) { path = `${file.finalPath}/${folders.join('/')}/${file.localName}` } else { path = `${file.finalPath}/${file.localName}` } this.files.push({ type: 'script', path, dependencyType: file.dependencyType }) } for (const file of userModules) { let path: string; const folders = Paths.getFoldersAfterFolder(file.localPath, AddonFolders.Modules); if (folders.length > 0) { path = `${file.finalPath}/${folders.join('/')}/${file.localName}` } else { path = `${file.finalPath}/${file.localName}` } this.files.push({ type: 'module', path }) } for (const file of userDomSideScripts) { let path: string; const folders = Paths.getFoldersAfterFolder(file.localPath, AddonFolders.DomSide); if (folders.length > 0) { path = `${file.finalPath}/${folders.join('/')}/${file.localName}` } else { path = `${file.finalPath}/${file.localName}` } this.files.push({ type: 'dom-side-script', path }) } } }