Skip to content

Commit 60f0209

Browse files
committed
feat(interfaces): Options
Signed-off-by: Lexus Drumgold <[email protected]>
1 parent 2a4f1b7 commit 60f0209

File tree

8 files changed

+76
-4
lines changed

8 files changed

+76
-4
lines changed

build.config.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ import pkg from './package.json' assert { type: 'json' }
1313
* @const {Config} config
1414
*/
1515
const config: Config = defineBuildConfig({
16+
entries: [
17+
{ dts: 'only' },
18+
{
19+
dts: false,
20+
pattern: ['**/index.ts', 'internal/*', 'regex/*', 'utils/*'],
21+
sourcemap: true,
22+
sourcesContent: false
23+
}
24+
],
1625
target: 'node' + pkg.engines.node.replace(/^\D+/, ''),
1726
tsconfig: 'tsconfig.build.json'
1827
})

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
},
2323
"type": "module",
2424
"files": [
25-
"dist"
25+
"dist",
26+
"src"
2627
],
2728
"exports": {
2829
".": "./dist/index.mjs",
@@ -68,15 +69,15 @@
6869
},
6970
"dependencies": {
7071
"@flex-development/errnode": "1.5.0",
71-
"@flex-development/pathe": "1.0.3"
72+
"@flex-development/pathe": "1.0.3",
73+
"@flex-development/tutils": "6.0.0-alpha.10"
7274
},
7375
"devDependencies": {
7476
"@commitlint/cli": "17.4.3",
7577
"@commitlint/config-conventional": "17.4.3",
7678
"@flex-development/mkbuild": "1.0.0-alpha.11",
7779
"@flex-development/mlly": "1.0.0-alpha.11",
7880
"@flex-development/tsconfig-utils": "1.1.1",
79-
"@flex-development/tutils": "6.0.0-alpha.10",
8081
"@graphql-eslint/eslint-plugin": "3.16.0",
8182
"@types/chai": "4.3.4",
8283
"@types/conventional-changelog": "3.1.1",

src/.npmignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# NPM IGNORE
2+
# https://npm.github.io/publishing-pkgs-docs/publishing/the-npmignore-file.html
3+
# https://github.com/yarnpkg/yarn/issues/685#issuecomment-457618561
4+
5+
# DIRECTORIES & FILES
6+
**/__mocks__/**
7+
**/__snapshots__/**
8+
**/__tests__/**

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
* @module ext-regex
44
*/
55

6+
export * from './interfaces'
67
export * from './regex'
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* @file Type Tests - Options
3+
* @module ext-regex/interfaces/tests/unit-d/Options
4+
*/
5+
6+
import type { KeysRequired, Nilable } from '@flex-development/tutils'
7+
import type TestSubject from '../options'
8+
9+
describe('unit-d:interfaces/Options', () => {
10+
it('should allow empty object', () => {
11+
expectTypeOf<KeysRequired<TestSubject>>().toBeNever()
12+
})
13+
14+
it('should match [flags?: Nilable<string>]', () => {
15+
expectTypeOf<TestSubject>()
16+
.toHaveProperty('flags')
17+
.toEqualTypeOf<Nilable<string>>()
18+
})
19+
})

src/interfaces/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/**
2+
* @file Entry Point - Interfaces
3+
* @module ext-regex/interfaces
4+
*/
5+
6+
export type { default as Options } from './options'

src/interfaces/options.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* @file Interfaces - Options
3+
* @module ext-regex/interfaces/Options
4+
*/
5+
6+
import type { Nilable } from '@flex-development/tutils'
7+
8+
/**
9+
* Options for creating regular expressions matching file extensions.
10+
*/
11+
interface Options {
12+
/**
13+
* Flags passed to the {@linkcode RegExp} constructor.
14+
*
15+
* @see https://developer.mozilla.org/docs/Web/JavaScript/Guide/Regular_Expressions#advanced_searching_with_flags
16+
*
17+
*
18+
* @default undefined
19+
*/
20+
flags?: Nilable<string>
21+
}
22+
23+
export type { Options as default }

vitest.config.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,12 @@ const config: UserConfigExport = defineConfig((): UserConfig => {
5252
all: !LINT_STAGED,
5353
clean: true,
5454
cleanOnRerun: true,
55-
exclude: ['**/__mocks__/**', '**/__tests__/**', '**/index.ts'],
55+
exclude: [
56+
'**/__mocks__/**',
57+
'**/__tests__/**',
58+
'**/index.ts',
59+
'src/interfaces/'
60+
],
5661
extension: ['.ts'],
5762
ignoreClassMethods: [],
5863
include: ['src'],

0 commit comments

Comments
 (0)