@open-mercato/search 0.5.1-develop.2683.4878a05b8e → 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.
- package/.turbo/turbo-build.log +2 -2
- package/build.mjs +6 -99
- package/package.json +4 -4
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
search built successfully
|
|
1
|
+
[build:search] found 80 entry points
|
|
2
|
+
[build:search] built successfully
|
package/build.mjs
CHANGED
|
@@ -1,103 +1,10 @@
|
|
|
1
|
-
import
|
|
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
|
|
5
|
+
const packageDir = dirname(fileURLToPath(import.meta.url))
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
absolute: true,
|
|
7
|
+
await buildPackage(packageDir, {
|
|
8
|
+
name: 'search',
|
|
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 (esbuild doesn't handle non-entry JSON files)
|
|
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('search built successfully')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-mercato/search",
|
|
3
|
-
"version": "0.5.1-develop.
|
|
3
|
+
"version": "0.5.1-develop.2691.d8a0934b37",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -126,9 +126,9 @@
|
|
|
126
126
|
"zod": "^4.3.6"
|
|
127
127
|
},
|
|
128
128
|
"peerDependencies": {
|
|
129
|
-
"@open-mercato/core": "0.5.1-develop.
|
|
130
|
-
"@open-mercato/queue": "0.5.1-develop.
|
|
131
|
-
"@open-mercato/shared": "0.5.1-develop.
|
|
129
|
+
"@open-mercato/core": "0.5.1-develop.2691.d8a0934b37",
|
|
130
|
+
"@open-mercato/queue": "0.5.1-develop.2691.d8a0934b37",
|
|
131
|
+
"@open-mercato/shared": "0.5.1-develop.2691.d8a0934b37"
|
|
132
132
|
},
|
|
133
133
|
"devDependencies": {
|
|
134
134
|
"@types/jest": "^30.0.0",
|