aeria-sdk 0.0.228 → 0.0.229

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/cli.js CHANGED
@@ -7,6 +7,10 @@ const { values: opts } = parseArgs({
7
7
  type: 'boolean',
8
8
  short: 'd',
9
9
  },
10
+ runtimeOnly: {
11
+ type: 'boolean',
12
+ short: 'r',
13
+ },
10
14
  },
11
15
  });
12
16
  export const main = async () => {
@@ -14,5 +18,7 @@ export const main = async () => {
14
18
  if (opts.dev) {
15
19
  config.environment = 'development';
16
20
  }
17
- mirrorRemotely(config);
21
+ await mirrorRemotely(config, {
22
+ dts: !opts.runtimeOnly,
23
+ });
18
24
  };
package/dist/mirror.d.ts CHANGED
@@ -4,6 +4,10 @@ type MirrorObject = {
4
4
  router?: unknown;
5
5
  };
6
6
  export declare const runtimeContent: (config: InstanceConfig) => string;
7
- export declare const writeMirrorFiles: (mirror: MirrorObject, config: InstanceConfig) => Promise<void>;
8
- export declare const mirrorRemotely: (config: InstanceConfig) => Promise<void>;
7
+ export declare const writeRuntimeFile: (mirrorPath: string, config: InstanceConfig) => Promise<void>;
8
+ export declare const writeDtsFile: (mirrorPath: string, mirror: MirrorObject, config: InstanceConfig) => Promise<void>;
9
+ export declare const writeMirrorFiles: (mirror: MirrorObject | undefined, config: InstanceConfig) => Promise<void>;
10
+ export declare const mirrorRemotely: (config: InstanceConfig, options?: {
11
+ dts: boolean;
12
+ }) => Promise<void>;
9
13
  export {};
package/dist/mirror.js CHANGED
@@ -102,34 +102,49 @@ export const storage = getStorage(instanceConfig)
102
102
  export const upload = uploader(instanceConfig)
103
103
  export default aeria
104
104
  \n`;
105
+ export const writeRuntimeFile = async (mirrorPath, config) => {
106
+ const syntheticRequire = createRequire(path.join(path.dirname(path.resolve(mirrorPath)), 'node_modules'));
107
+ let resolvedPath;
108
+ try {
109
+ resolvedPath = syntheticRequire.resolve('aeria-sdk');
110
+ }
111
+ catch (err) {
112
+ console.warn(`couldn't locate node_modules in "${mirrorPath}"`);
113
+ return;
114
+ }
115
+ const runtimeBase = path.dirname(resolvedPath);
116
+ const js = runtimeContent(config);
117
+ // this array join must be used, otherwise the .js will be transformed by the transform-import-extensions script
118
+ const fname = [
119
+ 'runtime',
120
+ 'js',
121
+ ].join('.');
122
+ await writeFile(path.join(runtimeBase, fname), js);
123
+ await writeFile(path.join(mirrorPath, fname), js);
124
+ };
125
+ export const writeDtsFile = async (mirrorPath, mirror, config) => {
126
+ const dts = mirrorDts(mirror, config);
127
+ await writeFile(path.join(mirrorPath, DTS_FILENAME), dts);
128
+ };
105
129
  export const writeMirrorFiles = async (mirror, config) => {
106
130
  const mirrorPaths = config.mirrorPaths || ['.aeria']
107
131
  .map((mirrorPath) => path.join(process.cwd(), mirrorPath));
108
- const dts = mirrorDts(mirror, config);
109
- const js = runtimeContent(config);
110
132
  for (const mirrorPath of mirrorPaths) {
111
- const syntheticRequire = createRequire(path.join(path.dirname(path.resolve(mirrorPath)), 'node_modules'));
112
- let resolvedPath;
113
- try {
114
- resolvedPath = syntheticRequire.resolve('aeria-sdk');
133
+ await writeRuntimeFile(mirrorPath, config);
134
+ if (mirror) {
135
+ await writeDtsFile(mirrorPath, mirror, config);
115
136
  }
116
- catch (err) {
117
- console.warn(`couldn't locate node_modules in "${mirrorPath}"`);
118
- continue;
119
- }
120
- const runtimeBase = path.dirname(resolvedPath);
121
- await writeFile(path.join(mirrorPath, DTS_FILENAME), dts);
122
- // this array join must be used, otherwise the .js will be transformed by the transform-import-extensions script
123
- await writeFile(path.join(runtimeBase, [
124
- 'runtime',
125
- 'js',
126
- ].join('.')), js);
127
137
  }
128
138
  };
129
- export const mirrorRemotely = async (config) => {
139
+ export const mirrorRemotely = async (config, options = {
140
+ dts: true,
141
+ }) => {
130
142
  const aeria = createInstance(config);
131
- const mirror = deserialize(await aeria().describe.POST({
132
- router: true,
133
- }));
143
+ let mirror;
144
+ if (options.dts) {
145
+ mirror = deserialize(await aeria().describe.POST({
146
+ router: true,
147
+ }));
148
+ }
134
149
  return writeMirrorFiles(mirror, config);
135
150
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "aeria-sdk",
3
3
  "type": "module",
4
- "version": "0.0.228",
4
+ "version": "0.0.229",
5
5
  "description": "",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",