mirror of
https://github.com/SamEyeBam/animate.git
synced 2025-09-28 06:55:25 +00:00
larry babby and threejs for glsl
This commit is contained in:
60
webGl/my-threejs-test/node_modules/@parcel/source-map/dist/utils.js.flow
generated
vendored
Normal file
60
webGl/my-threejs-test/node_modules/@parcel/source-map/dist/utils.js.flow
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
// @flow
|
||||
import type { VLQMap, SourceMapStringifyOptions } from './types';
|
||||
import path from 'path';
|
||||
|
||||
export function generateInlineMap(map: string): string {
|
||||
return `data:application/json;charset=utf-8;base64,${Buffer.from(map).toString('base64')}`;
|
||||
}
|
||||
|
||||
export async function partialVlqMapToSourceMap(map: VLQMap, opts: SourceMapStringifyOptions): Promise<VLQMap | string> {
|
||||
let { fs, file, sourceRoot, inlineSources, rootDir, format = 'string' } = opts;
|
||||
|
||||
let resultMap = {
|
||||
...map,
|
||||
sourcesContent: map.sourcesContent
|
||||
? map.sourcesContent.map((content) => {
|
||||
if (content) {
|
||||
return content;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
})
|
||||
: [],
|
||||
version: 3,
|
||||
file,
|
||||
sourceRoot,
|
||||
};
|
||||
|
||||
if (resultMap.sourcesContent.length < resultMap.sources.length) {
|
||||
for (let i = 0; i <= resultMap.sources.length - resultMap.sourcesContent.length; i++) {
|
||||
resultMap.sourcesContent.push(null);
|
||||
}
|
||||
}
|
||||
|
||||
if (fs) {
|
||||
resultMap.sourcesContent = await Promise.all(
|
||||
resultMap.sourcesContent.map(async (content, index): Promise<string | null> => {
|
||||
let sourceName = map.sources[index];
|
||||
// If sourceName starts with `..` it is outside rootDir, in this case we likely cannot access this file from the browser or packaged node_module
|
||||
// Because of this we have to include the sourceContent to ensure you can always see the sourcecontent for each mapping.
|
||||
if (!content && (inlineSources || sourceName.startsWith('..'))) {
|
||||
try {
|
||||
return await fs.readFile(path.resolve(rootDir || '/', sourceName), 'utf-8');
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
return content;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
if (format === 'inline' || format === 'string') {
|
||||
let stringifiedMap = JSON.stringify(resultMap);
|
||||
if (format === 'inline') {
|
||||
return generateInlineMap(stringifiedMap);
|
||||
}
|
||||
return stringifiedMap;
|
||||
}
|
||||
|
||||
return resultMap;
|
||||
}
|
Reference in New Issue
Block a user