This repository has been archived by the owner on Nov 20, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix axios incompatible with edge runtime (#357)
- Loading branch information
Showing
18 changed files
with
623 additions
and
237 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ dependsOn: | |
- code-highlight | ||
- custom-field | ||
- jose-browser | ||
- typesense-xior | ||
|
||
tasks: | ||
build: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
{ | ||
"extends": "./playground/.nuxt/tsconfig.json", | ||
"compilerOptions": { | ||
"moduleResolution": "Bundler" | ||
}, | ||
"include": ["./src/**/*", "./playground/**/*.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# typesense-xior | ||
|
||
Rebundle [typesense](https://github.com/typesense/typesense-js) client with [xior](https://github.com/suhaotian/xior) to make it compatible with edge runtime like Cloudflare worker, Vercel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
tasks: | ||
build: | ||
command: vite build | ||
inputs: | ||
- src/**/* | ||
- vite.config.ts | ||
outputs: | ||
- dist/**/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"name": "@storipress/typesense-xior", | ||
"type": "module", | ||
"version": "1.8.1", | ||
"packageManager": "yarn@4.1.1", | ||
"files": [ | ||
"./dist/*" | ||
], | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"exports": { | ||
".": { | ||
"types": "./dist/typesense-xior.d.ts", | ||
"import": "./dist/typesense-xior.js" | ||
} | ||
}, | ||
"scripts": { | ||
"build": "moon run build", | ||
"prepack": "moon run build" | ||
}, | ||
"dependencies": { | ||
"typesense": "1.8.1", | ||
"xior": "0.3.9" | ||
}, | ||
"devDependencies": { | ||
"@moonrepo/cli": "1.23.4", | ||
"builtin-modules": "^3.3.0", | ||
"vite": "^5.2.8" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from 'typesense' | ||
export { default } from 'typesense' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from 'typesense/src/Typesense' | ||
export { default } from 'typesense/src/Typesense' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import type { XiorRequestConfig } from 'xior' | ||
import axios from 'xior' | ||
|
||
export default (requestConfig: XiorRequestConfig) => { | ||
return axios.request(requestConfig) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"compilerOptions": { | ||
/* AND if you're building for a library in a monorepo: */ | ||
"composite": true, | ||
"target": "es2022", | ||
/* If your code runs in the DOM: */ | ||
/* If your code doesn't run in the DOM: */ | ||
"lib": ["es2022"], | ||
"moduleDetection": "force", | ||
"baseUrl": ".", | ||
/* If NOT transpiling with TypeScript: */ | ||
"module": "ES2022", | ||
"moduleResolution": "Bundler", | ||
"resolveJsonModule": true, | ||
"allowJs": true, | ||
/* Strictness */ | ||
"strict": true, | ||
"noUncheckedIndexedAccess": true, | ||
/* AND if you're building for a library: */ | ||
"declaration": true, | ||
"declarationMap": true, | ||
"noEmit": true, | ||
"outDir": "dist", | ||
"sourceMap": true, | ||
/* Base Options: */ | ||
"esModuleInterop": true, | ||
"isolatedModules": true, | ||
"skipLibCheck": true | ||
}, | ||
"include": ["src/**/*", "tsup.config.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { fileURLToPath } from 'node:url' | ||
import path from 'node:path' | ||
import { defineConfig } from 'vite' | ||
import builtin from 'builtin-modules' | ||
|
||
const __dirname = path.dirname(fileURLToPath(import.meta.url)) | ||
|
||
export default defineConfig({ | ||
resolve: { | ||
alias: { | ||
axios: path.join(__dirname, './src/xior.ts'), | ||
}, | ||
}, | ||
build: { | ||
minify: false, | ||
lib: { | ||
entry: 'src/index.ts', | ||
formats: ['es'], | ||
}, | ||
rollupOptions: { | ||
external: builtin as string[], | ||
}, | ||
}, | ||
}) |
Oops, something went wrong.