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

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 (56) hide show
  1. package/Intuned.json +1 -1
  2. package/WebTemplate/api.ts +92 -90
  3. package/WebTemplate/controllers/authSessions/create.ts +2 -2
  4. package/WebTemplate/controllers/authSessions/store.ts +1 -1
  5. package/WebTemplate/controllers/runApi/helpers.ts +7 -11
  6. package/WebTemplate/index.playwright.ts +42 -32
  7. package/WebTemplate/jobs.ts +2 -13
  8. package/WebTemplate/utils.ts +1 -51
  9. package/api/test2.ts +5 -7
  10. package/auth-sessions/check.ts +1 -3
  11. package/auth-sessions/create.ts +10 -10
  12. package/bin/intuned-api-run +1 -1
  13. package/bin/intuned-auth-session-check +1 -1
  14. package/bin/intuned-auth-session-create +1 -1
  15. package/bin/intuned-auth-session-load +1 -1
  16. package/bin/intuned-auth-session-refresh +1 -1
  17. package/bin/intuned-browser-save-state +1 -1
  18. package/bin/intuned-browser-start +1 -1
  19. package/bin/intuned-build +1 -1
  20. package/bin/intuned-ts-check +1 -1
  21. package/dist/commands/api/run.js +2 -6
  22. package/dist/commands/auth-sessions/run-check.js +1 -3
  23. package/dist/commands/auth-sessions/run-create.js +2 -4
  24. package/dist/commands/build.js +4 -7
  25. package/dist/commands/common/browserUtils.js +1 -1
  26. package/dist/commands/common/getDefaultExportFromFile.d.ts +1 -0
  27. package/dist/commands/common/{tsNodeImport.js → getDefaultExportFromFile.js} +4 -3
  28. package/dist/commands/common/getFirstLineNumber.test.js +2 -2
  29. package/dist/commands/common/utils/settings.js +1 -1
  30. package/dist/commands/common/utils/webTemplate.js +2 -2
  31. package/dist/commands/interface/run.js +119 -143
  32. package/dist/commands/ts-check.js +2 -2
  33. package/dist/common/Logger/Logger/index.d.ts +1 -1
  34. package/dist/common/Logger/index.d.ts +1 -1
  35. package/dist/common/getPlaywrightConstructs.d.ts +1 -1
  36. package/dist/common/getPlaywrightConstructs.js +3 -3
  37. package/dist/common/runApi/errors.d.ts +1 -1
  38. package/dist/common/runApi/index.d.ts +4 -4
  39. package/dist/common/runApi/index.js +68 -27
  40. package/dist/common/runApi/types.d.ts +6 -20
  41. package/dist/common/runApi/types.js +1 -5
  42. package/dist/index.d.ts +4 -4
  43. package/dist/index.js +12 -12
  44. package/dist/runtime/RunError.d.ts +1 -1
  45. package/dist/runtime/executionHelpers.test.js +2 -2
  46. package/dist/runtime/export.d.ts +1 -1
  47. package/dist/runtime/extendPayload.d.ts +1 -1
  48. package/dist/runtime/extendPayload.js +1 -1
  49. package/dist/runtime/index.d.ts +7 -7
  50. package/dist/runtime/index.js +6 -6
  51. package/dist/runtime/runInfo.d.ts +1 -1
  52. package/dist/runtime/runInfo.js +1 -1
  53. package/package.json +5 -5
  54. package/tsconfig.json +1 -1
  55. package/dist/commands/common/tsNodeImport.d.ts +0 -1
  56. package/preserve-dynamic-imports.js +0 -16
@@ -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.js");
21
+ var _errors = require("./errors");
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.js");
35
+ var _types = require("./types");
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,7 +128,9 @@ 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)(new _errors.AuthRequiredError());
131
+ return (0, _neverthrow.err)({
132
+ code: "AuthRequiredError"
133
+ });
132
134
  }
133
135
  console.log("Running auth check");
134
136
  const authCheckResult = await checkAuthSessionWithRetries(page, context, 2);
@@ -140,17 +142,20 @@ async function* runApiGenerator({
140
142
  return authCheckResult;
141
143
  }
142
144
  if (!authCheckResult.value) {
143
- return (0, _neverthrow.err)(new _errors.AuthCheckFailedError());
145
+ return (0, _neverthrow.err)({
146
+ code: "AuthCheckFailedError"
147
+ });
144
148
  }
145
149
  }
150
+ console.log("Running function", automationFunction.name);
146
151
  const args = [...(automationFunction.params ? [automationFunction.params] : []), page, context];
