New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

angular-router-loader

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-router-loader - npm Package Compare versions

Comparing version

to
0.7.0

25

CHANGELOG.md

@@ -1,3 +0,3 @@

<a name="0.5.0"></a>
# [0.5.0](https://github.com/brandonroberts/angular-router-loader/compare/v0.3.4...v0.5.0) (2017-01-07)
<a name="0.7.0"></a>
# [0.7.0](https://github.com/brandonroberts/angular-router-loader/compare/v0.6.0...v0.7.0) (2017-11-14)

@@ -7,3 +7,22 @@

* **docs:** Added updated changelog ([7d1f7f3](https://github.com/brandonroberts/angular-router-loader/commit/7d1f7f3))
### Features
* **loader:** Add support for dynamic import ([#90](https://github.com/brandonroberts/angular-router-loader/issues/90)) ([a9835ab](https://github.com/brandonroberts/angular-router-loader/commit/a9835ab))
* **loader:** Update regex to be able to use double-quotes and single-quotes ([#80](https://github.com/brandonroberts/angular-router-loader/issues/80)) ([0444b6e](https://github.com/brandonroberts/angular-router-loader/commit/0444b6e))
<a name="0.6.0"></a>
# [0.6.0](https://github.com/brandonroberts/angular-router-loader/compare/v0.3.4...v0.6.0) (2017-03-29)
### Bug Fixes
* **deps:** Updated webpack/loader-utils version to fix deprecation warning ([#61](https://github.com/brandonroberts/angular-router-loader/issues/61)) ([979ae85](https://github.com/brandonroberts/angular-router-loader/commit/979ae85))
* **docs:** Clarify `genDir` option usage ([#51](https://github.com/brandonroberts/angular-router-loader/issues/51)) ([b6f46b3](https://github.com/brandonroberts/angular-router-loader/commit/b6f46b3))
* **docs:** Fix colons in readme.md ([#36](https://github.com/brandonroberts/angular-router-loader/issues/36)) ([58db6de](https://github.com/brandonroberts/angular-router-loader/commit/58db6de))
* **loader:** Fixed bug when using query string with loadChildren ([#62](https://github.com/brandonroberts/angular-router-loader/issues/62)) ([8616eae](https://github.com/brandonroberts/angular-router-loader/commit/8616eae))
* **loader:** Prefer the query 'debug' parameter to the global value ([#37](https://github.com/brandonroberts/angular-router-loader/issues/37)) ([b96316c](https://github.com/brandonroberts/angular-router-loader/commit/b96316c))

@@ -14,3 +33,3 @@

* **loader:** Added support for nested lazy loading in AOT ([a2fb4d6](https://github.com/brandonroberts/angular-router-loader/commit/a2fb4d6))
* **loader:** Added support for plain JavaScript async require statement ([#69](https://github.com/brandonroberts/angular-router-loader/issues/69)) ([7714e1f](https://github.com/brandonroberts/angular-router-loader/commit/7714e1f))

@@ -17,0 +36,0 @@

18

docs/options.md

@@ -40,3 +40,3 @@ ## General Loader Options

If you prefer to use `System.import`, set the `loader` to `system`
To use `System.import`, set the `loader` to `system`

@@ -49,8 +49,18 @@ **NOTE:** Using `system` only works with Webpack 2. Webpack 1 users should use the default.

path: 'lazy',
loadChildren: () => System.import('./lazy/lazy.module').then(function(module) {
return module['LazyModule'];
})
loadChildren: () => System.import('./lazy/lazy.module').then(module => module['LazyModule'])
}
```
To use `dynamic import`, set the `loader` to `import`
**NOTE:** Using `import` only works with Webpack >= 2.1.0.
replacement
```ts
{
path: 'lazy',
loadChildren: () => import('./lazy/lazy.module').then(module => module['LazyModule'])
}
```
## Loader options (AoT compilation)

@@ -57,0 +67,0 @@

{
"name": "angular-router-loader",
"version": "0.6.0",
"version": "0.7.0",
"description": "A webpack loader for Angular that enables string-based module loading with the Angular Router",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -27,3 +27,17 @@ var should = require('should');

`loadChildren :"${modulePath}"`,
`loadChildren : "${modulePath}"`
`loadChildren : "${modulePath}"`,
`"loadChildren":"${modulePath}"`,
`"loadChildren": "${modulePath}"`,
`"loadChildren" : "${modulePath}"`,
`"loadChildren" : "${modulePath}"`,
`"loadChildren" :"${modulePath}"`,
`"loadChildren" : "${modulePath}"`,
`'loadChildren':"${modulePath}"`,
`'loadChildren': "${modulePath}"`,
`'loadChildren' : "${modulePath}"`,
`'loadChildren' : "${modulePath}"`,
`'loadChildren' :"${modulePath}"`,
`'loadChildren' : "${modulePath}"`
];

@@ -152,5 +166,3 @@

'loadChildren: () => System.import(\'./path/to/file.module\')',
' .then(function(module) {',
' return module[\'FileModule\'];',
' })'
' .then(module => module[\'FileModule\'])'
];

@@ -166,2 +178,16 @@

it ('should return a loadChildren dynamic import statement', function() {
var result = [
'loadChildren: () => import(\'./path/to/file.module\')',
' .then(module => module[\'FileModule\'])'
];
var loadedString = loader.call({
resourcePath: resourcePath,
query: '?loader=import'
}, `loadChildren: '${modulePath}'`);
checkResult(loadedString, result);
});
it('should return a loadChildren async require statement with default', function() {

@@ -282,5 +308,3 @@ var modulePath = './path/to/file.module';

'loadChildren: () => System.import(\'./path/to/file.module.ngfactory\')',
' .then(function(module) {',
' return module[\'FileModuleNgFactory\'];',
' })'
' .then(module => module[\'FileModuleNgFactory\'])'
];

@@ -296,2 +320,16 @@

it ('should return a loadChildren dynamic import statement', function() {
var result = [
'loadChildren: () => import(\'./path/to/file.module.ngfactory\')',
' .then(module => module[\'FileModuleNgFactory\'])'
];
var loadedString = loader.call({
resourcePath: resourcePath,
query: query + '&loader=import'
}, `loadChildren: '${modulePath}'`);
checkResult(loadedString, result);
});
it('should support a custom moduleSuffix', function() {

@@ -298,0 +336,0 @@ var moduleSuffix = '.ngfile';

@@ -74,5 +74,3 @@ var should = require('should');

'loadChildren: () => System.import(\'' + path + '\')',
' .then(function(module) {',
' return module[\'' + name + '\'];',
' })'
' .then(module => module[\'' + name + '\'])'
];

@@ -84,2 +82,15 @@

describe('getImportLoader', function() {
var getImportLoader = utils.getImportLoader;
it('should return an asynchronous dynamic import loadChildren statement', function() {
var result = [
'loadChildren: () => import(\'' + path + '\')',
' .then(module => module[\'' + name + '\'])'
];
getImportLoader('path', 'name', true).should.eql(result.join(''));
});
});
describe('normalizeFilePath', function() {

@@ -86,0 +97,0 @@ var pmock = require('pmock');

@@ -9,3 +9,3 @@ var loaderUtils = require('loader-utils');

// regex for loadChildren string
var loadChildrenRegex = /loadChildren[\s]*:[\s]*['|"](.*?)['|"]/gm;
var loadChildrenRegex = /["']?loadChildren["']?[\s]*:[\s]*['|"](.*?)['|"]/gm;

@@ -94,2 +94,4 @@ // parse query params

replacement = utils.getSystemLoader(filePath, moduleName, inline);
} else if (loader === 'import') {
replacement = utils.getImportLoader(filePath, moduleName, inline);
} else {

@@ -96,0 +98,0 @@ replacement = utils.getRequireLoader(filePath, chunkName, moduleName, inline, isJs);

@@ -38,5 +38,3 @@ var os = require('os');

'loadChildren: () => System.import(\'' + filePath + '\')',
' .then(function(module) {',
' return module[\'' + moduleName + '\'];',
' })'
' .then(module => module[\'' + moduleName + '\'])'
];

@@ -47,2 +45,11 @@

module.exports.getImportLoader = function(filePath, moduleName, inline) {
var result = [
'loadChildren: () => import(\'' + filePath + '\')',
' .then(module => module[\'' + moduleName + '\'])'
];
return inline ? result.join('') : result.join('\n');
};
module.exports.getFilename = function(resourcePath) {

@@ -49,0 +56,0 @@ var filename = path.basename(resourcePath);