@output.ai/core 0.1.3 → 0.1.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@output.ai/core",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "The core module of the output framework",
5
5
  "type": "module",
6
6
  "exports": {
@@ -3,21 +3,26 @@ import * as stackTraceParser from 'stacktrace-parser';
3
3
  // OS separator, but in a deterministic way, allowing this to work in Temporal's sandbox
4
4
  // This avoids importing from node:path
5
5
  const SEP = new Error().stack.includes( '/' ) ? '/' : '\\';
6
- const ignorePaths = [
7
- `${SEP}node_modules${SEP}`,
8
- `${SEP}app${SEP}sdk${SEP}`,
9
- `node:internal${SEP}`,
6
+
7
+ const transformSeparators = path => path.replaceAll( '/', SEP );
8
+ const defaultIgnorePaths = [
9
+ '/@output.ai/core/',
10
+ '/@output.ai/llm/',
11
+ '/sdk/core/',
12
+ '/sdk/llm/',
13
+ 'node:internal/',
10
14
  'evalmachine.',
11
- `webpack${SEP}bootstrap`
15
+ 'webpack/bootstrap'
12
16
  ];
13
17
 
14
18
  /**
15
19
  * Return the directory of the file invoking the code that called this function
16
20
  * Excludes some internal paths and the sdk itself
17
21
  */
18
- export default () => {
22
+ export default ( additionalIgnorePaths = [] ) => {
19
23
  const stack = new Error().stack;
20
24
  const lines = stackTraceParser.parse( stack );
25
+ const ignorePaths = [ ...additionalIgnorePaths, ...defaultIgnorePaths ].map( transformSeparators );
21
26
 
22
27
  const frame = lines.find( l => !ignorePaths.some( p => l.file.includes( p ) ) );
23
28
  if ( !frame ) {
@@ -1,9 +1,13 @@
1
- import { describe, it, expect } from 'vitest';
1
+ import { describe, it, expect, afterEach } from 'vitest';
2
2
  import { mkdirSync, writeFileSync, rmSync } from 'node:fs';
3
3
  import { join } from 'node:path';
4
4
  import { importComponents } from './loader_tools.js';
5
5
 
6
6
  describe( '.importComponents', () => {
7
+ const TEMP_BASE = join( process.cwd(), 'sdk/core/temp_test_modules' );
8
+ afterEach( () => {
9
+ rmSync( TEMP_BASE, { recursive: true, force: true } );
10
+ } );
7
11
  it( 'imports modules and yields metadata from exports tagged with METADATA_ACCESS_SYMBOL', async () => {
8
12
  const root = join( process.cwd(), 'sdk/core/temp_test_modules', `meta-${Date.now()}` );
9
13
  mkdirSync( root, { recursive: true } );