@aeriajs/entrypoint 0.0.0 → 0.0.1
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/README.md +2 -9
- package/dist/index.d.ts +1 -0
- package/dist/index.js +7 -3
- package/dist/index.mjs +25 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
# `@aeriajs/entrypoint`
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## Introduction
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
$ yarn add @aeriajs/entrypoint
|
|
7
|
-
# or
|
|
8
|
-
$ npm install @aeriajs/entrypoint
|
|
9
|
-
```
|
|
5
|
+
This package handles dynamic imports.
|
|
10
6
|
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
This is an internal utility, not intended for public usage.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Collection, ApiConfig } from '@aeriajs/types';
|
|
2
|
+
export declare const getEntrypointPath: () => Promise<string>;
|
|
2
3
|
export declare const getEntrypoint: () => Promise<any>;
|
|
3
4
|
export declare const getCollections: () => Promise<Record<string, Collection | (() => Collection)>>;
|
|
4
5
|
export declare const getCollection: (collectionName: string) => Promise<Collection | undefined>;
|
package/dist/index.js
CHANGED
|
@@ -3,17 +3,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getConfig = exports.getRouter = exports.getCollection = exports.getCollections = exports.getEntrypoint = void 0;
|
|
6
|
+
exports.getConfig = exports.getRouter = exports.getCollection = exports.getCollections = exports.getEntrypoint = exports.getEntrypointPath = void 0;
|
|
7
7
|
const common_1 = require("@aeriajs/common");
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const promises_1 = __importDefault(require("fs/promises"));
|
|
10
10
|
let collectionsMemo;
|
|
11
11
|
const collectionMemo = {};
|
|
12
|
-
const
|
|
12
|
+
const getEntrypointPath = async () => {
|
|
13
13
|
const { main, aeriaMain } = JSON.parse(await promises_1.default.readFile(path_1.default.join(process.cwd(), 'package.json'), {
|
|
14
14
|
encoding: 'utf8',
|
|
15
15
|
}));
|
|
16
|
-
return
|
|
16
|
+
return path_1.default.join(process.cwd(), aeriaMain || main);
|
|
17
|
+
};
|
|
18
|
+
exports.getEntrypointPath = getEntrypointPath;
|
|
19
|
+
const getEntrypoint = async () => {
|
|
20
|
+
return (0, common_1.dynamicImport)(await (0, exports.getEntrypointPath)());
|
|
17
21
|
};
|
|
18
22
|
exports.getEntrypoint = getEntrypoint;
|
|
19
23
|
const internalGetCollections = async () => {
|
package/dist/index.mjs
CHANGED
|
@@ -127,7 +127,7 @@ import path from "path";
|
|
|
127
127
|
import fs from "fs/promises";
|
|
128
128
|
var collectionsMemo;
|
|
129
129
|
var collectionMemo = {};
|
|
130
|
-
export var
|
|
130
|
+
export var getEntrypointPath = function() {
|
|
131
131
|
var _ref = _async_to_generator(function() {
|
|
132
132
|
var _JSON_parse, main, aeriaMain, _;
|
|
133
133
|
return _ts_generator(this, function(_state) {
|
|
@@ -146,7 +146,30 @@ export var getEntrypoint = function() {
|
|
|
146
146
|
]), main = _JSON_parse.main, aeriaMain = _JSON_parse.aeriaMain;
|
|
147
147
|
return [
|
|
148
148
|
2,
|
|
149
|
-
|
|
149
|
+
path.join(process.cwd(), aeriaMain || main)
|
|
150
|
+
];
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
return function getEntrypointPath() {
|
|
155
|
+
return _ref.apply(this, arguments);
|
|
156
|
+
};
|
|
157
|
+
}();
|
|
158
|
+
export var getEntrypoint = function() {
|
|
159
|
+
var _ref = _async_to_generator(function() {
|
|
160
|
+
return _ts_generator(this, function(_state) {
|
|
161
|
+
switch(_state.label){
|
|
162
|
+
case 0:
|
|
163
|
+
return [
|
|
164
|
+
4,
|
|
165
|
+
getEntrypointPath()
|
|
166
|
+
];
|
|
167
|
+
case 1:
|
|
168
|
+
return [
|
|
169
|
+
2,
|
|
170
|
+
dynamicImport.apply(void 0, [
|
|
171
|
+
_state.sent()
|
|
172
|
+
])
|
|
150
173
|
];
|
|
151
174
|
}
|
|
152
175
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aeriajs/entrypoint",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dist"
|
|
23
23
|
],
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@aeriajs/common": "^0.0.
|
|
25
|
+
"@aeriajs/common": "^0.0.1",
|
|
26
26
|
"@aeriajs/types": "^0.0.0"
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|