Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit fd48b8a

Browse files
author
vakrilov
committed
refactor: convert bundle-config-loader to TS
1 parent 6b5aa36 commit fd48b8a

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ jasmine-config/reporter.d.ts
3131
jasmine-config/reporter.js
3232
jasmine-config/reporter.js.map
3333

34+
bundle-config-loader.d.ts
35+
bundle-config-loader.js
36+
bundle-config-loader.js.map
37+
3438
**/*.spec.js*
3539
**/*.spec.d.ts*
3640

bundle-config-loader.js renamed to bundle-config-loader.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
const unitTestingConfigLoader = require("./unit-testing-config-loader");
1+
import unitTestingConfigLoader from "./unit-testing-config-loader";
2+
import { loader } from "webpack";
3+
import { getOptions } from "loader-utils";
24

3-
module.exports = function (source, map) {
4-
this.cacheable();
5+
const loader: loader.Loader = function (source, map) {
56
const {
67
angular = false,
78
loadCss = true,
89
unitTesting,
910
projectRoot,
1011
appFullPath,
11-
registerModules = /(root|page)(\.(land|port|phone|tablet|minH\d+|minW\d+|minWH\d+))?\.(xml|css|js|ts|scss)$/
12-
} = this.query;
12+
registerModules = /(root|page)(\.(land|port|phone|tablet|minH\d+|minW\d+|minWH\d+))?\.(xml|css|js|ts|scss)$/
13+
} = getOptions(this);;
1314

1415
if (unitTesting) {
1516
source = unitTestingConfigLoader({ appFullPath, projectRoot, angular, rootPagesRegExp: registerModules });
@@ -75,3 +76,6 @@ module.exports = function (source, map) {
7576

7677
this.callback(null, source, map);
7778
};
79+
80+
81+
export default loader;

jasmine-config/jasmine.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"spec_dir": ".",
33
"spec_files": [
4-
"./!(node_modules)/**/*.spec.js",
4+
"!node_modules/**/*.spec.js",
5+
"!demo/**/*.spec.js",
56
"./*.spec.js"
67
],
78
"helpers": [

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,15 @@
7777
"@angular/compiler-cli": "8.0.0",
7878
"@ngtools/webpack": "8.0.0",
7979
"@types/jasmine": "^3.3.7",
80+
"@types/loader-utils": "^1.1.3",
8081
"@types/node": "^10.12.12",
8182
"@types/proxyquire": "1.3.28",
8283
"@types/semver": "^6.0.0",
84+
"@types/webpack": "^4.4.34",
8385
"conventional-changelog-cli": "^1.3.22",
8486
"jasmine": "^3.2.0",
8587
"jasmine-spec-reporter": "^4.2.1",
88+
"loader-utils": "^1.2.3",
8689
"proxyquire": "2.1.0",
8790
"typescript": "~3.4.0"
8891
}

0 commit comments

Comments
 (0)