-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Require Node.js 12.20 and move to ESM (#25)
- Loading branch information
Showing
11 changed files
with
56 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
import filenamify = require('./filenamify'); | ||
import {Options} from './filenamify.js'; | ||
|
||
/** | ||
Convert the filename in a path a valid filename and return the augmented path. | ||
*/ | ||
declare const filenamifyPath: (path: string, options?: filenamify.Options) => string; | ||
|
||
export = filenamifyPath; | ||
export default function filenamifyPath(path: string, options?: Options): string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
'use strict'; | ||
const path = require('path'); | ||
const filenamify = require('./filenamify'); | ||
import path from 'node:path'; | ||
import filenamify from './filenamify.js'; | ||
|
||
const filenamifyPath = (filePath, options) => { | ||
export default function filenamifyPath(filePath, options) { | ||
filePath = path.resolve(filePath); | ||
return path.join(path.dirname(filePath), filenamify(path.basename(filePath), options)); | ||
}; | ||
|
||
module.exports = filenamifyPath; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,8 @@ | ||
import filenamify = require('./filenamify'); | ||
import filenamifyPath = require('./filenamify-path'); | ||
import filenamify from './filenamify.js'; | ||
import filenamifyPath from './filenamify-path.js'; | ||
|
||
declare const filenamifyCombined: { | ||
/** | ||
Convert a string to a valid filename. | ||
export default filenamify; | ||
|
||
@example | ||
``` | ||
import filenamify = require('filenamify'); | ||
filenamify('<foo/bar>'); | ||
//=> 'foo!bar' | ||
filenamify('foo:"bar"', {replacement: '🐴'}); | ||
//=> 'foo🐴bar' | ||
``` | ||
*/ | ||
(string: string, options?: filenamify.Options): string; | ||
|
||
path: typeof filenamifyPath; | ||
export { | ||
filenamifyPath | ||
}; | ||
|
||
export = filenamifyCombined; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,2 @@ | ||
'use strict'; | ||
const filenamify = require('./filenamify'); | ||
const filenamifyPath = require('./filenamify-path'); | ||
|
||
const filenamifyCombined = filenamify; | ||
filenamifyCombined.path = filenamifyPath; | ||
|
||
module.exports = filenamify; | ||
export {default} from './filenamify.js'; | ||
export {default as filenamifyPath} from './filenamify-path.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import {expectType} from 'tsd'; | ||
import filenamify = require('.'); | ||
import filenamify, {filenamifyPath} from './index.js'; | ||
|
||
expectType<string>(filenamify('<foo/bar>')); | ||
expectType<string>(filenamify('foo:"bar"', {replacement: '🐴'})); | ||
expectType<string>(filenamify.path('/some/!path')); | ||
expectType<string>(filenamifyPath('/some/!path')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters