@motiadev/core 0.13.0-beta.162-632691 → 0.13.0-beta.162-380543

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.
@@ -1,8 +1,17 @@
1
1
  import path from "path";
2
+ import { createRequire } from "module";
2
3
  import { fileURLToPath } from "url";
3
4
 
4
5
  //#region src/language-runner.ts
5
6
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
7
+ const require = createRequire(import.meta.url);
8
+ const getTsxLoaderPath = () => {
9
+ try {
10
+ return require.resolve("tsx");
11
+ } catch {
12
+ return "tsx";
13
+ }
14
+ };
6
15
  const getLanguageBasedRunner = (stepFilePath = "", overrides) => {
7
16
  const isPython = stepFilePath.endsWith(".py");
8
17
  const isRuby = stepFilePath.endsWith(".rb");
@@ -33,7 +42,7 @@ const getLanguageBasedRunner = (stepFilePath = "", overrides) => {
33
42
  return {
34
43
  runner: jsRunner,
35
44
  command: "node",
36
- args: []
45
+ args: ["--import", getTsxLoaderPath()]
37
46
  };
38
47
  }
39
48
  throw Error(`Unsupported file extension ${stepFilePath}`);
@@ -1 +1 @@
1
- {"version":3,"file":"language-runner.mjs","names":[],"sources":["../../src/language-runner.ts"],"sourcesContent":["import path from 'path'\nimport { fileURLToPath } from 'url'\n\nexport type LanguageRunnerConfig = {\n command: string\n runner: string\n args: string[]\n}\n\nexport type LanguageRunnerOverrides = {\n python?: string\n ruby?: string\n node?: {\n js: string\n ts?: string\n }\n}\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url))\nexport const getLanguageBasedRunner = (\n stepFilePath = '',\n overrides?: LanguageRunnerOverrides,\n): LanguageRunnerConfig => {\n const isPython = stepFilePath.endsWith('.py')\n const isRuby = stepFilePath.endsWith('.rb')\n const isNode = stepFilePath.endsWith('.js') || stepFilePath.endsWith('.ts')\n\n if (isPython) {\n const pythonRunner = path.join(__dirname, 'python', overrides?.python ?? 'python-runner.py')\n return { runner: pythonRunner, command: 'python', args: [] }\n } else if (isRuby) {\n const rubyRunner = path.join(__dirname, 'ruby', overrides?.ruby ?? 'ruby-runner.rb')\n return { runner: rubyRunner, command: 'ruby', args: [] }\n } else if (isNode) {\n const defaultNodeOverrides = overrides?.node\n const tsRunner = path.join(__dirname, 'node', defaultNodeOverrides?.ts ?? 'node-runner.ts')\n const jsRunner = path.join(__dirname, 'node', defaultNodeOverrides?.js ?? 'node-runner.mjs')\n\n if (process.env._MOTIA_TEST_MODE === 'true') {\n return {\n runner: tsRunner,\n command: 'node',\n args: ['--loader', 'ts-node/esm', '--no-warnings=ExperimentalWarning'],\n }\n }\n\n return { runner: jsRunner, command: 'node', args: [] }\n }\n\n throw Error(`Unsupported file extension ${stepFilePath}`)\n}\n"],"mappings":";;;;AAkBA,MAAM,YAAY,KAAK,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC;AAC9D,MAAa,0BACX,eAAe,IACf,cACyB;CACzB,MAAM,WAAW,aAAa,SAAS,MAAM;CAC7C,MAAM,SAAS,aAAa,SAAS,MAAM;CAC3C,MAAM,SAAS,aAAa,SAAS,MAAM,IAAI,aAAa,SAAS,MAAM;AAE3E,KAAI,SAEF,QAAO;EAAE,QADY,KAAK,KAAK,WAAW,UAAU,WAAW,UAAU,mBAAmB;EAC7D,SAAS;EAAU,MAAM,EAAE;EAAE;UACnD,OAET,QAAO;EAAE,QADU,KAAK,KAAK,WAAW,QAAQ,WAAW,QAAQ,iBAAiB;EACvD,SAAS;EAAQ,MAAM,EAAE;EAAE;UAC/C,QAAQ;EACjB,MAAM,uBAAuB,WAAW;EACxC,MAAM,WAAW,KAAK,KAAK,WAAW,QAAQ,sBAAsB,MAAM,iBAAiB;EAC3F,MAAM,WAAW,KAAK,KAAK,WAAW,QAAQ,sBAAsB,MAAM,kBAAkB;AAE5F,MAAI,QAAQ,IAAI,qBAAqB,OACnC,QAAO;GACL,QAAQ;GACR,SAAS;GACT,MAAM;IAAC;IAAY;IAAe;IAAoC;GACvE;AAGH,SAAO;GAAE,QAAQ;GAAU,SAAS;GAAQ,MAAM,EAAE;GAAE;;AAGxD,OAAM,MAAM,8BAA8B,eAAe"}
1
+ {"version":3,"file":"language-runner.mjs","names":[],"sources":["../../src/language-runner.ts"],"sourcesContent":["import { createRequire } from 'module'\nimport path from 'path'\nimport { fileURLToPath } from 'url'\n\nexport type LanguageRunnerConfig = {\n command: string\n runner: string\n args: string[]\n}\n\nexport type LanguageRunnerOverrides = {\n python?: string\n ruby?: string\n node?: {\n js: string\n ts?: string\n }\n}\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url))\nconst require = createRequire(import.meta.url)\n\n// Resolve tsx loader path from this package's node_modules\nconst getTsxLoaderPath = () => {\n try {\n return require.resolve('tsx')\n } catch {\n return 'tsx'\n }\n}\n\nexport const getLanguageBasedRunner = (\n stepFilePath = '',\n overrides?: LanguageRunnerOverrides,\n): LanguageRunnerConfig => {\n const isPython = stepFilePath.endsWith('.py')\n const isRuby = stepFilePath.endsWith('.rb')\n const isNode = stepFilePath.endsWith('.js') || stepFilePath.endsWith('.ts')\n\n if (isPython) {\n const pythonRunner = path.join(__dirname, 'python', overrides?.python ?? 'python-runner.py')\n return { runner: pythonRunner, command: 'python', args: [] }\n } else if (isRuby) {\n const rubyRunner = path.join(__dirname, 'ruby', overrides?.ruby ?? 'ruby-runner.rb')\n return { runner: rubyRunner, command: 'ruby', args: [] }\n } else if (isNode) {\n const defaultNodeOverrides = overrides?.node\n const tsRunner = path.join(__dirname, 'node', defaultNodeOverrides?.ts ?? 'node-runner.ts')\n const jsRunner = path.join(__dirname, 'node', defaultNodeOverrides?.js ?? 'node-runner.mjs')\n\n if (process.env._MOTIA_TEST_MODE === 'true') {\n return {\n runner: tsRunner,\n command: 'node',\n args: ['--loader', 'ts-node/esm', '--no-warnings=ExperimentalWarning'],\n }\n }\n\n const tsxPath = getTsxLoaderPath()\n return { runner: jsRunner, command: 'node', args: ['--import', tsxPath] }\n }\n\n throw Error(`Unsupported file extension ${stepFilePath}`)\n}\n"],"mappings":";;;;;AAmBA,MAAM,YAAY,KAAK,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC;AAC9D,MAAM,UAAU,cAAc,OAAO,KAAK,IAAI;AAG9C,MAAM,yBAAyB;AAC7B,KAAI;AACF,SAAO,QAAQ,QAAQ,MAAM;SACvB;AACN,SAAO;;;AAIX,MAAa,0BACX,eAAe,IACf,cACyB;CACzB,MAAM,WAAW,aAAa,SAAS,MAAM;CAC7C,MAAM,SAAS,aAAa,SAAS,MAAM;CAC3C,MAAM,SAAS,aAAa,SAAS,MAAM,IAAI,aAAa,SAAS,MAAM;AAE3E,KAAI,SAEF,QAAO;EAAE,QADY,KAAK,KAAK,WAAW,UAAU,WAAW,UAAU,mBAAmB;EAC7D,SAAS;EAAU,MAAM,EAAE;EAAE;UACnD,OAET,QAAO;EAAE,QADU,KAAK,KAAK,WAAW,QAAQ,WAAW,QAAQ,iBAAiB;EACvD,SAAS;EAAQ,MAAM,EAAE;EAAE;UAC/C,QAAQ;EACjB,MAAM,uBAAuB,WAAW;EACxC,MAAM,WAAW,KAAK,KAAK,WAAW,QAAQ,sBAAsB,MAAM,iBAAiB;EAC3F,MAAM,WAAW,KAAK,KAAK,WAAW,QAAQ,sBAAsB,MAAM,kBAAkB;AAE5F,MAAI,QAAQ,IAAI,qBAAqB,OACnC,QAAO;GACL,QAAQ;GACR,SAAS;GACT,MAAM;IAAC;IAAY;IAAe;IAAoC;GACvE;AAIH,SAAO;GAAE,QAAQ;GAAU,SAAS;GAAQ,MAAM,CAAC,YADnC,kBAAkB,CACqC;GAAE;;AAG3E,OAAM,MAAM,8BAA8B,eAAe"}
@@ -4,7 +4,7 @@ import { fileURLToPath } from "url";
4
4
 
5
5
  //#region src/steps/index.ts
6
6
  const systemSteps = [{
7
- filePath: path.join(path.dirname(fileURLToPath(import.meta.url)), "emit.step.js"),
7
+ filePath: path.join(path.dirname(fileURLToPath(import.meta.url)), "emit.step.mjs"),
8
8
  version: "1",
9
9
  config
10
10
  }];
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["systemSteps: Step[]","emitConfig"],"sources":["../../../src/steps/index.ts"],"sourcesContent":["import path from 'path'\nimport { fileURLToPath } from 'url'\nimport type { Step } from '../types'\nimport { config as emitConfig } from './emit.step'\n\nexport const systemSteps: Step[] = [\n {\n // NOTE: this is the path of the file inside the dist folder\n filePath: path.join(path.dirname(fileURLToPath(import.meta.url)), 'emit.step.js'),\n version: '1',\n config: emitConfig,\n },\n]\n"],"mappings":";;;;;AAKA,MAAaA,cAAsB,CACjC;CAEE,UAAU,KAAK,KAAK,KAAK,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC,EAAE,eAAe;CACjF,SAAS;CACDC;CACT,CACF"}
1
+ {"version":3,"file":"index.mjs","names":["systemSteps: Step[]","emitConfig"],"sources":["../../../src/steps/index.ts"],"sourcesContent":["import path from 'path'\nimport { fileURLToPath } from 'url'\nimport type { Step } from '../types'\nimport { config as emitConfig } from './emit.step'\n\nexport const systemSteps: Step[] = [\n {\n // NOTE: this is the path of the file inside the dist folder (dist/src/steps/)\n filePath: path.join(path.dirname(fileURLToPath(import.meta.url)), 'emit.step.mjs'),\n version: '1',\n config: emitConfig,\n },\n]\n"],"mappings":";;;;;AAKA,MAAaA,cAAsB,CACjC;CAEE,UAAU,KAAK,KAAK,KAAK,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC,EAAE,gBAAgB;CAClF,SAAS;CACDC;CACT,CACF"}
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "import": "./dist/index.mjs"
12
12
  }
13
13
  },
14
- "version": "0.13.0-beta.162-632691",
14
+ "version": "0.13.0-beta.162-380543",
15
15
  "dependencies": {
16
16
  "@amplitude/analytics-node": "^1.5.26",
17
17
  "@standard-schema/spec": "^1.0.0",
@@ -19,7 +19,9 @@
19
19
  "body-parser": "^1.20.3",
20
20
  "colors": "^1.4.0",
21
21
  "dotenv": "^16.4.7",
22
+ "esbuild": "^0.24.0",
22
23
  "express": "^4.21.2",
24
+ "tsx": "^4.19.0",
23
25
  "node-cron": "^3.0.3",
24
26
  "ts-node": "^10.9.2",
25
27
  "tsconfig-paths": "^4.2.0",
package/tsdown.config.ts CHANGED
@@ -16,7 +16,9 @@ export default defineConfig({
16
16
  'body-parser',
17
17
  'colors',
18
18
  'dotenv',
19
+ 'esbuild',
19
20
  'express',
21
+ 'tsx',
20
22
  'node-cron',
21
23
  'ts-node',
22
24
  'tsconfig-paths',