@open-editor/vite
Advanced tools
+3
-2
@@ -121,3 +121,3 @@ import { ViteDevServer } from 'vite'; | ||
| */ | ||
| configureServer(server: Pick<ViteDevServer, 'middlewares'>): void; | ||
| configureServer(server: Pick<ViteDevServer, "middlewares">): void; | ||
| /** | ||
@@ -139,2 +139,3 @@ * 模块解析逻辑 | Module resolution logic | ||
| export { Options, OpenEditorPlugin as default }; | ||
| export { OpenEditorPlugin as default }; | ||
| export type { Options }; |
+1
-1
@@ -1,1 +0,1 @@ | ||
| "use strict";var node_path=require("node:path"),shared=require("@open-editor/shared"),node=require("@open-editor/shared/node"),server=require("@open-editor/server"),_documentCurrentScript=typeof document<"u"?document.currentScript:null;const CLIENT_ID="/client.mjs";function OpenEditorPlugin(options={}){if(!node.isDev())return{name:"OpenEditorPlugin"};const{onOpenEditor}=options,rootDir=shared.normalizePath(options.rootDir?node_path.resolve(options.rootDir):process.cwd());return{name:"OpenEditorPlugin",apply:"serve",configureServer(server$1){server$1.middlewares.use(shared.ServerApis.OPEN_EDITOR,server.openEditorMiddleware({rootDir,onOpenEditor}))},resolveId(id){if(id===shared.CLIENT_MODULE_ID)return node.resolvePath(shared.CLIENT_MODULE_ID,typeof document>"u"?require("url").pathToFileURL(__filename).href:_documentCurrentScript&&_documentCurrentScript.tagName.toUpperCase()==="SCRIPT"&&_documentCurrentScript.src||new URL("index.js",document.baseURI).href).replace(/\.js$/,".mjs")},transform(code,id){if(id.endsWith(CLIENT_ID))return shared.injectClient(code,{...options,rootDir})}}}module.exports=OpenEditorPlugin; | ||
| "use strict";var e=require("node:path"),r=require("@open-editor/shared"),n=require("@open-editor/shared/node"),i=require("@open-editor/server"),t="undefined"!=typeof document?document.currentScript:null;function OpenEditorPlugin(o={}){if(!n.isDev())return{name:"OpenEditorPlugin"};let{onOpenEditor:d}=o,u=r.normalizePath(o.rootDir?e.resolve(o.rootDir):process.cwd());return{name:"OpenEditorPlugin",apply:"serve",configureServer(e){e.middlewares.use(r.ServerApis.OPEN_EDITOR,i.openEditorMiddleware({rootDir:u,onOpenEditor:d}))},resolveId(e){if(e===r.CLIENT_MODULE_ID)return n.resolvePath(r.CLIENT_MODULE_ID,"undefined"==typeof document?require("url").pathToFileURL(__filename).href:t&&"SCRIPT"===t.tagName.toUpperCase()&&t.src||new URL("index.js",document.baseURI).href).replace(/\.js$/,".mjs")},transform(e,n){if(n.endsWith("/client.mjs"))return r.injectClient(e,{...o,rootDir:u})}}}module.exports=OpenEditorPlugin; |
+1
-1
@@ -1,1 +0,1 @@ | ||
| import{resolve}from"node:path";import{normalizePath,ServerApis,CLIENT_MODULE_ID,injectClient}from"@open-editor/shared";import{isDev,resolvePath}from"@open-editor/shared/node";import{openEditorMiddleware}from"@open-editor/server";const CLIENT_ID="/client.mjs";function OpenEditorPlugin(options={}){if(!isDev())return{name:"OpenEditorPlugin"};const{onOpenEditor}=options,rootDir=normalizePath(options.rootDir?resolve(options.rootDir):process.cwd());return{name:"OpenEditorPlugin",apply:"serve",configureServer(server){server.middlewares.use(ServerApis.OPEN_EDITOR,openEditorMiddleware({rootDir,onOpenEditor}))},resolveId(id){if(id===CLIENT_MODULE_ID)return resolvePath(CLIENT_MODULE_ID,import.meta.url).replace(/\.js$/,".mjs")},transform(code,id){if(id.endsWith(CLIENT_ID))return injectClient(code,{...options,rootDir})}}}export{OpenEditorPlugin as default}; | ||
| import{resolve as r}from"node:path";import{normalizePath as e,ServerApis as o,CLIENT_MODULE_ID as t,injectClient as i}from"@open-editor/shared";import{isDev as n,resolvePath as p}from"@open-editor/shared/node";import{openEditorMiddleware as d}from"@open-editor/server";function OpenEditorPlugin(m={}){if(!n())return{name:"OpenEditorPlugin"};let{onOpenEditor:s}=m,u=e(m.rootDir?r(m.rootDir):process.cwd());return{name:"OpenEditorPlugin",apply:"serve",configureServer(r){r.middlewares.use(o.OPEN_EDITOR,d({rootDir:u,onOpenEditor:s}))},resolveId(r){if(r===t)return p(t,import.meta.url).replace(/\.js$/,".mjs")},transform(r,e){if(e.endsWith("/client.mjs"))return i(r,{...m,rootDir:u})}}}export{OpenEditorPlugin as default}; |
+6
-5
| { | ||
| "name": "@open-editor/vite", | ||
| "version": "0.9.4", | ||
| "version": "1.0.0-beta.0", | ||
| "description": "🚀 A vite plugin for fast find source code.", | ||
@@ -13,3 +13,4 @@ "main": "./dist/index.js", | ||
| "types": "./dist/index.d.ts" | ||
| } | ||
| }, | ||
| "./*": "./dist/*" | ||
| }, | ||
@@ -40,5 +41,5 @@ "files": [ | ||
| "dependencies": { | ||
| "@open-editor/client": "0.9.4", | ||
| "@open-editor/server": "0.9.4", | ||
| "@open-editor/shared": "0.9.4" | ||
| "@open-editor/client": "1.0.0-beta.0", | ||
| "@open-editor/server": "1.0.0-beta.0", | ||
| "@open-editor/shared": "1.0.0-beta.0" | ||
| }, | ||
@@ -45,0 +46,0 @@ "devDependencies": { |
+2
-2
@@ -20,7 +20,7 @@ # @open-editor/vite | ||
| // vite.config.ts | ||
| import OpenEditor from '@open-editor/vite'; | ||
| import openEditor from '@open-editor/vite'; | ||
| export default defineConfig({ | ||
| plugins: [ | ||
| OpenEditor({ | ||
| openEditor({ | ||
| /* options */ | ||
@@ -27,0 +27,0 @@ }), |
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 2 instances in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 2 instances in 1 package
12602
-2.18%144
-0.69%+ Added
+ Added
+ Added
- Removed
- Removed
- Removed