vite-code-inspector-plugin
Advanced tools
Comparing version 0.14.2 to 0.15.0
@@ -1,1 +0,1 @@ | ||
"use strict";var P=Object.defineProperty,d=Object.defineProperties;var C=Object.getOwnPropertyDescriptors;var g=Object.getOwnPropertySymbols;var T=Object.prototype.hasOwnProperty,j=Object.prototype.propertyIsEnumerable;var v=(e,t,r)=>t in e?P(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,i=(e,t)=>{for(var r in t||(t={}))T.call(t,r)&&v(e,r,t[r]);if(g)for(var r of g(t))j.call(t,r)&&v(e,r,t[r]);return e},y=(e,t)=>d(e,C(t));var h=(e,t,r)=>new Promise((l,n)=>{var c=a=>{try{u(r.next(a))}catch(m){n(m)}},s=a=>{try{u(r.throw(a))}catch(m){n(m)}},u=a=>a.done?l(a.value):Promise.resolve(a.value).then(c,s);u((r=r.apply(e,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("code-inspector-core"),S="vite-code-inspector-plugin",W=["isJsx","isTsx","lang.jsx","lang.tsx"];function J(e){const t={port:0,entry:"",output:e.output};return y(i({name:S},e.enforcePre===!1?{}:{enforce:"pre"}),{apply(l,{command:n}){if(e!=null&&e.close)return!1;let c;return typeof(e==null?void 0:e.dev)=="function"?c=e==null?void 0:e.dev():c=e==null?void 0:e.dev,c===!1?!1:!!c||n==="serve"},transform(l,n){return h(this,null,function*(){if(n.match("node_modules"))return l;l=yield f.getCodeWithWebComponent(e,n,l,t);const[c]=n.split("?",2),s=f.normalizePath(c),u=new URLSearchParams(n);if(e!=null&&e.match&&!e.match.test(s))return l;const{escapeTags:a=[]}=e||{};return f.isJsTypeFile(s)||s.endsWith(".vue")&&(W.some(x=>u.get(x)!==null)||u.get("lang")==="tsx"||u.get("lang")==="jsx")?f.transformCode({content:l,filePath:s,fileType:"jsx",escapeTags:a}):s.endsWith(".vue")&&u.get("type")!=="style"&&u.get("raw")===null?f.transformCode({content:l,filePath:s,fileType:"vue",escapeTags:a}):s.endsWith(".svelte")?f.transformCode({content:l,filePath:s,fileType:"svelte",escapeTags:a}):l})}})}exports.ViteCodeInspectorPlugin=J; | ||
"use strict";var x=Object.defineProperty,i=Object.defineProperties;var C=Object.getOwnPropertyDescriptors;var m=Object.getOwnPropertySymbols;var j=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable;var v=(e,r,t)=>r in e?x(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,h=(e,r)=>{for(var t in r||(r={}))j.call(r,t)&&v(e,t,r[t]);if(m)for(var t of m(r))T.call(r,t)&&v(e,t,r[t]);return e},y=(e,r)=>i(e,C(r));var P=(e,r,t)=>new Promise((l,a)=>{var n=s=>{try{u(t.next(s))}catch(c){a(c)}},f=s=>{try{u(t.throw(s))}catch(c){a(c)}},u=s=>s.done?l(s.value):Promise.resolve(s.value).then(n,f);u((t=t.apply(e,r)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("code-inspector-core"),W="vite-code-inspector-plugin",b=["isJsx","isTsx","lang.jsx","lang.tsx"];function w(e){const r={port:0,entry:"",output:e.output};return y(h({name:W},e.enforcePre===!1?{}:{enforce:"pre"}),{apply(l,{command:a}){if(e!=null&&e.close)return!1;let n;return typeof(e==null?void 0:e.dev)=="function"?n=e==null?void 0:e.dev():n=e==null?void 0:e.dev,n===!1?!1:!!n||a==="serve"},transform(l,a){return P(this,null,function*(){if(a.match("node_modules"))return l;l=yield g.getCodeWithWebComponent(e,a,l,r);const[n]=a.split("?",2),f=g.normalizePath(n),u=new URLSearchParams(a);if(e!=null&&e.match&&!e.match.test(f))return l;const{escapeTags:s=[]}=e||{};let c="";return g.isJsTypeFile(f)||f.endsWith(".vue")&&(b.some(d=>u.get(d)!==null)||u.get("lang")==="tsx"||u.get("lang")==="jsx")?c="jsx":f.endsWith(".vue")&&u.get("type")!=="style"&&u.get("raw")===null?c="vue":f.endsWith(".svelte")&&(c="svelte"),c?g.transformCode({content:l,filePath:f,fileType:c,escapeTags:s}):l})}})}exports.ViteCodeInspectorPlugin=w; |
{ | ||
"name": "vite-code-inspector-plugin", | ||
"version": "0.14.2", | ||
"version": "0.15.0", | ||
"main": "./dist/index.js", | ||
@@ -41,3 +41,3 @@ "module": "./dist/index.mjs", | ||
"dependencies": { | ||
"code-inspector-core": "0.14.2" | ||
"code-inspector-core": "0.15.0" | ||
}, | ||
@@ -44,0 +44,0 @@ "devDependencies": { |
@@ -43,2 +43,4 @@ <div align="center"> | ||
✅ rspack / rsbuild<br /> | ||
✅ farm<br /> | ||
✅ esbuild<br /> | ||
✅ nextjs / nuxt / umijs eg.<br /> | ||
@@ -154,2 +156,39 @@ - The following Web frameworks are currently supported:<br /> | ||
<details> | ||
<summary>Click to expand configuration about: <b>esbuild</b></summary> | ||
```js | ||
// esbuild.config.js | ||
const esbuild = require('esbuild'); | ||
const { codeInspectorPlugin } = require('code-inspector-plugin'); | ||
esbuild.build({ | ||
// other configs... | ||
// [注意] esbuild 中使用时,dev 函数的返回值需自己根据环境判断,本地开发的环境返回 true,线上打包返回 false | ||
plugins: [codeInspectorPlugin({ bundler: 'esbuild', dev: () => true })], | ||
}); | ||
``` | ||
</details> | ||
<details> | ||
<summary>Click to expand configuration about: <b>farm</b></summary> | ||
```js | ||
// farm.config.js | ||
import { defineConfig } from '@farmfe/core'; | ||
import { codeInspectorPlugin } from 'code-inspector-plugin'; | ||
export default defineConfig({ | ||
vitePlugins: [ | ||
codeInspectorPlugin({ | ||
bundler: 'vite', | ||
}), | ||
// ...other code | ||
], | ||
}); | ||
``` | ||
</details> | ||
<details> | ||
<summary>Click to expand configuration about: <b>vue-cli</b></summary> | ||
@@ -297,3 +336,3 @@ | ||
For Chinese users, you can join the QQ group `769748484` add the author's WeiXin account `zhoulx1688888` for consultation and feedback: | ||
For Chinese users, you can join the QQ group `769748484` or add the author's WeiXin account `zhoulx1688888` for consultation and feedback: | ||
@@ -300,0 +339,0 @@ <div style="display: flex; column-gap: 16px; row-gap: 16px; flex-wrap: wrap;"> |
Sorry, the diff of this file is not supported yet
17078
345
89
+ Addedcode-inspector-core@0.15.0(transitive)
- Removedcode-inspector-core@0.14.2(transitive)
Updatedcode-inspector-core@0.15.0