@open-mercato/ai-assistant 0.5.1-develop.2681.c559bb2bc3 → 0.5.1-develop.2691.d8a0934b37

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,2 +1,2 @@
1
- Found 90 entry points
2
- ai-assistant built successfully
1
+ [build:ai-assistant] found 90 entry points
2
+ [build:ai-assistant] built successfully
package/build.mjs CHANGED
@@ -1,103 +1,10 @@
1
- import * as esbuild from 'esbuild'
2
- import { glob } from 'glob'
3
- import { readFileSync, writeFileSync, existsSync, mkdirSync, copyFileSync } from 'node:fs'
4
- import { dirname, join, relative } from 'node:path'
1
+ import { dirname } from 'node:path'
5
2
  import { fileURLToPath } from 'node:url'
3
+ import { buildPackage } from '../../scripts/build-package.mjs'
6
4
 
7
- const __dirname = dirname(fileURLToPath(import.meta.url))
5
+ const packageDir = dirname(fileURLToPath(import.meta.url))
8
6
 
9
- const entryPoints = await glob('src/**/*.{ts,tsx}', {
10
- cwd: __dirname,
11
- ignore: ['**/__tests__/**', '**/*.test.ts', '**/*.test.tsx'],
12
- absolute: true,
7
+ await buildPackage(packageDir, {
8
+ name: 'ai-assistant',
9
+ copyJson: true,
13
10
  })
14
-
15
- if (entryPoints.length === 0) {
16
- console.error('No entry points found!')
17
- process.exit(1)
18
- }
19
-
20
- console.log(`Found ${entryPoints.length} entry points`)
21
-
22
- // Plugin to add .js extension to relative imports
23
- const addJsExtension = {
24
- name: 'add-js-extension',
25
- setup(build) {
26
- build.onEnd(async (result) => {
27
- if (result.errors.length > 0) return
28
- const outputFiles = await glob('dist/**/*.js', { cwd: __dirname, absolute: true })
29
- for (const file of outputFiles) {
30
- const fileDir = dirname(file)
31
- let content = readFileSync(file, 'utf-8')
32
- // Add .js to relative imports that don't have an extension
33
- content = content.replace(
34
- /from\s+["'](\.[^"']+)["']/g,
35
- (match, path) => {
36
- if (path.endsWith('.js') || path.endsWith('.json')) return match
37
- // Check if it's a directory with index.js
38
- const resolvedPath = join(fileDir, path)
39
- if (existsSync(resolvedPath) && existsSync(join(resolvedPath, 'index.js'))) {
40
- return `from "${path}/index.js"`
41
- }
42
- return `from "${path}.js"`
43
- }
44
- )
45
- content = content.replace(
46
- /import\s*\(\s*["'](\.[^"']+)["']\s*\)/g,
47
- (match, path) => {
48
- if (path.endsWith('.js') || path.endsWith('.json')) return match
49
- // Check if it's a directory with index.js
50
- const resolvedPath = join(fileDir, path)
51
- if (existsSync(resolvedPath) && existsSync(join(resolvedPath, 'index.js'))) {
52
- return `import("${path}/index.js")`
53
- }
54
- return `import("${path}.js")`
55
- }
56
- )
57
- // Handle side-effect imports: import "./path" (no from clause)
58
- content = content.replace(
59
- /import\s+["'](\.[^"']+)["'];/g,
60
- (match, path) => {
61
- if (path.endsWith('.js') || path.endsWith('.json')) return match
62
- // Check if it's a directory with index.js
63
- const resolvedPath = join(fileDir, path)
64
- if (existsSync(resolvedPath) && existsSync(join(resolvedPath, 'index.js'))) {
65
- return `import "${path}/index.js";`
66
- }
67
- return `import "${path}.js";`
68
- }
69
- )
70
- writeFileSync(file, content)
71
- }
72
- })
73
- }
74
- }
75
-
76
- const outdir = join(__dirname, 'dist')
77
-
78
- await esbuild.build({
79
- entryPoints,
80
- outdir,
81
- outbase: join(__dirname, 'src'),
82
- format: 'esm',
83
- platform: 'node',
84
- target: 'node18',
85
- sourcemap: true,
86
- jsx: 'automatic',
87
- plugins: [addJsExtension],
88
- })
89
-
90
- // Copy JSON files from src to dist
91
- const jsonFiles = await glob('src/**/*.json', {
92
- cwd: __dirname,
93
- ignore: ['**/node_modules/**'],
94
- absolute: true,
95
- })
96
- for (const jsonFile of jsonFiles) {
97
- const relativePath = relative(join(__dirname, 'src'), jsonFile)
98
- const destPath = join(outdir, relativePath)
99
- mkdirSync(dirname(destPath), { recursive: true })
100
- copyFileSync(jsonFile, destPath)
101
- }
102
-
103
- console.log('ai-assistant built successfully')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-mercato/ai-assistant",
3
- "version": "0.5.1-develop.2681.c559bb2bc3",
3
+ "version": "0.5.1-develop.2691.d8a0934b37",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=22.0.0"
@@ -98,12 +98,12 @@
98
98
  "zod-to-json-schema": "^3.25.2"
99
99
  },
100
100
  "peerDependencies": {
101
- "@open-mercato/shared": "0.5.1-develop.2681.c559bb2bc3",
102
- "@open-mercato/ui": "0.5.1-develop.2681.c559bb2bc3",
101
+ "@open-mercato/shared": "0.5.1-develop.2691.d8a0934b37",
102
+ "@open-mercato/ui": "0.5.1-develop.2691.d8a0934b37",
103
103
  "zod": ">=3.23.0"
104
104
  },
105
105
  "devDependencies": {
106
- "@open-mercato/cli": "0.5.1-develop.2681.c559bb2bc3",
106
+ "@open-mercato/cli": "0.5.1-develop.2691.d8a0934b37",
107
107
  "tsx": "^4.21.0"
108
108
  },
109
109
  "publishConfig": {