-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support option item privateJsDocTag (#24)
* feat: support option item privateJsDocTag * publish 3.2.6-alpha.0 * fix && publish 3.2.6-alpha.1 * add TODO * add test * fix: internal namespace exported * publish alpha.2 * add named export test * fix: named export * publish alpha.3
- Loading branch information
Showing
13 changed files
with
219 additions
and
3 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
41 changes: 41 additions & 0 deletions
41
test/privateJsDocTag/__snapshots__/private-js-doc-tag.test.ts.snap
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Private JS doc tag 1`] = ` | ||
"declare module \\"testTag\\" { | ||
export namespace publicNS { | ||
export const publicVar: number; | ||
} | ||
export const publicNamedExport: number; | ||
export class A { | ||
publicMethod(): __private._index__InternalA; | ||
get publicAccessor(); | ||
set publicAccessor(v: __private._index__InternalA); | ||
publicField: number; | ||
} | ||
export const typeLiternal: { | ||
publicMethod(): __private._index__InternalA; | ||
publicProp: number; | ||
}; | ||
export interface publicInterface { | ||
publicMethod(): __private._index__internalInterface; | ||
publicProp: number; | ||
} | ||
export const publicFromAll: number; | ||
export namespace __private { | ||
/** | ||
* @internal | ||
*/ | ||
export class _index__InternalA { | ||
} | ||
/** | ||
* @internal | ||
*/ | ||
export interface _index__internalInterface { | ||
publicMethod(): _index__InternalA; | ||
publicProp: number; | ||
} | ||
} | ||
export {}; | ||
} | ||
" | ||
`; |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
import ps from 'path'; | ||
import { bundle } from '../../source/gift'; | ||
|
||
test('Private JS doc tag', async () => { | ||
const inputPath = ps.join(__dirname, './test-case/index.d.ts'); | ||
const { groups } = bundle({ | ||
input: inputPath, | ||
rootModule: inputPath, | ||
name: 'testTag', | ||
output: ps.join(__dirname, './outout.d.ts'), | ||
privateJsDocTag: 'internal', | ||
}); | ||
expect(groups.length).toBe(1); | ||
expect(groups[0].code).toMatchSnapshot(); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export const internalFromAll: number; | ||
export const publicFromAll: number; |
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 |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import * as publicNS from './public-namespace'; | ||
import * as internalNS from './internal-namespace'; | ||
|
||
export { publicNS }; | ||
/** | ||
* @internal | ||
*/ | ||
export { internalNS }; | ||
|
||
export * from './all'; | ||
export { internalNamedExport, publicNamedExport } from './named-export'; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export class InternalA {} | ||
|
||
export class A { | ||
/** | ||
* @internal | ||
*/ | ||
internalMethod (): InternalA; | ||
|
||
publicMethod (): InternalA; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
get internalAccessor (); | ||
set internalAccessor (v: InternalA); | ||
|
||
get publicAccessor (); | ||
set publicAccessor (v: InternalA); | ||
|
||
/** | ||
* @internal | ||
*/ | ||
inaternalField: number; | ||
|
||
publicField: number; | ||
} | ||
|
||
export declare const typeLiternal: { | ||
/** | ||
* @internal | ||
*/ | ||
internalMethod (): InternalA; | ||
publicMethod (): InternalA; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
inaternalProp: number; | ||
publicProp: number; | ||
} | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export interface internalInterface { | ||
/** | ||
* @internal | ||
*/ | ||
internalMethod (): InternalA; | ||
publicMethod (): InternalA; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
inaternalProp: number; | ||
publicProp: number; | ||
} | ||
|
||
export interface publicInterface { | ||
/** | ||
* @internal | ||
*/ | ||
internalMethod (): internalInterface; | ||
publicMethod (): internalInterface; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
inaternalProp: number; | ||
publicProp: number; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export declare const publicVar: number; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export declare const internalVar: number; | ||
|
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export const publicNamedExport: number; | ||
/** | ||
* @internal | ||
*/ | ||
export const internalNamedExport: number; |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export declare const publicVar: number; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export declare const internalVar: number; | ||
|