@output.ai/core 0.5.8 → 0.5.10

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.5.8",
3
+ "version": "0.5.10",
4
4
  "description": "The core module of the output framework",
5
5
  "type": "module",
6
6
  "exports": {
@@ -122,11 +122,11 @@ export const staticMatchers = {
122
122
  * @param {string} path - Path to test
123
123
  * @returns {boolean}
124
124
  */
125
- sharedStepsDir: v => v.includes( `${sep}shared${sep}steps${sep}` ),
125
+ sharedStepsDir: v => v.includes( `${sep}shared${sep}steps${sep}` ) && v.endsWith( '.js' ),
126
126
  /**
127
127
  * Matches the shared folder for evaluators src/shared/evaluators/../evaluator_file.js
128
128
  * @param {string} path - Path to test
129
129
  * @returns {boolean}
130
130
  */
131
- sharedEvaluatorsDir: v => v.includes( `${sep}shared${sep}evaluators${sep}` )
131
+ sharedEvaluatorsDir: v => v.includes( `${sep}shared${sep}evaluators${sep}` ) && v.endsWith( '.js' )
132
132
  };
@@ -1,7 +1,7 @@
1
1
  import { describe, it, expect, afterEach } from 'vitest';
2
2
  import { mkdirSync, writeFileSync, rmSync } from 'node:fs';
3
3
  import { join, sep } from 'node:path';
4
- import { importComponents } from './loader_tools.js';
4
+ import { importComponents, staticMatchers } from './loader_tools.js';
5
5
 
6
6
  describe( '.importComponents', () => {
7
7
  const TEMP_BASE = join( process.cwd(), 'sdk/core/temp_test_modules' );
@@ -116,3 +116,41 @@ describe( '.importComponents', () => {
116
116
  rmSync( root, { recursive: true, force: true } );
117
117
  } );
118
118
  } );
119
+
120
+ describe( '.staticMatchers', () => {
121
+ describe( '.sharedStepsDir', () => {
122
+ it( 'matches .js files inside shared/steps/', () => {
123
+ expect( staticMatchers.sharedStepsDir( `${sep}app${sep}dist${sep}shared${sep}steps${sep}tools.js` ) ).toBe( true );
124
+ } );
125
+
126
+ it( 'matches .js files in nested subdirectories of shared/steps/', () => {
127
+ expect( staticMatchers.sharedStepsDir( `${sep}app${sep}dist${sep}shared${sep}steps${sep}utils${sep}helper.js` ) ).toBe( true );
128
+ } );
129
+
130
+ it( 'rejects .ts files inside shared/steps/', () => {
131
+ expect( staticMatchers.sharedStepsDir( `${sep}app${sep}src${sep}shared${sep}steps${sep}tools.ts` ) ).toBe( false );
132
+ } );
133
+
134
+ it( 'rejects non-.js files inside shared/steps/', () => {
135
+ expect( staticMatchers.sharedStepsDir( `${sep}app${sep}dist${sep}shared${sep}steps${sep}readme.md` ) ).toBe( false );
136
+ } );
137
+ } );
138
+
139
+ describe( '.sharedEvaluatorsDir', () => {
140
+ it( 'matches .js files inside shared/evaluators/', () => {
141
+ expect( staticMatchers.sharedEvaluatorsDir( `${sep}app${sep}dist${sep}shared${sep}evaluators${sep}quality.js` ) ).toBe( true );
142
+ } );
143
+
144
+ it( 'matches .js files in nested subdirectories of shared/evaluators/', () => {
145
+ expect( staticMatchers.sharedEvaluatorsDir( `${sep}app${sep}dist${sep}shared${sep}evaluators${sep}utils${sep}helper.js` ) ).toBe( true );
146
+ } );
147
+
148
+ it( 'rejects .ts files inside shared/evaluators/', () => {
149
+ expect( staticMatchers.sharedEvaluatorsDir( `${sep}app${sep}src${sep}shared${sep}evaluators${sep}quality.ts` ) ).toBe( false );
150
+ } );
151
+
152
+ it( 'rejects non-.js files inside shared/evaluators/', () => {
153
+ expect( staticMatchers.sharedEvaluatorsDir( `${sep}app${sep}dist${sep}shared${sep}evaluators${sep}readme.md` ) ).toBe( false );
154
+ } );
155
+ } );
156
+ } );
@@ -7,8 +7,3 @@ export const ComponentFile = {
7
7
  STEPS: 'steps',
8
8
  WORKFLOW: 'workflow'
9
9
  };
10
-
11
- export const CoreModule = {
12
- LOCAL: 'local_core',
13
- NPM: '@output.ai/core'
14
- };
@@ -43,11 +43,10 @@ describe( 'workflow_validator loader', () => {
43
43
  rmSync( dir, { recursive: true, force: true } );
44
44
  } );
45
45
 
46
- it( 'workflow.js: allows imports from @output.ai/core and local_core', async () => {
46
+ it( 'workflow.js: allows imports from @output.ai/core', async () => {
47
47
  const dir = mkdtempSync( join( tmpdir(), 'wf-allow-external-' ) );
48
48
  const src = [
49
49
  'import a from "@output.ai/core";',
50
- 'import b from "local_core";',
51
50
  'const z = 1;'
52
51
  ].join( '\n' );
53
52
  await expect( runLoader( join( dir, 'workflow.js' ), src ) ).resolves.toBeTruthy();