Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}).then(data => {
const _content = JSON.stringify(data, null, ' ')
/* eslint-disable no-console */
console.log('file', file.replace(/\.[yr]a?ml$/, '.json'))
/* eslint-enable no-console */
fs.writeFileSync(
path.join(generatedPath, file.replace(/\.[yr]a?ml$/, '.json')),
_content
)
})
}
// This logic is based on that of AssetSourceResolver, with additional support for file hashes and
// explicitly provided URIs
const scale = AssetSourceResolver.pickScale(meta.scales, PixelRatio.get());
const index = meta.scales.findIndex(s => s === scale);
const hash = meta.fileHashes ? meta.fileHashes[index] || meta.fileHashes[0] : meta.hash;
// Allow asset processors to directly provide the URL to load
const uri = meta.fileUris ? meta.fileUris[index] || meta.fileUris[0] : meta.uri;
if (uri) {
return { uri: resolveUri(uri), hash };
}
// Check if the assetUrl was overridden in the manifest
const assetUrlOverride = Constants.manifest && Constants.manifest.assetUrlOverride;
if (assetUrlOverride) {
const uri = path.join(assetUrlOverride, hash);
return { uri: resolveUri(uri), hash };
}
const fileScale = scale === 1 ? '' : `@${scale}x`;
const fileExtension = meta.type ? `.${encodeURIComponent(meta.type)}` : '';
const suffix = `/${encodeURIComponent(
meta.name
)}${fileScale}${fileExtension}?platform=${encodeURIComponent(
Platform.OS
)}&hash=${encodeURIComponent(meta.hash)}`;
// For assets with a specified absolute URL, we use the existing origin instead of prepending the
// development server or production CDN URL origin
if (/^https?:\/\//.test(meta.httpServerLocation)) {
const uri = meta.httpServerLocation + suffix;
return { uri, hash };
return imports.some(i =>
relativeImportToPath(i)
? path.join(
path.dirname(filePath),
relativeImportToPath(i)
) === result.file.replace(/\.[^/.]+$/, '')
: result.file.includes(i.replace(/\./g, '/'))
)
public render() {
return <div>
<header>
<h1>{ strings.app_name }</h1>
<h3>{ strings.app_description }</h3>
<p>{strings.home_description}</p>
<a href="//opendota.com">{strings.home_description2}</a>
</header>
<main>
<section>
{
return {
alt: e,
url: `${process.env.PUBLIC_URL}/images/alliances/${e}.png`
};
})}/>
<h4>{underlordsLoc["dac_ingame_tab_synergies"]}</h4>
{
const hero = heroes[e as keyof typeof heroes];
return {
alt: hero.dota_unit_name,
url: GetHeroImage(hero.dota_unit_name)
};
})}/></section></main></div>
export function joinPaths(path1, path2) {
return path.join(path1, path2);
}
readFileAsync(filePath) {
for (const item of this.items) {
if (filePath.indexOf(
path.join(item.file.path, item.file.name)
) === 0) {
return new Promise((resolve) => {
resolve(item.content)
})
}
}
return new Promise((resolve) => {
resolve(
'::fileRef::' +
path.relative(path.dirname(this.baseItem), filePath)
)
})
}
export function resolveUri(uri: string): string {
if (!manifestBaseUrl) {
return uri;
}
const { protocol } = new URL(uri);
if (protocol !== '') {
return uri;
}
const baseUrl = new URL(manifestBaseUrl);
const resolvedPath = uri.startsWith('/') ? uri : path.join(baseUrl.pathname, uri);
baseUrl.set('pathname', resolvedPath);
return baseUrl.href;
}
export function resolveUri(uri) {
if (!manifestBaseUrl) {
return uri;
}
const { protocol } = new URL(uri);
if (protocol !== '') {
return uri;
}
const baseUrl = new URL(manifestBaseUrl);
const resolvedPath = uri.startsWith('/') ? uri : path.join(baseUrl.pathname, uri);
baseUrl.set('pathname', resolvedPath);
return baseUrl.href;
}
//# sourceMappingURL=AssetSources.js.map
return imports.some(i =>
path
.join(path.parse(result.file).dir, path.parse(result.file).name)
.endsWith(path.join(path.parse(i).dir, path.parse(i).name))
)