Last change
on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Rev | Line | |
---|
[6a3a178] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | var projectRelative = require('./project-relative');
|
---|
| 4 |
|
---|
| 5 | /**
|
---|
| 6 | * Codec for relative paths with respect to the context directory, preceded by a webpack:// protocol.
|
---|
| 7 | * @type {{name:string, decode: function, encode: function, root: function}}
|
---|
| 8 | */
|
---|
| 9 | module.exports = {
|
---|
| 10 | name : 'webpackProtocol',
|
---|
| 11 | decode: decode,
|
---|
| 12 | encode: encode,
|
---|
| 13 | root : root
|
---|
| 14 | };
|
---|
| 15 |
|
---|
| 16 | /**
|
---|
| 17 | * Decode the given uri.
|
---|
| 18 | * @this {{options: object}} A loader or compilation
|
---|
| 19 | * @param {string} uri A source uri to decode
|
---|
| 20 | * @returns {boolean|string} False where unmatched else the decoded path
|
---|
| 21 | */
|
---|
| 22 | function decode(uri) {
|
---|
| 23 | /* jshint validthis:true */
|
---|
| 24 | var analysis = /^webpack:\/{2}(.*)$/.exec(uri);
|
---|
| 25 | return !!analysis && projectRelative.decode.call(this, analysis[1]);
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | /**
|
---|
| 29 | * Encode the given file path.
|
---|
| 30 | * @this {{options: object}} A loader or compilation
|
---|
| 31 | * @param {string} absolute An absolute file path to encode
|
---|
| 32 | * @returns {string} A uri
|
---|
| 33 | */
|
---|
| 34 | function encode(absolute) {
|
---|
| 35 | /* jshint validthis:true */
|
---|
| 36 | return 'webpack://' + projectRelative.encode.call(this, absolute);
|
---|
| 37 | }
|
---|
| 38 |
|
---|
| 39 | /**
|
---|
| 40 | * The source-map root where relevant.
|
---|
| 41 | * @this {{options: object}} A loader or compilation
|
---|
| 42 | * @returns {string|undefined} The source-map root applicable to any encoded uri
|
---|
| 43 | */
|
---|
| 44 | function root() {
|
---|
| 45 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.