locter 0.3.2 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +864 -0
- package/dist/index.esm.js +842 -0
- package/dist/{index.d.ts → types/index.d.ts} +0 -0
- package/dist/{loader → types/loader}/file-type/index.d.ts +0 -0
- package/dist/types/loader/file-type/json.d.ts +3 -0
- package/dist/{loader → types/loader}/file-type/script/async.d.ts +0 -0
- package/dist/{loader → types/loader}/file-type/script/index.d.ts +0 -0
- package/dist/{loader → types/loader}/file-type/script/sync.d.ts +0 -0
- package/dist/types/loader/file-type/script/type.d.ts +5 -0
- package/dist/{loader → types/loader}/file-type/script/utils.d.ts +0 -0
- package/dist/{loader → types/loader}/index.d.ts +0 -0
- package/dist/types/loader/module.d.ts +3 -0
- package/dist/types/loader/utils.d.ts +2 -0
- package/dist/{locator → types/locator}/async.d.ts +0 -0
- package/dist/{locator → types/locator}/index.d.ts +0 -0
- package/dist/{locator → types/locator}/sync.d.ts +0 -0
- package/dist/{locator → types/locator}/type.d.ts +2 -2
- package/dist/{locator → types/locator}/utils.d.ts +1 -0
- package/dist/{utils → types/utils}/error.d.ts +0 -0
- package/dist/{utils → types/utils}/file-name.d.ts +0 -0
- package/dist/{utils → types/utils}/has-own-property.d.ts +0 -0
- package/dist/{utils → types/utils}/index.d.ts +0 -0
- package/dist/{utils → types/utils}/to-array.d.ts +0 -0
- package/package.json +29 -18
- package/dist/index.js +0 -26
- package/dist/index.js.map +0 -1
- package/dist/loader/file-type/index.js +0 -25
- package/dist/loader/file-type/index.js.map +0 -1
- package/dist/loader/file-type/json.d.ts +0 -2
- package/dist/loader/file-type/json.js +0 -46
- package/dist/loader/file-type/json.js.map +0 -1
- package/dist/loader/file-type/script/async.js +0 -78
- package/dist/loader/file-type/script/async.js.map +0 -1
- package/dist/loader/file-type/script/index.js +0 -27
- package/dist/loader/file-type/script/index.js.map +0 -1
- package/dist/loader/file-type/script/sync.js +0 -43
- package/dist/loader/file-type/script/sync.js.map +0 -1
- package/dist/loader/file-type/script/type.d.ts +0 -5
- package/dist/loader/file-type/script/type.js +0 -9
- package/dist/loader/file-type/script/type.js.map +0 -1
- package/dist/loader/file-type/script/utils.js +0 -33
- package/dist/loader/file-type/script/utils.js.map +0 -1
- package/dist/loader/index.js +0 -26
- package/dist/loader/index.js.map +0 -1
- package/dist/loader/module.d.ts +0 -3
- package/dist/loader/module.js +0 -45
- package/dist/loader/module.js.map +0 -1
- package/dist/loader/utils.d.ts +0 -2
- package/dist/loader/utils.js +0 -19
- package/dist/loader/utils.js.map +0 -1
- package/dist/locator/async.js +0 -85
- package/dist/locator/async.js.map +0 -1
- package/dist/locator/index.js +0 -27
- package/dist/locator/index.js.map +0 -1
- package/dist/locator/sync.js +0 -70
- package/dist/locator/sync.js.map +0 -1
- package/dist/locator/type.js +0 -9
- package/dist/locator/type.js.map +0 -1
- package/dist/locator/utils.js +0 -40
- package/dist/locator/utils.js.map +0 -1
- package/dist/utils/error.js +0 -21
- package/dist/utils/error.js.map +0 -1
- package/dist/utils/file-name.js +0 -22
- package/dist/utils/file-name.js.map +0 -1
- package/dist/utils/has-own-property.js +0 -8
- package/dist/utils/has-own-property.js.map +0 -1
- package/dist/utils/index.js +0 -27
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/to-array.js +0 -14
- package/dist/utils/to-array.js.map +0 -1
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type LocatorInfo = {
|
|
2
2
|
path: string;
|
|
3
3
|
name: string;
|
|
4
4
|
extension: '.js' | '.ts' | '.json' | string;
|
|
5
5
|
};
|
|
6
|
-
export
|
|
6
|
+
export type LocatorOptions = {
|
|
7
7
|
path: string | string[];
|
|
8
8
|
ignore: string | string[];
|
|
9
9
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { LocatorInfo, LocatorOptions } from './type';
|
|
2
2
|
export declare function buildLocatorOptions(options?: Partial<LocatorOptions>): LocatorOptions;
|
|
3
3
|
export declare function isLocatorInfo(data: unknown): data is LocatorInfo;
|
|
4
|
+
export declare function pathToLocatorInfo(input: string, skipResolve?: boolean): LocatorInfo;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "locter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "A library to locate a file by criteria and load it",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Peter Placzek",
|
|
@@ -11,14 +11,16 @@
|
|
|
11
11
|
"type": "git",
|
|
12
12
|
"url": "https://github.com/tada5hi/locter.git"
|
|
13
13
|
},
|
|
14
|
-
"main": "dist/index.js",
|
|
15
|
-
"
|
|
14
|
+
"main": "dist/index.cjs.js",
|
|
15
|
+
"module": "dist/index.esm.js",
|
|
16
|
+
"types": "dist/types/index.d.ts",
|
|
16
17
|
"files": [
|
|
17
18
|
"dist/"
|
|
18
19
|
],
|
|
19
20
|
"scripts": {
|
|
20
|
-
"build": "
|
|
21
|
-
"build:
|
|
21
|
+
"build:types": "tsc --emitDeclarationOnly",
|
|
22
|
+
"build:js": "rollup -c",
|
|
23
|
+
"build": "rimraf dist && npm run build:types && npm run build:js",
|
|
22
24
|
"commit": "npx git-cz",
|
|
23
25
|
"test": "cross-env NODE_ENV=test jest --config ./test/jest.config.js",
|
|
24
26
|
"test:coverage": "cross-env NODE_ENV=test jest --config ./test/jest.config.js --coverage",
|
|
@@ -35,34 +37,43 @@
|
|
|
35
37
|
],
|
|
36
38
|
"license": "MIT",
|
|
37
39
|
"devDependencies": {
|
|
38
|
-
"@
|
|
39
|
-
"@
|
|
40
|
-
"@
|
|
41
|
-
"@commitlint/
|
|
42
|
-
"@
|
|
40
|
+
"@babel/core": "^7.20.2",
|
|
41
|
+
"@babel/preset-env": "^7.20.2",
|
|
42
|
+
"@babel/preset-typescript": "^7.18.6",
|
|
43
|
+
"@commitlint/cli": "^17.3.0",
|
|
44
|
+
"@commitlint/config-angular": "^17.3.0",
|
|
45
|
+
"@commitlint/config-conventional": "^17.3.0",
|
|
46
|
+
"@commitlint/cz-commitlint": "^17.3.0",
|
|
47
|
+
"@rollup/plugin-babel": "^6.0.3",
|
|
48
|
+
"@rollup/plugin-commonjs": "^23.0.2",
|
|
49
|
+
"@rollup/plugin-node-resolve": "^15.0.0",
|
|
50
|
+
"@semantic-release/changelog": "^6.0.2",
|
|
43
51
|
"@semantic-release/commit-analyzer": "^9.0.2",
|
|
44
52
|
"@semantic-release/git": "^10.0.1",
|
|
45
|
-
"@semantic-release/github": "^8.0.
|
|
53
|
+
"@semantic-release/github": "^8.0.7",
|
|
46
54
|
"@semantic-release/npm": "^9.0.1",
|
|
47
55
|
"@semantic-release/release-notes-generator": "^10.0.3",
|
|
48
|
-
"@tada5hi/eslint-config-typescript": "^1.0.
|
|
56
|
+
"@tada5hi/eslint-config-typescript": "^1.0.10",
|
|
49
57
|
"@types/glob": "^8.0.0",
|
|
58
|
+
"@types/is-file-esm": "^1.0.0",
|
|
50
59
|
"@types/jest": "^27.5.0",
|
|
51
|
-
"@types/node": "^18.
|
|
52
|
-
"@types/yargs": "^17.0.
|
|
60
|
+
"@types/node": "^18.11.9",
|
|
61
|
+
"@types/yargs": "^17.0.14",
|
|
53
62
|
"coveralls": "^3.1.0",
|
|
54
63
|
"cross-env": "^7.0.3",
|
|
55
|
-
"eslint": "^8.
|
|
56
|
-
"husky": "^8.0.
|
|
64
|
+
"eslint": "^8.28.0",
|
|
65
|
+
"husky": "^8.0.2",
|
|
57
66
|
"jest": "^27.5.1",
|
|
58
67
|
"rimraf": "^3.0.2",
|
|
68
|
+
"rollup": "^3.5.0",
|
|
59
69
|
"semantic-release": "^19.0.5",
|
|
60
70
|
"ts-jest": "^27.1.4",
|
|
61
71
|
"ts-node": "^10.9.1",
|
|
62
|
-
"typescript": "^4.
|
|
72
|
+
"typescript": "^4.9.3"
|
|
63
73
|
},
|
|
64
74
|
"dependencies": {
|
|
65
|
-
"glob": "^8.0.3"
|
|
75
|
+
"glob": "^8.0.3",
|
|
76
|
+
"is-file-esm": "^1.0.0"
|
|
66
77
|
},
|
|
67
78
|
"config": {
|
|
68
79
|
"commitizen": {
|
package/dist/index.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2022.
|
|
4
|
-
* Author Peter Placzek (tada5hi)
|
|
5
|
-
* For the full copyright and license information,
|
|
6
|
-
* view the LICENSE file that was distributed with this source code.
|
|
7
|
-
*/
|
|
8
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
-
if (k2 === undefined) k2 = k;
|
|
10
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
-
}
|
|
14
|
-
Object.defineProperty(o, k2, desc);
|
|
15
|
-
}) : (function(o, m, k, k2) {
|
|
16
|
-
if (k2 === undefined) k2 = k;
|
|
17
|
-
o[k2] = m[k];
|
|
18
|
-
}));
|
|
19
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
20
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
-
};
|
|
22
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
__exportStar(require("./loader"), exports);
|
|
24
|
-
__exportStar(require("./locator"), exports);
|
|
25
|
-
__exportStar(require("./utils"), exports);
|
|
26
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;AAEH,2CAAyB;AACzB,4CAA0B;AAC1B,0CAAwB"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2022.
|
|
4
|
-
* Author Peter Placzek (tada5hi)
|
|
5
|
-
* For the full copyright and license information,
|
|
6
|
-
* view the LICENSE file that was distributed with this source code.
|
|
7
|
-
*/
|
|
8
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
-
if (k2 === undefined) k2 = k;
|
|
10
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
-
}
|
|
14
|
-
Object.defineProperty(o, k2, desc);
|
|
15
|
-
}) : (function(o, m, k, k2) {
|
|
16
|
-
if (k2 === undefined) k2 = k;
|
|
17
|
-
o[k2] = m[k];
|
|
18
|
-
}));
|
|
19
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
20
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
-
};
|
|
22
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
__exportStar(require("./script"), exports);
|
|
24
|
-
__exportStar(require("./json"), exports);
|
|
25
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/loader/file-type/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;AAEH,2CAAyB;AACzB,yCAAuB"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2022-2022.
|
|
4
|
-
* Author Peter Placzek (tada5hi)
|
|
5
|
-
* For the full copyright and license information,
|
|
6
|
-
* view the LICENSE file that was distributed with this source code.
|
|
7
|
-
*/
|
|
8
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
9
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
10
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
11
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
12
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
13
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
14
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
-
};
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.loadJsonFileSync = exports.loadJsonFile = void 0;
|
|
22
|
-
const fs_1 = __importDefault(require("fs"));
|
|
23
|
-
const utils_1 = require("../../utils");
|
|
24
|
-
function loadJsonFile(filePath) {
|
|
25
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
try {
|
|
27
|
-
const file = yield fs_1.default.promises.readFile(filePath);
|
|
28
|
-
return JSON.parse(file.toString('utf-8'));
|
|
29
|
-
}
|
|
30
|
-
catch (e) {
|
|
31
|
-
return (0, utils_1.handleFileLoadError)(e);
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
exports.loadJsonFile = loadJsonFile;
|
|
36
|
-
function loadJsonFileSync(filePath) {
|
|
37
|
-
try {
|
|
38
|
-
const file = fs_1.default.readFileSync(filePath);
|
|
39
|
-
return JSON.parse(file.toString('utf-8'));
|
|
40
|
-
}
|
|
41
|
-
catch (e) {
|
|
42
|
-
return (0, utils_1.handleFileLoadError)(e);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
exports.loadJsonFileSync = loadJsonFileSync;
|
|
46
|
-
//# sourceMappingURL=json.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"json.js","sourceRoot":"","sources":["../../../src/loader/file-type/json.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;AAEH,4CAAoB;AACpB,uCAAkD;AAElD,SAAsB,YAAY,CAAC,QAAgB;;QAC/C,IAAI;YACA,MAAM,IAAI,GAAG,MAAM,YAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YAClD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;SAC7C;QAAC,OAAO,CAAC,EAAE;YACR,OAAO,IAAA,2BAAmB,EAAC,CAAC,CAAC,CAAC;SACjC;IACL,CAAC;CAAA;AAPD,oCAOC;AAED,SAAgB,gBAAgB,CAAC,QAAgB;IAC7C,IAAI;QACA,MAAM,IAAI,GAAG,YAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QACvC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;KAC7C;IAAC,OAAO,CAAC,EAAE;QACR,OAAO,IAAA,2BAAmB,EAAC,CAAC,CAAC,CAAC;KACjC;AACL,CAAC;AAPD,4CAOC"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2022.
|
|
4
|
-
* Author Peter Placzek (tada5hi)
|
|
5
|
-
* For the full copyright and license information,
|
|
6
|
-
* view the LICENSE file that was distributed with this source code.
|
|
7
|
-
*/
|
|
8
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
-
if (k2 === undefined) k2 = k;
|
|
10
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
-
}
|
|
14
|
-
Object.defineProperty(o, k2, desc);
|
|
15
|
-
}) : (function(o, m, k, k2) {
|
|
16
|
-
if (k2 === undefined) k2 = k;
|
|
17
|
-
o[k2] = m[k];
|
|
18
|
-
}));
|
|
19
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
-
}) : function(o, v) {
|
|
22
|
-
o["default"] = v;
|
|
23
|
-
});
|
|
24
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
25
|
-
if (mod && mod.__esModule) return mod;
|
|
26
|
-
var result = {};
|
|
27
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
28
|
-
__setModuleDefault(result, mod);
|
|
29
|
-
return result;
|
|
30
|
-
};
|
|
31
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
32
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
33
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
34
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
35
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
36
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
37
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
-
exports.loadScriptFileExport = exports.loadScriptFile = void 0;
|
|
42
|
-
const utils_1 = require("./utils");
|
|
43
|
-
const locator_1 = require("../../../locator");
|
|
44
|
-
const utils_2 = require("../../utils");
|
|
45
|
-
const utils_3 = require("../../../utils");
|
|
46
|
-
function loadScriptFile(data) {
|
|
47
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
-
const filePath = (0, locator_1.isLocatorInfo)(data) ?
|
|
49
|
-
(0, utils_2.buildLoaderFilePath)(data) :
|
|
50
|
-
data;
|
|
51
|
-
try {
|
|
52
|
-
return yield Promise.resolve().then(() => __importStar(require(filePath)));
|
|
53
|
-
}
|
|
54
|
-
catch (e) {
|
|
55
|
-
return (0, utils_3.handleFileLoadError)(e);
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
exports.loadScriptFile = loadScriptFile;
|
|
60
|
-
function loadScriptFileExport(data, filterFn) {
|
|
61
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
-
const filePath = (0, locator_1.isLocatorInfo)(data) ?
|
|
63
|
-
(0, utils_2.buildLoaderFilePath)(data) :
|
|
64
|
-
data;
|
|
65
|
-
try {
|
|
66
|
-
const data = yield loadScriptFile(filePath);
|
|
67
|
-
if (typeof data === 'object') {
|
|
68
|
-
return (0, utils_1.getExportItem)(data, filterFn);
|
|
69
|
-
}
|
|
70
|
-
return undefined;
|
|
71
|
-
}
|
|
72
|
-
catch (e) {
|
|
73
|
-
return (0, utils_3.handleFileLoadError)(e);
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
exports.loadScriptFileExport = loadScriptFileExport;
|
|
78
|
-
//# sourceMappingURL=async.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"async.js","sourceRoot":"","sources":["../../../../src/loader/file-type/script/async.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,mCAAwC;AAExC,8CAA8D;AAC9D,uCAAkD;AAClD,0CAAqD;AAErD,SAAsB,cAAc,CAAC,IAA0B;;QAC3D,MAAM,QAAQ,GAAG,IAAA,uBAAa,EAAC,IAAI,CAAC,CAAC,CAAC;YAClC,IAAA,2BAAmB,EAAC,IAAI,CAAC,CAAC,CAAC;YAC3B,IAAI,CAAC;QAET,IAAI;YACA,OAAO,wDAAa,QAAQ,GAAC,CAAC;SACjC;QAAC,OAAO,CAAC,EAAE;YACR,OAAO,IAAA,2BAAmB,EAAC,CAAC,CAAC,CAAC;SACjC;IACL,CAAC;CAAA;AAVD,wCAUC;AAED,SAAsB,oBAAoB,CACtC,IAA0B,EAC1B,QAAyB;;QAEzB,MAAM,QAAQ,GAAG,IAAA,uBAAa,EAAC,IAAI,CAAC,CAAC,CAAC;YAClC,IAAA,2BAAmB,EAAC,IAAI,CAAC,CAAC,CAAC;YAC3B,IAAI,CAAC;QAET,IAAI;YACA,MAAM,IAAI,GAAG,MAAM,cAAc,CAAC,QAAQ,CAAC,CAAC;YAC5C,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;gBAC1B,OAAO,IAAA,qBAAa,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;aACxC;YAED,OAAO,SAAS,CAAC;SACpB;QAAC,OAAO,CAAC,EAAE;YACR,OAAO,IAAA,2BAAmB,EAAC,CAAC,CAAC,CAAC;SACjC;IACL,CAAC;CAAA;AAlBD,oDAkBC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2022-2022.
|
|
4
|
-
* Author Peter Placzek (tada5hi)
|
|
5
|
-
* For the full copyright and license information,
|
|
6
|
-
* view the LICENSE file that was distributed with this source code.
|
|
7
|
-
*/
|
|
8
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
-
if (k2 === undefined) k2 = k;
|
|
10
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
-
}
|
|
14
|
-
Object.defineProperty(o, k2, desc);
|
|
15
|
-
}) : (function(o, m, k, k2) {
|
|
16
|
-
if (k2 === undefined) k2 = k;
|
|
17
|
-
o[k2] = m[k];
|
|
18
|
-
}));
|
|
19
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
20
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
-
};
|
|
22
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
__exportStar(require("./async"), exports);
|
|
24
|
-
__exportStar(require("./sync"), exports);
|
|
25
|
-
__exportStar(require("./type"), exports);
|
|
26
|
-
__exportStar(require("./utils"), exports);
|
|
27
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/loader/file-type/script/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;AAEH,0CAAwB;AACxB,yCAAuB;AACvB,yCAAuB;AACvB,0CAAwB"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2022.
|
|
4
|
-
* Author Peter Placzek (tada5hi)
|
|
5
|
-
* For the full copyright and license information,
|
|
6
|
-
* view the LICENSE file that was distributed with this source code.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.loadScriptFileExportSync = exports.loadScriptFileSync = void 0;
|
|
10
|
-
const utils_1 = require("./utils");
|
|
11
|
-
const locator_1 = require("../../../locator");
|
|
12
|
-
const utils_2 = require("../../utils");
|
|
13
|
-
const utils_3 = require("../../../utils");
|
|
14
|
-
function loadScriptFileSync(data) {
|
|
15
|
-
const filePath = (0, locator_1.isLocatorInfo)(data) ?
|
|
16
|
-
(0, utils_2.buildLoaderFilePath)(data) :
|
|
17
|
-
data;
|
|
18
|
-
try {
|
|
19
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires, global-require,import/no-dynamic-require
|
|
20
|
-
return require(filePath);
|
|
21
|
-
}
|
|
22
|
-
catch (e) {
|
|
23
|
-
return (0, utils_3.handleFileLoadError)(e);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
exports.loadScriptFileSync = loadScriptFileSync;
|
|
27
|
-
function loadScriptFileExportSync(data, filterFn) {
|
|
28
|
-
const filePath = (0, locator_1.isLocatorInfo)(data) ?
|
|
29
|
-
(0, utils_2.buildLoaderFilePath)(data) :
|
|
30
|
-
data;
|
|
31
|
-
try {
|
|
32
|
-
const data = loadScriptFileSync(filePath);
|
|
33
|
-
if (typeof data === 'object') {
|
|
34
|
-
return (0, utils_1.getExportItem)(data, filterFn);
|
|
35
|
-
}
|
|
36
|
-
return undefined;
|
|
37
|
-
}
|
|
38
|
-
catch (e) {
|
|
39
|
-
return (0, utils_3.handleFileLoadError)(e);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
exports.loadScriptFileExportSync = loadScriptFileExportSync;
|
|
43
|
-
//# sourceMappingURL=sync.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../../../../src/loader/file-type/script/sync.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAGH,mCAAwC;AACxC,8CAA8D;AAC9D,uCAAkD;AAClD,0CAAqD;AAErD,SAAgB,kBAAkB,CAAC,IAA0B;IACzD,MAAM,QAAQ,GAAG,IAAA,uBAAa,EAAC,IAAI,CAAC,CAAC,CAAC;QAClC,IAAA,2BAAmB,EAAC,IAAI,CAAC,CAAC,CAAC;QAC3B,IAAI,CAAC;IAET,IAAI;QACA,wGAAwG;QACxG,OAAO,OAAO,CAAC,QAAQ,CAAC,CAAC;KAC5B;IAAC,OAAO,CAAC,EAAE;QACR,OAAO,IAAA,2BAAmB,EAAC,CAAC,CAAC,CAAC;KACjC;AACL,CAAC;AAXD,gDAWC;AAED,SAAgB,wBAAwB,CACpC,IAA0B,EAC1B,QAAyB;IAEzB,MAAM,QAAQ,GAAG,IAAA,uBAAa,EAAC,IAAI,CAAC,CAAC,CAAC;QAClC,IAAA,2BAAmB,EAAC,IAAI,CAAC,CAAC,CAAC;QAC3B,IAAI,CAAC;IAET,IAAI;QACA,MAAM,IAAI,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;QAE1C,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;YAC1B,OAAO,IAAA,qBAAa,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;SACxC;QAED,OAAO,SAAS,CAAC;KACpB;IAAC,OAAO,CAAC,EAAE;QACR,OAAO,IAAA,2BAAmB,EAAC,CAAC,CAAC,CAAC;KACjC;AACL,CAAC;AAnBD,4DAmBC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2022.
|
|
4
|
-
* Author Peter Placzek (tada5hi)
|
|
5
|
-
* For the full copyright and license information,
|
|
6
|
-
* view the LICENSE file that was distributed with this source code.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
//# sourceMappingURL=type.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../../../src/loader/file-type/script/type.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2022.
|
|
4
|
-
* Author Peter Placzek (tada5hi)
|
|
5
|
-
* For the full copyright and license information,
|
|
6
|
-
* view the LICENSE file that was distributed with this source code.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.getExportItem = void 0;
|
|
10
|
-
const utils_1 = require("../../../utils");
|
|
11
|
-
function getExportItem(data, filterFn) {
|
|
12
|
-
if (filterFn) {
|
|
13
|
-
const keys = Object.keys(data);
|
|
14
|
-
for (let i = 0; i < keys.length; i++) {
|
|
15
|
-
if (filterFn(keys[i], data[keys[i]])) {
|
|
16
|
-
return {
|
|
17
|
-
key: keys[i],
|
|
18
|
-
value: data[keys[i]],
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
return {
|
|
25
|
-
key: 'default',
|
|
26
|
-
value: (0, utils_1.hasOwnProperty)(data, 'default') ? data.default : data,
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
/* istanbul ignore next */
|
|
30
|
-
return undefined;
|
|
31
|
-
}
|
|
32
|
-
exports.getExportItem = getExportItem;
|
|
33
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/loader/file-type/script/utils.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,0CAAgD;AAGhD,SAAgB,aAAa,CACzB,IAAyB,EACzB,QAAwB;IAExB,IAAI,QAAQ,EAAE;QACV,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAClC,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;gBAClC,OAAO;oBACH,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;oBACZ,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;iBACvB,CAAC;aACL;SACJ;KACJ;SAAM;QACH,OAAO;YACH,GAAG,EAAE,SAAS;YACd,KAAK,EAAE,IAAA,sBAAc,EAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI;SAC/D,CAAC;KACL;IAED,0BAA0B;IAC1B,OAAO,SAAS,CAAC;AACrB,CAAC;AAvBD,sCAuBC"}
|
package/dist/loader/index.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2022.
|
|
4
|
-
* Author Peter Placzek (tada5hi)
|
|
5
|
-
* For the full copyright and license information,
|
|
6
|
-
* view the LICENSE file that was distributed with this source code.
|
|
7
|
-
*/
|
|
8
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
-
if (k2 === undefined) k2 = k;
|
|
10
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
-
}
|
|
14
|
-
Object.defineProperty(o, k2, desc);
|
|
15
|
-
}) : (function(o, m, k, k2) {
|
|
16
|
-
if (k2 === undefined) k2 = k;
|
|
17
|
-
o[k2] = m[k];
|
|
18
|
-
}));
|
|
19
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
20
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
-
};
|
|
22
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
__exportStar(require("./file-type"), exports);
|
|
24
|
-
__exportStar(require("./module"), exports);
|
|
25
|
-
__exportStar(require("./utils"), exports);
|
|
26
|
-
//# sourceMappingURL=index.js.map
|
package/dist/loader/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/loader/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;AAEH,8CAA4B;AAC5B,2CAAyB;AACzB,0CAAwB"}
|
package/dist/loader/module.d.ts
DELETED
package/dist/loader/module.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2022.
|
|
4
|
-
* Author Peter Placzek (tada5hi)
|
|
5
|
-
* For the full copyright and license information,
|
|
6
|
-
* view the LICENSE file that was distributed with this source code.
|
|
7
|
-
*/
|
|
8
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
9
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
10
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
11
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
12
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
13
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
14
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.loadFileSync = exports.loadFile = void 0;
|
|
19
|
-
const file_type_1 = require("./file-type");
|
|
20
|
-
const utils_1 = require("./utils");
|
|
21
|
-
function loadFile(info) {
|
|
22
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
if (!info) {
|
|
24
|
-
return undefined;
|
|
25
|
-
}
|
|
26
|
-
const filePath = (0, utils_1.buildLoaderFilePath)(info);
|
|
27
|
-
if (info.extension === '.json') {
|
|
28
|
-
return (0, file_type_1.loadJsonFile)(filePath);
|
|
29
|
-
}
|
|
30
|
-
return (0, file_type_1.loadScriptFile)(filePath);
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
exports.loadFile = loadFile;
|
|
34
|
-
function loadFileSync(info) {
|
|
35
|
-
if (!info) {
|
|
36
|
-
return undefined;
|
|
37
|
-
}
|
|
38
|
-
const filePath = (0, utils_1.buildLoaderFilePath)(info);
|
|
39
|
-
if (info.extension === '.json') {
|
|
40
|
-
return (0, file_type_1.loadJsonFileSync)(filePath);
|
|
41
|
-
}
|
|
42
|
-
return (0, file_type_1.loadScriptFileSync)(filePath);
|
|
43
|
-
}
|
|
44
|
-
exports.loadFileSync = loadFileSync;
|
|
45
|
-
//# sourceMappingURL=module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/loader/module.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;AAGH,2CAEqB;AACrB,mCAA8C;AAE9C,SAAsB,QAAQ,CAAC,IAAiB;;QAC5C,IAAI,CAAC,IAAI,EAAE;YACP,OAAO,SAAS,CAAC;SACpB;QAED,MAAM,QAAQ,GAAG,IAAA,2BAAmB,EAAC,IAAI,CAAC,CAAC;QAE3C,IAAI,IAAI,CAAC,SAAS,KAAK,OAAO,EAAE;YAC5B,OAAO,IAAA,wBAAY,EAAC,QAAQ,CAAC,CAAC;SACjC;QAED,OAAO,IAAA,0BAAc,EAAC,QAAQ,CAAC,CAAC;IACpC,CAAC;CAAA;AAZD,4BAYC;AAED,SAAgB,YAAY,CAAC,IAAiB;IAC1C,IAAI,CAAC,IAAI,EAAE;QACP,OAAO,SAAS,CAAC;KACpB;IAED,MAAM,QAAQ,GAAG,IAAA,2BAAmB,EAAC,IAAI,CAAC,CAAC;IAE3C,IAAI,IAAI,CAAC,SAAS,KAAK,OAAO,EAAE;QAC5B,OAAO,IAAA,4BAAgB,EAAC,QAAQ,CAAC,CAAC;KACrC;IAED,OAAO,IAAA,8BAAkB,EAAC,QAAQ,CAAC,CAAC;AACxC,CAAC;AAZD,oCAYC"}
|
package/dist/loader/utils.d.ts
DELETED
package/dist/loader/utils.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2022.
|
|
4
|
-
* Author Peter Placzek (tada5hi)
|
|
5
|
-
* For the full copyright and license information,
|
|
6
|
-
* view the LICENSE file that was distributed with this source code.
|
|
7
|
-
*/
|
|
8
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.buildLoaderFilePath = void 0;
|
|
13
|
-
const path_1 = __importDefault(require("path"));
|
|
14
|
-
function buildLoaderFilePath(info) {
|
|
15
|
-
return path_1.default.join(info.path, info.name) +
|
|
16
|
-
(info.extension === '.json' ? '.json' : '');
|
|
17
|
-
}
|
|
18
|
-
exports.buildLoaderFilePath = buildLoaderFilePath;
|
|
19
|
-
//# sourceMappingURL=utils.js.map
|
package/dist/loader/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/loader/utils.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;AAEH,gDAAwB;AAGxB,SAAgB,mBAAmB,CAAC,IAAiB;IACjD,OAAO,cAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC;QAClC,CAAC,IAAI,CAAC,SAAS,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AACpD,CAAC;AAHD,kDAGC"}
|