Spaces:
Sleeping
Sleeping
pythonic-rag-FastAPIReact / frontend /node_modules /adjust-sourcemap-loader /codec /source-relative.js
Download frontend/node_modules/adjust-sourcemap-loader/codec/source-relative.js from sepidnes/pythonic-rag-FastAPIReact: direct link, hf CLI and curl.
- Browser
- Download file 1.45 kB
-
https://huggingface.co/spaces/sepidnes/pythonic-rag-FastAPIReact/resolve/94e32638a275d46bc1ba62feac204fcaaf313da4/frontend/node_modules/adjust-sourcemap-loader/codec/source-relative.js
- Command line
-
hf download hf://spaces/sepidnes/pythonic-rag-FastAPIReact@94e32638a275d46bc1ba62feac204fcaaf313da4/frontend/node_modules/adjust-sourcemap-loader/codec/source-relative.js
-
curl -L -o source-relative.js https://huggingface.co/spaces/sepidnes/pythonic-rag-FastAPIReact/resolve/94e32638a275d46bc1ba62feac204fcaaf313da4/frontend/node_modules/adjust-sourcemap-loader/codec/source-relative.js
1.45 kB
| ; | |
| var path = require('path'), | |
| fs = require('fs'); | |
| /** | |
| * Codec for relative paths with respect to the source directory. | |
| * @type {{name:string, decode: function, encode: function, root: function}} | |
| */ | |
| module.exports = { | |
| name : 'sourceRelative', | |
| decode: decode, | |
| encode: encode, | |
| root : root | |
| }; | |
| /** | |
| * Decode the given uri. | |
| * Any path without leading slash is tested against source directory. | |
| * @this {{options: object}} A loader or compilation | |
| * @param {string} uri A source uri to decode | |
| * @returns {boolean|string} False where unmatched else the decoded path | |
| */ | |
| function decode(uri) { | |
| /* jshint validthis:true */ | |
| var base = !uri.startsWith('/') && this.context, | |
| absFile = !!base && path.normalize(path.join(base, uri)), | |
| isValid = !!absFile && fs.existsSync(absFile) && fs.statSync(absFile).isFile(); | |
| return isValid && absFile; | |
| } | |
| /** | |
| * Encode the given file path. | |
| * @this {{options: object}} A loader or compilation | |
| * @param {string} absolute An absolute file path to encode | |
| * @returns {string} A uri without leading slash | |
| */ | |
| function encode(absolute) { | |
| /* jshint validthis:true */ | |
| return path.relative(this.context, absolute); | |
| } | |
| /** | |
| * The source-map root where relevant. | |
| * @this {{options: object}} A loader or compilation | |
| * @returns {string|undefined} The source-map root applicable to any encoded uri | |
| */ | |
| function root() { | |
| /* jshint validthis:true */ | |
| return this.context; | |
| } | |