const runTimeDependencies = { "externals": { "rxjs": "^6.5.5", "@youwol/flux-view": "^1.1.0" }, "includedInBundle": { "semver": "^7.3.4" } } const externals = { "rxjs": { "commonjs": "rxjs", "commonjs2": "rxjs", "root": "rxjs_APIv6" }, "@youwol/flux-view": { "commonjs": "@youwol/flux-view", "commonjs2": "@youwol/flux-view", "root": "@youwol/flux-view_APIv1" }, "rxjs/operators": { "commonjs": "rxjs/operators", "commonjs2": "rxjs/operators", "root": [ "rxjs_APIv6", "operators" ] } } const exportedSymbols = { "rxjs": { "apiKey": "6", "exportedSymbol": "rxjs" }, "@youwol/flux-view": { "apiKey": "1", "exportedSymbol": "@youwol/flux-view" } } const mainEntry : {entryFile: string,loadDependencies:string[]} = { "entryFile": "./index.ts", "loadDependencies": [] } const secondaryEntries : {[k:string]:{entryFile: string, name: string, loadDependencies:string[]}}= { "workersPool": { "entryFile": "./lib/workers-pool/index.ts", "loadDependencies": [ "rxjs", "@youwol/flux-view" ], "name": "workersPool" }, "testUtils": { "entryFile": "./lib/test-utils/index.ts", "loadDependencies": [], "name": "testUtils" } } const entries = { '@youwol/cdn-client': './index.ts', ...Object.values(secondaryEntries).reduce( (acc,e) => ({...acc, [`@youwol/cdn-client/${e.name}`]:e.entryFile}), {}) } export const setup = { name:'@youwol/cdn-client', assetId:'QHlvdXdvbC9jZG4tY2xpZW50', version:'2.1.3', shortDescription:"Library for dynamic npm's libraries installation from YouWol's CDN.", developerDocumentation:'https://platform.youwol.com/applications/@youwol/cdn-explorer/latest?package=@youwol/cdn-client&tab=doc', npmPackage:'https://www.npmjs.com/package/@youwol/cdn-client', sourceGithub:'https://github.com/youwol/cdn-client', userGuide:'', apiVersion:'2', runTimeDependencies, externals, exportedSymbols, entries, secondaryEntries, getDependencySymbolExported: (module:string) => { return `${exportedSymbols[module].exportedSymbol}_APIv${exportedSymbols[module].apiKey}` }, installMainModule: ({cdnClient, installParameters}:{ cdnClient:{install:(unknown) => Promise}, installParameters? }) => { const parameters = installParameters || {} const scripts = parameters.scripts || [] const modules = [ ...(parameters.modules || []), ...mainEntry.loadDependencies.map( d => `${d}#${runTimeDependencies.externals[d]}`) ] return cdnClient.install({ ...parameters, modules, scripts, }).then(() => { return window[`@youwol/cdn-client_APIv2`] }) }, installAuxiliaryModule: ({name, cdnClient, installParameters}:{ name: string, cdnClient:{install:(unknown) => Promise}, installParameters? }) => { const entry = secondaryEntries[name] if(!entry){ throw Error(`Can not find the secondary entry '${name}'. Referenced in template.py?`) } const parameters = installParameters || {} const scripts = [ ...(parameters.scripts || []), `@youwol/cdn-client#2.1.3~dist/@youwol/cdn-client/${entry.name}.js` ] const modules = [ ...(parameters.modules || []), ...entry.loadDependencies.map( d => `${d}#${runTimeDependencies.externals[d]}`) ] return cdnClient.install({ ...parameters, modules, scripts, }).then(() => { return window[`@youwol/cdn-client/${entry.name}_APIv2`] }) }, getCdnDependencies(name?: string){ if(name && !secondaryEntries[name]){ throw Error(`Can not find the secondary entry '${name}'. Referenced in template.py?`) } const deps = name ? secondaryEntries[name].loadDependencies : mainEntry.loadDependencies return deps.map( d => `${d}#${runTimeDependencies.externals[d]}`) } }