Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit 11100a0

Browse files
authored
Prepare release 1.0.0-pre.7 (#29)
* Updated CHANGELOG and package.json for 1.0.0-pre.7 release. * Small renames for correctness and consistency. * Security audit fix by updating package-lock'd minimist and mkdirp
1 parent 0f4ecf9 commit 11100a0

File tree

5 files changed

+19
-26
lines changed

5 files changed

+19
-26
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1212

1313
<!-- ## Unreleased -->
1414
<!-- Add new unreleased items here -->
15+
## [1.0.0-pre.7] - 2020-04-09
16+
- Added support for Windows paths (thanks, @andrewiggins)
1517

1618
## [1.0.0-pre.6] - 2019-08-06
1719
- Fixed issue where syntax errors encountered in files would result in an empty response.

package-lock.json

Lines changed: 8 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "koa-node-resolve",
3-
"version": "1.0.0-pre.6",
3+
"version": "1.0.0-pre.7",
44
"description": "Koa middleware that transforms Node package specifiers to relative paths",
55
"main": "lib/koa-node-resolve.js",
66
"files": [

src/support/path-utils.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,16 @@
1313
*/
1414
import {posix, sep as pathSeparator} from 'path';
1515

16-
const dirnameRegex = process.platform === 'win32' ? /[^\\]+$/ : /[^\/]+$/;
16+
const filenameRegex = process.platform === 'win32' ? /[^\\]+$/ : /[^\/]+$/;
1717

1818
/**
1919
* Similar to `path.dirname()` except includes trailing slash and for a
2020
* path `/like/this/` will return `/like/this/` instead of `/like` since the
2121
* trailing slash indicates `this` is a folder name not a file name.
2222
* (`path.dirname('/like/this/')` returns `/like`.)
2323
*/
24-
export const dirname = (path: string): string => path.replace(dirnameRegex, '');
24+
export const dirname = (path: string): string =>
25+
path.replace(filenameRegex, '');
2526

2627
export const ensureLeadingDotInURL = (path: string): string =>
2728
(path.startsWith('../') || path.startsWith('./')) ? path : './' + path;
@@ -32,12 +33,12 @@ export const ensureTrailingSlashInPath = (path: string): string =>
3233
export const forwardSlashesOnlyPlease = (path: string): string =>
3334
path.replace(/\\/g, '/');
3435

35-
export const getBaseUrl = (href: string): string => href.replace(/[^\/]+$/, '');
36+
export const getBaseURL = (href: string): string => href.replace(/[^\/]+$/, '');
3637

3738
export const noLeadingSlashInURL = (href: string): string =>
3839
href.replace(/^\//, '');
3940

40-
export const relativePathToUrl = (from: string, to: string): string =>
41+
export const relativePathToURL = (from: string, to: string): string =>
4142
ensureLeadingDotInURL(posix.relative(
42-
getBaseUrl(forwardSlashesOnlyPlease(from)),
43+
getBaseURL(forwardSlashesOnlyPlease(from)),
4344
forwardSlashesOnlyPlease(to)));

src/support/resolve-node-specifier.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import nodeResolve from 'resolve';
1515

1616
import {Logger} from './logger';
1717

18-
import {dirname, relativePathToUrl} from './path-utils';
18+
import {dirname, relativePathToURL} from './path-utils';
1919

2020
export const resolveNodeSpecifier =
2121
(modulePath: string, specifier: string, logger: Logger): string => {
@@ -35,7 +35,7 @@ export const resolveNodeSpecifier =
3535
packageJson.main
3636
})
3737
});
38-
const resolvedURL = relativePathToUrl(modulePath, dependencyPath);
38+
const resolvedURL = relativePathToURL(modulePath, dependencyPath);
3939
if (resolvedURL !== specifier) {
4040
logger.debug &&
4141
logger.debug(`Resolved Node module specifier "${specifier}" to "${

0 commit comments

Comments
 (0)