@open-mercato/ai-assistant 0.10.1-develop.7847.1.7d83dc5794 → 0.10.1-develop.7857.1.259928eb85
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/jest.config.cjs +1 -1
- package/package.json +10 -7
- package/src/__tests__/package-exports.test.ts +40 -0
package/jest.config.cjs
CHANGED
|
@@ -32,7 +32,7 @@ module.exports = {
|
|
|
32
32
|
],
|
|
33
33
|
},
|
|
34
34
|
transformIgnorePatterns: [
|
|
35
|
-
'node_modules/(?!(
|
|
35
|
+
'node_modules/(?!(sanitize-html|htmlparser2|domhandler|domutils|dom-serializer|domelementtype|entities|@mikro-orm|kysely|ai|@ai-sdk|ai-sdk-ollama|@workflow|@standard-schema|@tanstack/react-table|@tanstack/table-core|@tanstack/react-store|@tanstack/store)/)',
|
|
36
36
|
],
|
|
37
37
|
testMatch: ['<rootDir>/src/**/__tests__/**/*.test.(ts|tsx)'],
|
|
38
38
|
passWithNoTests: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-mercato/ai-assistant",
|
|
3
|
-
"version": "0.10.1-develop.
|
|
3
|
+
"version": "0.10.1-develop.7857.1.259928eb85",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -15,7 +15,10 @@
|
|
|
15
15
|
"test": "jest --config jest.config.cjs --forceExit"
|
|
16
16
|
},
|
|
17
17
|
"exports": {
|
|
18
|
-
".":
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./src/index.ts",
|
|
20
|
+
"default": "./dist/index.js"
|
|
21
|
+
},
|
|
19
22
|
"./modules/ai_assistant": {
|
|
20
23
|
"types": "./src/modules/ai_assistant/index.ts",
|
|
21
24
|
"default": "./dist/modules/ai_assistant/index.js"
|
|
@@ -100,16 +103,16 @@
|
|
|
100
103
|
"zod-to-json-schema": "^3.25.2"
|
|
101
104
|
},
|
|
102
105
|
"peerDependencies": {
|
|
103
|
-
"@open-mercato/shared": "0.10.1-develop.
|
|
104
|
-
"@open-mercato/ui": "0.10.1-develop.
|
|
106
|
+
"@open-mercato/shared": "0.10.1-develop.7857.1.259928eb85",
|
|
107
|
+
"@open-mercato/ui": "0.10.1-develop.7857.1.259928eb85",
|
|
105
108
|
"react": "^19.0.0",
|
|
106
109
|
"react-dom": "^19.0.0",
|
|
107
110
|
"zod": ">=3.23.0"
|
|
108
111
|
},
|
|
109
112
|
"devDependencies": {
|
|
110
|
-
"@open-mercato/cli": "0.10.1-develop.
|
|
111
|
-
"@open-mercato/shared": "0.10.1-develop.
|
|
112
|
-
"@open-mercato/ui": "0.10.1-develop.
|
|
113
|
+
"@open-mercato/cli": "0.10.1-develop.7857.1.259928eb85",
|
|
114
|
+
"@open-mercato/shared": "0.10.1-develop.7857.1.259928eb85",
|
|
115
|
+
"@open-mercato/ui": "0.10.1-develop.7857.1.259928eb85",
|
|
113
116
|
"@types/react": "^19.2.18",
|
|
114
117
|
"@types/react-dom": "^19.2.5",
|
|
115
118
|
"react": "19.2.8",
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { execFileSync } from 'node:child_process'
|
|
2
|
+
import { existsSync, mkdtempSync, mkdirSync, readFileSync, realpathSync, rmSync, writeFileSync } from 'node:fs'
|
|
3
|
+
import { tmpdir } from 'node:os'
|
|
4
|
+
import path from 'node:path'
|
|
5
|
+
import ts from 'typescript'
|
|
6
|
+
|
|
7
|
+
const packageDir = path.resolve(__dirname, '../..')
|
|
8
|
+
|
|
9
|
+
describe('published ai-assistant root export', () => {
|
|
10
|
+
it.each([
|
|
11
|
+
['bundler', ts.ModuleResolutionKind.Bundler, ts.ModuleKind.ESNext],
|
|
12
|
+
['NodeNext', ts.ModuleResolutionKind.NodeNext, ts.ModuleKind.NodeNext],
|
|
13
|
+
])('resolves root types outside workspace aliases with %s', (_name, moduleResolution, module) => {
|
|
14
|
+
const consumerDir = realpathSync(mkdtempSync(path.join(tmpdir(), 'ai-assistant-consumer-')))
|
|
15
|
+
try {
|
|
16
|
+
const installedDir = path.join(consumerDir, 'node_modules/@open-mercato/ai-assistant')
|
|
17
|
+
mkdirSync(installedDir, { recursive: true })
|
|
18
|
+
const packResult = JSON.parse(execFileSync('npm', [
|
|
19
|
+
'pack', '--ignore-scripts', '--json', '--pack-destination', consumerDir,
|
|
20
|
+
], { cwd: packageDir, encoding: 'utf8', timeout: 20000 })) as Array<{ filename: string }>
|
|
21
|
+
execFileSync('tar', ['-xzf', path.join(consumerDir, packResult[0].filename),
|
|
22
|
+
'--strip-components=1', '-C', installedDir], { timeout: 10000 })
|
|
23
|
+
writeFileSync(path.join(consumerDir, 'package.json'), JSON.stringify({ type: 'module' }))
|
|
24
|
+
const consumerFile = path.join(consumerDir, 'index.ts')
|
|
25
|
+
writeFileSync(consumerFile, "export const loadAssistant = () => import('@open-mercato/ai-assistant')\n")
|
|
26
|
+
const resolved = ts.resolveModuleName('@open-mercato/ai-assistant', consumerFile, {
|
|
27
|
+
moduleResolution, module, strict: true,
|
|
28
|
+
}, ts.sys).resolvedModule
|
|
29
|
+
|
|
30
|
+
expect(resolved?.resolvedFileName).toBe(path.join(installedDir, 'src/index.ts'))
|
|
31
|
+
expect(resolved?.isExternalLibraryImport).toBe(true)
|
|
32
|
+
expect(existsSync(resolved?.resolvedFileName ?? '')).toBe(true)
|
|
33
|
+
const manifest = JSON.parse(readFileSync(path.join(installedDir, 'package.json'), 'utf8'))
|
|
34
|
+
expect(manifest.exports['.'].default).toBe('./dist/index.js')
|
|
35
|
+
expect(manifest.main).toBe('./dist/index.js')
|
|
36
|
+
} finally {
|
|
37
|
+
rmSync(consumerDir, { recursive: true, force: true })
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
})
|