Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions esdoc-importpath-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ Therefore, convert the import path by using following setting.
"option": {
"stripPackageName": false,
"replaces": [
{"from": "^src/", "to": "lib/"}
{"from": "^src/", "fromFlags": "i", "to": "lib/"}
]
}
}
]
}
```

``from`` is regular expression and ``to``is letter. In the internal ``from`` and ``to`` are used with ``String#replace(new RegExp (from), to)``.
``from`` is regular expression, ``fromFlags`` is flags of regular expression, and ``to``is letter. In the internal ``from``, ``fromFlags`` and ``to`` are used with ``String#replace(new RegExp (from, fromFlags), to)``.

When writing multi rules, it will also be carried out transformation many times.
For example, ``[{from: "^src/", to: "lib/"}, {from: "MyFooClass", to: "my-foo"}]`` converted as follows:
Expand Down
2 changes: 1 addition & 1 deletion esdoc-importpath-plugin/src/Plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Plugin {
const option = ev.data.option;

for (let item of option.replaces) {
item.from = new RegExp(item.from);
item.from = new RegExp(item.from, item.fromFlags);
}

// get package.json
Expand Down
2 changes: 1 addition & 1 deletion esdoc-importpath-plugin/test/esdoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"name": "./src/Plugin.js",
"option": {
"replaces": [
{"from": "^src/", "to": "lib/"},
{"from": "^src/", "fromFlags": "i", "to": "lib/"},
{"from": "^lib/MyClass2.js", "to": "lib/foo"}
]
}
Expand Down