@@ -76,8 +76,12 @@ class ModuleResolver {
76
76
this . allowedTypes = allowedTypes
77
77
this . load = load
78
78
this . cwd = cwd || process . cwd ( )
79
- this . nonScopePrefix = `${ org } -${ type } -`
80
- this . scopePrefix = `@${ org } /${ type } -`
79
+ if ( org ) {
80
+ this . nonScopePrefix = `${ org } -${ type } -`
81
+ this . scopePrefix = `@${ org } /${ type } -`
82
+ } else {
83
+ this . nonScopePrefix = `${ type } -`
84
+ }
81
85
this . typePrefixLength = type . length + 1
82
86
/* - */
83
87
this . prefixSlicePosition = this . typePrefixLength + org . length + 1
@@ -197,7 +201,7 @@ class ModuleResolver {
197
201
const pkg = resolveScopePackage ( req )
198
202
if ( pkg ) {
199
203
// speicial handling for default org.
200
- if ( pkg . org === this . org ) {
204
+ if ( this . org && pkg . org === this . org ) {
201
205
shortcut = pkg . name . startsWith ( `${ this . type } -` )
202
206
? pkg . name . slice ( this . typePrefixLength )
203
207
: pkg . name
@@ -265,6 +269,10 @@ export function resolveScopePackage (name: string) {
265
269
}
266
270
}
267
271
272
+ export const getMarkdownItResolver = ( cwd : string ) => new ModuleResolver (
273
+ 'markdown-it' , '' , [ String , Function ] , true /* load module */ , cwd
274
+ )
275
+
268
276
export const getPluginResolver = ( cwd : string ) : ModuleResolver => new ModuleResolver (
269
277
'plugin' , 'vuepress' , [ String , Function , Object ] , true /* load module */ , cwd
270
278
)
0 commit comments