@intuned/runtime-dev 0.1.0-test.2 → 0.1.0-test.20

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.
Files changed (57) hide show
  1. package/Intuned.json +1 -1
  2. package/WebTemplate/api.ts +90 -92
  3. package/WebTemplate/controllers/authSessions/check.ts +2 -1
  4. package/WebTemplate/controllers/authSessions/create.ts +4 -4
  5. package/WebTemplate/controllers/authSessions/store.ts +1 -1
  6. package/WebTemplate/controllers/runApi/helpers.ts +11 -7
  7. package/WebTemplate/index.playwright.ts +32 -42
  8. package/WebTemplate/jobs.ts +13 -2
  9. package/WebTemplate/utils.ts +51 -1
  10. package/api/test2.ts +7 -5
  11. package/auth-sessions/check.ts +3 -1
  12. package/auth-sessions/create.ts +10 -10
  13. package/bin/intuned-api-run +1 -1
  14. package/bin/intuned-auth-session-check +1 -1
  15. package/bin/intuned-auth-session-create +1 -1
  16. package/bin/intuned-auth-session-load +1 -1
  17. package/bin/intuned-auth-session-refresh +1 -1
  18. package/bin/intuned-browser-save-state +1 -1
  19. package/bin/intuned-browser-start +1 -1
  20. package/bin/intuned-build +1 -1
  21. package/bin/intuned-ts-check +1 -1
  22. package/dist/commands/api/run.js +6 -2
  23. package/dist/commands/auth-sessions/run-check.js +3 -1
  24. package/dist/commands/auth-sessions/run-create.js +4 -2
  25. package/dist/commands/build.js +7 -4
  26. package/dist/commands/common/browserUtils.js +1 -1
  27. package/dist/commands/common/getFirstLineNumber.test.js +2 -2
  28. package/dist/commands/common/tsNodeImport.d.ts +1 -0
  29. package/dist/commands/common/{getDefaultExportFromFile.js → tsNodeImport.js} +3 -4
  30. package/dist/commands/common/utils/settings.js +1 -1
  31. package/dist/commands/common/utils/webTemplate.js +2 -2
  32. package/dist/commands/interface/run.js +131 -107
  33. package/dist/commands/ts-check.js +2 -2
  34. package/dist/common/Logger/Logger/index.d.ts +1 -1
  35. package/dist/common/Logger/index.d.ts +1 -1
  36. package/dist/common/getPlaywrightConstructs.d.ts +1 -1
  37. package/dist/common/getPlaywrightConstructs.js +3 -3
  38. package/dist/common/runApi/errors.d.ts +1 -1
  39. package/dist/common/runApi/index.d.ts +4 -4
  40. package/dist/common/runApi/index.js +27 -68
  41. package/dist/common/runApi/types.d.ts +20 -6
  42. package/dist/common/runApi/types.js +5 -1
  43. package/dist/index.d.ts +4 -4
  44. package/dist/index.js +12 -12
  45. package/dist/runtime/RunError.d.ts +1 -1
  46. package/dist/runtime/executionHelpers.test.js +2 -2
  47. package/dist/runtime/export.d.ts +1 -1
  48. package/dist/runtime/extendPayload.d.ts +1 -1
  49. package/dist/runtime/extendPayload.js +1 -1
  50. package/dist/runtime/index.d.ts +7 -7
  51. package/dist/runtime/index.js +6 -6
  52. package/dist/runtime/runInfo.d.ts +1 -1
  53. package/dist/runtime/runInfo.js +1 -1
  54. package/package.json +5 -5
  55. package/preserve-dynamic-imports.js +16 -0
  56. package/tsconfig.json +1 -1
  57. package/dist/commands/common/getDefaultExportFromFile.d.ts +0 -1
@@ -18,7 +18,7 @@ var fs = _fsExtra;
18
18
  var _jwtTokenManager = require("../jwtTokenManager");
19
19
  var _contextStorageStateHelpers = require("../contextStorageStateHelpers");
20
20
  var _neverthrow = require("neverthrow");
