commit
ce6780aed1
13
_SETUP.md
13
_SETUP.md
|
@ -87,3 +87,16 @@ or incremental (in watch mode)
|
|||
```bash
|
||||
yarn type-lint --watch
|
||||
```
|
||||
|
||||
### To update all examples use
|
||||
|
||||
```bash
|
||||
yarn build:examples
|
||||
```
|
||||
|
||||
### To update a specific example use
|
||||
|
||||
```bash
|
||||
cd examples/<path to example>
|
||||
node build.js
|
||||
```
|
||||
|
|
|
@ -61,7 +61,7 @@ class RequestShortener {
|
|||
: dirname;
|
||||
|
||||
if (parentDirectory && parentDirectory !== directory) {
|
||||
this.parentDirectoryRegExp = createRegExpForPath(parentDirectory);
|
||||
this.parentDirectoryRegExp = createRegExpForPath(`${parentDirectory}/`);
|
||||
}
|
||||
|
||||
if (__dirname.length >= 2) {
|
||||
|
@ -99,7 +99,7 @@ class RequestShortener {
|
|||
result = result.replace(this.currentDirectoryRegExp, "!.");
|
||||
}
|
||||
if (this.parentDirectoryRegExp) {
|
||||
result = result.replace(this.parentDirectoryRegExp, "!..");
|
||||
result = result.replace(this.parentDirectoryRegExp, "!../");
|
||||
}
|
||||
if (!this.buildinsAsModule && this.buildinsRegExp) {
|
||||
result = result.replace(this.buildinsRegExp, "!(webpack)");
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
"use strict";
|
||||
|
||||
const RequestShortener = require("../lib/RequestShortener");
|
||||
|
||||
describe("RequestShortener", () => {
|
||||
it("should create RequestShortener and shorten with ./ file in directory", () => {
|
||||
const shortener = new RequestShortener("/foo/bar");
|
||||
expect(shortener.shorten("/foo/bar/some.js")).toEqual("./some.js");
|
||||
});
|
||||
|
||||
it("should create RequestShortener and shorten with ../ file in parent directory", () => {
|
||||
const shortener = new RequestShortener("/foo/bar");
|
||||
expect(shortener.shorten("/foo/baz/some.js")).toEqual("../baz/some.js");
|
||||
});
|
||||
|
||||
it("should create RequestShortener and not shorten parent directory neighbor", () => {
|
||||
const shortener = new RequestShortener("/foo/bar");
|
||||
expect(shortener.shorten("/foo_baz/bar/some.js")).toEqual(
|
||||
"/foo_baz/bar/some.js"
|
||||
);
|
||||
});
|
||||
});
|
48
yarn.lock
48
yarn.lock
|
@ -1953,13 +1953,13 @@ eslint-plugin-jest@^22.2.2:
|
|||
"@typescript-eslint/experimental-utils" "^1.13.0"
|
||||
|
||||
eslint-plugin-jsdoc@^15.3.2:
|
||||
version "15.9.2"
|
||||
resolved "https://registry.yarnpkg.com/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-15.9.2.tgz#fe02042ed6d2e140dc7710afd129382712c95101"
|
||||
integrity sha512-dJjIWFJlh4ti3CegWYN0jUUdjEsWvJ8TZJ/cMQldioVLxMmU3UZeZsHzxYcCicJwSVhQ+uGm+dbUyEIm0slX3Q==
|
||||
version "15.10.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-15.10.0.tgz#67ded2bf37aa14f80fd938527a38fd99b430be03"
|
||||
integrity sha512-3nxbAcppP880k9De+rXAs4jsZuhFjhjav/VZU62grwi7btiKPzPUsjYOyZaEBVJOjPxIo+BBhovZmhZ5UQv+AQ==
|
||||
dependencies:
|
||||
comment-parser "^0.6.2"
|
||||
debug "^4.1.1"
|
||||
jsdoctypeparser "5.0.1"
|
||||
jsdoctypeparser "^5.1.1"
|
||||
lodash "^4.17.15"
|
||||
object.entries-ponyfill "^1.0.1"
|
||||
regextras "^0.6.1"
|
||||
|
@ -3620,10 +3620,10 @@ jsbn@~0.1.0:
|
|||
resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513"
|
||||
integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM=
|
||||
|
||||
jsdoctypeparser@5.0.1:
|
||||
version "5.0.1"
|
||||
resolved "https://registry.yarnpkg.com/jsdoctypeparser/-/jsdoctypeparser-5.0.1.tgz#0d6bc09bb8bebeca5a588fcd508228d2189409a3"
|
||||
integrity sha512-dYwcK6TKzvq+ZKtbp4sbQSW9JMo6s+4YFfUs5D/K7bZsn3s1NhEhZ+jmIPzby0HbkbECBe+hNPEa6a+E21o94w==
|
||||
jsdoctypeparser@^5.1.1:
|
||||
version "5.1.1"
|
||||
resolved "https://registry.yarnpkg.com/jsdoctypeparser/-/jsdoctypeparser-5.1.1.tgz#99c57412fe736c70024bf54204ed1bb93cf4a49f"
|
||||
integrity sha512-APGygIJrT5bbz5lsVt8vyLJC0miEbQf/z9ZBfTr4RYvdia8AhWMRlYgivvwHG5zKD/VW3d6qpChCy64hpQET3A==
|
||||
|
||||
jsdom@^11.5.1:
|
||||
version "11.12.0"
|
||||
|
@ -4094,7 +4094,15 @@ memoizee@^0.4.14:
|
|||
next-tick "1"
|
||||
timers-ext "^0.1.5"
|
||||
|
||||
memory-fs@^0.4.0, memory-fs@~0.4.1:
|
||||
memory-fs@^0.5.0:
|
||||
version "0.5.0"
|
||||
resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.5.0.tgz#324c01288b88652966d161db77838720845a8e3c"
|
||||
integrity sha512-jA0rdU5KoQMC0e6ppoNRtpp6vjFq6+NY7r8hywnC7V+1Xj/MtHwGIbB1QaK/dunyjWteJzmkpd7ooeWg10T7GA==
|
||||
dependencies:
|
||||
errno "^0.1.3"
|
||||
readable-stream "^2.0.1"
|
||||
|
||||
memory-fs@~0.4.1:
|
||||
version "0.4.1"
|
||||
resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.4.1.tgz#3a9a20b8462523e447cfbc7e8bb80ed667bfc552"
|
||||
integrity sha1-OpoguEYlI+RHz7x+i7gO1me/xVI=
|
||||
|
@ -5202,14 +5210,14 @@ rc@^1.2.7:
|
|||
strip-json-comments "~2.0.1"
|
||||
|
||||
react-dom@^16.8.0:
|
||||
version "16.9.0"
|
||||
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.9.0.tgz#5e65527a5e26f22ae3701131bcccaee9fb0d3962"
|
||||
integrity sha512-YFT2rxO9hM70ewk9jq0y6sQk8cL02xm4+IzYBz75CQGlClQQ1Bxq0nhHF6OtSbit+AIahujJgb/CPRibFkMNJQ==
|
||||
version "16.10.2"
|
||||
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.10.2.tgz#4840bce5409176bc3a1f2bd8cb10b92db452fda6"
|
||||
integrity sha512-kWGDcH3ItJK4+6Pl9DZB16BXYAZyrYQItU4OMy0jAkv5aNqc+mAKb4TpFtAteI6TJZu+9ZlNhaeNQSVQDHJzkw==
|
||||
dependencies:
|
||||
loose-envify "^1.1.0"
|
||||
object-assign "^4.1.1"
|
||||
prop-types "^15.6.2"
|
||||
scheduler "^0.15.0"
|
||||
scheduler "^0.16.2"
|
||||
|
||||
react-is@^16.8.1, react-is@^16.8.4:
|
||||
version "16.8.6"
|
||||
|
@ -5217,9 +5225,9 @@ react-is@^16.8.1, react-is@^16.8.4:
|
|||
integrity sha512-aUk3bHfZ2bRSVFFbbeVS4i+lNPZr3/WM5jT2J5omUVV1zzcs1nAaf3l51ctA5FFvCRbhrH0bdAsRRQddFJZPtA==
|
||||
|
||||
react@^16.8.0:
|
||||
version "16.9.0"
|
||||
resolved "https://registry.yarnpkg.com/react/-/react-16.9.0.tgz#40ba2f9af13bc1a38d75dbf2f4359a5185c4f7aa"
|
||||
integrity sha512-+7LQnFBwkiw+BobzOF6N//BdoNw0ouwmSJTEm9cglOOmsg/TMiFHZLe2sEoN5M7LgJTj9oHH0gxklfnQe66S1w==
|
||||
version "16.10.2"
|
||||
resolved "https://registry.yarnpkg.com/react/-/react-16.10.2.tgz#a5ede5cdd5c536f745173c8da47bda64797a4cf0"
|
||||
integrity sha512-MFVIq0DpIhrHFyqLU0S3+4dIcBhhOvBE8bJ/5kHPVOVaGdo0KuiQzpcjCPsf585WvhypqtrMILyoE2th6dT+Lw==
|
||||
dependencies:
|
||||
loose-envify "^1.1.0"
|
||||
object-assign "^4.1.1"
|
||||
|
@ -5538,10 +5546,10 @@ sax@^1.2.4:
|
|||
resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9"
|
||||
integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==
|
||||
|
||||
scheduler@^0.15.0:
|
||||
version "0.15.0"
|
||||
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.15.0.tgz#6bfcf80ff850b280fed4aeecc6513bc0b4f17f8e"
|
||||
integrity sha512-xAefmSfN6jqAa7Kuq7LIJY0bwAPG3xlCj0HMEBQk1lxYiDKZscY2xJ5U/61ZTrYbmNQbXa+gc7czPkVo11tnCg==
|
||||
scheduler@^0.16.2:
|
||||
version "0.16.2"
|
||||
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.16.2.tgz#f74cd9d33eff6fc554edfb79864868e4819132c1"
|
||||
integrity sha512-BqYVWqwz6s1wZMhjFvLfVR5WXP7ZY32M/wYPo04CcuPM7XZEbV2TBNW7Z0UkguPTl0dWMA59VbNXxK6q+pHItg==
|
||||
dependencies:
|
||||
loose-envify "^1.1.0"
|
||||
object-assign "^4.1.1"
|
||||
|
|
Loading…
Reference in New Issue