Browse Source

Rename scriptPathOverrides with scriptPathRegexpOverrides

As sourceMapPathOverrides does not use regular expressions, the new name for
script overrides is more explicit and consistent.
drone
Nicolas Petton 2 years ago
parent
commit
395da26dec
No known key found for this signature in database GPG Key ID: E8BCD7866AFCF978
5 changed files with 16 additions and 16 deletions
  1. +3
    -3
      doc/Indium.texi
  2. +7
    -7
      server/helpers/workspace.js
  3. +3
    -3
      server/spec/helpers/workspace-spec.js
  4. +2
    -2
      sphinx-doc/debugger.rst
  5. +1
    -1
      sphinx-doc/setup.rst

+ 3
- 3
doc/Indium.texi View File

@ -325,7 +325,7 @@ this @code{.indium.json} file is placed, but it can be overridden with the @code
@}
@end example
Custom script path overrides can be set with @code{scriptPathOverrides}. See
Custom script path overrides can be set with @code{scriptPathRegexpOverrides}. See
@ref{14,,Overriding script paths} for more information on script paths and debugging.
Custom sourcemap path overrides can be set with @code{sourceMapPathOverrides}. See
@ -809,14 +809,14 @@ sourcemap paths using @code{M-x indium-list-sourcemap-sources}.
If your application’s script URLs don’t correspond directly to where
their source code is located, you can use @code{scriptPathOverrides} to
their source code is located, you can use @code{scriptPathRegexpOverrides} to
tell Indium where to find the sources. It maps regular expressions to
Javascript substitution strings.
For example, if your project root is @code{/home/user/projects/foo/}, and
the source code for @indicateurl{http://localhost:3000/js/app.js/1234567890} is at
@code{/home/user/projects/foo/private/js/app.js}, you might set
@code{scriptPathOverrides} to:
@code{scriptPathRegexpOverrides} to:
@example
@{


+ 7
- 7
server/helpers/workspace.js View File

@ -70,16 +70,16 @@ const resolveRoot = conf => {
};
const locateScript = (pathname, conf) => {
let overrides = conf.scriptPathOverrides || {};
let overrides = conf.scriptPathRegexpOverrides || {};
for (let pattern of Object.keys(overrides)) {
let regex = new RegExp(pattern);
for (let pattern of Object.keys(overrides)) {
let regex = new RegExp(pattern);
if (pathname.match(regex)) {
return pathname.replace(regex, overrides[pattern]);
}
if (pathname.match(regex)) {
return pathname.replace(regex, overrides[pattern]);
}
return pathname;
}
return pathname;
};
const resolveUrl = (url, conf) => {


+ 3
- 3
server/spec/helpers/workspace-spec.js View File

@ -221,10 +221,10 @@ describe("URL resolution", () => {
expect(resolveUrl(url, conf)).toEqual(url);
});
it("supports script path overrides", () => {
it("supports script path regexp overrides", () => {
let conf = {
projectFile: "/home/user/projects/foo/.indium.json",
"scriptPathOverrides": {
"scriptPathRegexpOverrides": {
"(/js/.*\\.js)/[0-9]+": "private$1"
}
};
@ -233,4 +233,4 @@ describe("URL resolution", () => {
expect(resolveUrl(url, conf)).toEqual("/home/user/projects/foo/private/js/app.js");
});
});
});

+ 2
- 2
sphinx-doc/debugger.rst View File

@ -50,14 +50,14 @@ Overriding script paths
~~~~~~~~~~~~~~~~~~~~~~~
If your application's script URLs don't correspond directly to where
their source code is located, you can use ``scriptPathOverrides`` to
their source code is located, you can use ``scriptPathRegexpOverrides`` to
tell Indium where to find the sources. It maps regular expressions to
Javascript substitution strings.
For example, if your project root is ``/home/user/projects/foo/``, and
the source code for http://localhost:3000/js/app.js/1234567890 is at
``/home/user/projects/foo/private/js/app.js``, you might set
``scriptPathOverrides`` to::
``scriptPathRegexpOverrides`` to::
{
"(/js/.*\\.js)/[0-9]+": "private$1"


+ 1
- 1
sphinx-doc/setup.rst View File

@ -48,7 +48,7 @@ this ``.indium.json`` file is placed, but it can be overridden with the ``root``
]
}
Custom script path overrides can be set with ``scriptPathOverrides``. See
Custom script path overrides can be set with ``scriptPathRegexpOverrides``. See
:ref:`scriptpaths` for more information on script paths and debugging.
Custom sourcemap path overrides can be set with ``sourceMapPathOverrides``. See


Loading…
Cancel
Save