aeria-sdk 0.0.92 → 0.0.93
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/mirror.d.ts +1 -1
- package/dist/mirror.js +17 -19
- package/dist/mirror.mjs +17 -19
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
package/dist/mirror.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { InstanceConfig } from './types';
|
|
2
2
|
export declare const runtimeCjs: (config: InstanceConfig) => string;
|
|
3
3
|
export declare const runtimeEsm: (config: InstanceConfig) => string;
|
|
4
|
-
export declare const writeMirrorFiles: (mirror: any, config: InstanceConfig
|
|
4
|
+
export declare const writeMirrorFiles: (mirror: any, config: InstanceConfig) => Promise<void>;
|
|
5
5
|
export declare const mirrorRemotely: (config: InstanceConfig) => Promise<void>;
|
package/dist/mirror.js
CHANGED
|
@@ -7,6 +7,7 @@ const promises_1 = require("fs/promises");
|
|
|
7
7
|
const module_1 = require("module");
|
|
8
8
|
const topLevel_js_1 = require("./topLevel.js");
|
|
9
9
|
const utils_js_1 = require("./utils.js");
|
|
10
|
+
const DTS_FILENAME = 'aeria-sdk.d.ts';
|
|
10
11
|
const mirrorDts = (mirrorObj, config) => {
|
|
11
12
|
const collections = mirrorObj.descriptions;
|
|
12
13
|
return `import type {
|
|
@@ -81,11 +82,11 @@ declare module 'aeria-sdk' {
|
|
|
81
82
|
& ((bearerToken?: string) => TopLevelObject & Endpoints)
|
|
82
83
|
& TopLevelObject & Endpoints
|
|
83
84
|
|
|
84
|
-
|
|
85
|
+
const topLevelAeria: TopLevelAeria
|
|
85
86
|
|
|
86
87
|
export const url: string
|
|
87
88
|
export const aeria: TopLevelAeria
|
|
88
|
-
export default
|
|
89
|
+
export default topLevelAeria
|
|
89
90
|
}
|
|
90
91
|
\n`;
|
|
91
92
|
};
|
|
@@ -107,23 +108,20 @@ export const storage = getStorage(config)
|
|
|
107
108
|
export default aeria
|
|
108
109
|
\n`;
|
|
109
110
|
exports.runtimeEsm = runtimeEsm;
|
|
110
|
-
const writeMirrorFiles = async (mirror, config
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
const syntheticRequire = (0, module_1.createRequire)(path.join(
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
await (0, promises_1.writeFile)(path.join(filesPath, 'aeria-sdk.d.ts'), mirrorDts(mirror, config));
|
|
125
|
-
await (0, promises_1.writeFile)(path.join(runtimeBase, 'runtime.js'), (0, exports.runtimeCjs)(config));
|
|
126
|
-
await (0, promises_1.writeFile)(path.join(runtimeBase, 'runtime.mjs'), (0, exports.runtimeEsm)(config));
|
|
111
|
+
const writeMirrorFiles = async (mirror, config) => {
|
|
112
|
+
const mirrorPaths = config.mirrorPaths || ['.aeria']
|
|
113
|
+
.map((mirrorPath) => path.join(process.cwd(), mirrorPath));
|
|
114
|
+
const dts = mirrorDts(mirror, config);
|
|
115
|
+
const cjs = (0, exports.runtimeCjs)(config);
|
|
116
|
+
const esm = (0, exports.runtimeEsm)(config);
|
|
117
|
+
for (const mirrorPath of mirrorPaths) {
|
|
118
|
+
const syntheticRequire = (0, module_1.createRequire)(path.join(path.dirname(path.resolve(mirrorPath)), 'node_modules'));
|
|
119
|
+
const resolvedPath = syntheticRequire.resolve('aeria-sdk');
|
|
120
|
+
const runtimeBase = path.dirname(resolvedPath);
|
|
121
|
+
await (0, promises_1.writeFile)(path.join(mirrorPath, DTS_FILENAME), dts);
|
|
122
|
+
await (0, promises_1.writeFile)(path.join(runtimeBase, 'runtime.js'), cjs);
|
|
123
|
+
await (0, promises_1.writeFile)(path.join(runtimeBase, 'runtime.mjs'), esm);
|
|
124
|
+
}
|
|
127
125
|
};
|
|
128
126
|
exports.writeMirrorFiles = writeMirrorFiles;
|
|
129
127
|
const mirrorRemotely = async (config) => {
|
package/dist/mirror.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import * as path from "path";
|
|
3
3
|
import { deserialize } from "@aeriajs/common";
|
|
4
|
-
import { writeFile
|
|
4
|
+
import { writeFile } from "fs/promises";
|
|
5
5
|
import { createRequire } from "module";
|
|
6
6
|
import { topLevel } from "./topLevel.mjs";
|
|
7
7
|
import { publicUrl } from "./utils.mjs";
|
|
8
|
+
const DTS_FILENAME = "aeria-sdk.d.ts";
|
|
8
9
|
const mirrorDts = (mirrorObj, config) => {
|
|
9
10
|
const collections = mirrorObj.descriptions;
|
|
10
11
|
return `import type {
|
|
@@ -80,11 +81,11 @@ declare module 'aeria-sdk' {
|
|
|
80
81
|
& ((bearerToken?: string) => TopLevelObject & Endpoints)
|
|
81
82
|
& TopLevelObject & Endpoints
|
|
82
83
|
|
|
83
|
-
|
|
84
|
+
const topLevelAeria: TopLevelAeria
|
|
84
85
|
|
|
85
86
|
export const url: string
|
|
86
87
|
export const aeria: TopLevelAeria
|
|
87
|
-
export default
|
|
88
|
+
export default topLevelAeria
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
`;
|
|
@@ -107,22 +108,19 @@ export const storage = getStorage(config)
|
|
|
107
108
|
export default aeria
|
|
108
109
|
|
|
109
110
|
`;
|
|
110
|
-
export const writeMirrorFiles = async (mirror, config
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
const syntheticRequire = createRequire(path.join(
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
await writeFile(path.join(filesPath, "aeria-sdk.d.ts"), mirrorDts(mirror, config));
|
|
124
|
-
await writeFile(path.join(runtimeBase, "runtime.mjs"), runtimeCjs(config));
|
|
125
|
-
await writeFile(path.join(runtimeBase, "runtime.mjs"), runtimeEsm(config));
|
|
111
|
+
export const writeMirrorFiles = async (mirror, config) => {
|
|
112
|
+
const mirrorPaths = config.mirrorPaths || [".aeria"].map((mirrorPath) => path.join(process.cwd(), mirrorPath));
|
|
113
|
+
const dts = mirrorDts(mirror, config);
|
|
114
|
+
const cjs = runtimeCjs(config);
|
|
115
|
+
const esm = runtimeEsm(config);
|
|
116
|
+
for (const mirrorPath of mirrorPaths) {
|
|
117
|
+
const syntheticRequire = createRequire(path.join(path.dirname(path.resolve(mirrorPath)), "node_modules"));
|
|
118
|
+
const resolvedPath = syntheticRequire.resolve("aeria-sdk");
|
|
119
|
+
const runtimeBase = path.dirname(resolvedPath);
|
|
120
|
+
await writeFile(path.join(mirrorPath, DTS_FILENAME), dts);
|
|
121
|
+
await writeFile(path.join(runtimeBase, "runtime.mjs"), cjs);
|
|
122
|
+
await writeFile(path.join(runtimeBase, "runtime.mjs"), esm);
|
|
123
|
+
}
|
|
126
124
|
};
|
|
127
125
|
export const mirrorRemotely = async (config) => {
|
|
128
126
|
const aeria = topLevel(config);
|
package/dist/types.d.ts
CHANGED