Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import * as Loader from './src/Loader';
import * as options from './src/options';
declare function loader(source: any, sourcemap: any): void;
declare module loader {
type ReplaceResult = Loader.ReplaceResult;
type LoaderCodeGen = Loader.LoaderCodeGen;
type RouterLoaderOptions = options.RouterLoaderOptions;
type RouteResourceOptions = options.RouteResourceOptions;
/**
* Add a code generator that can be used in the 'loader' option.
* @param name
* @param codeGen
*/
function setCodeGen(name: string, codeGen: Loader.LoaderCodeGen): void;
}
export = loader;
44 changes: 44 additions & 0 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 54 additions & 0 deletions dist/src/Loader.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/// <reference types="lodash" />
import { RouterLoaderOptions, RouteResourceOptions } from './options';
export interface ReplaceResult {
/**
* Debug mode
*/
debug: boolean;
/**
* The resolved path
*/
filePath: string;
/**
* The NgModule property on the resolved module
*/
moduleName: string;
/**
* The RESOURCE query used to resolve the module.
* Note: This is the query defined on the URI used in "loadChildren", not the global query.
*/
resourceQuery: RouteResourceOptions;
/**
* The updated source file.
*/
source: string;
/**
* The content remove from the source file.
*/
match: string;
/**
* The content inserted into the source file.
*/
replacement: string;
}
export declare type LoaderCodeGen = Function & (((file: string, module: string) => string) | ((file: string, module: string, loaderOptions: RouterLoaderOptions) => string) | ((file: string, module: string, loaderOptions: RouterLoaderOptions, resourceOptions: RouteResourceOptions) => string));
export declare class Loader {
private webpack;
query: RouterLoaderOptions;
constructor(webpack: any);
replace(source: string): Promise<[ReplaceResult] | undefined>;
private resolve(context, resourceUri);
private replaceSource(match, loadChildrenPath);
private normalize(filePath);
private trackSymbolRootDecl(absPath, moduleName);
/**
* Convert a source tree file path into a it's genDir representation
* this only change the path to the file, not the file iteself (i.e: suffix)
* @param absFilePath
* @returns {string}
*/
private sourceTreeToGenDir(absFilePath);
private genDirToSourceTree(absFilePath);
static setCodeGen(name: string, codeGen: LoaderCodeGen): void;
static LOADER_CODEGEN_MAP: Map<string, LoaderCodeGen>;
}
144 changes: 144 additions & 0 deletions dist/src/Loader.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading