Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix project build issues #796

Merged
merged 2 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18
20
6 changes: 0 additions & 6 deletions .swcrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
[
{
"test": ".*\\.ts$",
"env": {
"targets": "node >= 16"
},
"jsc": {
"target": "es2022",
"parser": {
Expand All @@ -24,9 +21,6 @@
"type": "commonjs",
"ignoreDynamic": true
},
"env": {
"targets": "node >= 16"
},
"jsc": {
"target": "es2022",
"parser": {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,6 @@
},
"engines": {
"node": ">= 16.0.0"
}
},
"packageManager": "pnpm@8.15.4+sha512.0bd3a9be9eb0e9a692676deec00a303ba218ba279d99241475616b398dbaeedd11146f92c2843458f557b1d127e09d4c171e105bdcd6b61002b39685a8016b9e"
}
8 changes: 2 additions & 6 deletions packages/orama/.swcrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
[
{
"test": ".*\\.ts$",
"env": {
"targets": "node >= 16"
},

"jsc": {
"target": "es2022",
"parser": {
Expand All @@ -24,9 +22,7 @@
"type": "commonjs",
"ignoreDynamic": true
},
"env": {
"targets": "node >= 16"
},

"jsc": {
"target": "es2022",
"parser": {
Expand Down
2 changes: 1 addition & 1 deletion packages/orama/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"allowJs": true,
"target": "ESNext",
"module": "ESNext",
"module": "NodeNext",
"outDir": "dist",
"lib": ["ESNext", "DOM"],
"esModuleInterop": true,
Expand Down
3 changes: 1 addition & 2 deletions packages/plugin-analytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"files": ["dist"],
"scripts": {
"build": "tsup --config tsup.lib.js",
"lint": "ts-standard --fix src",
"lint": "eslint src --ext .js,.ts,.tsx,.cts",
"test": "c8 -c src/tests/config/c8-local.json tap src/tests/*.test.ts"
},
"dependencies": {
Expand All @@ -44,7 +44,6 @@
"tap": "^18.7.1",
"tap-mocha-reporter": "^5.0.3",
"tape": "^5.6.1",
"ts-standard": "^12.0.2",
"tsup": "^7.2.0",
"tsx": "4",
"typescript": "^5.0.0"
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-analytics/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"compilerOptions": {
"allowJs": true,
"target": "ESNext",
"module": "ESNext",
"module": "NodeNext",
"outDir": "dist",
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"moduleResolution": "Node",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"declaration": true,
"forceConsistentCasingInFileNames": true,
Expand Down
3 changes: 0 additions & 3 deletions packages/plugin-astro/.swcrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
[
{
"test": ".*\\.ts$",
"env": {
"targets": "node >= 16"
},
"jsc": {
"target": "es2022",
"parser": {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"build": "swc --delete-dir-on-start --extensions .ts -d dist src",
"postbuild": "tsc -p . --emitDeclarationOnly",
"pretest": "node ../../scripts/test-pack.mjs plugin-astro",
"test": "node --loader=tsx --no-warnings=loader --test ./test/integration.ts | tap-mocha-reporter spec",
"test": "node --import=tsx --no-warnings=loader --test ./test/integration.ts | tap-mocha-reporter spec",
"lint": "eslint src --ext .js,.ts,.tsx,.cts"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-astro/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { AnyOrama, Orama, SearchParams } from '@orama/orama'
import { create as createOramaDB, insert as insertIntoOramaDB, save as saveOramaDB } from '@orama/orama'
import type { AstroConfig, AstroIntegration, RouteData } from 'astro'
import type { AstroIntegration, RouteData } from 'astro'
import { compile } from 'html-to-text'
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'
import path from 'node:path'
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-astro/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"allowJs": true,
"target": "ESNext",
"module": "ESNext",
"module": "NodeNext",
"outDir": "dist",
"lib": ["ESNext", "DOM"],
"esModuleInterop": true,
Expand All @@ -12,7 +12,7 @@
"skipLibCheck": true,
"resolveJsonModule": true,
"sourceMap": true,
"moduleResolution": "node"
"moduleResolution": "NodeNext"
},
"include": ["src/*.ts", "src/**/*.ts"]
}
6 changes: 0 additions & 6 deletions packages/plugin-data-persistence/.swcrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
[
{
"test": ".*\\.ts$",
"env": {
"targets": "node >= 16"
},
"jsc": {
"target": "es2022",
"parser": {
Expand All @@ -24,9 +21,6 @@
"type": "commonjs",
"ignoreDynamic": true
},
"env": {
"targets": "node >= 16"
},
"jsc": {
"target": "es2022",
"parser": {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-data-persistence/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"allowJs": true,
"target": "ESNext",
"module": "ESNext",
"module": "NodeNext",
"outDir": "dist",
"lib": ["ESNext", "DOM"],
"esModuleInterop": true,
Expand Down
1 change: 1 addition & 0 deletions packages/plugin-docusaurus-v3/scripts/postbuild.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash

mkdir -p dist/theme/SearchBar
cp src/theme/SearchBar/*.css dist/theme/SearchBar
9 changes: 0 additions & 9 deletions packages/plugin-docusaurus/.swcrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
[
{
"test": ".*\\.ts$",
"env": {
"targets": "node >= 16"
},
"jsc": {
"target": "es2022",
"parser": {
Expand All @@ -20,9 +17,6 @@
},
{
"test": ".*\\.tsx$",
"env": {
"targets": "node >= 16"
},
"jsc": {
"target": "es2022",
"parser": {
Expand All @@ -48,9 +42,6 @@
"type": "commonjs",
"ignoreDynamic": true
},
"env": {
"targets": "node >= 16"
},
"jsc": {
"target": "es2022",
"parser": {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-docusaurus/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"allowJs": true,
"target": "ESNext",
"module": "ESNext",
"module": "NodeNext",
"outDir": "dist",
"lib": ["ESNext", "DOM"],
"jsx": "react-jsx",
Expand Down
6 changes: 0 additions & 6 deletions packages/plugin-match-highlight/.swcrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
[
{
"test": ".*\\.ts$",
"env": {
"targets": "node >= 16"
},
"jsc": {
"target": "es2022",
"parser": {
Expand All @@ -24,9 +21,6 @@
"type": "commonjs",
"ignoreDynamic": true
},
"env": {
"targets": "node >= 16"
},
"jsc": {
"target": "es2022",
"parser": {
Expand Down
2 changes: 0 additions & 2 deletions packages/plugin-match-highlight/src/commonjs.cts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-expect-error Ignore broken resolution - This errors when using tsconfig.cjs.json
import type { AnyOrama } from '@orama/orama'

import type {
Expand All @@ -7,7 +6,6 @@ import type {
searchWithHighlight as esmSearchWithHighlight,
saveWithHighlight as esmSaveWithHighlight,
loadWithHighlight as esmLoadWithHighlight
// @ts-expect-error Ignore broken resolution - This errors when using tsconfig.cjs.json
} from './index.js'

export interface OramaPluginMatchHighlight {
Expand Down
1 change: 1 addition & 0 deletions packages/plugin-match-highlight/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
save,
search
} from '@orama/orama'
// @ts-ignore
import { boundedLevenshtein } from '@orama/orama/internals'

export interface Position {
Expand Down
3 changes: 2 additions & 1 deletion packages/plugin-match-highlight/tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "CommonJS"
"module": "CommonJS",
"moduleResolution": "node"
},
"include": ["src/*.cts"]
}
2 changes: 1 addition & 1 deletion packages/plugin-match-highlight/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"allowJs": true,
"target": "ESNext",
"module": "ESNext",
"module": "NodeNext",
"moduleResolution": "nodenext",
"outDir": "dist",
"lib": ["ESNext", "DOM"],
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-nextra/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"allowJs": true,
"target": "ES5",
"module": "ESNext",
"module": "NodeNext",
"outDir": "dist",
"jsx": "react",
"noImplicitAny": false,
Expand Down
6 changes: 0 additions & 6 deletions packages/plugin-parsedoc/.swcrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
[
{
"test": ".*\\.ts$",
"env": {
"targets": "node >= 16"
},
"jsc": {
"target": "es2022",
"parser": {
Expand All @@ -24,9 +21,6 @@
"type": "commonjs",
"ignoreDynamic": true
},
"env": {
"targets": "node >= 16"
},
"jsc": {
"target": "es2022",
"parser": {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-parsedoc/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"allowJs": true,
"target": "ESNext",
"module": "ESNext",
"module": "NodeNext",
"outDir": "dist",
"lib": ["ESNext", "DOM"],
"esModuleInterop": true,
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-vitepress/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ export function OramaPlugin(pluginOptions: OramaPluginOptions = {}): Plugin {
}

const pluginSiteConfig: Partial<SiteConfig> = {
buildEnd(ctx) {},
transformHead(ctx) {
buildEnd() {},
transformHead() {
return []
}
}
3 changes: 1 addition & 2 deletions packages/stemmers/scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,10 @@ async function compile(lang, fullLang, jsExtension, tsExtension, moduleType) {
const language = `\nexport const language = '${fullLang}'`
const compiled = await transform(content + language, {
module: { type: moduleType },
env: { targets: 'node >= 16' },
jsc: { target: 'es2022' }
})

const minified = await minify(compiled.code, { sourceMap: true })
const minified = await minify(compiled.code, { sourceMap: true, module: moduleType !== "commonjs" })

await writeFile(resolve(destinationDir, `${lang}.${jsExtension}`), minified.code, 'utf-8')
await writeFile(resolve(destinationDir, `${lang}.${jsExtension}.map`), minified.map, 'utf-8')
Expand Down
3 changes: 1 addition & 2 deletions packages/stopwords/scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,10 @@ async function compile(lang, jsExtension, tsExtension, moduleType) {

const compiled = await transform(content, {
module: { type: moduleType },
env: { targets: 'node >= 16' },
jsc: { target: 'es2022' }
})

const minified = await minify(compiled.code, { sourceMap: true })
const minified = await minify(compiled.code, { sourceMap: true, module: moduleType !== "commonjs" })

await writeFile(resolve(destinationDir, `${lang}.${jsExtension}`), minified.code, 'utf-8')
await writeFile(resolve(destinationDir, `${lang}.${jsExtension}.map`), minified.map, 'utf-8')
Expand Down
Loading
Loading