@primero-ai/temporal-graph-tools 1.1.4 → 1.1.6

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,6 +1,6 @@
1
1
  import { isAbsolute, resolve, join } from 'node:path';
2
2
  import { mkdtemp, writeFile } from 'node:fs/promises';
3
- import { pathToFileURL } from 'node:url';
3
+ import { createRequire } from 'node:module';
4
4
  import { buildWorkflowBundleCode } from './workflow-bundler.js';
5
5
  import { collectWorkflowBuildResults } from './workflow/collection.js';
6
6
  let cachedEsbuild;
@@ -30,10 +30,10 @@ export async function loadActivitiesFromBundle(bundle) {
30
30
  }
31
31
  const source = ensureActivityInlineSourceMap(bundle.code, bundle.map);
32
32
  const tempDir = await mkdtemp(join(process.cwd(), '.temporal-graph-tools-'));
33
- const tempFile = join(tempDir, `activities-${Date.now()}-${Math.random().toString(16).slice(2)}.mjs`);
33
+ const tempFile = join(tempDir, `activities-${Date.now()}-${Math.random().toString(16).slice(2)}.cjs`);
34
34
  await writeFile(tempFile, source, 'utf8');
35
- const moduleUrl = pathToFileURL(tempFile).href;
36
- const moduleNamespace = (await import(moduleUrl));
35
+ const require = createRequire(import.meta.url);
36
+ const moduleNamespace = require(tempFile);
37
37
  const activitiesExport = moduleNamespace.activities;
38
38
  if (isActivityImplementations(activitiesExport)) {
39
39
  return activitiesExport;
@@ -97,7 +97,7 @@ async function bundleActivitiesWithEsbuild(bundles, options = {}) {
97
97
  if (entrypoints.length === 0) {
98
98
  throw new Error('bundleActivities requires at least one entrypoint.');
99
99
  }
100
- const filename = ((_b = options.filename) !== null && _b !== void 0 ? _b : 'activities.bundle.mjs').trim();
100
+ const filename = ((_b = options.filename) !== null && _b !== void 0 ? _b : 'activities.bundle.cjs').trim();
101
101
  const externals = new Set(['@primero-ai/temporal-graph-tools', '@swc/*']);
102
102
  ((_c = options.externals) !== null && _c !== void 0 ? _c : []).forEach((name) => {
103
103
  if (typeof name === 'string' && name.trim().length > 0) {
@@ -115,7 +115,7 @@ async function bundleActivitiesWithEsbuild(bundles, options = {}) {
115
115
  },
116
116
  bundle: true,
117
117
  platform: 'node',
118
- format: 'esm',
118
+ format: 'cjs',
119
119
  target: ['node18'],
120
120
  absWorkingDir: process.cwd(),
121
121
  outfile: filename,
@@ -123,8 +123,10 @@ async function bundleActivitiesWithEsbuild(bundles, options = {}) {
123
123
  sourcemap: 'inline',
124
124
  external: Array.from(externals),
125
125
  });
126
- const jsFile = (_d = buildResult.outputFiles) === null || _d === void 0 ? void 0 : _d.find((file) => file.path.endsWith('.js') || file.path.endsWith('.mjs'));
127
- const mapFile = (_e = buildResult.outputFiles) === null || _e === void 0 ? void 0 : _e.find((file) => file.path.endsWith('.js.map') || file.path.endsWith('.mjs.map'));
126
+ const jsFile = (_d = buildResult.outputFiles) === null || _d === void 0 ? void 0 : _d.find((file) => file.path.endsWith('.js') || file.path.endsWith('.mjs') || file.path.endsWith('.cjs'));
127
+ const mapFile = (_e = buildResult.outputFiles) === null || _e === void 0 ? void 0 : _e.find((file) => file.path.endsWith('.js.map') ||
128
+ file.path.endsWith('.mjs.map') ||
129
+ file.path.endsWith('.cjs.map'));
128
130
  if (!jsFile) {
129
131
  throw new Error('Failed to generate activities bundle.');
130
132
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primero-ai/temporal-graph-tools",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "description": "Utilities for working with DAG workflows.",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/primero-ai/temporal-graph-tools#readme",