in packages/build-tools/console-toolkit-plugin-xconsole-fs-route/src/route/RouteMeta.ts [43:74]
constructor(opts: IPageMetaOption) {
const { directory, cwd, distDir, ext, layoutPath } = opts;
this.dir = directory;
this.distDir = distDir;
this.style = resolve(directory, SYTLE);
this.component = resolve(directory, COMPONENT_ENTRY)
.replace(/\.(j|t)sx?/g, ext);
this.config = this.existPath(resolve(directory, CONFIG));
this.model = this.existPath(resolve(directory, MODEL));
this.importPath = relative(this.distDir, this.component)
.replace(/(\\|\/)/g, '/')
.replace(/\.(j|t)sx?/g, '');
this.componentName = getComponentName(relative(distDir, this.dir));
this.routePath = relative(cwd, directory)
.replace(/\.\./g, '')
.replace(/(\\|\/)/g, '/')
.replace(/\/\$/g, '/:')
.replace(/^\$/g, ':');
this.layoutPath = layoutPath;
if (layoutPath) {
this.layoutImportPath = relative(this.distDir, layoutPath)
.replace(/(\\|\/)/g, '/')
.replace(/\.(j|t)sx?/g, '');
this.layoutComponentName = getComponentName(relative(distDir, layoutPath));
}
this.buildMeta();
}