147
- const validatedModuleResult = await validateModule(automationFunction.module);
148
- if (validatedModuleResult.isErr()) {
149
- return validatedModuleResult;
152
+ const importResult = await importFunction(automationFunction.name);
153
+ if (importResult.isErr()) {
154
+ return importResult;
150
155
  }
151
156
  let result;
152
- if (validatedModuleResult.value.type === "async-generator") {
153
- const generator = validatedModuleResult.value.generator(...args);
157
+ if (importResult.value.type === "async-generator") {
158
+ const generator = importResult.value.generator(...args);
154
159
  let next = undefined;
155
160
  while (true) {
156
161
  const generatorResult = await generator.next(...(next ? [next] : []));
@@ -162,7 +167,7 @@ async function* runApiGenerator({
162
167
  break;
163
168
  }
164
169
  } else {
165
- result = await validatedModuleResult.value.func(...args);
170
+ result = await importResult.value.func(...args);
166
171
  }
167
172
  return (0, _neverthrow.ok)({
168
173
  result,
@@ -212,7 +217,7 @@ async function checkAuthSessionWithRetries(page, context, retries = 3) {
212
217
  }
213
218
  let tryNumber = 0;
214
219
  console.log("Checking auth session with retries", `${_constants.AUTH_SESSIONS_FOLDER_NAME}/check`);
215
- const importResult = await validateModule(`${_constants.AUTH_SESSIONS_FOLDER_NAME}/check`);
220
+ const importResult = await importFunction(`${_constants.AUTH_SESSIONS_FOLDER_NAME}/check`);
216
221
  if (importResult.isErr()) {
217
222
  return (0, _neverthrow.err)(importResult.error);
218
223
  }
@@ -227,21 +232,57 @@ async function checkAuthSessionWithRetries(page, context, retries = 3) {
227
232
  }
228
233
  return (0, _neverthrow.ok)(false);
229
234
  }
230
- async function validateModule(module) {
231
- if (!module || !module.default || !module.default.constructor) {
232
- return (0, _neverthrow.err)(new _errors.InvalidApiError("API file path does not have a default export"));
233
- }
234
- if (module.default.constructor.name === "AsyncGeneratorFunction") {
235
- return (0, _neverthrow.ok)({
236
- type: "async-generator",
237
- generator: module.default
238
- });
239
- }
240
- if (module.default.constructor.name === "AsyncFunction") {
241
- return (0, _neverthrow.ok)({
242
- type: "async",
243
- func: module.default
244
- });
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;
245
287
  }
246
- return (0, _neverthrow.err)(new _errors.InvalidApiError("API file path does not have a default async function/generator export"));
247
288
  }
@@ -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.js";
4
+ import type { RunAutomationError } from "./errors";
5
5
  import z from "zod";
6
6
  export interface PayloadToAppend {
7
7
  apiName: string;
@@ -127,23 +127,13 @@ 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
- 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
- }>;
130
+ name: z.ZodString;
137
131
  params: z.ZodOptional<z.ZodAny>;
138
132
  }, "strip", z.ZodTypeAny, {
139
- module: {
140
- default: (...args: unknown[]) => unknown;
141
- };
133
+ name: string;
142
134
  params?: any;
143
135
  }, {
144
- module: {
145
- default: (...args: unknown[]) => unknown;
146
- };
136
+ name: string;
147
137
  params?: any;
148
138
  }>;
149
139
  tracing: z.ZodDefault<z.ZodOptional<z.ZodDiscriminatedUnion<"enabled", [z.ZodObject<{
@@ -370,9 +360,7 @@ export declare const runApiParametersSchema: z.ZodObject<{
370
360
  retrieveSession: z.ZodDefault<z.ZodBoolean>;
371
361
  }, "strip", z.ZodTypeAny, {
372
362
  automationFunction: {
373
- module: {
374
- default: (...args: unknown[]) => unknown;
375
- };
363
+ name: string;
376
364
  params?: any;
377
365
  };
378
366
  tracing: {
@@ -428,9 +416,7 @@ export declare const runApiParametersSchema: z.ZodObject<{
428
416
  } | undefined;
429
417
  }, {
430
418
  automationFunction: {
431
- module: {
432
- default: (...args: unknown[]) => unknown;
433
- };
419
+ name: string;
434
420
  params?: any;
435
421
  };
436
422
  functionsToken?: string | undefined;
@@ -16,11 +16,7 @@ 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
- module: _zod.default.object({
20
- default: _zod.default.function()
21
- }, {
22
- required_error: "API handler must have a default export function"
23
- }),
19
+ name: _zod.default.string(),
24
20
  params: _zod.default.any().optional()
25
21
  }),
26
22
  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/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";
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";
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 _index.RunError;
9
+ return _runtime.RunError;
10
10
  }
11
11
  });
12
12
  Object.defineProperty(exports, "extendPayload", {
13
13
  enumerable: true,
14
14
  get: function () {
15
- return _index.extendPayload;
15
+ return _runtime.extendPayload;
16
16
  }
17
17
  });
18
18
  Object.defineProperty(exports, "extendTimeout", {
19
19
  enumerable: true,
20
20
  get: function () {
21
- return _index.extendTimeout;
21
+ return _runtime.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 _index2.getExecutionContext;
33
+ return _asyncLocalStorage.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 _index.requestMultipleChoice;
45
+ return _runtime.requestMultipleChoice;
46
46
  }
47
47
  });
48
48
  Object.defineProperty(exports, "requestOTP", {
49
49
  enumerable: true,
50
50
  get: function () {
51
- return _index.requestOTP;
51
+ return _runtime.requestOTP;
52
52
  }
53
53
  });
54
54
  Object.defineProperty(exports, "runInfo", {
55
55
  enumerable: true,
56
56
  get: function () {
57
- return _index.runInfo;
57
+ return _runtime.runInfo;
58
58
  }
59
59
  });
60
60
  Object.defineProperty(exports, "runWithContext", {
61
61
  enumerable: true,
62
62
  get: function () {
63
- return _index2.runWithContext;
63
+ return _asyncLocalStorage.runWithContext;
64
64
  }
65
65
  });
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");
66
+ var _runtime = require("./runtime");
67
+ var _asyncLocalStorage = require("./common/asyncLocalStorage");
68
+ var _downloadDirectory = require("./runtime/downloadDirectory");
69
+ var _getPlaywrightConstructs = require("./common/getPlaywrightConstructs");
@@ -1,4 +1,4 @@
1
- import { RunErrorOptions } from "./export.js";
1
+ import { RunErrorOptions } from "./export";
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.js");
6
- var _enums = require("./enums.js");
5
+ var _index = require("./index");
6
+ var _enums = require("./enums");
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.js";
1
+ import { RunEnvironment } from "./enums";
2
2
 
3
3
  /**
4
4
  * ## Description
@@ -1,2 +1,2 @@
1
- import { Payload } from "./export.js";
1
+ import { Payload } from "./export";
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.js");
8
+ var _extendTimeout = require("./extendTimeout");
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.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";
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";
@@ -45,9 +45,9 @@ Object.defineProperty(exports, "runInfo", {
45
45
  return _runInfo.runInfo;
46
46
  }
47
47
  });
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");
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");
@@ -1,2 +1,2 @@
1
- import { RunInfo } from "./export.js";
1
+ import { RunInfo } from "./export";
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.js");
8
+ var _enums = require("./enums");
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.19",
3
+ "version": "0.1.0-test.2",
4
4
  "description": "Intuned runtime",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",
7
- "./runtime": "./dist/runtime/index.js",
7
+ "./dist/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,7 +12,8 @@
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"
15
+ "./dist/common/constants": "./dist/common/constants.js",
16
+ "./dist/commands/interface/run": "./dist/commands/interface/run.js"
16
17
  },
17
18
  "types": "./dist/index.d.ts",
18
19
  "author": "Intuned Team",
@@ -50,7 +51,6 @@
50
51
  "intuned-ts-check": "./bin/intuned-ts-check"
51
52
  },
52
53
  "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,7 +65,6 @@
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",
69
68
  "chalk": "^4.1.2",
70
69
  "commander": "^11.0.0",
71
70
  "cross-fetch": "^4.0.0",
@@ -90,6 +89,7 @@
90
89
  "source-map": "^0.7.4",
91
90
  "stack-utils": "^2.0.6",
92
91
  "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",
package/tsconfig.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "target": "es2021",
4
4
  "module": "esnext",
5
5
  "esModuleInterop": true,
6
- "moduleResolution": "node",
6
+ "moduleResolution": "bundler",
7
7
  "resolveJsonModule": true,
8
8
  "outDir": "./dist",
9
9
  "strict": false,
@@ -1 +0,0 @@
1
- export declare function tsNodeImport(apiFilePath: string): Promise<any>;
@@ -1,16 +0,0 @@
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
- };