21
- var _errors = require("./errors");
21
+ var _errors = require("./errors.js");
22
22
  Object.keys(_errors).forEach(function (key) {
23
23
  if (key === "default" || key === "__esModule") return;
24
24
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -32,7 +32,7 @@ Object.keys(_errors).forEach(function (key) {
32
32
  });
33
33
  var _constants = require("../constants");
34
34
  var _getPlaywrightConstructs = require("../getPlaywrightConstructs");
35
- var _types = require("./types");
35
+ var _types = require("./types.js");
36
36
  Object.keys(_types).forEach(function (key) {
37
37
  if (key === "default" || key === "__esModule") return;
38
38
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -128,9 +128,7 @@ async function* runApiGenerator({
128
128
  var _getExecutionContext;
129
129
  if (auth !== null && auth !== void 0 && auth.runCheck) {
130
130
  if (!auth.session) {
131
- return (0, _neverthrow.err)({
132
- code: "AuthRequiredError"
133
- });
131
+ return (0, _neverthrow.err)(new _errors.AuthRequiredError());
134
132
  }
135
133
  console.log("Running auth check");
136
134
  const authCheckResult = await checkAuthSessionWithRetries(page, context, 2);
@@ -142,20 +140,17 @@ async function* runApiGenerator({
142
140
  return authCheckResult;
143
141
  }
144
142
  if (!authCheckResult.value) {
145
- return (0, _neverthrow.err)({
146
- code: "AuthCheckFailedError"
147
- });
143
+ return (0, _neverthrow.err)(new _errors.AuthCheckFailedError());
148
144
  }
149
145
  }
150
- console.log("Running function", automationFunction.name);
151
146
  const args = [...(automationFunction.params ? [automationFunction.params] : []), page, context];
152
- const importResult = await importFunction(automationFunction.name);
153
- if (importResult.isErr()) {
154
- return importResult;
147
+ const validatedModuleResult = await validateModule(automationFunction.module);
148
+ if (validatedModuleResult.isErr()) {
149
+ return validatedModuleResult;
155
150
  }
156
151
  let result;
157
- if (importResult.value.type === "async-generator") {
158
- const generator = importResult.value.generator(...args);
152
+ if (validatedModuleResult.value.type === "async-generator") {
153
+ const generator = validatedModuleResult.value.generator(...args);
159
154
  let next = undefined;
160
155
  while (true) {
161
156
  const generatorResult = await generator.next(...(next ? [next] : []));
@@ -167,7 +162,7 @@ async function* runApiGenerator({
167
162
  break;
168
163
  }
169
164
  } else {
170
- result = await importResult.value.func(...args);
165
+ result = await validatedModuleResult.value.func(...args);
171
166
  }
172
167
  return (0, _neverthrow.ok)({
173
168
  result,
@@ -217,7 +212,7 @@ async function checkAuthSessionWithRetries(page, context, retries = 3) {
217
212
  }
218
213
  let tryNumber = 0;
219
214
  console.log("Checking auth session with retries", `${_constants.AUTH_SESSIONS_FOLDER_NAME}/check`);
220
- const importResult = await importFunction(`${_constants.AUTH_SESSIONS_FOLDER_NAME}/check`);
215
+ const importResult = await validateModule(`${_constants.AUTH_SESSIONS_FOLDER_NAME}/check`);
221
216
  if (importResult.isErr()) {
222
217
  return (0, _neverthrow.err)(importResult.error);
223
218
  }
@@ -232,57 +227,21 @@ async function checkAuthSessionWithRetries(page, context, retries = 3) {
232
227
  }
233
228
  return (0, _neverthrow.ok)(false);
234
229
  }
235
- async function importFunction(path) {
236
- const functionNameParts = path.split("/");
237
- const functionNameDepth = functionNameParts.length;
238
- try {
239
- let imported = undefined;
240
- switch (functionNameDepth) {
241
- case 1:
242
- imported = await (specifier => new Promise(r => r(specifier)).then(s => _interopRequireWildcard(require(s))))(`${functionNameParts[0]}.ts`);
243
- break;
244
- case 2:
245
- imported = await (specifier => new Promise(r => r(specifier)).then(s => _interopRequireWildcard(require(s))))(`${functionNameParts[0]}/${functionNameParts[1]}.ts`);
246
- break;
247
- case 3:
248
- imported = await (specifier => new Promise(r => r(specifier)).then(s => _interopRequireWildcard(require(s))))(`${functionNameParts[0]}/${functionNameParts[1]}/${functionNameParts[2]}.ts`);
249
- break;
250
- case 4:
251
- imported = await (specifier => new Promise(r => r(specifier)).then(s => _interopRequireWildcard(require(s))))(`${functionNameParts[0]}/${functionNameParts[1]}/${functionNameParts[2]}/${functionNameParts[3]}.ts`);
252
- break;
253
- case 5:
254
- imported = await (specifier => new Promise(r => r(specifier)).then(s => _interopRequireWildcard(require(s))))(`${functionNameParts[0]}/${functionNameParts[1]}/${functionNameParts[2]}/${functionNameParts[3]}/${functionNameParts[4]}.ts`);
255
- break;
256
- case 6:
257
- imported = await (specifier => new Promise(r => r(specifier)).then(s => _interopRequireWildcard(require(s))))(`${functionNameParts[0]}/${functionNameParts[1]}/${functionNameParts[2]}/${functionNameParts[3]}/${functionNameParts[4]}/${functionNameParts[5]}.ts`);
258
- break;
259
- default:
260
- return (0, _neverthrow.err)(new _errors.MaxLevelsExceededError(5));
261
- }
262
- if (!imported || !imported.default || !imported.default.constructor) {
263
- return (0, _neverthrow.err)(new _errors.InvalidApiError("API file path does not have a default export"));
264
- }
265
- if (imported.default.constructor.name === "AsyncGeneratorFunction") {
266
- return (0, _neverthrow.ok)({
267
- type: "async-generator",
268
- generator: imported.default
269
- });
270
- }
271
- if (imported.default.constructor.name === "AsyncFunction") {
272
- return (0, _neverthrow.ok)({
273
- type: "async",
274
- func: imported.default
275
- });
276
- }
277
- return (0, _neverthrow.err)(new _errors.InvalidApiError("API file path does not have a default async function/generator export"));
278
- } catch (error) {
279
- if (error.message.includes("Unknown variable dynamic import")) {
280
- return (0, _neverthrow.err)(new _errors.ApiNotFoundError(path));
281
- }
282
- if ((error === null || error === void 0 ? void 0 : error.code) === "ERR_MODULE_NOT_FOUND") {
283
- console.log("API not found", error);
284
- return (0, _neverthrow.err)(new _errors.ApiNotFoundError(path));
285
- }
286
- throw error;
230
+ async function validateModule(moduleToValidate) {
231
+ if (!moduleToValidate || !moduleToValidate.default || !moduleToValidate.default.constructor) {
232
+ return (0, _neverthrow.err)(new _errors.InvalidApiError("API file path does not have a default export"));
233
+ }
234
+ if (moduleToValidate.default.constructor.name === "AsyncGeneratorFunction") {
235
+ return (0, _neverthrow.ok)({
236
+ type: "async-generator",
237
+ generator: moduleToValidate.default
238
+ });
239
+ }
240
+ if (moduleToValidate.default.constructor.name === "AsyncFunction") {
241
+ return (0, _neverthrow.ok)({
242
+ type: "async",
243
+ func: moduleToValidate.default
244
+ });
287
245
  }
246
+ return (0, _neverthrow.err)(new _errors.InvalidApiError("API file path does not have a default async function/generator export"));
288
247
  }
@@ -1,7 +1,7 @@
1
1
  import type { IntunedStorageState } from "../contextStorageStateHelpers";
2
2
  import type { Payload } from "../../runtime/export";
3
3
  import type { Result } from "neverthrow";
4
- import type { RunAutomationError } from "./errors";
4
+ import type { RunAutomationError } from "./errors.js";
5
5
  import z from "zod";
6
6
  export interface PayloadToAppend {
7
7
  apiName: string;
@@ -127,13 +127,23 @@ export declare const runApiSessionSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
127
127
  export declare const runApiParametersSchema: z.ZodObject<{
128
128
  functionsToken: z.ZodOptional<z.ZodString>;
129
129
  automationFunction: z.ZodObject<{
130
- name: z.ZodString;
130
+ module: z.ZodObject<{
131
+ default: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
132
+ }, "strip", z.ZodTypeAny, {
133
+ default: (...args: unknown[]) => unknown;
134
+ }, {
135
+ default: (...args: unknown[]) => unknown;
136
+ }>;
131
137
  params: z.ZodOptional<z.ZodAny>;
132
138
  }, "strip", z.ZodTypeAny, {
133
- name: string;
139
+ module: {
140
+ default: (...args: unknown[]) => unknown;
141
+ };
134
142
  params?: any;
135
143
  }, {
136
- name: string;
144
+ module: {
145
+ default: (...args: unknown[]) => unknown;
146
+ };
137
147
  params?: any;
138
148
  }>;
139
149
  tracing: z.ZodDefault<z.ZodOptional<z.ZodDiscriminatedUnion<"enabled", [z.ZodObject<{
@@ -360,7 +370,9 @@ export declare const runApiParametersSchema: z.ZodObject<{
360
370
  retrieveSession: z.ZodDefault<z.ZodBoolean>;
361
371
  }, "strip", z.ZodTypeAny, {
362
372
  automationFunction: {
363
- name: string;
373
+ module: {
374
+ default: (...args: unknown[]) => unknown;
375
+ };
364
376
  params?: any;
365
377
  };
366
378
  tracing: {
@@ -416,7 +428,9 @@ export declare const runApiParametersSchema: z.ZodObject<{
416
428
  } | undefined;
417
429
  }, {
418
430
  automationFunction: {
419
- name: string;
431
+ module: {
432
+ default: (...args: unknown[]) => unknown;
433
+ };
420
434
  params?: any;
421
435
  };
422
436
  functionsToken?: string | undefined;
@@ -16,7 +16,11 @@ const runApiSessionSchema = exports.runApiSessionSchema = _zod.default.discrimin
16
16
  const runApiParametersSchema = exports.runApiParametersSchema = _zod.default.object({
17
17
  functionsToken: _zod.default.string().optional(),
18
18
  automationFunction: _zod.default.object({
19
- name: _zod.default.string(),
19
+ module: _zod.default.object({
20
+ default: _zod.default.function()
21
+ }, {
22
+ required_error: "API handler must have a default export function"
23
+ }),
20
24
  params: _zod.default.any().optional()
21
25
  }),
22
26
  tracing: _zod.default.discriminatedUnion("enabled", [_zod.default.object({
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { extendPayload, extendTimeout, runInfo, RunError, requestMultipleChoice, requestOTP, } from "./runtime";
2
- export { runWithContext, getExecutionContext, } from "./common/asyncLocalStorage";
3
- export { getDownloadDirectoryPath } from "./runtime/downloadDirectory";
4
- export { getProductionPlaywrightConstructs } from "./common/getPlaywrightConstructs";
1
+ export { extendPayload, extendTimeout, runInfo, RunError, requestMultipleChoice, requestOTP, } from "./runtime/index.js";
2
+ export { runWithContext, getExecutionContext, } from "./common/asyncLocalStorage/index.js";
3
+ export { getDownloadDirectoryPath } from "./runtime/downloadDirectory.js";
4
+ export { getProductionPlaywrightConstructs } from "./common/getPlaywrightConstructs.js";
package/dist/index.js CHANGED
@@ -6,19 +6,19 @@ Object.defineProperty(exports, "__esModule", {
6
6
  Object.defineProperty(exports, "RunError", {
7
7
  enumerable: true,
8
8
  get: function () {
9
- return _runtime.RunError;
9
+ return _index.RunError;
10
10
  }
11
11
  });
12
12
  Object.defineProperty(exports, "extendPayload", {
13
13
  enumerable: true,
14
14
  get: function () {
15
- return _runtime.extendPayload;
15
+ return _index.extendPayload;
16
16
  }
17
17
  });
18
18
  Object.defineProperty(exports, "extendTimeout", {
19
19
  enumerable: true,
20
20
  get: function () {
21
- return _runtime.extendTimeout;
21
+ return _index.extendTimeout;
22
22
  }
23
23
  });
24
24
  Object.defineProperty(exports, "getDownloadDirectoryPath", {
@@ -30,7 +30,7 @@ Object.defineProperty(exports, "getDownloadDirectoryPath", {
30
30
  Object.defineProperty(exports, "getExecutionContext", {
31
31
  enumerable: true,
32
32
  get: function () {
33
- return _asyncLocalStorage.getExecutionContext;
33
+ return _index2.getExecutionContext;
34
34
  }
35
35
  });
36
36
  Object.defineProperty(exports, "getProductionPlaywrightConstructs", {
@@ -42,28 +42,28 @@ Object.defineProperty(exports, "getProductionPlaywrightConstructs", {
42
42
  Object.defineProperty(exports, "requestMultipleChoice", {
43
43
  enumerable: true,
44
44
  get: function () {
45
- return _runtime.requestMultipleChoice;
45
+ return _index.requestMultipleChoice;
46
46
  }
47
47
  });
48
48
  Object.defineProperty(exports, "requestOTP", {
49
49
  enumerable: true,
50
50
  get: function () {
51
- return _runtime.requestOTP;
51
+ return _index.requestOTP;
52
52
  }
53
53
  });
54
54
  Object.defineProperty(exports, "runInfo", {
55
55
  enumerable: true,
56
56
  get: function () {
57
- return _runtime.runInfo;
57
+ return _index.runInfo;
58
58
  }
59
59
  });
60
60
  Object.defineProperty(exports, "runWithContext", {
61
61
  enumerable: true,
62
62
  get: function () {
63
- return _asyncLocalStorage.runWithContext;
63
+ return _index2.runWithContext;
64
64
  }
65
65
  });
66
- var _runtime = require("./runtime");
67
- var _asyncLocalStorage = require("./common/asyncLocalStorage");
68
- var _downloadDirectory = require("./runtime/downloadDirectory");
69
- var _getPlaywrightConstructs = require("./common/getPlaywrightConstructs");
66
+ var _index = require("./runtime/index.js");
67
+ var _index2 = require("./common/asyncLocalStorage/index.js");
68
+ var _downloadDirectory = require("./runtime/downloadDirectory.js");
69
+ var _getPlaywrightConstructs = require("./common/getPlaywrightConstructs.js");
@@ -1,4 +1,4 @@
1
- import { RunErrorOptions } from "./export";
1
+ import { RunErrorOptions } from "./export.js";
2
2
  export declare class RunError extends Error {
3
3
  options: RunErrorOptions;
4
4
  constructor(message: string, options?: RunErrorOptions);
@@ -2,8 +2,8 @@
2
2
 
3
3
  var _vitest = require("vitest");
4
4
  var _asyncLocalStorage = require("../common/asyncLocalStorage");
5
- var _index = require("./index");
6
- var _enums = require("./enums");
5
+ var _index = require("./index.js");
6
+ var _enums = require("./enums.js");
7
7
  (0, _vitest.describe)("Execution Helpers", () => {
8
8
  (0, _vitest.it)("should be able to get execution info", () => {
9
9
  (0, _asyncLocalStorage.runWithContext)({
@@ -1,4 +1,4 @@
1
- import { RunEnvironment } from "./enums";
1
+ import { RunEnvironment } from "./enums.js";
2
2
 
3
3
  /**
4
4
  * ## Description
@@ -1,2 +1,2 @@
1
- import { Payload } from "./export";
1
+ import { Payload } from "./export.js";
2
2
  export declare function extendPayload(payload: Payload | Payload[]): void;
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.extendPayload = extendPayload;
7
7
  var _asyncLocalStorage = require("../common/asyncLocalStorage");
8
- var _extendTimeout = require("./extendTimeout");
8
+ var _extendTimeout = require("./extendTimeout.js");
9
9
  function extendPayload(payload) {
10
10
  const context = (0, _asyncLocalStorage.getExecutionContext)();
11
11
  if (!context) {
@@ -1,7 +1,7 @@
1
- export { extendPayload } from "./extendPayload";
2
- export { extendTimeout } from "./extendTimeout";
3
- export { runInfo } from "./runInfo";
4
- export { RunError } from "./RunError";
5
- export { requestMultipleChoice, requestOTP } from "./requestMoreInfo";
6
- export type { RequestMoreInfoDetails } from "./requestMoreInfo";
7
- export { getDownloadDirectoryPath } from "./downloadDirectory";
1
+ export { extendPayload } from "./extendPayload.js";
2
+ export { extendTimeout } from "./extendTimeout.js";
3
+ export { runInfo } from "./runInfo.js";
4
+ export { RunError } from "./RunError.js";
5
+ export { requestMultipleChoice, requestOTP } from "./requestMoreInfo.js";
6
+ export type { RequestMoreInfoDetails } from "./requestMoreInfo.js";
7
+ export { getDownloadDirectoryPath } from "./downloadDirectory.js";
@@ -45,9 +45,9 @@ Object.defineProperty(exports, "runInfo", {
45
45
  return _runInfo.runInfo;
46
46
  }
47
47
  });
48
- var _extendPayload = require("./extendPayload");
49
- var _extendTimeout = require("./extendTimeout");
50
- var _runInfo = require("./runInfo");
51
- var _RunError = require("./RunError");
52
- var _requestMoreInfo = require("./requestMoreInfo");
53
- var _downloadDirectory = require("./downloadDirectory");
48
+ var _extendPayload = require("./extendPayload.js");
49
+ var _extendTimeout = require("./extendTimeout.js");
50
+ var _runInfo = require("./runInfo.js");
51
+ var _RunError = require("./RunError.js");
52
+ var _requestMoreInfo = require("./requestMoreInfo.js");
53
+ var _downloadDirectory = require("./downloadDirectory.js");
@@ -1,2 +1,2 @@
1
- import { RunInfo } from "./export";
1
+ import { RunInfo } from "./export.js";
2
2
  export declare function runInfo(): RunInfo;
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.runInfo = runInfo;
7
7
  var _asyncLocalStorage = require("../common/asyncLocalStorage");
8
- var _enums = require("./enums");
8
+ var _enums = require("./enums.js");
9
9
  function runInfo() {
10
10
  const context = (0, _asyncLocalStorage.getExecutionContext)();
11
11
  if (!context) {
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@intuned/runtime-dev",
3
- "version": "0.1.0-test.2",
3
+ "version": "0.1.0-test.20",
4
4
  "description": "Intuned runtime",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",
7
- "./dist/runtime": "./dist/runtime/index.js",
7
+ "./runtime": "./dist/runtime/index.js",
8
8
  "./dist/common/runApi": "./dist/common/runApi/index.js",
9
9
  "./dist/common/settingsSchema": "./dist/common/settingsSchema.js",
10
10
  "./dist/common/contextStorageStateHelpers": "./dist/common/contextStorageStateHelpers.js",
@@ -12,8 +12,7 @@
12
12
  "./dist/common/jwtTokenManager": "./dist/common/jwtTokenManager.js",
13
13
  "./dist/common/asyncLocalStorage": "./dist/common/asyncLocalStorage/index.js",
14
14
  "./dist/common/cleanEnvironmentVariables": "./dist/common/cleanEnvironmentVariables.js",
15
- "./dist/common/constants": "./dist/common/constants.js",
16
- "./dist/commands/interface/run": "./dist/commands/interface/run.js"
15
+ "./dist/common/constants": "./dist/common/constants.js"
17
16
  },
18
17
  "types": "./dist/index.d.ts",
19
18
  "author": "Intuned Team",
@@ -51,6 +50,7 @@
51
50
  "intuned-ts-check": "./bin/intuned-ts-check"
52
51
  },
53
52
  "dependencies": {
53
+ "@babel/plugin-syntax-dynamic-import": "^7.8.3",
54
54
  "@intuned/playwright": "^1.44.1-4",
55
55
  "@intuned/playwright-core": "^1.44.1-4",
56
56
  "@rollup/plugin-commonjs": "^25.0.2",
@@ -65,6 +65,7 @@
65
65
  "@types/node": "^20.4.1",
66
66
  "applicationinsights": "^2.9.2",
67
67
  "async-retry": "^1.3.3",
68
+ "babel-plugin-dynamic-import-node": "^2.3.3",
68
69
  "chalk": "^4.1.2",
69
70
  "commander": "^11.0.0",
70
71
  "cross-fetch": "^4.0.0",
@@ -89,7 +90,6 @@
89
90
  "source-map": "^0.7.4",
90
91
  "stack-utils": "^2.0.6",
91
92
  "ts-morph": "^21.0.1",
92
- "ts-node": "^10.9.1",
93
93
  "tslib": "^2.6.0",
94
94
  "typescript": "^5.1.6",
95
95
  "wait-on": "^7.2.0",
@@ -0,0 +1,16 @@
1
+ module.exports = function ({ template }) {
2
+ return {
3
+ visitor: {
4
+ CallExpression(path) {
5
+ if (path.node.callee.type === "Import") {
6
+ const buildRequire = template(`Promise.resolve(require(ARGUMENT))`);
7
+ path.replaceWith(
8
+ buildRequire({
9
+ ARGUMENT: path.node.arguments[0],
10
+ })
11
+ );
12
+ }
13
+ },
14
+ },
15
+ };
16
+ };
package/tsconfig.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "target": "es2021",
4
4
  "module": "esnext",
5
5
  "esModuleInterop": true,
6
- "moduleResolution": "bundler",
6
+ "moduleResolution": "node",
7
7
  "resolveJsonModule": true,
8
8
  "outDir": "./dist",
9
9
  "strict": false,
@@ -1 +0,0 @@
1
- export declare function getDefaultExportFromFile(apiFilePath: string): Promise<any>;